make_it_so 0.4.1 → 0.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +22 -11
- data/lib/make_it_so/rails/app_builder.rb +7 -13
- data/lib/make_it_so/version.rb +1 -1
- data/snippets/rails/js_jest_testing_deps.json +10 -0
- data/spec/features/user_generates_rails_spec.rb +14 -7
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 949efd8fd6f8be81fbd78b38d2db7aa56aa1c427
|
4
|
+
data.tar.gz: eb3c702c131873e182246d57368836423e3ed9bb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 445f44e631fb2f8a7af9f5d4bb6b92c8952ade88ccc99712a751059bfe8fae71f472c9ce65422baffff8d0c95c53f4dcff7c0af4b7566c468e24f7781f12d402
|
7
|
+
data.tar.gz: 47503825241b5a8c3f032b993541ba7771c7c3b2cbf483fb6488359484b30aa96e7fc14032cbf3ec319db9ee82a39cef461d312aaa5e6a827e4f3c25a6dd2543
|
data/README.md
CHANGED
@@ -3,19 +3,21 @@
|
|
3
3
|
![Make It So](http://images.simplysyndicated.com/wp-content/uploads/2014/07/make-it-so-captain.jpg)
|
4
4
|
|
5
5
|
Make It So is a command line utility that makes it easy to create starting points
|
6
|
-
for all apps Ruby.
|
7
|
-
Gosu, and other paradigms are in progress.
|
6
|
+
for all apps Ruby.
|
8
7
|
|
9
8
|
## Installation
|
10
9
|
|
11
|
-
Add this line to your application's Gemfile:
|
12
|
-
|
13
10
|
Install it yourself as:
|
14
11
|
|
15
12
|
$ gem install make_it_so
|
16
13
|
|
17
14
|
## Usage
|
18
15
|
|
16
|
+
Make It So has multiple options to help you get started. You can get up and running with Rails, Sinatra, or Gosu without configuration issues. If you would like to see a list of options:
|
17
|
+
|
18
|
+
```no-highlight
|
19
|
+
make_it_so
|
20
|
+
```
|
19
21
|
|
20
22
|
### Rails
|
21
23
|
|
@@ -32,18 +34,27 @@ rake db:create
|
|
32
34
|
rake db:migrate
|
33
35
|
```
|
34
36
|
|
35
|
-
|
37
|
+
By default, the generator will create a Rails app with the following options activated:
|
38
|
+
|
39
|
+
- RSpec
|
40
|
+
- Devise
|
41
|
+
- Postgres
|
42
|
+
- Foundation
|
43
|
+
- React
|
44
|
+
- Karma
|
36
45
|
|
37
|
-
|
46
|
+
To take advantage of view-specific javascript, inject a script tag at the end of the body tag. Javascript should always be the last thing loaded on the page. In view logic you can do the following:
|
38
47
|
|
39
48
|
```erb
|
40
49
|
<%= content_for :extra_footer do %>
|
41
|
-
|
42
|
-
|
43
|
-
|
50
|
+
<script type="text/javascript">
|
51
|
+
var widget = new Something.Widget('foo');
|
52
|
+
</script>
|
44
53
|
<% end %>
|
45
54
|
```
|
46
55
|
|
56
|
+
There is experimental support for a `--jest` flag that will use Jest for client side testing instead of karma/jasmine.
|
57
|
+
|
47
58
|
### Sinatra
|
48
59
|
|
49
60
|
In the terminal, run:
|
@@ -52,7 +63,7 @@ In the terminal, run:
|
|
52
63
|
make_it_so sinatra <app_name>
|
53
64
|
```
|
54
65
|
|
55
|
-
By default, the generator
|
66
|
+
By default, the generator will create a sinatra root complete with an RSpec configuration.
|
56
67
|
|
57
68
|
### Gosu
|
58
69
|
|
@@ -61,7 +72,7 @@ In the terminal, run:
|
|
61
72
|
make_it_so gosu <app_name>
|
62
73
|
```
|
63
74
|
|
64
|
-
By default, the generator
|
75
|
+
By default, the generator will create a gosu template complete with an RSpec configuration.
|
65
76
|
|
66
77
|
The tree structure looks like:
|
67
78
|
|
@@ -100,23 +100,17 @@ module MakeItSo
|
|
100
100
|
|
101
101
|
def jest
|
102
102
|
after_bundle do
|
103
|
-
|
104
|
-
|
105
|
-
'babel-jest',
|
106
|
-
'enzyme',
|
107
|
-
'enzyme-adapter-react-15.4',
|
108
|
-
'react-addons-test-utils',
|
109
|
-
'jest-fetch-mock'
|
110
|
-
]
|
111
|
-
run "yarn add #{deps.join(' ')} --dev"
|
103
|
+
unparsed_json = snippet('js_jest_testing_deps.json')
|
104
|
+
parsed_json = JSON.parse(unparsed_json)
|
112
105
|
|
113
106
|
run 'mkdir -p spec/javascript/support'
|
114
107
|
inside 'spec/javascript/support' do
|
115
108
|
template 'enzyme.js'
|
116
|
-
template 'jest-fetch-mock.js'
|
117
109
|
end
|
118
110
|
|
119
111
|
modify_json(package_json_file) do |json|
|
112
|
+
json["devDependencies"] ||= {}
|
113
|
+
json["devDependencies"].merge!(parsed_json["devDependencies"])
|
120
114
|
json["scripts"] ||= {}
|
121
115
|
json["scripts"]["test"] = "node_modules/.bin/jest"
|
122
116
|
json["scripts"]["test:dev"] = "node_modules/.bin/jest --notify --watch"
|
@@ -131,9 +125,9 @@ module MakeItSo
|
|
131
125
|
"app/javascript"
|
132
126
|
],
|
133
127
|
"setupFiles": [
|
134
|
-
"./spec/javascript/support/enzyme.js"
|
135
|
-
|
136
|
-
|
128
|
+
"./spec/javascript/support/enzyme.js"
|
129
|
+
],
|
130
|
+
"testURL": "http://localhost/"
|
137
131
|
})
|
138
132
|
end
|
139
133
|
|
data/lib/make_it_so/version.rb
CHANGED
@@ -295,6 +295,12 @@ feature 'jest' do
|
|
295
295
|
end
|
296
296
|
end
|
297
297
|
|
298
|
+
scenario 'adds fetch-mock as a dependency' do
|
299
|
+
in_package_json?(package_json_path) do |json|
|
300
|
+
expect(json["devDependencies"]["fetch-mock"]).to_not be_nil
|
301
|
+
end
|
302
|
+
end
|
303
|
+
|
298
304
|
scenario 'adds jest as the test script in package.json' do
|
299
305
|
in_package_json?(package_json_path) do |json|
|
300
306
|
expect(json["scripts"]["test"]).to include("jest")
|
@@ -324,6 +330,14 @@ feature 'jest' do
|
|
324
330
|
end
|
325
331
|
end
|
326
332
|
|
333
|
+
scenario 'adds testURL to jest configuration' do
|
334
|
+
in_package_json?(package_json_path) do |json|
|
335
|
+
expect(json["jest"]).to_not be_nil
|
336
|
+
expect(json["jest"]["testURL"]).to_not be_nil
|
337
|
+
expect(json["jest"]["testURL"]).to eq("http://localhost/")
|
338
|
+
end
|
339
|
+
end
|
340
|
+
|
327
341
|
scenario 'adds a spec/javascript/support/enzyme.js file' do
|
328
342
|
support_file = File.join(app_path, 'spec/javascript/support/enzyme.js')
|
329
343
|
expect(FileTest.exists?(support_file)).to eq(true)
|
@@ -335,11 +349,4 @@ feature 'jest' do
|
|
335
349
|
expect(json["jest"]["setupFiles"]).to include('./spec/javascript/support/enzyme.js')
|
336
350
|
end
|
337
351
|
end
|
338
|
-
|
339
|
-
scenario 'adds spec/javascript/support/jest-fetch-mock.js to setup' do
|
340
|
-
in_package_json?(package_json_path) do |json|
|
341
|
-
expect(json["jest"]).to_not be_nil
|
342
|
-
expect(json["jest"]["setupFiles"]).to include('./spec/javascript/support/jest-fetch-mock.js')
|
343
|
-
end
|
344
|
-
end
|
345
352
|
end
|
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.
|
4
|
+
version: 0.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dan Pickett
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-08-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -168,6 +168,7 @@ files:
|
|
168
168
|
- lib/make_it_so/version.rb
|
169
169
|
- make_it_so.gemspec
|
170
170
|
- snippets/rails/application_generator.rb
|
171
|
+
- snippets/rails/js_jest_testing_deps.json
|
171
172
|
- snippets/rails/js_testing_deps.json
|
172
173
|
- snippets/rails/react_dependencies.json
|
173
174
|
- snippets/rails/user_factory.rb
|