thor_template 0.0.8 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +24 -1
- data/lib/starter_project/lib/thor_template/cli/help.rb +2 -2
- data/lib/starter_project/lib/thor_template/cli.rb +1 -1
- data/lib/starter_project/lib/thor_template/command.rb +25 -0
- data/lib/starter_project/lib/thor_template.rb +1 -0
- data/lib/starter_project/spec/spec_helper.rb +3 -3
- data/lib/thor_template/cli/help.rb +2 -2
- data/lib/thor_template/cli.rb +3 -2
- data/lib/thor_template/command.rb +25 -0
- data/lib/thor_template/version.rb +1 -1
- data/lib/thor_template.rb +1 -0
- data/spec/spec_helper.rb +4 -4
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fc5ca84c6260eede4acbb985f1779da5c13e3269
|
4
|
+
data.tar.gz: 4de37c9e5c4083d1193dfa2e47804381b06f9df1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eb79144bb5ef0b1caf736130a48e6f30573059745ef6d1cb26050fc089dcc5241725361d64888696dcbb784e7e36c3a3b4a0c31c1bed1d45da6758c7b9fa3d9f
|
7
|
+
data.tar.gz: 239212eea5d063db0bb48480d206d491db2b6cc444296f202bc60209f59c4833769d63fbb44b3a05b5559172c8e7c5d6bd35d94653523c4d66b2d7d44933aeb5
|
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,11 @@
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
This project *tries* to adhere to [Semantic Versioning](http://semver.org/), even before v1.0.
|
5
5
|
|
6
|
+
## [1.0.0]
|
7
|
+
|
8
|
+
- allow --help or -h at the end of the command
|
9
|
+
- major version bump. been in used and tested for a while now
|
10
|
+
|
6
11
|
## [0.0.7]
|
7
12
|
|
8
13
|
- Update starter project to use newer ruby syntax
|
data/README.md
CHANGED
@@ -19,4 +19,27 @@ $ cd foo
|
|
19
19
|
$ bin/foo hello world
|
20
20
|
</pre>
|
21
21
|
|
22
|
-
This generates a starter cli project called foo with a working hello command.
|
22
|
+
This generates a starter cli project called foo with a working hello command.
|
23
|
+
|
24
|
+
## Dashes Problem
|
25
|
+
|
26
|
+
Names with dashes don't work quite right with this tool. For example:
|
27
|
+
|
28
|
+
```
|
29
|
+
thor_template new my-project
|
30
|
+
```
|
31
|
+
|
32
|
+
This results in a some the files and text not being renamed properly.
|
33
|
+
|
34
|
+
I usually work around this by creating a project with the underscore name first:
|
35
|
+
|
36
|
+
```
|
37
|
+
thor_template new my_project
|
38
|
+
```
|
39
|
+
|
40
|
+
Then then I rename 3 spots:
|
41
|
+
|
42
|
+
* my_project.gemspec - Change the name from my_project to my-project. So the gem name has a dash.
|
43
|
+
* bin/my_project - Change the name from bin/my_project to bin/my-project. So the binary has a dash. The require in the file also.
|
44
|
+
* lib/my_project.rb - Change the name from lib/my_project.rb to lib/my-project.rb. So if the project is required it is `require my-project`.
|
45
|
+
* spec/spec_helper.rb - Change the require lib/my_project.rb to lib/my-project.rb. And spec/lib/cli_spec. So the test passes.
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'thor'
|
2
|
+
|
3
|
+
module ThorTemplate
|
4
|
+
class Command < Thor
|
5
|
+
class << self
|
6
|
+
def dispatch(m, args, options, config)
|
7
|
+
# Allow calling for help via:
|
8
|
+
# thor_template command help
|
9
|
+
# thor_template command -h
|
10
|
+
# thor_template command --help
|
11
|
+
# thor_template command -D
|
12
|
+
#
|
13
|
+
# as well thor's normal way:
|
14
|
+
#
|
15
|
+
# thor_template help command
|
16
|
+
help_flags = Thor::HELP_MAPPINGS + ["help"]
|
17
|
+
if args.length > 1 && !(args & help_flags).empty?
|
18
|
+
args -= help_flags
|
19
|
+
args.insert(-2, "help")
|
20
|
+
end
|
21
|
+
super
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
data/lib/thor_template/cli.rb
CHANGED
@@ -1,9 +1,10 @@
|
|
1
1
|
require 'thor'
|
2
|
+
require 'thor_template/command'
|
2
3
|
require 'thor_template/cli/help'
|
3
4
|
|
4
5
|
module ThorTemplate
|
5
6
|
|
6
|
-
class CLI <
|
7
|
+
class CLI < Command
|
7
8
|
class_option :verbose, :type => :boolean
|
8
9
|
class_option :noop, :type => :boolean
|
9
10
|
|
@@ -13,4 +14,4 @@ module ThorTemplate
|
|
13
14
|
end
|
14
15
|
|
15
16
|
end
|
16
|
-
end
|
17
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'thor'
|
2
|
+
|
3
|
+
module ThorTemplate
|
4
|
+
class Command < Thor
|
5
|
+
class << self
|
6
|
+
def dispatch(m, args, options, config)
|
7
|
+
# Allow calling for help via:
|
8
|
+
# thor_template command help
|
9
|
+
# thor_template command -h
|
10
|
+
# thor_template command --help
|
11
|
+
# thor_template command -D
|
12
|
+
#
|
13
|
+
# as well thor's normal way:
|
14
|
+
#
|
15
|
+
# thor_template help command
|
16
|
+
help_flags = Thor::HELP_MAPPINGS + ["help"]
|
17
|
+
if args.length > 1 && !(args & help_flags).empty?
|
18
|
+
args -= help_flags
|
19
|
+
args.insert(-2, "help")
|
20
|
+
end
|
21
|
+
super
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
data/lib/thor_template.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
@@ -6,11 +6,11 @@
|
|
6
6
|
ENV['VCR'] ? ENV['VCR'] : ENV['VCR'] = '1'
|
7
7
|
ENV['TEST'] = '1'
|
8
8
|
|
9
|
-
require
|
10
|
-
|
9
|
+
require 'simplecov'
|
10
|
+
SimpleCov.start
|
11
11
|
|
12
12
|
require "pp"
|
13
|
-
|
13
|
+
|
14
14
|
root = File.expand_path('../../', __FILE__)
|
15
15
|
require "#{root}/lib/thor_template"
|
16
16
|
|
@@ -38,4 +38,4 @@ end
|
|
38
38
|
|
39
39
|
VCR.configure do |config|
|
40
40
|
config.ignore_hosts 'codeclimate.com'
|
41
|
-
end
|
41
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: thor_template
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tung Nguyen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-06-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -163,6 +163,7 @@ files:
|
|
163
163
|
- lib/starter_project/lib/thor_template.rb
|
164
164
|
- lib/starter_project/lib/thor_template/cli.rb
|
165
165
|
- lib/starter_project/lib/thor_template/cli/help.rb
|
166
|
+
- lib/starter_project/lib/thor_template/command.rb
|
166
167
|
- lib/starter_project/lib/thor_template/version.rb
|
167
168
|
- lib/starter_project/spec/lib/cli_spec.rb
|
168
169
|
- lib/starter_project/spec/spec_helper.rb
|
@@ -171,6 +172,7 @@ files:
|
|
171
172
|
- lib/thor_template.rb
|
172
173
|
- lib/thor_template/cli.rb
|
173
174
|
- lib/thor_template/cli/help.rb
|
175
|
+
- lib/thor_template/command.rb
|
174
176
|
- lib/thor_template/generator.rb
|
175
177
|
- lib/thor_template/version.rb
|
176
178
|
- spec/lib/cli_spec.rb
|
@@ -197,7 +199,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
197
199
|
version: '0'
|
198
200
|
requirements: []
|
199
201
|
rubyforge_project:
|
200
|
-
rubygems_version: 2.6.
|
202
|
+
rubygems_version: 2.6.11
|
201
203
|
signing_key:
|
202
204
|
specification_version: 4
|
203
205
|
summary: Generates starter cli tool project.
|
@@ -205,4 +207,3 @@ test_files:
|
|
205
207
|
- spec/lib/cli_spec.rb
|
206
208
|
- spec/lib/generator_spec.rb
|
207
209
|
- spec/spec_helper.rb
|
208
|
-
has_rdoc:
|