thor_template 0.0.8 → 1.0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 93d37f044e3d3ed2fce5fe5cbedca6df4fa96a41
4
- data.tar.gz: c95abfa3e0b04e22af7928260625dee4308f9815
3
+ metadata.gz: fc5ca84c6260eede4acbb985f1779da5c13e3269
4
+ data.tar.gz: 4de37c9e5c4083d1193dfa2e47804381b06f9df1
5
5
  SHA512:
6
- metadata.gz: 8fea818a7d44575a57534bee69ef91ef62d03ccbee452c05b6404e6c9e69a1597a344e6110bc441857c40bc523af97ff1eabf7eec3db368632927eba35039ca8
7
- data.tar.gz: acad4f5db99521aa7f93dde14be25d1f9ecbeeca8d1f57ab78945db83cc5c20addc021783e9e8a2b2adefa0c5e1f2b3e6d464e7d9a1c512eb78471091f5baa54
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.
@@ -1,5 +1,5 @@
1
1
  module ThorTemplate
2
- class CLI < Thor
2
+ class CLI < Command
3
3
  class Help
4
4
  class << self
5
5
  def hello
@@ -10,4 +10,4 @@ EOL
10
10
  end
11
11
  end
12
12
  end
13
- end
13
+ end
@@ -3,7 +3,7 @@ require 'thor_template/cli/help'
3
3
 
4
4
  module ThorTemplate
5
5
 
6
- class CLI < Thor
6
+ class CLI < Command
7
7
  class_option :verbose, type: :boolean
8
8
  class_option :noop, type: :boolean
9
9
 
@@ -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
@@ -2,5 +2,6 @@ $:.unshift(File.expand_path("../", __FILE__))
2
2
  require "thor_template/version"
3
3
 
4
4
  module ThorTemplate
5
+ autoload :Command, 'thor_template/command'
5
6
  autoload :CLI, 'thor_template/cli'
6
7
  end
@@ -1,10 +1,10 @@
1
1
  ENV['TEST'] = '1'
2
2
 
3
- require "codeclimate-test-reporter"
4
- CodeClimate::TestReporter.start
3
+ require 'simplecov'
4
+ SimpleCov.start
5
5
 
6
6
  require "pp"
7
-
7
+
8
8
  root = File.expand_path('../../', __FILE__)
9
9
  require "#{root}/lib/thor_template"
10
10
 
@@ -1,5 +1,5 @@
1
1
  module ThorTemplate
2
- class CLI < Thor
2
+ class CLI < Command
3
3
  class Help
4
4
  class << self
5
5
  def generate
@@ -14,4 +14,4 @@ EOL
14
14
  end
15
15
  end
16
16
  end
17
- end
17
+ end
@@ -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 < Thor
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
@@ -1,3 +1,3 @@
1
1
  module ThorTemplate
2
- VERSION = "0.0.8"
2
+ VERSION = "1.0.0"
3
3
  end
data/lib/thor_template.rb CHANGED
@@ -3,6 +3,7 @@ require "thor/vcr" if ENV['VCR'] == '1'
3
3
  require "thor_template/cli"
4
4
 
5
5
  module ThorTemplate
6
+ autoload :Command, 'thor_template/command'
6
7
  autoload :Version, 'thor_template/version'
7
8
  autoload :Generator, 'thor_template/generator'
8
9
  end
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 "codeclimate-test-reporter"
10
- CodeClimate::TestReporter.start
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.8
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: 2016-09-28 00:00:00.000000000 Z
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.4
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: