thor_template 2.0.2 → 2.1.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: 584d7fe13f8296ed7a0d8c8531600b762567c0bc
4
- data.tar.gz: c7853d032960135539476d542901c63a7819a022
3
+ metadata.gz: 1761a5aa4a73d962066765feeb7949f606440d04
4
+ data.tar.gz: c001211c5758678b4a382b4381358d87fac1a127
5
5
  SHA512:
6
- metadata.gz: aba061fa571a435c39450fefd77d5efdff672bd0aa4e6c7672a8585a1955bc1a48a55c1d4e952a6647a1af127edd8a98a400a6a14d0a3abbdc6d74c92f92562a
7
- data.tar.gz: 21c60b09d5ccd58ac030f0cfc2b4e0c3ae80a5f28b5e2d354f776d98a6b3281e04ddfcc5e035ed9b12a9fc5fa1cd773053d8b6213457392894435c1d2d4ea006
6
+ metadata.gz: 64b2a7d826cea332c687535c79d7739a5f2456594f7608fe5b91e6c989d55435e881ce7ca8f86a87bc0784e75d965734d6c3fcfd53a5676a601cf48117acb574
7
+ data.tar.gz: f74a3bc2cafeae3d4317233c699657852c1be5002c9ce1857c2fc57a809577ada22feb2f0b880d1108ad19ab02324623ae8004ae1eeaf8b5d09048995bb59124
data/CHANGELOG.md CHANGED
@@ -3,6 +3,12 @@
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
+ ## [2.1.0]
7
+
8
+ - improve help class
9
+ - comment out SimpleCov
10
+ - reanme bin folder to exe
11
+
6
12
  ## [2.0.1]
7
13
 
8
14
  - fix gem name that gets build for the starter project
data/README.md CHANGED
@@ -18,7 +18,7 @@ gem install thor_template
18
18
  ```sh
19
19
  thor_template new mycli
20
20
  cd mycli
21
- bin/mycli hello world
21
+ exe/mycli hello world
22
22
  ```
23
23
 
24
24
  The above generated a starter CLI project called mycli with a working hello command. The generated project also has starter specs for you 😁
File without changes
@@ -30,7 +30,7 @@ $ gem install thor_template
30
30
  ## Usage
31
31
 
32
32
  ```sh
33
- bin/thor_template hello yourname
33
+ exe/thor_template hello yourname
34
34
  ```
35
35
 
36
36
  ## Contributing
File without changes
@@ -2,6 +2,7 @@ $:.unshift(File.expand_path("../", __FILE__))
2
2
  require "thor_template/version"
3
3
 
4
4
  module ThorTemplate
5
+ autoload :Help, "thor_template/help"
5
6
  autoload :Command, "thor_template/command"
6
7
  autoload :CLI, "thor_template/cli"
7
8
  end
@@ -1,16 +1,12 @@
1
- require "thor"
2
- require "thor_template/cli/help"
3
-
4
1
  module ThorTemplate
5
-
6
2
  class CLI < Command
7
3
  class_option :verbose, type: :boolean
8
4
  class_option :noop, type: :boolean
9
5
 
10
6
  desc "hello NAME", "say hello to NAME"
11
- long_desc Help.hello
7
+ long_desc Help.text(:hello)
12
8
  option :from, desc: "from person"
13
- def hello(name)
9
+ def hello(name="you")
14
10
  puts "from: #{options[:from]}" if options[:from]
15
11
  puts "Hello #{name}"
16
12
  end
@@ -0,0 +1,9 @@
1
+ module ThorTemplate::Help
2
+ class << self
3
+ def text(namespaced_command)
4
+ path = namespaced_command.to_s.gsub(':','/')
5
+ path = File.expand_path("../help/#{path}.md", __FILE__)
6
+ IO.read(path) if File.exist?(path)
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,3 @@
1
+ Examples:
2
+
3
+ $ USER_PROVIDED_NAME hello
@@ -12,7 +12,7 @@ describe ThorTemplate::CLI do
12
12
 
13
13
  describe "USER_PROVIDED_NAME" do
14
14
  it "should hello world" do
15
- out = execute("bin/USER_PROVIDED_NAME hello world #{@args}")
15
+ out = execute("exe/USER_PROVIDED_NAME hello world #{@args}")
16
16
  expect(out).to include("from: Tung\nHello world")
17
17
  end
18
18
  end
@@ -1,7 +1,7 @@
1
1
  ENV["TEST"] = "1"
2
2
 
3
- require "simplecov"
4
- SimpleCov.start
3
+ # require "simplecov"
4
+ # SimpleCov.start
5
5
 
6
6
  require "pp"
7
7
 
@@ -14,7 +14,8 @@ Gem::Specification.new do |spec|
14
14
  spec.license = "MIT"
15
15
 
16
16
  spec.files = `git ls-files`.split($/)
17
- spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
+ spec.bindir = "exe"
18
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
18
19
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
20
  spec.require_paths = ["lib"]
20
21
 
data/lib/thor_template.rb CHANGED
@@ -1,8 +1,9 @@
1
1
  $:.unshift(File.expand_path("../", __FILE__))
2
2
  require "thor/vcr" if ENV['VCR'] == '1'
3
- require "thor_template/cli"
3
+ require "thor_template/version"
4
4
 
5
5
  module ThorTemplate
6
+ autoload :Help, 'thor_template/help'
6
7
  autoload :Command, 'thor_template/command'
7
8
  autoload :Version, 'thor_template/version'
8
9
  autoload :Generator, 'thor_template/generator'
@@ -1,17 +1,12 @@
1
- require 'thor'
2
- require 'thor_template/command'
3
- require 'thor_template/cli/help'
4
-
5
1
  module ThorTemplate
6
-
7
2
  class CLI < Command
8
3
  class_option :verbose, :type => :boolean
9
4
  class_option :noop, :type => :boolean
10
5
 
11
6
  desc "new NAME", "generates project based on thor template"
7
+ long_desc Help.text(:new)
12
8
  def new(name)
13
9
  Generator.new(options.merge(name: name)).run
14
10
  end
15
-
16
11
  end
17
12
  end
@@ -0,0 +1,9 @@
1
+ module ThorTemplate::Help
2
+ class << self
3
+ def text(namespaced_command)
4
+ path = namespaced_command.to_s.gsub(':','/')
5
+ path = File.expand_path("../help/#{path}.md", __FILE__)
6
+ IO.read(path) if File.exist?(path)
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,5 @@
1
+ Examples:
2
+
3
+ $ thor_template new hello
4
+
5
+ $ thor_template new another_project
@@ -45,7 +45,7 @@ module ThorTemplate
45
45
  def special_rename?(path)
46
46
  %w[
47
47
  thor_template.gemspec
48
- bin/thor_template
48
+ exe/thor_template
49
49
  lib/thor_template.rb
50
50
  ].include?(path)
51
51
  end
@@ -1,3 +1,3 @@
1
1
  module ThorTemplate
2
- VERSION = "2.0.2"
2
+ VERSION = "2.1.0"
3
3
  end
data/spec/lib/cli_spec.rb CHANGED
@@ -13,7 +13,7 @@ describe ThorTemplate::CLI do
13
13
  describe "new" do
14
14
  context("simple single name") do
15
15
  it "should generate" do
16
- out = execute("cd tmp && ../bin/thor_template new hello #{@args}")
16
+ out = execute("cd tmp && ../exe/thor_template new hello #{@args}")
17
17
  expect(out).to include("Created hello project!")
18
18
  out = execute("cd tmp/hello && rake")
19
19
  expect(out).to include("0 failures")
@@ -22,7 +22,7 @@ describe ThorTemplate::CLI do
22
22
 
23
23
  context("underscored name") do
24
24
  it "should generate" do
25
- out = execute("cd tmp && ../bin/thor_template new my_cli #{@args}")
25
+ out = execute("cd tmp && ../exe/thor_template new my_cli #{@args}")
26
26
  expect(out).to include("Created my_cli project!")
27
27
  out = execute("cd tmp/my_cli && rake")
28
28
  expect(out).to include("0 failures")
@@ -31,7 +31,7 @@ describe ThorTemplate::CLI do
31
31
 
32
32
  context("dasherized name") do
33
33
  it "should generate" do
34
- out = execute("cd tmp && ../bin/thor_template new my-cli #{@args}")
34
+ out = execute("cd tmp && ../exe/thor_template new my-cli #{@args}")
35
35
  expect(out).to include("Created my-cli project!")
36
36
  out = execute("cd tmp/my-cli && rake")
37
37
  expect(out).to include("0 failures")
@@ -41,7 +41,7 @@ describe ThorTemplate::CLI do
41
41
  # CamelCase is ugly :(
42
42
  context("simple CamelCase name") do
43
43
  it "should generate" do
44
- out = execute("cd tmp && ../bin/thor_template new MyCli #{@args}")
44
+ out = execute("cd tmp && ../exe/thor_template new MyCli #{@args}")
45
45
  expect(out).to include("Created MyCli project!")
46
46
  out = execute("cd tmp/MyCli && rake")
47
47
  expect(out).to include("0 failures")
data/spec/spec_helper.rb CHANGED
@@ -6,8 +6,8 @@
6
6
  ENV['VCR'] ? ENV['VCR'] : ENV['VCR'] = '1'
7
7
  ENV['TEST'] = '1'
8
8
 
9
- require 'simplecov'
10
- SimpleCov.start
9
+ # require 'simplecov'
10
+ # SimpleCov.start
11
11
 
12
12
  require "pp"
13
13
 
@@ -14,7 +14,8 @@ Gem::Specification.new do |spec|
14
14
  spec.license = "MIT"
15
15
 
16
16
  spec.files = `git ls-files`.split($/)
17
- spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
+ spec.bindir = "exe"
18
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
18
19
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
20
  spec.require_paths = ["lib"]
20
21
 
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: 2.0.2
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tung Nguyen
8
8
  autorequire:
9
- bindir: bin
9
+ bindir: exe
10
10
  cert_chain: []
11
- date: 2017-11-17 00:00:00.000000000 Z
11
+ date: 2017-12-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -179,7 +179,7 @@ files:
179
179
  - LICENSE.txt
180
180
  - README.md
181
181
  - Rakefile
182
- - bin/thor_template
182
+ - exe/thor_template
183
183
  - lib/starter_project/.gitignore
184
184
  - lib/starter_project/.rspec
185
185
  - lib/starter_project/Gemfile
@@ -187,20 +187,22 @@ files:
187
187
  - lib/starter_project/LICENSE.txt
188
188
  - lib/starter_project/README.md
189
189
  - lib/starter_project/Rakefile
190
- - lib/starter_project/bin/thor_template
190
+ - lib/starter_project/exe/thor_template
191
191
  - lib/starter_project/lib/thor_template.rb
192
192
  - lib/starter_project/lib/thor_template/cli.rb
193
- - lib/starter_project/lib/thor_template/cli/help.rb
194
193
  - lib/starter_project/lib/thor_template/command.rb
194
+ - lib/starter_project/lib/thor_template/help.rb
195
+ - lib/starter_project/lib/thor_template/help/hello.md
195
196
  - lib/starter_project/lib/thor_template/version.rb
196
197
  - lib/starter_project/spec/lib/cli_spec.rb
197
198
  - lib/starter_project/spec/spec_helper.rb
198
199
  - lib/starter_project/thor_template.gemspec
199
200
  - lib/thor_template.rb
200
201
  - lib/thor_template/cli.rb
201
- - lib/thor_template/cli/help.rb
202
202
  - lib/thor_template/command.rb
203
203
  - lib/thor_template/generator.rb
204
+ - lib/thor_template/help.rb
205
+ - lib/thor_template/help/new.md
204
206
  - lib/thor_template/renamer.rb
205
207
  - lib/thor_template/version.rb
206
208
  - spec/lib/cli_spec.rb
@@ -1,13 +0,0 @@
1
- module ThorTemplate
2
- class CLI < Command
3
- class Help
4
- class << self
5
- def hello
6
- <<-EOL
7
- Hello world example
8
- EOL
9
- end
10
- end
11
- end
12
- end
13
- end
@@ -1,17 +0,0 @@
1
- module ThorTemplate
2
- class CLI < Command
3
- class Help
4
- class << self
5
- def generate
6
- <<-EOL
7
- Examples:
8
-
9
- $ thor_template new hello
10
-
11
- $ thor_template new another_project
12
- EOL
13
- end
14
- end
15
- end
16
- end
17
- end