cli-template 3.0.0 → 3.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +5 -0
  3. data/README.md +11 -1
  4. data/lib/cli-template/sequence.rb +1 -1
  5. data/lib/cli-template/version.rb +1 -1
  6. data/lib/templates/{skeleton → default}/%project_name%.gemspec.tt +0 -0
  7. data/lib/templates/{skeleton → default}/.gitignore +0 -0
  8. data/lib/templates/{skeleton → default}/.rspec +0 -0
  9. data/lib/templates/{skeleton → default}/CHANGELOG.md +0 -0
  10. data/lib/templates/{skeleton → default}/Gemfile.tt +0 -0
  11. data/lib/templates/{skeleton → default}/Guardfile +0 -0
  12. data/lib/templates/{skeleton → default}/LICENSE.txt +0 -0
  13. data/lib/templates/{skeleton → default}/README.md.tt +0 -0
  14. data/lib/templates/{skeleton → default}/Rakefile +0 -0
  15. data/lib/templates/{skeleton → default}/exe/%project_name%.tt +0 -0
  16. data/lib/templates/{skeleton → default}/lib/%project_name%.rb.tt +2 -0
  17. data/lib/templates/{skeleton → default}/lib/%underscored_name%/cli.rb.tt +13 -7
  18. data/lib/templates/{skeleton → default}/lib/%underscored_name%/command.rb.tt +26 -13
  19. data/lib/templates/default/lib/%underscored_name%/completer.rb.tt +138 -0
  20. data/lib/templates/default/lib/%underscored_name%/completer/script.rb.tt +6 -0
  21. data/lib/templates/default/lib/%underscored_name%/completer/script.sh.tt +16 -0
  22. data/lib/templates/default/lib/%underscored_name%/completions.rb.tt +9 -0
  23. data/lib/templates/{skeleton → default}/lib/%underscored_name%/help.rb.tt +0 -0
  24. data/lib/templates/default/lib/%underscored_name%/help/completions.md.tt +18 -0
  25. data/lib/templates/default/lib/%underscored_name%/help/completions/script.md.tt +3 -0
  26. data/lib/templates/default/lib/%underscored_name%/help/hello.md.tt +5 -0
  27. data/lib/templates/default/lib/%underscored_name%/help/sub/goodbye.md.tt +5 -0
  28. data/lib/templates/{skeleton → default}/lib/%underscored_name%/main.rb.tt +6 -0
  29. data/lib/templates/{skeleton → default}/lib/%underscored_name%/rake_command.rb.tt +0 -0
  30. data/lib/templates/{skeleton → default}/lib/%underscored_name%/sub.rb.tt +0 -0
  31. data/lib/templates/{skeleton → default}/lib/%underscored_name%/version.rb.tt +0 -0
  32. data/lib/templates/default/spec/lib/cli_spec.rb.tt +37 -0
  33. data/lib/templates/{skeleton → default}/spec/spec_helper.rb.tt +0 -0
  34. metadata +30 -24
  35. data/lib/templates/skeleton/lib/%underscored_name%/help/hello.md.tt +0 -3
  36. data/lib/templates/skeleton/lib/%underscored_name%/help/sub/goodbye.md.tt +0 -3
  37. data/lib/templates/skeleton/spec/lib/cli_spec.rb.tt +0 -24
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 042da28b0ec9d9d406c3204bb08210c996c98022f2b75a2bfc454d7b79916c1e
4
- data.tar.gz: 8ce3733852b7f5790a466699572323f82862a2ed18f92a42a7247a815d050879
3
+ metadata.gz: 5cec11731996364ad6e192824c457ce0800423eb72ac4782bdf72bfb8fd32155
4
+ data.tar.gz: 8a5748d23604d64f35a5ecc98d6fbf1610cde7ac848c8480be36629d4dd3d5b3
5
5
  SHA512:
6
- metadata.gz: cfe099ee8efae48d4752a570652361ae6e147fd7be9716dcd9bfb35f58fcd61ce0d24a53749c24817abdb57f0f3dc0c8f3f9ed3ea28de537e6a38960e6b7f3a2
7
- data.tar.gz: ad5c81b830fe057937dd74419bbac0e19de6e41f84b967572babb61ea2c8631a84f7c1899fdec6f3a4356d00d7e6aca51305adfdaa4364aa27fcb7c239d76336
6
+ metadata.gz: 1ad85e072ea3ca0c17b63c568034d0d962b3d12baa8c848efa585c6d21aa3bd8c49c2f6305ca73fd63002fbafd1a7c600037e0952419336ffcf2420562ffcc36
7
+ data.tar.gz: 33a433e8b3b050a39f9fd11563d6c12843e7979d18a0f0401a5d1b61813e6dd419cb6b0f6fd57a1d18ed1328c045f2ded87968a061915787940211d6e9fdcaa4
@@ -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
+ ## [3.1.0]
7
+ - Merge pull request #1 from tongueroo/completions: support for TAB auto-completion
8
+ - add completions command to starter project
9
+ - add completions:script command
10
+
6
11
  ## [3.0.0]
7
12
  - tool is now called cli-template
8
13
  - namespaced commands support
data/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  [![CircleCI](https://circleci.com/gh/tongueroo/cli-template.svg?style=svg)](https://circleci.com/gh/tongueroo/cli-template)
4
4
  [![Maintainability](https://api.codeclimate.com/v1/badges/c6c4f26aaafccab10baf/maintainability)](https://codeclimate.com/github/tongueroo/cli-template/maintainability)
5
5
 
6
- `cli-template` is a generator tool that builds a starter CLI project based on [Thor](http://whatisthor.com/). It is the successor tool to [thor_template](https://github.com/tongueroo/thor_template), which is also a tool that generates CLI projects. The main difference is `cli-template` allows for namespace commands. The usage section demonstrates a namespace command below.
6
+ `cli-template` is a generator tool that builds a starter CLI project based on [Thor](http://whatisthor.com/). It is the successor tool to [thor_template](https://github.com/tongueroo/thor_template), which is also a tool that generates CLI projects. The main difference is `cli-template` uses colons for namespaced commands. The usage section demonstrates a namespaced command below.
7
7
 
8
8
  The predecessor tool is covered in this original blog post, [Build Thor CLI Project in Under a Second](https://blog.boltops.com/2017/09/14/build-thor-cli-project-in-under-a-second). It covers usage and also contains a video demo. An updated blog post will eventually be made, for now, refer to the original blog post.
9
9
 
@@ -43,6 +43,16 @@ And run:
43
43
  rake release
44
44
  ```
45
45
 
46
+ When installed as a gem, you no longer have to prepend exe in front of the command. For example, `exe/mycli` becomes the `mycli` command.
47
+
48
+ ## Auto Completion
49
+
50
+ The generated CLI tool supports TAB auto-completion. To enable auto, you can add this to your `~/.bashrc` or `~/.profile`:
51
+
52
+ eval $(mycli completions:script)
53
+
54
+ Remember to re-load your shell. Note, the auto completion will only work once you tool is installed and it's binary is avaialble in your PATH.
55
+
46
56
  ## Installation
47
57
 
48
58
  ```sh
@@ -9,7 +9,7 @@ class CliTemplate::Sequence < Thor::Group
9
9
  include CliTemplate::Helpers
10
10
 
11
11
  def self.source_root
12
- File.expand_path("../../templates/skeleton", __FILE__)
12
+ File.expand_path("../../templates/default", __FILE__)
13
13
  end
14
14
 
15
15
  private
@@ -1,3 +1,3 @@
1
1
  module CliTemplate
2
- VERSION = "3.0.0"
2
+ VERSION = "3.1.0"
3
3
  end
@@ -7,4 +7,6 @@ module <%= project_class_name %>
7
7
  autoload :RakeCommand, "<%= underscored_name %>/rake_command"
8
8
  autoload :CLI, "<%= underscored_name %>/cli"
9
9
  autoload :Sub, "<%= underscored_name %>/sub"
10
+ autoload :Completions, "<%= underscored_name %>/completions"
11
+ autoload :Completer, "<%= underscored_name %>/completer"
10
12
  end
@@ -33,8 +33,8 @@ class <%= project_class_name %>::CLI
33
33
 
34
34
  # thor_args normalized the args Array to work with our Thor command
35
35
  # subclasses.
36
- # 1. The namespace is stripe
37
- # 2. Help is shifted in front if a help flag is detected
36
+ # 1. The namespace is stripped
37
+ # 2. The help is shifted in front if a help flag is detected
38
38
  def thor_args
39
39
  args = @given_args.clone
40
40
 
@@ -69,8 +69,12 @@ class <%= project_class_name %>::CLI
69
69
  end
70
70
 
71
71
  # 1. look up Thor tasks
72
- # 2. look up Rake tasks
72
+ # 2. look up Rake tasks - currently disabled
73
73
  # 3. help menu with all commands when both Thor and Rake tasks are not found
74
+ #
75
+ # Example:
76
+ #
77
+ # lookup("sub:hello") => Sub
74
78
  def lookup(full_command)
75
79
  thor_task_found = <%= project_class_name %>::Command.namespaced_commands.include?(full_command)
76
80
  if thor_task_found
@@ -131,10 +135,12 @@ class <%= project_class_name %>::CLI
131
135
  shell.say "Commands:"
132
136
  shell.print_table(thor_list, :indent => 2, :truncate => true)
133
137
 
134
- unless rake_list.empty?
135
- shell.say "\nCommands via rake:"
136
- shell.print_table(rake_list, :indent => 2, :truncate => true)
137
- end
138
+ # TODO: commenting out for now, feels weird to show the rake tasks
139
+ # automatically also by default. Maybe add an option for this.
140
+ # unless rake_list.empty?
141
+ # shell.say "\nCommands via rake:"
142
+ # shell.print_table(rake_list, :indent => 2, :truncate => true)
143
+ # end
138
144
 
139
145
  shell.say "\n"
140
146
  shell.say main_help_body
@@ -22,10 +22,8 @@ module <%= project_class_name %>
22
22
  # ["help"]
23
23
  # ["dynamodb:migrate"]
24
24
  #
25
- # Same signature as RakeCommand.perform. Not using full_command.
26
- #
27
- # To call a thor task via ruby.
28
- # Signature is a little weird with the repetition, examples:
25
+ # Same signature as RakeCommand.perform. Signature is a little weird
26
+ # with some repetition. Examples:
29
27
  #
30
28
  # <%= project_class_name %>::Main.perform("hello", ["hello"])
31
29
  # <%= project_class_name %>::Main.perform("dynamodb:migrate", ["migrate"])
@@ -66,22 +64,33 @@ module <%= project_class_name %>
66
64
  next
67
65
  end
68
66
 
69
- # special mapping cases
70
- special_cases = {
71
- "<%= project_class_name %>::Cli" => "<%= project_class_name %>::CLI",
72
- "<%= project_class_name %>::Version" => "<%= project_class_name %>::VERSION",
73
- }
74
- class_name = special_cases[class_name] || class_name
67
+ class_name = class_map[class_name] || class_name
75
68
 
76
69
  puts "eager_load! loading path: #{path} class_name: #{class_name}" if debug?
77
70
  class_name.constantize # dont have to worry about order.
78
71
  end
79
72
  end
80
73
 
74
+ # Special class mapping cases. This is because ActiveSupport's autoloading
75
+ # forces a specific naming convention.
76
+ def class_map
77
+ map = {
78
+ "<%= project_class_name %>::Cli" => "<%= project_class_name %>::CLI",
79
+ "<%= project_class_name %>::Version" => "<%= project_class_name %>::VERSION",
80
+ "<%= project_class_name %>::Completion" => "<%= project_class_name %>::Completions",
81
+ }
82
+ map.merge(additional_class_map)
83
+ map
84
+ end
85
+
86
+ # Override this if you need add addtional class mappings.
87
+ def additional_class_map
88
+ {}
89
+ end
90
+
81
91
  # Fully qualifed task names. Examples:
82
- # build
83
- # process:controller
84
- # dynamodb:migrate:down
92
+ # hello
93
+ # sub:goodbye
85
94
  def namespaced_commands
86
95
  eager_load!
87
96
  subclasses.map do |klass|
@@ -124,12 +133,16 @@ module <%= project_class_name %>
124
133
  list.sort_by! { |array| array[0] }
125
134
  end
126
135
 
136
+ # Example:
137
+ # klass_from_namespace(nil) => Main
138
+ # klass_from_namespace("sub") => Sub
127
139
  def klass_from_namespace(namespace)
128
140
  if namespace.nil?
129
141
  <%= project_class_name %>::Main
130
142
  else
131
143
  class_name = namespace.gsub(':','/')
132
144
  class_name = "<%= project_class_name %>::#{class_name.classify}"
145
+ class_name = class_map[class_name] || class_name
133
146
  class_name.constantize
134
147
  end
135
148
  end
@@ -0,0 +1,138 @@
1
+ # Code Explanation. This is mainly focused on the run method.
2
+ #
3
+ # There are 3 main branches of logic for completions:
4
+ #
5
+ # 1. top-level commands - when there are zero completed words
6
+ # 2. params completions - when a command has some required params
7
+ # 3. options completions - when we have finished auto-completing the top-level command and required params, the rest of the completion words will be options
8
+ #
9
+ # Terms:
10
+ #
11
+ # params - these are params in the command itself. Example: for the method `scale(service, count)` the params would be `service, count`.
12
+ # options - these are cli options flags. Examples: --noop, --verbose
13
+ #
14
+ # When we are done processing method params, the completions will be only options. When the detected params size is greater than the arity we are have finished auto-completing the parameters in the method declaration. For example, say you had a method for a CLI command with the following form:
15
+ #
16
+ # scale(service, count) = arity of 2
17
+ #
18
+ # <%= project_name %> scale service count [TAB] # there are 3 params including the "scale" command
19
+ #
20
+ # So the completions will be something like:
21
+ #
22
+ # --noop --verbose etc
23
+ #
24
+ # A note about artity values:
25
+ #
26
+ # We are using the arity of the command method to determine if we have finish auto-completing the params completions. When the ruby method has a splat param, it's arity will be negative. Here are some example methods and their arities.
27
+ #
28
+ # ship(service) = 1
29
+ # scale(service, count) = 2
30
+ # ships(*services) = -1
31
+ # foo(example, *rest) = -2
32
+ #
33
+ # Fortunately, negative and positive arity values are processed the same way. So we take simply take the abs of the arity.
34
+ #
35
+ # To test:
36
+ #
37
+ # <%= project_name %> completions
38
+ # <%= project_name %> completions hello
39
+ # <%= project_name %> completions hello name
40
+ # <%= project_name %> completions hello name --
41
+ # <%= project_name %> completions hello name --noop
42
+ #
43
+ # <%= project_name %> completions
44
+ # <%= project_name %> completions sub:goodbye
45
+ # <%= project_name %> completions sub:goodbye name
46
+ #
47
+ # Note when testing, the first top-level word must be an exact match
48
+ #
49
+ # <%= project_name %> completions hello # works fine
50
+ # <%= project_name %> completions he # incomplete, this will just break
51
+ #
52
+ # The completions assumes that the top-level word that is being passed in
53
+ # from completor/scripts.sh will always match exactly. This must be the
54
+ # case. For parameters, the word does not have to match exactly.
55
+ #
56
+ module <%= project_class_name %>
57
+ class Completer
58
+ autoload :Script, '<%= underscored_name %>/completer/script'
59
+
60
+ def initialize(*params)
61
+ @params = params
62
+ end
63
+
64
+ def current_command
65
+ @params[0]
66
+ end
67
+
68
+ # Example: sub:goodbye => "sub"
69
+ def namespace
70
+ return nil unless current_command
71
+
72
+ if current_command.include?(':')
73
+ words = current_command.split(':')
74
+ words.pop
75
+ words.join(':')
76
+ end
77
+ end
78
+
79
+ # Example: sub:goodbye => "goodbye"
80
+ def trailing_command
81
+ current_command.split(':').last
82
+ end
83
+
84
+ def run
85
+ if @params.size == 0
86
+ puts all_commands
87
+ return
88
+ end
89
+
90
+ # will only get to here if the top-level command has been fully auto-completed.
91
+ arity = command_class.instance_method(trailing_command).arity.abs
92
+ if @params.size <= arity
93
+ puts params_completions(current_command)
94
+ else
95
+ puts options_completions(current_command)
96
+ end
97
+ end
98
+
99
+ # all top-level commands
100
+ def all_commands
101
+ # Interesing, extra :help commands show up here but no whne using
102
+ # <%= project_class_name %>::Command.help_list in main_help -> thor_list
103
+ # We'll filter out :help for auto-completion.
104
+ commands = <%= project_class_name %>::Command.namespaced_commands
105
+ commands.reject { |c| c =~ /:help$/ }
106
+ end
107
+
108
+ def params_completions(current_command)
109
+ method_params = command_class.instance_method(trailing_command).parameters
110
+ # Example:
111
+ # >> Sub.instance_method(:goodbye).parameters
112
+ # => [[:req, :name]]
113
+ # >>
114
+ method_params.map!(&:last)
115
+
116
+ offset = @params.size - 1
117
+ offset_params = method_params[offset..-1]
118
+ method_params[offset..-1].first
119
+ end
120
+
121
+ def options_completions(current_command)
122
+ used = ARGV.select { |a| a.include?('--') } # so we can remove used options
123
+
124
+ method_options = command_class.all_commands[trailing_command].options.keys
125
+ class_options = command_class.class_options.keys
126
+
127
+ all_options = method_options + class_options
128
+
129
+ all_options.map! { |o| "--#{o.to_s.dasherize}" }
130
+ filtered_options = all_options - used
131
+ filtered_options
132
+ end
133
+
134
+ def command_class
135
+ @command_class ||= <%= project_class_name %>::Command.klass_from_namespace(namespace)
136
+ end
137
+ end
138
+ end
@@ -0,0 +1,6 @@
1
+ class <%= project_class_name %>::Completer::Script
2
+ def self.generate
3
+ bash_script = File.expand_path("script.sh", File.dirname(__FILE__))
4
+ puts "source #{bash_script}"
5
+ end
6
+ end
@@ -0,0 +1,16 @@
1
+ _<%= project_name %>() {
2
+ COMPREPLY=()
3
+ local word="${COMP_WORDS[COMP_CWORD]}"
4
+
5
+ if [ "$COMP_CWORD" -eq 1 ]; then
6
+ local completions=$(<%= project_name %> completions)
7
+ COMPREPLY=( $(compgen -W "$completions" -- "$word") )
8
+ else
9
+ local words=("${COMP_WORDS[@]}")
10
+ unset words[0]
11
+ local completions=$(<%= project_name %> completions ${words[@]})
12
+ COMPREPLY=( $(compgen -W "$completions" -- "$word") )
13
+ fi
14
+ }
15
+
16
+ complete -F _<%= project_name %> <%= project_name %>
@@ -0,0 +1,9 @@
1
+ module <%= project_class_name %>
2
+ class Completions < Command
3
+ desc "script", "generates script that can be eval to setup auto-completion"
4
+ long_desc Help.text("completions:script")
5
+ def script
6
+ Completer::Script.generate
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,18 @@
1
+ Prints words for TAB auto-completion.
2
+
3
+ Examples:
4
+
5
+ <%= project_name %> completions
6
+ <%= project_name %> completions hello
7
+ <%= project_name %> completions hello name
8
+
9
+ To enable, TAB auto-completion add the following to your profile:
10
+
11
+ eval $(<%= project_name %> completions:script)
12
+
13
+ Auto-completion example usage:
14
+
15
+ <%= project_name %> [TAB]
16
+ <%= project_name %> hello [TAB]
17
+ <%= project_name %> hello name [TAB]
18
+ <%= project_name %> hello name --[TAB]
@@ -0,0 +1,3 @@
1
+ To use, add the following to your ~/.bashrc or ~/.profile
2
+
3
+ eval $(<%= project_name %> completions:script)
@@ -0,0 +1,5 @@
1
+ Examples:
2
+
3
+ <%= project_name %> hello
4
+ <%= project_name %> hello NAME
5
+ <%= project_name %> hello NAME --from me
@@ -0,0 +1,5 @@
1
+ Examples:
2
+
3
+ <%= project_name %> sub:goodbye
4
+ <%= project_name %> sub:goodbye NAME
5
+ <%= project_name %> sub:goodbye NAME --from me
@@ -13,6 +13,12 @@ module <%= project_class_name %>
13
13
  puts "Hello #{name}"
14
14
  end
15
15
 
16
+ desc "completions *PARAMS", "prints words for auto-completion"
17
+ long_desc Help.text(:completions)
18
+ def completions(*params)
19
+ Completer.new(*params).run
20
+ end
21
+
16
22
  desc "version", "prints version"
17
23
  def version
18
24
  puts VERSION
@@ -0,0 +1,37 @@
1
+ require "spec_helper"
2
+
3
+ describe <%= project_class_name %>::CLI do
4
+ before(:all) do
5
+ @args = "--from Tung"
6
+ end
7
+
8
+ describe "<%= project_name %>" do
9
+ it "hello" do
10
+ out = execute("exe/<%= project_name %> hello world #{@args}")
11
+ expect(out).to include("from: Tung\nHello world")
12
+ end
13
+
14
+ it "goodbye" do
15
+ out = execute("exe/<%= project_name %> sub:goodbye world #{@args}")
16
+ expect(out).to include("from: Tung\nGoodbye world")
17
+ end
18
+
19
+ it "completions" do
20
+ out = execute("exe/<%= project_name %> completions")
21
+ expect(out).to include("hello")
22
+ expect(out).to include("sub:goodbye")
23
+
24
+ out = execute("exe/<%= project_name %> completions hello")
25
+ expect(out).to include("name")
26
+
27
+ out = execute("exe/<%= project_name %> completions hello name")
28
+ expect(out).to include("--from")
29
+
30
+ out = execute("exe/<%= project_name %> completions sub:goodbye")
31
+ expect(out).to include("name")
32
+
33
+ out = execute("exe/<%= project_name %> completions sub:goodbye name")
34
+ expect(out).to include("--from")
35
+ end
36
+ end
37
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cli-template
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0
4
+ version: 3.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tung Nguyen
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-02-09 00:00:00.000000000 Z
11
+ date: 2018-02-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -164,28 +164,34 @@ files:
164
164
  - lib/cli-template/new.rb
165
165
  - lib/cli-template/sequence.rb
166
166
  - lib/cli-template/version.rb
167
- - lib/templates/skeleton/%project_name%.gemspec.tt
168
- - lib/templates/skeleton/.gitignore
169
- - lib/templates/skeleton/.rspec
170
- - lib/templates/skeleton/CHANGELOG.md
171
- - lib/templates/skeleton/Gemfile.tt
172
- - lib/templates/skeleton/Guardfile
173
- - lib/templates/skeleton/LICENSE.txt
174
- - lib/templates/skeleton/README.md.tt
175
- - lib/templates/skeleton/Rakefile
176
- - lib/templates/skeleton/exe/%project_name%.tt
177
- - lib/templates/skeleton/lib/%project_name%.rb.tt
178
- - lib/templates/skeleton/lib/%underscored_name%/cli.rb.tt
179
- - lib/templates/skeleton/lib/%underscored_name%/command.rb.tt
180
- - lib/templates/skeleton/lib/%underscored_name%/help.rb.tt
181
- - lib/templates/skeleton/lib/%underscored_name%/help/hello.md.tt
182
- - lib/templates/skeleton/lib/%underscored_name%/help/sub/goodbye.md.tt
183
- - lib/templates/skeleton/lib/%underscored_name%/main.rb.tt
184
- - lib/templates/skeleton/lib/%underscored_name%/rake_command.rb.tt
185
- - lib/templates/skeleton/lib/%underscored_name%/sub.rb.tt
186
- - lib/templates/skeleton/lib/%underscored_name%/version.rb.tt
187
- - lib/templates/skeleton/spec/lib/cli_spec.rb.tt
188
- - lib/templates/skeleton/spec/spec_helper.rb.tt
167
+ - lib/templates/default/%project_name%.gemspec.tt
168
+ - lib/templates/default/.gitignore
169
+ - lib/templates/default/.rspec
170
+ - lib/templates/default/CHANGELOG.md
171
+ - lib/templates/default/Gemfile.tt
172
+ - lib/templates/default/Guardfile
173
+ - lib/templates/default/LICENSE.txt
174
+ - lib/templates/default/README.md.tt
175
+ - lib/templates/default/Rakefile
176
+ - lib/templates/default/exe/%project_name%.tt
177
+ - lib/templates/default/lib/%project_name%.rb.tt
178
+ - lib/templates/default/lib/%underscored_name%/cli.rb.tt
179
+ - lib/templates/default/lib/%underscored_name%/command.rb.tt
180
+ - lib/templates/default/lib/%underscored_name%/completer.rb.tt
181
+ - lib/templates/default/lib/%underscored_name%/completer/script.rb.tt
182
+ - lib/templates/default/lib/%underscored_name%/completer/script.sh.tt
183
+ - lib/templates/default/lib/%underscored_name%/completions.rb.tt
184
+ - lib/templates/default/lib/%underscored_name%/help.rb.tt
185
+ - lib/templates/default/lib/%underscored_name%/help/completions.md.tt
186
+ - lib/templates/default/lib/%underscored_name%/help/completions/script.md.tt
187
+ - lib/templates/default/lib/%underscored_name%/help/hello.md.tt
188
+ - lib/templates/default/lib/%underscored_name%/help/sub/goodbye.md.tt
189
+ - lib/templates/default/lib/%underscored_name%/main.rb.tt
190
+ - lib/templates/default/lib/%underscored_name%/rake_command.rb.tt
191
+ - lib/templates/default/lib/%underscored_name%/sub.rb.tt
192
+ - lib/templates/default/lib/%underscored_name%/version.rb.tt
193
+ - lib/templates/default/spec/lib/cli_spec.rb.tt
194
+ - lib/templates/default/spec/spec_helper.rb.tt
189
195
  - spec/lib/cli_spec.rb
190
196
  - spec/spec_helper.rb
191
197
  homepage: https://gitub.com/tongueroo/cli-template
@@ -1,3 +0,0 @@
1
- Examples:
2
-
3
- <%= project_name %> hello
@@ -1,3 +0,0 @@
1
- Examples:
2
-
3
- <%= project_name %> sub:goodbye
@@ -1,24 +0,0 @@
1
- require "spec_helper"
2
-
3
- # to run specs with what"s remembered from vcr
4
- # $ rake
5
- #
6
- # to run specs with new fresh data from aws api calls
7
- # $ rake clean:vcr ; time rake
8
- describe <%= project_class_name %>::CLI do
9
- before(:all) do
10
- @args = "--from Tung"
11
- end
12
-
13
- describe "<%= project_name %>" do
14
- it "should hello world" do
15
- out = execute("exe/<%= project_name %> hello world #{@args}")
16
- expect(out).to include("from: Tung\nHello world")
17
- end
18
-
19
- it "should goodbye world" do
20
- out = execute("exe/<%= project_name %> sub:goodbye world #{@args}")
21
- expect(out).to include("from: Tung\nGoodbye world")
22
- end
23
- end
24
- end