skellington 0.1.4 → 0.2.0
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/features/non-local-path.feature +27 -0
- data/lib/skellington/generator.rb +4 -3
- data/lib/skellington/helpers.rb +5 -0
- data/lib/skellington/template.rb +3 -3
- data/lib/skellington/version.rb +1 -1
- data/spec/skellington_spec.rb +5 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8fca11d59b3e3b919e81f8cd2dd0fd933a29feea
|
4
|
+
data.tar.gz: 4dd88f27430f3f74b5372f6e0ee43d9a27c189f7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1d58c0a6eda4388aa61821c9ff9bfd45235140756498efd53470e04cc850a5e0de760b92be3837a862821f8fdcb070ee4567159927a7bb4117d185f157931dfc
|
7
|
+
data.tar.gz: 0455184f9ef0e6aa6a5663aa5fc692d9569230f398b915ac7638b8f6080ee94d0f15c6535497aaf0cb5f6bcf9c97cbb170bb3ef6987da2a33969e470bb106224
|
@@ -0,0 +1,27 @@
|
|
1
|
+
Feature: Generate skellington
|
2
|
+
|
3
|
+
Scenario: generate app at a non-local path
|
4
|
+
When I successfully run `skellington generate subdir/some_app`
|
5
|
+
Then a directory named "subdir/some_app/lib/" should exist
|
6
|
+
And a file named "subdir/some_app/lib/some_app.rb" should exist
|
7
|
+
And the file "subdir/some_app/lib/some_app.rb" should contain:
|
8
|
+
"""
|
9
|
+
require 'sinatra/base'
|
10
|
+
|
11
|
+
class SomeApp < Sinatra::Base
|
12
|
+
get '/' do
|
13
|
+
'Hello from SomeApp'
|
14
|
+
end
|
15
|
+
|
16
|
+
# start the server if ruby file executed directly
|
17
|
+
run! if app_file == $0
|
18
|
+
end
|
19
|
+
"""
|
20
|
+
And a file named "subdir/some_app/config.ru" should exist
|
21
|
+
And the file "subdir/some_app/config.ru" should contain:
|
22
|
+
"""
|
23
|
+
require 'rubygems'
|
24
|
+
require File.join(File.dirname(__FILE__), 'lib/some_app.rb')
|
25
|
+
|
26
|
+
run SomeApp
|
27
|
+
"""
|
@@ -1,9 +1,10 @@
|
|
1
1
|
module Skellington
|
2
2
|
class Generator
|
3
|
-
attr_reader :wormname, :camelname, :files, :gems
|
3
|
+
attr_reader :path, :wormname, :camelname, :files, :gems
|
4
4
|
|
5
|
-
def initialize
|
6
|
-
@
|
5
|
+
def initialize path
|
6
|
+
@path = File.dirname path
|
7
|
+
@wormname = File.basename path
|
7
8
|
@camelname = Skellington.camelise(@wormname)
|
8
9
|
@gems = config['gems']
|
9
10
|
@files = config['files']
|
data/lib/skellington/helpers.rb
CHANGED
data/lib/skellington/template.rb
CHANGED
@@ -8,9 +8,9 @@ module Skellington
|
|
8
8
|
def outpath
|
9
9
|
@outpath ||= begin
|
10
10
|
subs = @generator.files[@name]['outpath'].split '/'
|
11
|
-
@outpath = "#{@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.sub(subs[0], @generator.send(subs[1].to_sym))}"
|
12
12
|
rescue NoMethodError
|
13
|
-
@outpath = "#{@generator.wormname}/#{@name}"
|
13
|
+
@outpath = "#{@generator.path}/#{@generator.wormname}/#{@name}"
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
@@ -19,7 +19,7 @@ module Skellington
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def write
|
22
|
-
print "Generating #{outpath}..."
|
22
|
+
print "Generating #{Skellington.unslash outpath}..."
|
23
23
|
FileUtils.mkdir_p File.dirname outpath
|
24
24
|
f = File.open outpath, 'w'
|
25
25
|
f.write self
|
data/lib/skellington/version.rb
CHANGED
data/spec/skellington_spec.rb
CHANGED
@@ -5,5 +5,10 @@ module Skellington
|
|
5
5
|
it 'camelises a worm_case string' do
|
6
6
|
expect(Skellington.camelise 'worm_case').to eq 'WormCase'
|
7
7
|
end
|
8
|
+
|
9
|
+
it 'removes a leading ./' do
|
10
|
+
expect(Skellington.unslash './word').to eq 'word'
|
11
|
+
expect(Skellington.unslash 'another_word').to eq 'another_word'
|
12
|
+
end
|
8
13
|
end
|
9
14
|
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
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- pikesley
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-01-
|
11
|
+
date: 2015-01-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -189,6 +189,7 @@ files:
|
|
189
189
|
- features/cukes.feature
|
190
190
|
- features/gemfile.feature
|
191
191
|
- features/git.feature
|
192
|
+
- features/non-local-path.feature
|
192
193
|
- features/procfile.feature
|
193
194
|
- features/rakefile.feature
|
194
195
|
- features/rbenv.feature
|
@@ -242,6 +243,7 @@ test_files:
|
|
242
243
|
- features/cukes.feature
|
243
244
|
- features/gemfile.feature
|
244
245
|
- features/git.feature
|
246
|
+
- features/non-local-path.feature
|
245
247
|
- features/procfile.feature
|
246
248
|
- features/rakefile.feature
|
247
249
|
- features/rbenv.feature
|