skellington 0.4.0 → 0.4.1

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.
Files changed (63) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -1
  3. data/.rspec +1 -0
  4. data/Guardfile +1 -1
  5. data/README.md +44 -24
  6. data/Rakefile +1 -3
  7. data/config/config.yaml +28 -4
  8. data/files +24 -0
  9. data/lib/skellington/template.rb +1 -1
  10. data/lib/skellington/version.rb +1 -1
  11. data/lib/templates/.rspec.eruby +3 -0
  12. data/lib/templates/Rakefile.eruby +6 -1
  13. data/lib/templates/config.ru.eruby +1 -2
  14. data/lib/templates/features/json.feature.eruby +9 -0
  15. data/lib/templates/features/support/env.rb.eruby +2 -1
  16. data/lib/templates/lib/app.rb.eruby +28 -8
  17. data/lib/templates/lib/app/helpers.rb.eruby +4 -0
  18. data/lib/templates/lib/app/racks.rb.eruby +24 -0
  19. data/lib/templates/public/assets/favicon.ico.eruby +0 -0
  20. data/lib/templates/public/css/styles.css.eruby +0 -0
  21. data/lib/templates/public/js/app.js.eruby +0 -0
  22. data/lib/templates/spec/app/app_spec.rb.eruby +7 -0
  23. data/lib/templates/spec/javascripts/appSpec.js.eruby +5 -0
  24. data/lib/templates/spec/javascripts/support/jasmine.yml.eruby +15 -0
  25. data/lib/templates/spec/javascripts/support/jasmine_helper.rb.eruby +0 -0
  26. data/lib/templates/spec/spec_helper.rb.eruby +16 -0
  27. data/lib/templates/views/default.erb.eruby +15 -0
  28. data/lib/templates/views/includes/header.erb.eruby +22 -0
  29. data/lib/templates/{lib/views → views}/index.erb.eruby +0 -0
  30. data/skellington.gemspec +0 -3
  31. data/spec/cli/app_spec.rb +85 -0
  32. data/{features/bootstrap.feature → spec/cli/bootstrap_spec.rb} +41 -27
  33. data/spec/cli/config_ru_spec.rb +18 -0
  34. data/spec/cli/cukes_spec.rb +66 -0
  35. data/spec/cli/gemfile_spec.rb +38 -0
  36. data/spec/cli/git_spec.rb +12 -0
  37. data/spec/cli/javascript_spec.rb +42 -0
  38. data/spec/cli/non_local_path_spec.rb +55 -0
  39. data/spec/cli/procfile_spec.rb +16 -0
  40. data/spec/cli/public_spec.rb +14 -0
  41. data/spec/cli/rakefile_spec.rb +30 -0
  42. data/spec/cli/rbenv_spec.rb +17 -0
  43. data/spec/cli/spec_spec.rb +51 -0
  44. data/spec/cli_spec.rb +32 -0
  45. data/spec/hyphens_spec.rb +36 -0
  46. data/spec/spec_helper.rb +39 -0
  47. metadata +49 -78
  48. data/features/app.feature +0 -21
  49. data/features/cli.feature +0 -29
  50. data/features/config.ru.feature +0 -12
  51. data/features/cukes.feature +0 -50
  52. data/features/gemfile.feature +0 -27
  53. data/features/git.feature +0 -5
  54. data/features/guardfile.feature +0 -16
  55. data/features/hyphens.feature +0 -27
  56. data/features/naming.feature +0 -6
  57. data/features/non-local-path.feature +0 -29
  58. data/features/procfile.feature +0 -9
  59. data/features/rakefile.feature +0 -18
  60. data/features/rbenv.feature +0 -6
  61. data/features/support/env.rb +0 -6
  62. data/lib/templates/Guardfile.eruby +0 -8
  63. data/lib/templates/lib/views/default.erb.eruby +0 -35
@@ -0,0 +1,30 @@
1
+ module Skellington
2
+ describe CLI do
3
+ let :subject do
4
+ described_class.new
5
+ end
6
+
7
+ it 'generates a Rakefile' do
8
+ subject.generate 'dummy_app'
9
+ expect('dummy_app/Rakefile').to contain (
10
+ """
11
+ require File.join(File.dirname(__FILE__), 'lib/dummy_app.rb')
12
+
13
+ unless ENV['RACK_ENV'] == 'production'
14
+ require 'rspec/core/rake_task'
15
+ require 'cucumber/rake/task'
16
+ require 'coveralls/rake/task'
17
+ require 'jasmine'
18
+ load 'jasmine/tasks/jasmine.rake'
19
+
20
+ Cucumber::Rake::Task.new
21
+ RSpec::Core::RakeTask.new
22
+ Coveralls::RakeTask.new
23
+
24
+ task :default => [:cucumber, :spec, 'jasmine:ci', 'coveralls:push']
25
+ end
26
+ """
27
+ )
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,17 @@
1
+ module Skellington
2
+ describe CLI do
3
+ let :subject do
4
+ described_class.new
5
+ end
6
+
7
+ it 'generates a .ruby-version' do
8
+ subject.generate 'dummy_app'
9
+ expect(File).to exist 'dummy_app/.ruby-version'
10
+ expect('dummy_app/.ruby-version').to contain (
11
+ """
12
+ /[0-9]*\.[0-9]*\.[0-9]*/
13
+ """
14
+ )
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,51 @@
1
+ module Skellington
2
+ describe CLI do
3
+ let :subject do
4
+ described_class.new
5
+ end
6
+
7
+ it 'generates rspec files' do
8
+ subject.generate 'dummy_app'
9
+ expect('dummy_app/spec/spec_helper.rb').to contain (
10
+ """
11
+ require 'coveralls'
12
+ Coveralls.wear_merged!
13
+
14
+ require 'dummy_app'
15
+
16
+ RSpec.configure do |config|
17
+ config.expect_with :rspec do |expectations|
18
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
19
+ end
20
+
21
+ config.mock_with :rspec do |mocks|
22
+ mocks.verify_partial_doubles = true
23
+ end
24
+
25
+ config.order = :random
26
+ end
27
+ """
28
+ )
29
+
30
+ expect('dummy_app/spec/dummy_app/dummy_app_spec.rb').to contain (
31
+ """
32
+ module DummyApp
33
+ describe App do
34
+ it 'knows the truth' do
35
+ expect(true).to eq true
36
+ end
37
+ end
38
+ end
39
+ """
40
+ )
41
+
42
+ expect('dummy_app/.rspec').to contain (
43
+ """
44
+ --color
45
+ --require spec_helper
46
+ --format documentation
47
+ """
48
+ )
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,32 @@
1
+ module Skellington
2
+ describe CLI do
3
+ let :subject do
4
+ described_class.new
5
+ end
6
+
7
+ it 'has a version' do
8
+ expect { subject.version }.to output(/^skellington version #{VERSION}$/).to_stdout
9
+ end
10
+
11
+ it 'generates correct output' do
12
+ expect { subject.generate 'dummy_app' }.to output(/
13
+ Your new Sinatra app DummyApp has been created
14
+
15
+ Now do
16
+
17
+ cd dummy_app
18
+ bundle
19
+ bundle exec rake
20
+
21
+ And presuming that passes OK
22
+
23
+ git add .
24
+ git commit -m 'First commit'
25
+
26
+ You can run the app with
27
+
28
+ bundle exec rackup
29
+ /).to_stdout
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,36 @@
1
+ module Skellington
2
+ describe CLI do
3
+ let :subject do
4
+ described_class.new
5
+ end
6
+
7
+ it 'has a version' do
8
+ expect { subject.version }.to output(/^skellington version #{VERSION}$/).to_stdout
9
+ end
10
+
11
+ it 'generates correct output' do
12
+ expect { subject.generate 'hyphenated-name' }.to output(/
13
+ Your new Sinatra app HyphenatedName has been created
14
+
15
+ \(Note that 'hyphenated-name' has been changed to 'hyphenated_name' because Ruby finds '-'s troubling\)
16
+
17
+ Now do
18
+
19
+ cd hyphenated_name
20
+ bundle
21
+ bundle exec rake
22
+
23
+ And presuming that passes OK
24
+
25
+ git add .
26
+ git commit -m 'First commit'
27
+
28
+ You can run the app with
29
+
30
+ bundle exec rackup
31
+ /).to_stdout
32
+
33
+ expect(File).to exist 'hyphenated_name/lib/hyphenated_name.rb'
34
+ end
35
+ end
36
+ end
@@ -15,4 +15,43 @@ RSpec.configure do |config|
15
15
  config.filter_run :focus
16
16
  config.run_all_when_everything_filtered = true
17
17
  config.order = :random
18
+
19
+ config.before(:each) do
20
+ FileUtils.rm_rf 'tmp'
21
+ FileUtils.mkdir_p 'tmp'
22
+ FileUtils.cd 'tmp'
23
+ end
24
+
25
+ original_stderr = $stderr
26
+ original_stdout = $stdout
27
+ config.before(:all) do
28
+ # Redirect stderr and stdout
29
+ $stderr = File.new '/dev/null', 'w'
30
+ $stdout = File.new '/dev/null', 'w'
31
+ end
32
+ config.after(:all) do
33
+ $stderr = original_stderr
34
+ $stdout = original_stdout
35
+ end
36
+ end
37
+
38
+ RSpec::Matchers.define :contain do |expected|
39
+ match do |actual|
40
+ x = expected.split("\n").map { |l| l.strip }.reject { |m| m == '' }
41
+ a = File.readlines(actual).map { |l| l.strip }.reject { |m| m == '' }
42
+
43
+ pass = true
44
+ x.each_with_index do |e, i|
45
+ if /^\/.*\/$/.match e.strip
46
+ unless Regexp.new(e.strip[1..-2]).match a[i].strip
47
+ pass = false
48
+ end
49
+ else
50
+ unless e.strip == a[i].strip
51
+ pass = false
52
+ end
53
+ end
54
+ end
55
+ pass
56
+ end
18
57
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: skellington
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - pikesley
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-06 00:00:00.000000000 Z
11
+ date: 2016-01-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -94,20 +94,6 @@ dependencies:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
96
  version: '10.0'
97
- - !ruby/object:Gem::Dependency
98
- name: cucumber
99
- requirement: !ruby/object:Gem::Requirement
100
- requirements:
101
- - - "~>"
102
- - !ruby/object:Gem::Version
103
- version: '1.3'
104
- type: :development
105
- prerelease: false
106
- version_requirements: !ruby/object:Gem::Requirement
107
- requirements:
108
- - - "~>"
109
- - !ruby/object:Gem::Version
110
- version: '1.3'
111
97
  - !ruby/object:Gem::Dependency
112
98
  name: rspec
113
99
  requirement: !ruby/object:Gem::Requirement
@@ -136,34 +122,6 @@ dependencies:
136
122
  - - "~>"
137
123
  - !ruby/object:Gem::Version
138
124
  version: '4.5'
139
- - !ruby/object:Gem::Dependency
140
- name: guard-cucumber
141
- requirement: !ruby/object:Gem::Requirement
142
- requirements:
143
- - - "~>"
144
- - !ruby/object:Gem::Version
145
- version: '1.5'
146
- type: :development
147
- prerelease: false
148
- version_requirements: !ruby/object:Gem::Requirement
149
- requirements:
150
- - - "~>"
151
- - !ruby/object:Gem::Version
152
- version: '1.5'
153
- - !ruby/object:Gem::Dependency
154
- name: aruba
155
- requirement: !ruby/object:Gem::Requirement
156
- requirements:
157
- - - "~>"
158
- - !ruby/object:Gem::Version
159
- version: '0.6'
160
- type: :development
161
- prerelease: false
162
- version_requirements: !ruby/object:Gem::Requirement
163
- requirements:
164
- - - "~>"
165
- - !ruby/object:Gem::Version
166
- version: '0.6'
167
125
  description: Generate tedious Cucumber and Sinatra boilerplate like a boss
168
126
  email:
169
127
  - sam@pikesley.org
@@ -182,41 +140,54 @@ files:
182
140
  - Rakefile
183
141
  - bin/skellington
184
142
  - config/config.yaml
185
- - features/app.feature
186
- - features/bootstrap.feature
187
- - features/cli.feature
188
- - features/config.ru.feature
189
- - features/cukes.feature
190
- - features/gemfile.feature
191
- - features/git.feature
192
- - features/guardfile.feature
193
- - features/hyphens.feature
194
- - features/naming.feature
195
- - features/non-local-path.feature
196
- - features/procfile.feature
197
- - features/rakefile.feature
198
- - features/rbenv.feature
199
- - features/support/env.rb
143
+ - files
200
144
  - lib/skellington.rb
201
145
  - lib/skellington/cli.rb
202
146
  - lib/skellington/generator.rb
203
147
  - lib/skellington/helpers.rb
204
148
  - lib/skellington/template.rb
205
149
  - lib/skellington/version.rb
150
+ - lib/templates/.rspec.eruby
206
151
  - lib/templates/.ruby-version.eruby
207
152
  - lib/templates/Gemfile.eruby
208
- - lib/templates/Guardfile.eruby
209
153
  - lib/templates/Procfile.eruby
210
154
  - lib/templates/Rakefile.eruby
211
155
  - lib/templates/config.ru.eruby
212
156
  - lib/templates/features/first.feature.eruby
157
+ - lib/templates/features/json.feature.eruby
213
158
  - lib/templates/features/step_definitions/app_steps.rb.eruby
214
159
  - lib/templates/features/support/env.rb.eruby
215
160
  - lib/templates/lib/app.rb.eruby
216
- - lib/templates/lib/views/default.erb.eruby
217
- - lib/templates/lib/views/index.erb.eruby
161
+ - lib/templates/lib/app/helpers.rb.eruby
162
+ - lib/templates/lib/app/racks.rb.eruby
218
163
  - lib/templates/post-run.eruby
164
+ - lib/templates/public/assets/favicon.ico.eruby
165
+ - lib/templates/public/css/styles.css.eruby
166
+ - lib/templates/public/js/app.js.eruby
167
+ - lib/templates/spec/app/app_spec.rb.eruby
168
+ - lib/templates/spec/javascripts/appSpec.js.eruby
169
+ - lib/templates/spec/javascripts/support/jasmine.yml.eruby
170
+ - lib/templates/spec/javascripts/support/jasmine_helper.rb.eruby
171
+ - lib/templates/spec/spec_helper.rb.eruby
172
+ - lib/templates/views/default.erb.eruby
173
+ - lib/templates/views/includes/header.erb.eruby
174
+ - lib/templates/views/index.erb.eruby
219
175
  - skellington.gemspec
176
+ - spec/cli/app_spec.rb
177
+ - spec/cli/bootstrap_spec.rb
178
+ - spec/cli/config_ru_spec.rb
179
+ - spec/cli/cukes_spec.rb
180
+ - spec/cli/gemfile_spec.rb
181
+ - spec/cli/git_spec.rb
182
+ - spec/cli/javascript_spec.rb
183
+ - spec/cli/non_local_path_spec.rb
184
+ - spec/cli/procfile_spec.rb
185
+ - spec/cli/public_spec.rb
186
+ - spec/cli/rakefile_spec.rb
187
+ - spec/cli/rbenv_spec.rb
188
+ - spec/cli/spec_spec.rb
189
+ - spec/cli_spec.rb
190
+ - spec/hyphens_spec.rb
220
191
  - spec/skellington_spec.rb
221
192
  - spec/spec_helper.rb
222
193
  homepage: http://sam.pikesley.org/projects/skellington/
@@ -239,25 +210,25 @@ required_rubygems_version: !ruby/object:Gem::Requirement
239
210
  version: '0'
240
211
  requirements: []
241
212
  rubyforge_project:
242
- rubygems_version: 2.4.5
213
+ rubygems_version: 2.5.1
243
214
  signing_key:
244
215
  specification_version: 4
245
216
  summary: Opinionated boilerplate skeleton generator for a cuked Sinatra app
246
217
  test_files:
247
- - features/app.feature
248
- - features/bootstrap.feature
249
- - features/cli.feature
250
- - features/config.ru.feature
251
- - features/cukes.feature
252
- - features/gemfile.feature
253
- - features/git.feature
254
- - features/guardfile.feature
255
- - features/hyphens.feature
256
- - features/naming.feature
257
- - features/non-local-path.feature
258
- - features/procfile.feature
259
- - features/rakefile.feature
260
- - features/rbenv.feature
261
- - features/support/env.rb
218
+ - spec/cli/app_spec.rb
219
+ - spec/cli/bootstrap_spec.rb
220
+ - spec/cli/config_ru_spec.rb
221
+ - spec/cli/cukes_spec.rb
222
+ - spec/cli/gemfile_spec.rb
223
+ - spec/cli/git_spec.rb
224
+ - spec/cli/javascript_spec.rb
225
+ - spec/cli/non_local_path_spec.rb
226
+ - spec/cli/procfile_spec.rb
227
+ - spec/cli/public_spec.rb
228
+ - spec/cli/rakefile_spec.rb
229
+ - spec/cli/rbenv_spec.rb
230
+ - spec/cli/spec_spec.rb
231
+ - spec/cli_spec.rb
232
+ - spec/hyphens_spec.rb
262
233
  - spec/skellington_spec.rb
263
234
  - spec/spec_helper.rb
@@ -1,21 +0,0 @@
1
- Feature: Generate skellington
2
-
3
- Scenario: generate app file
4
- When I successfully run `skellington generate dummy_app`
5
- Then a directory named "dummy_app/lib/" should exist
6
- And a file named "dummy_app/lib/dummy_app.rb" should exist
7
- And the file "dummy_app/lib/dummy_app.rb" should contain:
8
- """
9
- require 'sinatra/base'
10
-
11
- class DummyApp < Sinatra::Base
12
- get '/' do
13
- @content = '<h1>Hello from DummyApp</h1>'
14
- @title = 'DummyApp'
15
- erb :index, layout: :default
16
- end
17
-
18
- # start the server if ruby file executed directly
19
- run! if app_file == $0
20
- end
21
- """
@@ -1,29 +0,0 @@
1
- Feature: Generate skellington
2
-
3
- Scenario: get some feedback
4
- When I successfully run `skellington generate dummy_app`
5
- Then the output should contain "Generating dummy_app/Gemfile"
6
- And the output should contain "bundle"
7
- And the output should contain:
8
- """
9
- Your new Sinatra app DummyApp has been created
10
-
11
- Now do
12
-
13
- cd dummy_app
14
- bundle
15
- bundle exec rake
16
-
17
- And presuming that passes OK
18
-
19
- git add .
20
- git commit -m 'First commit'
21
-
22
- You can run the app with
23
-
24
- bundle exec rackup
25
- """
26
-
27
- Scenario: get the version
28
- When I successfully run `skellington -v`
29
- Then the output should contain "skellington version"