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.
- checksums.yaml +4 -4
- data/.gitignore +1 -1
- data/.rspec +1 -0
- data/Guardfile +1 -1
- data/README.md +44 -24
- data/Rakefile +1 -3
- data/config/config.yaml +28 -4
- data/files +24 -0
- data/lib/skellington/template.rb +1 -1
- data/lib/skellington/version.rb +1 -1
- data/lib/templates/.rspec.eruby +3 -0
- data/lib/templates/Rakefile.eruby +6 -1
- data/lib/templates/config.ru.eruby +1 -2
- data/lib/templates/features/json.feature.eruby +9 -0
- data/lib/templates/features/support/env.rb.eruby +2 -1
- data/lib/templates/lib/app.rb.eruby +28 -8
- data/lib/templates/lib/app/helpers.rb.eruby +4 -0
- data/lib/templates/lib/app/racks.rb.eruby +24 -0
- data/lib/templates/public/assets/favicon.ico.eruby +0 -0
- data/lib/templates/public/css/styles.css.eruby +0 -0
- data/lib/templates/public/js/app.js.eruby +0 -0
- data/lib/templates/spec/app/app_spec.rb.eruby +7 -0
- data/lib/templates/spec/javascripts/appSpec.js.eruby +5 -0
- data/lib/templates/spec/javascripts/support/jasmine.yml.eruby +15 -0
- data/lib/templates/spec/javascripts/support/jasmine_helper.rb.eruby +0 -0
- data/lib/templates/spec/spec_helper.rb.eruby +16 -0
- data/lib/templates/views/default.erb.eruby +15 -0
- data/lib/templates/views/includes/header.erb.eruby +22 -0
- data/lib/templates/{lib/views → views}/index.erb.eruby +0 -0
- data/skellington.gemspec +0 -3
- data/spec/cli/app_spec.rb +85 -0
- data/{features/bootstrap.feature → spec/cli/bootstrap_spec.rb} +41 -27
- data/spec/cli/config_ru_spec.rb +18 -0
- data/spec/cli/cukes_spec.rb +66 -0
- data/spec/cli/gemfile_spec.rb +38 -0
- data/spec/cli/git_spec.rb +12 -0
- data/spec/cli/javascript_spec.rb +42 -0
- data/spec/cli/non_local_path_spec.rb +55 -0
- data/spec/cli/procfile_spec.rb +16 -0
- data/spec/cli/public_spec.rb +14 -0
- data/spec/cli/rakefile_spec.rb +30 -0
- data/spec/cli/rbenv_spec.rb +17 -0
- data/spec/cli/spec_spec.rb +51 -0
- data/spec/cli_spec.rb +32 -0
- data/spec/hyphens_spec.rb +36 -0
- data/spec/spec_helper.rb +39 -0
- metadata +49 -78
- data/features/app.feature +0 -21
- data/features/cli.feature +0 -29
- data/features/config.ru.feature +0 -12
- data/features/cukes.feature +0 -50
- data/features/gemfile.feature +0 -27
- data/features/git.feature +0 -5
- data/features/guardfile.feature +0 -16
- data/features/hyphens.feature +0 -27
- data/features/naming.feature +0 -6
- data/features/non-local-path.feature +0 -29
- data/features/procfile.feature +0 -9
- data/features/rakefile.feature +0 -18
- data/features/rbenv.feature +0 -6
- data/features/support/env.rb +0 -6
- data/lib/templates/Guardfile.eruby +0 -8
- data/lib/templates/lib/views/default.erb.eruby +0 -35
File without changes
|
data/skellington.gemspec
CHANGED
@@ -25,9 +25,6 @@ Gem::Specification.new do |spec|
|
|
25
25
|
spec.add_development_dependency 'coveralls', '~> 0.7'
|
26
26
|
spec.add_development_dependency 'bundler', '~> 1.7'
|
27
27
|
spec.add_development_dependency 'rake', '~> 10.0'
|
28
|
-
spec.add_development_dependency 'cucumber', '~> 1.3'
|
29
28
|
spec.add_development_dependency 'rspec', '~> 3.1'
|
30
29
|
spec.add_development_dependency 'guard-rspec', '~> 4.5'
|
31
|
-
spec.add_development_dependency 'guard-cucumber', '~> 1.5'
|
32
|
-
spec.add_development_dependency 'aruba', '~> 0.6'
|
33
30
|
end
|
@@ -0,0 +1,85 @@
|
|
1
|
+
module Skellington
|
2
|
+
describe CLI do
|
3
|
+
let :subject do
|
4
|
+
described_class.new
|
5
|
+
end
|
6
|
+
|
7
|
+
it 'generates an app file' do
|
8
|
+
subject.generate 'dummy_app'
|
9
|
+
expect('dummy_app/lib/dummy_app.rb').to contain (
|
10
|
+
"""
|
11
|
+
require 'sinatra/base'
|
12
|
+
require 'tilt/erubis'
|
13
|
+
|
14
|
+
require_relative 'dummy_app/racks'
|
15
|
+
require_relative 'dummy_app/helpers'
|
16
|
+
|
17
|
+
module DummyApp
|
18
|
+
class App < Sinatra::Base
|
19
|
+
helpers do
|
20
|
+
include DummyApp::Helpers
|
21
|
+
end
|
22
|
+
|
23
|
+
get '/' do
|
24
|
+
respond_to do |wants|
|
25
|
+
wants.html do
|
26
|
+
@content = '<h1>Hello from DummyApp</h1>'
|
27
|
+
@title = 'DummyApp'
|
28
|
+
erb :index, layout: :default
|
29
|
+
end
|
30
|
+
|
31
|
+
wants.json do
|
32
|
+
{
|
33
|
+
app: 'DummyApp'
|
34
|
+
}.to_json
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
# start the server if ruby file executed directly
|
40
|
+
run! if app_file == $0
|
41
|
+
end
|
42
|
+
end
|
43
|
+
"""
|
44
|
+
)
|
45
|
+
|
46
|
+
expect('dummy_app/lib/dummy_app/racks.rb').to contain (
|
47
|
+
"""
|
48
|
+
require 'rack/conneg'
|
49
|
+
|
50
|
+
module DummyApp
|
51
|
+
class App < Sinatra::Base
|
52
|
+
set :public_folder, 'public'
|
53
|
+
set :views, 'views'
|
54
|
+
|
55
|
+
use Rack::Conneg do |conneg|
|
56
|
+
conneg.set :accept_all_extensions, false
|
57
|
+
conneg.set :fallback, :html
|
58
|
+
conneg.ignore_contents_of 'public'
|
59
|
+
conneg.provide [
|
60
|
+
:html,
|
61
|
+
:json
|
62
|
+
]
|
63
|
+
end
|
64
|
+
|
65
|
+
before do
|
66
|
+
if negotiated?
|
67
|
+
content_type negotiated_type
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
"""
|
73
|
+
)
|
74
|
+
|
75
|
+
expect('dummy_app/lib/dummy_app/helpers.rb').to contain (
|
76
|
+
"""
|
77
|
+
module DummyApp
|
78
|
+
module Helpers
|
79
|
+
end
|
80
|
+
end
|
81
|
+
"""
|
82
|
+
)
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
@@ -1,12 +1,33 @@
|
|
1
|
-
|
1
|
+
module Skellington
|
2
|
+
describe CLI do
|
3
|
+
let :subject do
|
4
|
+
described_class.new
|
5
|
+
end
|
2
6
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
7
|
+
it 'generates a bootstrap template' do
|
8
|
+
subject.generate 'dummy_app'
|
9
|
+
expect('dummy_app/views/default.erb').to contain (
|
10
|
+
"""
|
11
|
+
<!DOCTYPE html>
|
12
|
+
<html lang='en'>
|
13
|
+
/erb.*'includes/header'/
|
14
|
+
<body>
|
15
|
+
<div class='container'>
|
16
|
+
<div class='row'>
|
17
|
+
<div class='col-md-2'></div>
|
18
|
+
<div class='col-md-8'>
|
19
|
+
<%= yield %>
|
20
|
+
</div>
|
21
|
+
<div class='col-md-2'></div>
|
22
|
+
</div>
|
23
|
+
</div>
|
24
|
+
</body>
|
25
|
+
</html>
|
26
|
+
"""
|
27
|
+
)
|
28
|
+
|
29
|
+
expect('dummy_app/views/includes/header.erb').to contain (
|
30
|
+
"""
|
10
31
|
<head>
|
11
32
|
<meta charset='utf-8' />
|
12
33
|
<meta http-equiv='X-UA-Compatible' content='IE=edge' />
|
@@ -25,24 +46,17 @@ Feature: Generate skellington
|
|
25
46
|
<script src='//maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js'></script>
|
26
47
|
<link rel='stylesheet' href='//maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css' type='text/css' />
|
27
48
|
<link rel='icon' type='image/png' href='/assets/favicon.ico' />
|
49
|
+
<link rel='stylesheet' href='/css/styles.css' />
|
50
|
+
<script src='/js/template.js'></script>
|
28
51
|
<title><%= @title %></title>
|
29
52
|
</head>
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
</div>
|
41
|
-
</body>
|
42
|
-
</html>
|
43
|
-
"""
|
44
|
-
And a file named "dummy_app/lib/views/index.erb" should exist
|
45
|
-
And the file "dummy_app/lib/views/index.erb" should contain:
|
46
|
-
"""
|
47
|
-
<%= @content %>
|
48
|
-
"""
|
53
|
+
"""
|
54
|
+
)
|
55
|
+
expect('dummy_app/views/index.erb').to contain (
|
56
|
+
"""
|
57
|
+
<%= @content %>
|
58
|
+
"""
|
59
|
+
)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module Skellington
|
2
|
+
describe CLI do
|
3
|
+
let :subject do
|
4
|
+
described_class.new
|
5
|
+
end
|
6
|
+
|
7
|
+
it 'generates a config.ru file' do
|
8
|
+
subject.generate 'dummy_app'
|
9
|
+
expect('dummy_app/config.ru').to contain (
|
10
|
+
"""
|
11
|
+
require File.join(File.dirname(__FILE__), 'lib/dummy_app.rb')
|
12
|
+
|
13
|
+
run DummyApp::App
|
14
|
+
"""
|
15
|
+
)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,66 @@
|
|
1
|
+
module Skellington
|
2
|
+
describe CLI do
|
3
|
+
let :subject do
|
4
|
+
described_class.new
|
5
|
+
end
|
6
|
+
|
7
|
+
it 'generates some cucumber file' do
|
8
|
+
subject.generate 'dummy_app'
|
9
|
+
expect('dummy_app/features/dummy_app.feature').to contain (
|
10
|
+
"""
|
11
|
+
Feature: Make sure DummyApp is plumbed in correctly
|
12
|
+
|
13
|
+
Scenario: Get root
|
14
|
+
When I send a GET request to \"/\"
|
15
|
+
Then the response status should be \"200\"
|
16
|
+
"""
|
17
|
+
)
|
18
|
+
|
19
|
+
expect('dummy_app/features/json.feature').to contain (
|
20
|
+
"""
|
21
|
+
Feature: Get JSON
|
22
|
+
|
23
|
+
Background:
|
24
|
+
Given I send and accept JSON
|
25
|
+
|
26
|
+
Scenario: Get JSON for a repo
|
27
|
+
When I send a GET request to \"/\"
|
28
|
+
Then the response status should be \"200\"
|
29
|
+
And the JSON response should have \"$app\" with the text \"DummyApp\"
|
30
|
+
"""
|
31
|
+
)
|
32
|
+
|
33
|
+
expect('dummy_app/features/support/env.rb').to contain (
|
34
|
+
"""
|
35
|
+
ENV['RACK_ENV'] = 'test'
|
36
|
+
|
37
|
+
require File.join(File.dirname(__FILE__), '..', '..', 'lib/dummy_app.rb')
|
38
|
+
|
39
|
+
require 'capybara'
|
40
|
+
require 'capybara/cucumber'
|
41
|
+
require 'rspec'
|
42
|
+
require 'cucumber/api_steps'
|
43
|
+
require 'active_support/core_ext/object/blank'
|
44
|
+
|
45
|
+
Capybara.app = DummyApp
|
46
|
+
|
47
|
+
class DummyAppWorld
|
48
|
+
include Capybara::DSL
|
49
|
+
include RSpec::Expectations
|
50
|
+
include RSpec::Matchers
|
51
|
+
|
52
|
+
def app
|
53
|
+
DummyApp::App
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
World do
|
58
|
+
DummyAppWorld.new
|
59
|
+
end
|
60
|
+
"""
|
61
|
+
)
|
62
|
+
|
63
|
+
expect(File).to exist 'dummy_app/features/step_definitions/dummy_app_steps.rb'
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
module Skellington
|
2
|
+
describe CLI do
|
3
|
+
let :subject do
|
4
|
+
described_class.new
|
5
|
+
end
|
6
|
+
|
7
|
+
it 'generates a Gemfile' do
|
8
|
+
subject.generate 'dummy_app'
|
9
|
+
expect('dummy_app/Gemfile').to contain (
|
10
|
+
"""
|
11
|
+
source 'https://rubygems.org'
|
12
|
+
|
13
|
+
/ruby [0-9]*\.[0-9]*\.[0-9]*/
|
14
|
+
|
15
|
+
gem 'sinatra'
|
16
|
+
gem 'puma'
|
17
|
+
gem 'rake'
|
18
|
+
gem 'rack-conneg'
|
19
|
+
|
20
|
+
group :test do
|
21
|
+
gem 'cucumber'
|
22
|
+
gem 'capybara'
|
23
|
+
gem 'coveralls'
|
24
|
+
gem 'jasmine'
|
25
|
+
gem 'rspec'
|
26
|
+
gem 'guard-rspec'
|
27
|
+
gem 'guard-jasmine'
|
28
|
+
gem 'guard'
|
29
|
+
gem 'guard-cucumber'
|
30
|
+
gem 'pry'
|
31
|
+
gem 'actionpack'
|
32
|
+
gem 'cucumber-api-steps', require: false
|
33
|
+
end
|
34
|
+
"""
|
35
|
+
)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
module Skellington
|
2
|
+
describe CLI do
|
3
|
+
let :subject do
|
4
|
+
described_class.new
|
5
|
+
end
|
6
|
+
|
7
|
+
it 'generates javascript files' do
|
8
|
+
subject.generate 'dummy_app'
|
9
|
+
expect('dummy_app/spec/javascripts/support/jasmine.yml').to contain (
|
10
|
+
"""
|
11
|
+
src_files:
|
12
|
+
- public/js/**/*.js
|
13
|
+
stylesheets:
|
14
|
+
- stylesheets/**/*.css
|
15
|
+
helpers:
|
16
|
+
- helpers/**/*.js
|
17
|
+
spec_files:
|
18
|
+
- '**/*[sS]pec.js'
|
19
|
+
src_dir:
|
20
|
+
spec_dir:
|
21
|
+
spec_helper: spec/javascripts/support/jasmine_helper.rb
|
22
|
+
boot_dir:
|
23
|
+
boot_files:
|
24
|
+
server: 'puma'
|
25
|
+
random: true
|
26
|
+
"""
|
27
|
+
)
|
28
|
+
|
29
|
+
expect(File).to exist 'dummy_app/spec/javascripts/support/jasmine_helper.rb'
|
30
|
+
|
31
|
+
expect('dummy_app/spec/javascripts/dummy_appSpec.js').to contain (
|
32
|
+
"""
|
33
|
+
describe('DummyApp', function() {
|
34
|
+
it('knows the truth', function() {
|
35
|
+
expect(true).toEqual(true)
|
36
|
+
})
|
37
|
+
})
|
38
|
+
"""
|
39
|
+
)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
module Skellington
|
2
|
+
describe CLI do
|
3
|
+
let :subject do
|
4
|
+
described_class.new
|
5
|
+
end
|
6
|
+
|
7
|
+
it 'generates an app at a non-local path' do
|
8
|
+
subject.generate 'subdir/some_app'
|
9
|
+
expect('subdir/some_app/lib/some_app.rb').to contain (
|
10
|
+
"""
|
11
|
+
require 'sinatra/base'
|
12
|
+
require 'tilt/erubis'
|
13
|
+
|
14
|
+
require_relative 'some_app/racks'
|
15
|
+
require_relative 'some_app/helpers'
|
16
|
+
|
17
|
+
module SomeApp
|
18
|
+
class App < Sinatra::Base
|
19
|
+
helpers do
|
20
|
+
include SomeApp::Helpers
|
21
|
+
end
|
22
|
+
|
23
|
+
get '/' do
|
24
|
+
respond_to do |wants|
|
25
|
+
wants.html do
|
26
|
+
@content = '<h1>Hello from SomeApp</h1>'
|
27
|
+
@title = 'SomeApp'
|
28
|
+
erb :index, layout: :default
|
29
|
+
end
|
30
|
+
|
31
|
+
wants.json do
|
32
|
+
{
|
33
|
+
app: 'SomeApp'
|
34
|
+
}.to_json
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
# start the server if ruby file executed directly
|
40
|
+
run! if app_file == $0
|
41
|
+
end
|
42
|
+
end
|
43
|
+
"""
|
44
|
+
)
|
45
|
+
|
46
|
+
expect('subdir/some_app/config.ru').to contain (
|
47
|
+
"""
|
48
|
+
require File.join(File.dirname(__FILE__), 'lib/some_app.rb')
|
49
|
+
|
50
|
+
run SomeApp::App
|
51
|
+
"""
|
52
|
+
)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module Skellington
|
2
|
+
describe CLI do
|
3
|
+
let :subject do
|
4
|
+
described_class.new
|
5
|
+
end
|
6
|
+
|
7
|
+
it 'generates a Procfile' do
|
8
|
+
subject.generate 'dummy_app'
|
9
|
+
expect('dummy_app/Procfile').to contain (
|
10
|
+
"""
|
11
|
+
web: bundle exec ruby lib/dummy_app.rb
|
12
|
+
"""
|
13
|
+
)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module Skellington
|
2
|
+
describe CLI do
|
3
|
+
let :subject do
|
4
|
+
described_class.new
|
5
|
+
end
|
6
|
+
|
7
|
+
it 'generates placeholders for static files' do
|
8
|
+
subject.generate 'dummy_app'
|
9
|
+
expect(File).to exist 'dummy_app/public/css/styles.css'
|
10
|
+
expect(File).to exist 'dummy_app/public/js/dummy_app.js'
|
11
|
+
expect(File).to exist 'dummy_app/public/assets/favicon.ico'
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|