make_it_so 0.5.1 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +2 -0
- data/Gemfile +2 -2
- data/README.md +3 -2
- data/lib/make_it_so/rails.rb +1 -1
- data/lib/make_it_so/rails/app_builder.rb +14 -6
- data/lib/make_it_so/version.rb +1 -1
- data/make_it_so.gemspec +1 -1
- data/snippets/rails/js_jest_testing_deps.json +5 -12
- data/snippets/rails/react_dependencies.json +2 -2
- data/spec/features/rails/user_generates_rails_spec.rb +20 -2
- data/templates/rails/app/assets/javascripts/application.foundation.js +18 -0
- data/templates/rails/app/assets/javascripts/application.js +16 -0
- data/templates/rails/app/javascript/react/components/example.test.js +5 -0
- metadata +11 -8
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 62d0d492e8ebf31a42c217e5294c22c11e8e27fda46526c9ed9466e63e3cbc0a
|
|
4
|
+
data.tar.gz: 4d9e66ac27776841fb882234c0da8dc98458836a9f44650c0a82dd6a284fb813
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4a56507b200ab5a6b5237b1b33abc919d8e7cb871e5b9533862024b6c47c02c983d155d04d91e7b819cb405a1ad04f783067802c0490b54d40c0c9c4bfb8353d
|
|
7
|
+
data.tar.gz: ebf9b7057c86b84dd9d1fa8ffcb7ab9837306efe1e81ebddac6f6a4ad4855024baafa76e12e935aaef7f8ec15e38f1541a3ec06e9701d7d4936079ee60ee36c4
|
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
|
@@ -2,7 +2,7 @@ source 'https://rubygems.org'
|
|
|
2
2
|
|
|
3
3
|
require_relative 'lib/make_it_so/rails'
|
|
4
4
|
|
|
5
|
-
ruby '2.
|
|
5
|
+
ruby '2.7.3'
|
|
6
6
|
|
|
7
7
|
# Specify your gem's dependencies in make_it_so.gemspec
|
|
8
8
|
gemspec
|
|
@@ -19,7 +19,7 @@ group :development do
|
|
|
19
19
|
gem gem_name, MakeItSo::Rails::VERSION
|
|
20
20
|
end
|
|
21
21
|
|
|
22
|
-
gem 'sprockets-rails', '3.
|
|
22
|
+
gem 'sprockets-rails', '3.2.2'
|
|
23
23
|
gem 'listen'
|
|
24
24
|
gem 'rspec-rails'
|
|
25
25
|
gem 'devise'
|
data/README.md
CHANGED
|
@@ -30,8 +30,9 @@ make_it_so rails <app_name>
|
|
|
30
30
|
Then run:
|
|
31
31
|
|
|
32
32
|
```ruby
|
|
33
|
-
|
|
34
|
-
rake db:
|
|
33
|
+
yarn install
|
|
34
|
+
bundle exec rake db:create
|
|
35
|
+
bundle exec rake db:migrate
|
|
35
36
|
```
|
|
36
37
|
|
|
37
38
|
By default, the generator will create a Rails app with the following options activated:
|
data/lib/make_it_so/rails.rb
CHANGED
|
@@ -75,6 +75,7 @@ module MakeItSo
|
|
|
75
75
|
copy_file 'new_application.js', 'application.js'
|
|
76
76
|
remove_file 'new_application.js'
|
|
77
77
|
end
|
|
78
|
+
|
|
78
79
|
end
|
|
79
80
|
end
|
|
80
81
|
|
|
@@ -262,15 +263,18 @@ module MakeItSo
|
|
|
262
263
|
|
|
263
264
|
after_bundle do
|
|
264
265
|
generate 'foundation:install foundation'
|
|
265
|
-
# foundation
|
|
266
|
-
# must remove it
|
|
266
|
+
# foundation install always messes with the JS manifest
|
|
267
267
|
remove_file 'app/views/layouts/foundation.html.erb'
|
|
268
268
|
|
|
269
269
|
inside 'app/assets/javascripts' do
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
after: "//= require jquery_ujs\n"
|
|
270
|
+
remove_file 'application.js'
|
|
271
|
+
template 'application.foundation.js', 'application.js'
|
|
273
272
|
end
|
|
273
|
+
# foundation-rails generates an application layout so we
|
|
274
|
+
# must remove it
|
|
275
|
+
remove_file 'app/views/layouts/foundation.html.erb'
|
|
276
|
+
|
|
277
|
+
|
|
274
278
|
end
|
|
275
279
|
end
|
|
276
280
|
|
|
@@ -294,7 +298,7 @@ module MakeItSo
|
|
|
294
298
|
end
|
|
295
299
|
end
|
|
296
300
|
|
|
297
|
-
def create_enzyme_config
|
|
301
|
+
def create_enzyme_config
|
|
298
302
|
run 'mkdir -p spec/javascript/support'
|
|
299
303
|
devDependencies = parsed_package_json["devDependencies"].keys
|
|
300
304
|
enzymeAdapter = devDependencies.select{ |d| d =~ /^enzyme-adapter-react-[0-9]*/ }[0]
|
|
@@ -303,6 +307,10 @@ module MakeItSo
|
|
|
303
307
|
template 'enzyme.js'
|
|
304
308
|
gsub_file 'enzyme.js', 'ADAPTER NAME GOES HERE', enzymeAdapter
|
|
305
309
|
end
|
|
310
|
+
|
|
311
|
+
inside 'app/javascript/react/components' do
|
|
312
|
+
template "example.test.js"
|
|
313
|
+
end
|
|
306
314
|
end
|
|
307
315
|
|
|
308
316
|
def parsed_package_json
|
data/lib/make_it_so/version.rb
CHANGED
data/make_it_so.gemspec
CHANGED
|
@@ -23,7 +23,7 @@ Gem::Specification.new do |spec|
|
|
|
23
23
|
spec.add_dependency "activerecord", "~> 5.2"
|
|
24
24
|
spec.add_dependency "json"
|
|
25
25
|
|
|
26
|
-
spec.add_development_dependency "bundler", "~> 2.
|
|
26
|
+
spec.add_development_dependency "bundler", "~> 2.1"
|
|
27
27
|
spec.add_development_dependency "rspec"
|
|
28
28
|
spec.add_development_dependency "capybara"
|
|
29
29
|
end
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
"devDependencies": {
|
|
3
3
|
"babel-jest": "^24.9.0",
|
|
4
4
|
"fetch-mock": "~5.13.1",
|
|
5
|
-
"jest": "^24.9.0"
|
|
5
|
+
"jest": "^24.9.0",
|
|
6
|
+
"@types/jest": "^24.9.0"
|
|
6
7
|
},
|
|
7
8
|
"scripts": {
|
|
8
9
|
"start": "./bin/webpack-dev-server",
|
|
@@ -11,17 +12,9 @@
|
|
|
11
12
|
},
|
|
12
13
|
"jest": {
|
|
13
14
|
"automock": false,
|
|
14
|
-
"roots": [
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
],
|
|
18
|
-
"moduleDirectories": [
|
|
19
|
-
"node_modules",
|
|
20
|
-
"app/javascript"
|
|
21
|
-
],
|
|
22
|
-
"setupFiles": [
|
|
23
|
-
"./spec/javascript/support/enzyme.js"
|
|
24
|
-
],
|
|
15
|
+
"roots": ["spec/javascript", "app/javascript"],
|
|
16
|
+
"moduleDirectories": ["node_modules", "app/javascript"],
|
|
17
|
+
"setupFiles": ["./spec/javascript/support/enzyme.js"],
|
|
25
18
|
"testURL": "http://localhost/"
|
|
26
19
|
}
|
|
27
20
|
}
|
|
@@ -6,10 +6,10 @@
|
|
|
6
6
|
"@babel/plugin-syntax-dynamic-import": "^7.0.0",
|
|
7
7
|
"@babel/plugin-transform-destructuring": "^7.6.0",
|
|
8
8
|
"@babel/plugin-transform-regenerator": "^7.4.5",
|
|
9
|
-
"@babel/plugin-transform-runtime": "^7.
|
|
9
|
+
"@babel/plugin-transform-runtime": "^7.13.10",
|
|
10
10
|
"@babel/preset-env": "^7.5.5",
|
|
11
11
|
"@babel/preset-react": "^7.0.0",
|
|
12
|
-
"@babel/runtime": "^7.
|
|
12
|
+
"@babel/runtime": "^7.13.10",
|
|
13
13
|
"babel-loader": "^8.0.6",
|
|
14
14
|
"prop-types": "~15.6.0",
|
|
15
15
|
"react": "~16.8.0",
|
|
@@ -193,6 +193,12 @@ feature 'user generates rails app with default settings' do
|
|
|
193
193
|
it 'does not include modernizr in the layout' do
|
|
194
194
|
expect(read_file('app/views/layouts/application.html.erb')).to_not include('modernizr')
|
|
195
195
|
end
|
|
196
|
+
|
|
197
|
+
it 'adds the custom application.js manifest to the assets folder' do
|
|
198
|
+
file_subpath = "app/assets/javascripts/application.js"
|
|
199
|
+
generated_js_manifest = File.join(app_path, file_subpath)
|
|
200
|
+
expect(FileTest.exists?(generated_js_manifest)).to eq(true)
|
|
201
|
+
end
|
|
196
202
|
end
|
|
197
203
|
|
|
198
204
|
context 'react' do
|
|
@@ -264,8 +270,8 @@ feature 'user generates rails app with default settings' do
|
|
|
264
270
|
|
|
265
271
|
it 'sets necessary presets in babel.config.js' do
|
|
266
272
|
babel_config = read_file('babel.config.js')
|
|
267
|
-
expect(babel_config).to include("@babel/env")
|
|
268
|
-
expect(babel_config).to include("@babel/react")
|
|
273
|
+
expect(babel_config).to include("@babel/preset-env")
|
|
274
|
+
expect(babel_config).to include("@babel/preset-react")
|
|
269
275
|
end
|
|
270
276
|
end
|
|
271
277
|
|
|
@@ -303,6 +309,12 @@ feature 'user generates rails app with default settings' do
|
|
|
303
309
|
expect(json["jest"]["setupFiles"]).to include('./spec/javascript/support/enzyme.js')
|
|
304
310
|
end
|
|
305
311
|
end
|
|
312
|
+
|
|
313
|
+
it 'adds example.test.js to react components folder' do
|
|
314
|
+
file_subpath = "app/javascript/react/components/example.test.js"
|
|
315
|
+
example_test_file = File.join(app_path, file_subpath)
|
|
316
|
+
expect(FileTest.exists?(example_test_file)).to eq(true)
|
|
317
|
+
end
|
|
306
318
|
end
|
|
307
319
|
|
|
308
320
|
context 'jest' do
|
|
@@ -318,6 +330,12 @@ feature 'user generates rails app with default settings' do
|
|
|
318
330
|
end
|
|
319
331
|
end
|
|
320
332
|
|
|
333
|
+
scenario 'adds @types/jest as a dependency' do
|
|
334
|
+
in_package_json?(package_json_path) do |json|
|
|
335
|
+
expect(json["devDependencies"]["@types/jest"]).to_not be_nil
|
|
336
|
+
end
|
|
337
|
+
end
|
|
338
|
+
|
|
321
339
|
scenario 'adds enzyme as a dependency' do
|
|
322
340
|
in_package_json?(package_json_path) do |json|
|
|
323
341
|
expect(json["devDependencies"]["enzyme"]).to_not be_nil
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
|
2
|
+
// listed below.
|
|
3
|
+
//
|
|
4
|
+
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, or any plugin's
|
|
5
|
+
// vendor/assets/javascripts directory can be referenced here using a relative path.
|
|
6
|
+
//
|
|
7
|
+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
|
8
|
+
// compiled file. JavaScript code in this file should be added after the last require_* statement.
|
|
9
|
+
//
|
|
10
|
+
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
|
|
11
|
+
// about supported directives.
|
|
12
|
+
//
|
|
13
|
+
//= require jquery
|
|
14
|
+
//= require jquery_ujs
|
|
15
|
+
//= require foundation
|
|
16
|
+
//= require_tree .
|
|
17
|
+
|
|
18
|
+
$(function(){ $(document).foundation(); });
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
|
2
|
+
// listed below.
|
|
3
|
+
//
|
|
4
|
+
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, or any plugin's
|
|
5
|
+
// vendor/assets/javascripts directory can be referenced here using a relative path.
|
|
6
|
+
//
|
|
7
|
+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
|
8
|
+
// compiled file. JavaScript code in this file should be added after the last require_* statement.
|
|
9
|
+
//
|
|
10
|
+
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
|
|
11
|
+
// about supported directives.
|
|
12
|
+
//
|
|
13
|
+
//= require jquery
|
|
14
|
+
//= require jquery_ujs
|
|
15
|
+
//= require_tree .
|
|
16
|
+
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: make_it_so
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.6.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Dan Pickett
|
|
8
|
-
autorequire:
|
|
8
|
+
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2021-04-15 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: thor
|
|
@@ -72,14 +72,14 @@ dependencies:
|
|
|
72
72
|
requirements:
|
|
73
73
|
- - "~>"
|
|
74
74
|
- !ruby/object:Gem::Version
|
|
75
|
-
version: 2.
|
|
75
|
+
version: '2.1'
|
|
76
76
|
type: :development
|
|
77
77
|
prerelease: false
|
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
|
79
79
|
requirements:
|
|
80
80
|
- - "~>"
|
|
81
81
|
- !ruby/object:Gem::Version
|
|
82
|
-
version: 2.
|
|
82
|
+
version: '2.1'
|
|
83
83
|
- !ruby/object:Gem::Dependency
|
|
84
84
|
name: rspec
|
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -158,10 +158,13 @@ files:
|
|
|
158
158
|
- templates/rails/.env
|
|
159
159
|
- templates/rails/.env.example
|
|
160
160
|
- templates/rails/.gitkeep
|
|
161
|
+
- templates/rails/app/assets/javascripts/application.foundation.js
|
|
162
|
+
- templates/rails/app/assets/javascripts/application.js
|
|
161
163
|
- templates/rails/app/controllers/application_controller.rb
|
|
162
164
|
- templates/rails/app/controllers/homes_controller.rb
|
|
163
165
|
- templates/rails/app/javascript/packs/new_application.js
|
|
164
166
|
- templates/rails/app/javascript/react/components/App.js
|
|
167
|
+
- templates/rails/app/javascript/react/components/example.test.js
|
|
165
168
|
- templates/rails/app/models/application_record.rb
|
|
166
169
|
- templates/rails/app/views/homes/index.html.erb
|
|
167
170
|
- templates/rails/app/views/layouts/application.html.erb.tt
|
|
@@ -193,7 +196,7 @@ homepage: ''
|
|
|
193
196
|
licenses:
|
|
194
197
|
- MIT
|
|
195
198
|
metadata: {}
|
|
196
|
-
post_install_message:
|
|
199
|
+
post_install_message:
|
|
197
200
|
rdoc_options: []
|
|
198
201
|
require_paths:
|
|
199
202
|
- lib
|
|
@@ -208,8 +211,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
208
211
|
- !ruby/object:Gem::Version
|
|
209
212
|
version: '0'
|
|
210
213
|
requirements: []
|
|
211
|
-
rubygems_version: 3.
|
|
212
|
-
signing_key:
|
|
214
|
+
rubygems_version: 3.1.6
|
|
215
|
+
signing_key:
|
|
213
216
|
specification_version: 4
|
|
214
217
|
summary: An application generator for all things ruby
|
|
215
218
|
test_files:
|