Skip to content

Commit 3c048e6

Browse files
committed
Generate predefined Gemfile.lock. Reason:
Gems evolve. While application generation works when a version of Katapult is released, emerging incompatibilities between gems quickly break the smooth generation experience. By delivering a working Gemfile.lock, application generation will work. The user can decide himself, if he wants to run bundle update.
1 parent 7ddb224 commit 3c048e6

File tree

7 files changed

+382
-3
lines changed

7 files changed

+382
-3
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
.config
55
.yardoc
66
Gemfile.lock
7+
!lib/generators/katapult/basics/templates/Gemfile.lock
78
InstalledFiles
89
_yardoc
910
coverage

bin/katapult

+3-2
Original file line numberDiff line numberDiff line change
@@ -74,14 +74,15 @@ when 'new'
7474
# Do not use `basics_command` as commit message, it contains the db password!
7575
util.git_commit 'rails generate katapult:basics', '--quiet'
7676

77-
util.pink <<-INSTRUCTIONS
77+
util.pink <<-'INSTRUCTIONS'
7878
Application initialization done.
7979
8080
Next steps:
8181
82+
- Run `bundle update` if you want to use the latest versions of all gems
83+
- Configure public/robots.txt
8284
- Model your application in lib/katapult/application_model.rb and transform it
8385
into code by running `katapult fire`
84-
- Configure public/robots.txt
8586
- Write a README
8687
INSTRUCTIONS
8788

features/basics.feature

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ Feature: Preparation of a new Rails app (basics generator)
2525

2626
And the configured Rails version should be listed in the Gemfile.lock
2727
And the file "Gemfile" should contain "gem 'katapult', path: '../../..'"
28+
And a file named "Gemfile.lock" should exist
2829

2930
And the file "app/controllers/application_controller.rb" should contain:
3031
"""

features/binary.feature

+1
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ Feature: Katapult binary `katapult`
4848
And the output should contain "Model your application in lib/katapult/application_model.rb"
4949
And the output should contain "Configure public/robots.txt"
5050
And the output should contain "Write a README"
51+
And the output should contain "Run `bundle update`"
5152

5253
When I cd to "binary_test"
5354
Then the file "Gemfile" should contain "gem 'katapult'"

lib/generators/katapult/basics/basics_generator.rb

+1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ def enhance_gemfile
4040
# installed with a custom :path option
4141
@katapult = File.readlines('Gemfile').find{ |line| line =~ /^gem 'katapult'/ }
4242
template 'Gemfile', force: true
43+
template 'Gemfile.lock', force: true
4344
end
4445

4546
def bundle_install

0 commit comments

Comments
 (0)