skellington 0.4.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
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
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d0588a7b4f1bb6307f0a45d6af3a0770848ab89d
4
- data.tar.gz: d5124016a9fe7ad3b11a8c43a56ae8060981b3e3
3
+ metadata.gz: e9cfadd02678c94f3e7086f19738dfe59a1942b7
4
+ data.tar.gz: 1a636831eaa0cf82be43debf681db927273e2058
5
5
  SHA512:
6
- metadata.gz: df013de81057b73652fb75d8e6574dcce47ab20ee48f433e1c69fe1e24106e77734f070a6f2f4b8d8b6c952d5f4566ce30049afa1a03b2cc3b7df3e1875306dd
7
- data.tar.gz: 0bd914bf20a98338756ab827352ebad1f96d3e57db4e4915a30f2a79a678de20a59b2c4a79ff7048552fb29e5ffcbc95b17978bd1301c3575e3175fa1d9d32bf
6
+ metadata.gz: ed3f2ec26f7ef88dc1a99449313a2dfad7401bf938424b8b8f8fd1d41c2a91bb1ace5300e1fef6582038d21a9bcb7a0cb163037d46362183ab50a200ce5debf7
7
+ data.tar.gz: 0061d7fd850e8686a9fb7fb091c2f4e11a9982e3564381acd9c1a4a600e4ae60eade81fd4eafcf7cf1fb917c9cd08b2ebcad0c273c1ddf447669ff3d46b07280
data/.gitignore CHANGED
@@ -6,9 +6,9 @@
6
6
  /doc/
7
7
  /pkg/
8
8
  /spec/reports/
9
- /tmp/
10
9
  *.bundle
11
10
  *.so
12
11
  *.o
13
12
  *.a
14
13
  mkmf.log
14
+ /tmp/
data/.rspec CHANGED
@@ -1,2 +1,3 @@
1
1
  --color
2
2
  --require spec_helper
3
+ --format documentation
data/Guardfile CHANGED
@@ -81,6 +81,6 @@ guard "cucumber" do
81
81
  watch(%r{^features/support/.+$}) { "features" }
82
82
 
83
83
  watch(%r{^features/step_definitions/(.+)_steps\.rb$}) do |m|
84
- Dir[File.join("**/#{m[1]}.feature")][0] || "features"
84
+ "features"
85
85
  end
86
86
  end
data/README.md CHANGED
@@ -8,41 +8,61 @@
8
8
 
9
9
  # Skellington
10
10
 
11
- Generate tedious [Cucumber](http://cukes.info/) and [Sinatra](http://www.sinatrarb.com/) boilerplate like a boss. Should work fine for both RVM- and rbenv-based setups
11
+ Generate a [Sinatra](http://www.sinatrarb.com/) app skeleton. Sets up
12
+
13
+ * [Cucumber](https://cucumber.io/)
14
+ * with [cucumber-api-steps](https://github.com/jayzes/cucumber-api-steps)
15
+ * [Rspec](http://rspec.info/)
16
+ * [Jasmine](http://jasmine.github.io/2.0/introduction.html)
17
+ * [Bootstrap](http://getbootstrap.com/)
18
+
19
+ Should work fine for both RVM- and rbenv-based setups
12
20
 
13
21
  $ gem install skellington
14
22
  $ skellington generate naming-things-is-hard
15
- Generating naming_things_is_hard/Gemfile...done
16
- Generating naming_things_is_hard/Rakefile...done
17
- Generating naming_things_is_hard/Procfile...done
18
- Generating naming_things_is_hard/Guardfile...done
19
- Generating naming_things_is_hard/.ruby-version...done
20
- Generating naming_things_is_hard/config.ru...done
21
- Generating naming_things_is_hard/features/naming_things_is_hard.feature...done
22
- Generating naming_things_is_hard/features/step_definitions/naming_things_is_hard_steps.rb...done
23
- Generating naming_things_is_hard/features/support/env.rb...done
24
- Generating naming_things_is_hard/lib/naming_things_is_hard.rb...done
25
- Generating naming_things_is_hard/lib/views/default.erb...done
26
- Generating naming_things_is_hard/lib/views/index.erb...done
23
+ Generating naming_things_is_hard/Gemfile...done
24
+ Generating naming_things_is_hard/Rakefile...done
25
+ Generating naming_things_is_hard/Procfile...done
26
+ Generating naming_things_is_hard/.ruby-version...done
27
+ Generating naming_things_is_hard/.rspec...done
28
+ Generating naming_things_is_hard/config.ru...done
29
+ Generating naming_things_is_hard/features/naming_things_is_hard.feature...done
30
+ Generating naming_things_is_hard/features/json.feature...done
31
+ Generating naming_things_is_hard/features/step_definitions/naming_things_is_hard_steps.rb...done
32
+ Generating naming_things_is_hard/features/support/env.rb...done
33
+ Generating naming_things_is_hard/lib/naming_things_is_hard.rb...done
34
+ Generating naming_things_is_hard/lib/naming_things_is_hard/racks.rb...done
35
+ Generating naming_things_is_hard/lib/naming_things_is_hard/helpers.rb...done
36
+ Generating naming_things_is_hard/views/default.erb...done
37
+ Generating naming_things_is_hard/views/index.erb...done
38
+ Generating naming_things_is_hard/views/includes/header.erb...done
39
+ Generating naming_things_is_hard/spec/spec_helper.rb...done
40
+ Generating naming_things_is_hard/spec/naming_things_is_hard/naming_things_is_hard_spec.rb...done
41
+ Generating naming_things_is_hard/spec/javascripts/support/jasmine.yml...done
42
+ Generating naming_things_is_hard/spec/javascripts/support/jasmine_helper.rb...done
43
+ Generating naming_things_is_hard/spec/javascripts/naming_things_is_hardSpec.js...done
44
+ Generating naming_things_is_hard/public/assets/favicon.ico...done
45
+ Generating naming_things_is_hard/public/css/styles.css...done
46
+ Generating naming_things_is_hard/public/js/naming_things_is_hard.js...done
27
47
 
28
- Your new Sinatra app NamingThingsIsHard has been created
48
+ Your new Sinatra app NamingThingsIsHard has been created
29
49
 
30
- (Note that 'naming-things-is-hard' has been changed to 'naming_things_is_hard' because Ruby finds '-'s troubling)
50
+ (Note that 'naming-things-is-hard' has been changed to 'naming_things_is_hard' because Ruby finds '-'s troubling)
31
51
 
32
- Now do
52
+ Now do
33
53
 
34
- cd naming_things_is_hard
35
- bundle
36
- rake
54
+ cd naming_things_is_hard
55
+ bundle
56
+ rake
37
57
 
38
- And presuming that passes OK
58
+ And presuming that passes OK
39
59
 
40
- git add .
41
- git commit -m 'First commit'
60
+ git add .
61
+ git commit -m 'First commit'
42
62
 
43
- You can run the app with
63
+ You can run the app with
44
64
 
45
- rackup
65
+ rackup
46
66
 
47
67
  This assumes a bunch of things, at least:
48
68
 
data/Rakefile CHANGED
@@ -1,10 +1,8 @@
1
1
  require 'bundler/gem_tasks'
2
2
  require 'rspec/core/rake_task'
3
- require 'cucumber/rake/task'
4
3
  require 'coveralls/rake/task'
5
4
 
6
5
  Coveralls::RakeTask.new
7
6
  RSpec::Core::RakeTask.new
8
- Cucumber::Rake::Task.new
9
7
 
10
- task :default => [:spec, :cucumber, 'coveralls:push']
8
+ task :default => [:spec, 'coveralls:push']
@@ -1,15 +1,22 @@
1
1
  gems:
2
2
  production:
3
3
  - sinatra
4
- - thin
4
+ - puma
5
5
  - rake
6
+ - rack-conneg
6
7
 
7
8
  test:
8
9
  - cucumber
9
10
  - capybara
11
+ - coveralls
12
+ - jasmine
13
+ - rspec
14
+ - guard-rspec
15
+ - guard-jasmine
10
16
  - guard
11
17
  - guard-cucumber
12
18
  - pry
19
+ - actionpack
13
20
 
14
21
  test_require_false:
15
22
  - cucumber-api-steps
@@ -18,18 +25,35 @@ files:
18
25
  Gemfile:
19
26
  Rakefile:
20
27
  Procfile:
21
- Guardfile:
22
28
  .ruby-version:
29
+ .rspec:
23
30
  config.ru:
24
31
  # the template has this name
25
32
  features/first.feature:
26
33
  # but the output file substitutes it like this, where wormname is an attribute
27
34
  # on the Generator object
28
35
  outpath: first/wormname
36
+ features/json.feature:
29
37
  features/step_definitions/app_steps.rb:
30
38
  outpath: app/wormname
31
39
  features/support/env.rb:
32
40
  lib/app.rb:
33
41
  outpath: app/wormname
34
- lib/views/default.erb:
35
- lib/views/index.erb:
42
+ lib/app/racks.rb:
43
+ outpath: app/wormname/racks
44
+ lib/app/helpers.rb:
45
+ outpath: app/wormname/helpers
46
+ views/default.erb:
47
+ views/index.erb:
48
+ views/includes/header.erb:
49
+ spec/spec_helper.rb:
50
+ spec/app/app_spec.rb:
51
+ outpath: app/wormname
52
+ spec/javascripts/support/jasmine.yml:
53
+ spec/javascripts/support/jasmine_helper.rb:
54
+ spec/javascripts/appSpec.js:
55
+ outpath: app/wormname
56
+ public/assets/favicon.ico:
57
+ public/css/styles.css:
58
+ public/js/app.js:
59
+ outpath: app/wormname
data/files ADDED
@@ -0,0 +1,24 @@
1
+ ./.rspec <
2
+ ./.ruby-version <
3
+ ./config.ru <
4
+ ./features/json.feature <
5
+ ./features/step_definitions/template_steps.rb <
6
+ ./features/support/env.rb <
7
+ ./features/template.feature <
8
+ ./Gemfile <
9
+ ./lib/template/helpers.rb <
10
+ ./lib/template/racks.rb <
11
+ ./lib/template.rb <
12
+ ./Procfile <
13
+ ./public/assets/favicon.ico <
14
+ ./public/css/styles.css <
15
+ ./public/js/template.js <
16
+ ./Rakefile <
17
+ ./spec/javascripts/support/jasmine.yml <
18
+ ./spec/javascripts/support/jasmine_helper.rb <
19
+ ./spec/javascripts/templateSpec.js <
20
+ ./spec/spec_helper.rb <
21
+ ./spec/template/template_spec.rb <
22
+ ./views/default.erb
23
+ ./views/includes/header.erb
24
+ ./views/index.erb
@@ -8,7 +8,7 @@ module Skellington
8
8
  def outpath
9
9
  @outpath ||= begin
10
10
  subs = @generator.files[@name]['outpath'].split '/'
11
- @outpath = "#{@generator.path}/#{@generator.send(subs[1].to_sym)}/#{@name.sub(subs[0], @generator.send(subs[1].to_sym))}"
11
+ @outpath = "#{@generator.path}/#{@generator.send(subs[1].to_sym)}/#{@name.gsub(subs[0], @generator.send(subs[1].to_sym))}"
12
12
  rescue NoMethodError
13
13
  @outpath = "#{@generator.path}/#{@generator.wormname}/#{@name}"
14
14
  end
@@ -1,3 +1,3 @@
1
1
  module Skellington
2
- VERSION = "0.4.0"
2
+ VERSION = "0.4.1"
3
3
  end
@@ -0,0 +1,3 @@
1
+ --color
2
+ --require spec_helper
3
+ --format documentation
@@ -3,8 +3,13 @@ require File.join(File.dirname(__FILE__), 'lib/<%= @gen.wormname %>.rb')
3
3
  unless ENV['RACK_ENV'] == 'production'
4
4
  require 'rspec/core/rake_task'
5
5
  require 'cucumber/rake/task'
6
+ require 'coveralls/rake/task'
7
+ require 'jasmine'
8
+ load 'jasmine/tasks/jasmine.rake'
6
9
 
7
10
  Cucumber::Rake::Task.new
11
+ RSpec::Core::RakeTask.new
12
+ Coveralls::RakeTask.new
8
13
 
9
- task :default => [:cucumber]
14
+ task :default => [:cucumber, :spec, 'jasmine:ci', 'coveralls:push']
10
15
  end
@@ -1,4 +1,3 @@
1
- require 'rubygems'
2
1
  require File.join(File.dirname(__FILE__), 'lib/<%= @gen.wormname %>.rb')
3
2
 
4
- run <%= @gen.camelname %>
3
+ run <%= @gen.camelname %>::App
@@ -0,0 +1,9 @@
1
+ Feature: Get JSON
2
+
3
+ Background:
4
+ Given I send and accept JSON
5
+
6
+ Scenario: Get JSON for a repo
7
+ When I send a GET request to "/"
8
+ Then the response status should be "200"
9
+ And the JSON response should have "$app" with the text "<%= @gen.camelname %>"
@@ -6,6 +6,7 @@ require 'capybara'
6
6
  require 'capybara/cucumber'
7
7
  require 'rspec'
8
8
  require 'cucumber/api_steps'
9
+ require 'active_support/core_ext/object/blank'
9
10
 
10
11
  Capybara.app = <%= @gen.camelname %>
11
12
 
@@ -15,7 +16,7 @@ class <%= @gen.camelname %>World
15
16
  include RSpec::Matchers
16
17
 
17
18
  def app
18
- <%= @gen.camelname %>
19
+ <%= @gen.camelname %>::App
19
20
  end
20
21
  end
21
22
 
@@ -1,12 +1,32 @@
1
1
  require 'sinatra/base'
2
+ require 'tilt/erubis'
2
3
 
3
- class <%= @gen.camelname %> < Sinatra::Base
4
- get '/' do
5
- @content = '<h1>Hello from <%= @gen.camelname %></h1>'
6
- @title = '<%= @gen.camelname %>'
7
- erb :index, layout: :default
8
- end
4
+ require_relative '<%= @gen.wormname %>/racks'
5
+ require_relative '<%= @gen.wormname %>/helpers'
6
+
7
+ module <%= @gen.camelname %>
8
+ class App < Sinatra::Base
9
+ helpers do
10
+ include <%= @gen.camelname %>::Helpers
11
+ end
12
+
13
+ get '/' do
14
+ respond_to do |wants|
15
+ wants.html do
16
+ @content = '<h1>Hello from <%= @gen.camelname %></h1>'
17
+ @title = '<%= @gen.camelname %>'
18
+ erb :index, layout: :default
19
+ end
9
20
 
10
- # start the server if ruby file executed directly
11
- run! if app_file == $0
21
+ wants.json do
22
+ {
23
+ app: '<%= @gen.camelname %>'
24
+ }.to_json
25
+ end
26
+ end
27
+ end
28
+
29
+ # start the server if ruby file executed directly
30
+ run! if app_file == $0
31
+ end
12
32
  end
@@ -0,0 +1,4 @@
1
+ module <%= @gen.camelname %>
2
+ module Helpers
3
+ end
4
+ end
@@ -0,0 +1,24 @@
1
+ require 'rack/conneg'
2
+
3
+ module <%= @gen.camelname %>
4
+ class App < Sinatra::Base
5
+ set :public_folder, 'public'
6
+ set :views, 'views'
7
+
8
+ use Rack::Conneg do |conneg|
9
+ conneg.set :accept_all_extensions, false
10
+ conneg.set :fallback, :html
11
+ conneg.ignore_contents_of 'public'
12
+ conneg.provide [
13
+ :html,
14
+ :json
15
+ ]
16
+ end
17
+
18
+ before do
19
+ if negotiated?
20
+ content_type negotiated_type
21
+ end
22
+ end
23
+ end
24
+ end
File without changes
@@ -0,0 +1,7 @@
1
+ module <%= @gen.camelname %>
2
+ describe App do
3
+ it 'knows the truth' do
4
+ expect(true).to eq true
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,5 @@
1
+ describe('<%= @gen.camelname %>', function() {
2
+ it('knows the truth', function() {
3
+ expect(true).toEqual(true)
4
+ })
5
+ })
@@ -0,0 +1,15 @@
1
+ src_files:
2
+ - public/js/**/*.js
3
+ stylesheets:
4
+ - stylesheets/**/*.css
5
+ helpers:
6
+ - helpers/**/*.js
7
+ spec_files:
8
+ - '**/*[sS]pec.js'
9
+ src_dir:
10
+ spec_dir:
11
+ spec_helper: spec/javascripts/support/jasmine_helper.rb
12
+ boot_dir:
13
+ boot_files:
14
+ server: 'puma'
15
+ random: true
@@ -0,0 +1,16 @@
1
+ require 'coveralls'
2
+ Coveralls.wear_merged!
3
+
4
+ require '<%= @gen.wormname %>'
5
+
6
+ RSpec.configure do |config|
7
+ config.expect_with :rspec do |expectations|
8
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
9
+ end
10
+
11
+ config.mock_with :rspec do |mocks|
12
+ mocks.verify_partial_doubles = true
13
+ end
14
+
15
+ config.order = :random
16
+ end
@@ -0,0 +1,15 @@
1
+ <!DOCTYPE html>
2
+ <html lang='en'>
3
+ <%%= erb :'includes/header' %>
4
+ <body>
5
+ <div class='container'>
6
+ <div class='row'>
7
+ <div class='col-md-2'></div>
8
+ <div class='col-md-8'>
9
+ <%%= yield %>
10
+ </div>
11
+ <div class='col-md-2'></div>
12
+ </div>
13
+ </div>
14
+ </body>
15
+ </html>
@@ -0,0 +1,22 @@
1
+ <head>
2
+ <meta charset='utf-8' />
3
+ <meta http-equiv='X-UA-Compatible' content='IE=edge' />
4
+ <meta name='viewport' content='width=device-width, initial-scale=1' />
5
+
6
+ <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
7
+ <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
8
+ <!--[if lt IE 9]>
9
+ <script src='https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js'></script>
10
+ <script src='https://oss.maxcdn.com/respond/1.4.2/respond.min.js'></script>
11
+ <![endif]-->
12
+
13
+ <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
14
+ <script src='https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js'></script>
15
+ <!-- Include all compiled plugins (below), or include individual files as needed -->
16
+ <script src='//maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js'></script>
17
+ <link rel='stylesheet' href='//maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css' type='text/css' />
18
+ <link rel='icon' type='image/png' href='/assets/favicon.ico' />
19
+ <link rel='stylesheet' href='/css/styles.css' />
20
+ <script src='/js/template.js'></script>
21
+ <title><%%= @title %></title>
22
+ </head>