skellington 0.0.1 → 0.0.2
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/.travis.yml +3 -0
- data/README.md +8 -29
- data/Rakefile +7 -1
- data/features/app.feature +19 -0
- data/features/config.ru.feature +12 -0
- data/features/cukes.feature +22 -0
- data/features/gemfile.feature +1 -1
- data/features/support/app.feature +0 -0
- data/lib/skellington.rb +2 -0
- data/lib/skellington/generator.rb +54 -21
- data/lib/skellington/template.rb +27 -0
- data/lib/skellington/version.rb +1 -1
- data/lib/templates/Gemfile.eruby +1 -1
- data/lib/templates/Procfile.eruby +1 -1
- data/lib/templates/Rakefile.eruby +1 -1
- data/lib/templates/config.ru.eruby +4 -0
- data/lib/templates/features/first.feature.eruby +5 -0
- data/lib/templates/features/support/env.rb.eruby +24 -0
- data/lib/templates/lib/app.rb.eruby +10 -0
- data/skellington.gemspec +1 -0
- data/spec/skellington_spec.rb +3 -3
- data/spec/template_spec.rb +35 -0
- metadata +31 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ebe62e8d497b68c839729162c81cb23103697759
|
4
|
+
data.tar.gz: b459a386d94e4789cb0c8722ce34310e5884a3ce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ad36570bf89289381d4b0bbe7e72d7366c2e75febfb12dd38a040a9aa6b6d981e82aad119b096b21bc4fac4451c0929dce6526fbfe6b968108d64faa3d272466
|
7
|
+
data.tar.gz: 57f8e3b4333e8aff3290b8be31cede0c3dc961a7bcb7df4d53591fb06cab687f79decbd5c7aab3f10f9f0bf5c6d55d52dfc185c8c97cb5ce615ad8d618e07a01
|
data/.travis.yml
ADDED
data/README.md
CHANGED
@@ -1,31 +1,10 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
Add this line to your application's Gemfile:
|
8
|
-
|
9
|
-
```ruby
|
10
|
-
gem 'skellington'
|
11
|
-
```
|
12
|
-
|
13
|
-
And then execute:
|
1
|
+
[](https://travis-ci.org/pikesley/skellington)
|
2
|
+
[](https://gemnasium.com/pikesley/skellington)
|
3
|
+
[](https://codeclimate.com/github/pikesley/skellington)
|
4
|
+
[](https://rubygems.org/gems/skellington)
|
5
|
+
[](http://pikesley.mit-license.org)
|
6
|
+
[](https://github.com/badges/badgerbadgerbadger)
|
14
7
|
|
15
|
-
|
16
|
-
|
17
|
-
Or install it yourself as:
|
18
|
-
|
19
|
-
$ gem install skellington
|
20
|
-
|
21
|
-
## Usage
|
22
|
-
|
23
|
-
TODO: Write usage instructions here
|
24
|
-
|
25
|
-
## Contributing
|
8
|
+
# Skellington
|
26
9
|
|
27
|
-
|
28
|
-
2. Create your feature branch (`git checkout -b my-new-feature`)
|
29
|
-
3. Commit your changes (`git commit -am 'Add some feature'`)
|
30
|
-
4. Push to the branch (`git push origin my-new-feature`)
|
31
|
-
5. Create a new Pull Request
|
10
|
+
Zero to cuke-powered Sinatra starter app
|
data/Rakefile
CHANGED
@@ -0,0 +1,19 @@
|
|
1
|
+
Feature: Generate skellington
|
2
|
+
|
3
|
+
Scenario: generate app file
|
4
|
+
When I successfully run `skellington generate dummy_gem`
|
5
|
+
Then a directory named "dummy_gem/lib/" should exist
|
6
|
+
And a file named "dummy_gem/lib/dummy_gem.rb" should exist
|
7
|
+
And the file "dummy_gem/lib/dummy_gem.rb" should contain:
|
8
|
+
"""
|
9
|
+
require 'sinatra/base'
|
10
|
+
|
11
|
+
class DummyGem < Sinatra::Base
|
12
|
+
get '/' do
|
13
|
+
'Hello from DummyGem'
|
14
|
+
end
|
15
|
+
|
16
|
+
# start the server if ruby file executed directly
|
17
|
+
run! if app_file == $0
|
18
|
+
end
|
19
|
+
"""
|
@@ -0,0 +1,12 @@
|
|
1
|
+
Feature: Generate skellington
|
2
|
+
|
3
|
+
Scenario: generate config.ru
|
4
|
+
When I successfully run `skellington generate dummy_gem`
|
5
|
+
Then a file named "dummy_gem/config.ru" should exist
|
6
|
+
And the file "dummy_gem/config.ru" should contain:
|
7
|
+
"""
|
8
|
+
require 'rubygems'
|
9
|
+
require File.join(File.dirname(__FILE__), 'lib/dummy_gem.rb')
|
10
|
+
|
11
|
+
run DummyGem
|
12
|
+
"""
|
@@ -0,0 +1,22 @@
|
|
1
|
+
Feature: Generate skellington
|
2
|
+
|
3
|
+
Scenario: generate feature
|
4
|
+
When I successfully run `skellington generate dummy_gem`
|
5
|
+
Then a directory named "dummy_gem/features" should exist
|
6
|
+
And a file named "dummy_gem/features/dummy_gem.feature" should exist
|
7
|
+
And the file "dummy_gem/features/dummy_gem.feature" should contain:
|
8
|
+
"""
|
9
|
+
Feature: Make sure it's plumbed in correctly
|
10
|
+
|
11
|
+
Scenario: Get root
|
12
|
+
When I send a GET request to "/"
|
13
|
+
Then the response status should be "200"
|
14
|
+
"""
|
15
|
+
|
16
|
+
Scenario: generate env.rb
|
17
|
+
When I successfully run `skellington generate dummy_gem`
|
18
|
+
And a file named "dummy_gem/features/support/env.rb" should exist
|
19
|
+
And the file "dummy_gem/features/support/env.rb" should contain:
|
20
|
+
"""
|
21
|
+
DummyGem
|
22
|
+
"""
|
data/features/gemfile.feature
CHANGED
File without changes
|
data/lib/skellington.rb
CHANGED
@@ -4,33 +4,66 @@ module Skellington
|
|
4
4
|
@path = path
|
5
5
|
FileUtils.mkdir_p @path
|
6
6
|
|
7
|
-
@config = YAML.load File.read
|
8
|
-
gemfile
|
9
|
-
rakefile
|
10
|
-
procfile
|
11
|
-
end
|
7
|
+
@config = YAML.load File.read File.join File.dirname(__FILE__), '..', '..', 'config/config.yaml'
|
12
8
|
|
13
|
-
|
14
|
-
|
15
|
-
|
9
|
+
@files = {
|
10
|
+
'Gemfile'=> {
|
11
|
+
params: {
|
12
|
+
config: @config
|
13
|
+
}
|
14
|
+
},
|
15
|
+
'Rakefile' => {
|
16
|
+
params: {
|
17
|
+
filename: @path
|
18
|
+
}
|
19
|
+
},
|
20
|
+
'Procfile' => {
|
21
|
+
params: {
|
22
|
+
filename: @path
|
23
|
+
}
|
24
|
+
},
|
25
|
+
'config.ru' => {
|
26
|
+
params: {
|
27
|
+
filename: @path,
|
28
|
+
camel_name: Skellington.camelise(@path)
|
29
|
+
}
|
30
|
+
},
|
31
|
+
'features/first.feature' => {
|
32
|
+
params: {},
|
33
|
+
outpath: "features/#{@path}.feature"
|
34
|
+
},
|
35
|
+
'features/support/env.rb' => {
|
36
|
+
params: {
|
37
|
+
filename: @path,
|
38
|
+
camel_name: Skellington.camelise(@path)
|
39
|
+
}
|
40
|
+
},
|
41
|
+
'lib/app.rb' => {
|
42
|
+
params: {
|
43
|
+
camel_name: Skellington.camelise(@path)
|
44
|
+
},
|
45
|
+
outpath: "lib/#{@path}.rb"
|
46
|
+
}
|
47
|
+
}
|
16
48
|
|
17
|
-
|
18
|
-
template 'Rakefile', camel_case_name: @path
|
49
|
+
generate
|
19
50
|
end
|
20
51
|
|
21
|
-
def
|
22
|
-
|
23
|
-
|
52
|
+
def generate
|
53
|
+
@files.each do |k, v|
|
54
|
+
t = Template.new k
|
55
|
+
t.params = v[:params]
|
24
56
|
|
25
|
-
|
26
|
-
|
57
|
+
t.outpath = "#{@path}/#{k}"
|
58
|
+
t.outpath = "#{@path}/#{v[:outpath]}" if v[:outpath]
|
59
|
+
t.write
|
60
|
+
end
|
27
61
|
end
|
62
|
+
end
|
28
63
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
f.close
|
34
|
-
end
|
64
|
+
def self.camelise worm_case
|
65
|
+
parts = worm_case.split '_'
|
66
|
+
parts.map! { |word| "#{word[0].upcase}#{word[1..-1]}" }
|
67
|
+
parts.join ''
|
35
68
|
end
|
36
69
|
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Skellington
|
2
|
+
class Template
|
3
|
+
attr_reader :name
|
4
|
+
attr_accessor :params, :outpath
|
5
|
+
|
6
|
+
def initialize name
|
7
|
+
@name = name
|
8
|
+
@outpath = name
|
9
|
+
end
|
10
|
+
|
11
|
+
def templates_dir
|
12
|
+
File.join File.dirname(__FILE__), '..', 'templates'
|
13
|
+
end
|
14
|
+
|
15
|
+
def write
|
16
|
+
FileUtils.mkdir_p File.dirname @outpath
|
17
|
+
f = File.open @outpath, 'w'
|
18
|
+
f.write self
|
19
|
+
f.close
|
20
|
+
end
|
21
|
+
|
22
|
+
def to_s
|
23
|
+
t = File.read(File.open("#{templates_dir}/#{@name}.eruby"))
|
24
|
+
Erubis::Eruby.new(t).result(@params)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
data/lib/skellington/version.rb
CHANGED
data/lib/templates/Gemfile.eruby
CHANGED
@@ -1 +1 @@
|
|
1
|
-
web: bundle exec ruby lib/<%=
|
1
|
+
web: bundle exec ruby lib/<%= filename %>.rb
|
@@ -0,0 +1,24 @@
|
|
1
|
+
ENV['RACK_ENV'] = 'test'
|
2
|
+
|
3
|
+
require File.join(File.dirname(__FILE__), '..', '..', 'lib/<%= filename %>.rb')
|
4
|
+
|
5
|
+
require 'capybara'
|
6
|
+
require 'capybara/cucumber'
|
7
|
+
require 'rspec'
|
8
|
+
require 'cucumber/api_steps'
|
9
|
+
|
10
|
+
Capybara.app = <%= camel_name %>
|
11
|
+
|
12
|
+
class <%= camel_name %>World
|
13
|
+
include Capybara::DSL
|
14
|
+
include RSpec::Expectations
|
15
|
+
include RSpec::Matchers
|
16
|
+
|
17
|
+
def app
|
18
|
+
<%= camel_name %>
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
World do
|
23
|
+
<%= camel_name %>World.new
|
24
|
+
end
|
data/skellington.gemspec
CHANGED
@@ -20,6 +20,7 @@ Gem::Specification.new do |spec|
|
|
20
20
|
|
21
21
|
spec.add_dependency 'thor', '~> 0.19'
|
22
22
|
spec.add_dependency 'erubis', '~> 2.7'
|
23
|
+
spec.add_dependency 'fileutils', '~> 0.7'
|
23
24
|
|
24
25
|
spec.add_development_dependency 'bundler', '~> 1.7'
|
25
26
|
spec.add_development_dependency 'rake', '~> 10.0'
|
data/spec/skellington_spec.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
module Skellington
|
4
|
-
describe
|
5
|
-
|
6
|
-
|
4
|
+
describe Skellington do
|
5
|
+
it 'camelises a worm_case string' do
|
6
|
+
expect(Skellington.camelise 'worm_case').to eq 'WormCase'
|
7
7
|
end
|
8
8
|
end
|
9
9
|
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Skellington
|
4
|
+
describe Template do
|
5
|
+
before :each do
|
6
|
+
@t = Template.new 'Rakefile'
|
7
|
+
@t.params = { filename: 'dummy_gem' }
|
8
|
+
end
|
9
|
+
|
10
|
+
it 'has a name' do
|
11
|
+
expect(@t.name).to eq 'Rakefile'
|
12
|
+
end
|
13
|
+
|
14
|
+
it 'takes variables' do
|
15
|
+
expect(@t.params[:filename]).to eq 'dummy_gem'
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'produces output' do
|
19
|
+
expect(@t.to_s).to match /require File.join\(File.dirname\(__FILE__\), 'lib\/dummy_gem.rb'\)/
|
20
|
+
end
|
21
|
+
|
22
|
+
it 'writes to a file' do
|
23
|
+
@t.outpath = 'tmp/Rakefile'
|
24
|
+
@t.write
|
25
|
+
expect(File).to exist 'tmp/Rakefile'
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'behaves well with a more complex name' do
|
29
|
+
@t = Template.new 'features/first.feature'
|
30
|
+
@t.outpath = 'tmp/features/dummy_gem.feature'
|
31
|
+
@t.write
|
32
|
+
expect(File).to exist 'tmp/features/dummy_gem.feature'
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: skellington
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- pikesley
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '2.7'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: fileutils
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0.7'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0.7'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: bundler
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -146,6 +160,7 @@ extra_rdoc_files: []
|
|
146
160
|
files:
|
147
161
|
- ".gitignore"
|
148
162
|
- ".rspec"
|
163
|
+
- ".travis.yml"
|
149
164
|
- Gemfile
|
150
165
|
- Guardfile
|
151
166
|
- LICENSE.md
|
@@ -154,20 +169,30 @@ files:
|
|
154
169
|
- Rakefile
|
155
170
|
- bin/skellington
|
156
171
|
- config/config.yaml
|
172
|
+
- features/app.feature
|
173
|
+
- features/config.ru.feature
|
174
|
+
- features/cukes.feature
|
157
175
|
- features/gemfile.feature
|
158
176
|
- features/procfile.feature
|
159
177
|
- features/rakefile.feature
|
178
|
+
- features/support/app.feature
|
160
179
|
- features/support/env.rb
|
161
180
|
- lib/skellington.rb
|
162
181
|
- lib/skellington/cli.rb
|
163
182
|
- lib/skellington/generator.rb
|
183
|
+
- lib/skellington/template.rb
|
164
184
|
- lib/skellington/version.rb
|
165
185
|
- lib/templates/Gemfile.eruby
|
166
186
|
- lib/templates/Procfile.eruby
|
167
187
|
- lib/templates/Rakefile.eruby
|
188
|
+
- lib/templates/config.ru.eruby
|
189
|
+
- lib/templates/features/first.feature.eruby
|
190
|
+
- lib/templates/features/support/env.rb.eruby
|
191
|
+
- lib/templates/lib/app.rb.eruby
|
168
192
|
- skellington.gemspec
|
169
193
|
- spec/skellington_spec.rb
|
170
194
|
- spec/spec_helper.rb
|
195
|
+
- spec/template_spec.rb
|
171
196
|
homepage: ''
|
172
197
|
licenses:
|
173
198
|
- MIT
|
@@ -193,9 +218,14 @@ signing_key:
|
|
193
218
|
specification_version: 4
|
194
219
|
summary: Opinionated boilerplate skeleton for a cuked Sinatra app
|
195
220
|
test_files:
|
221
|
+
- features/app.feature
|
222
|
+
- features/config.ru.feature
|
223
|
+
- features/cukes.feature
|
196
224
|
- features/gemfile.feature
|
197
225
|
- features/procfile.feature
|
198
226
|
- features/rakefile.feature
|
227
|
+
- features/support/app.feature
|
199
228
|
- features/support/env.rb
|
200
229
|
- spec/skellington_spec.rb
|
201
230
|
- spec/spec_helper.rb
|
231
|
+
- spec/template_spec.rb
|