cli-template 4.0.0 → 4.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b53337284c8b96dbc2542077b822c17bc84aef700324434f2516f3dc1e49fec8
4
- data.tar.gz: 8919ffcd06b6080fb07e098f495180379c8de7fecf6f7463d22292eb15c89c14
3
+ metadata.gz: 574675906a5563a0fd58d1afd7c4e9d28aa72ca2689bdf8802ad11212f7b9d18
4
+ data.tar.gz: 3950f3c40baef9b16aa3a11115c153f148af09f5b7c0e673a8d1b985571b089f
5
5
  SHA512:
6
- metadata.gz: 463553b6d137103f0fdcb7c0ee79e5f8852116442940f3d86385e7e05473cbc0360cb0f90bb94ceeff6e5ea73745a9f74ef717620e5d4861266196cb3c4c27a8
7
- data.tar.gz: be52eb5f0f27e5bb0e1cd9c5b789df36829329eb82bae2a09a9fc401196a5c8fdcc563a6c7d502e031a0afd4ff4254339c3149ef98fcaca7375160580e0775b5
6
+ metadata.gz: ad3011b0a62b11ede64d8272d8b990e6441afb860e778d07ed9aa8a7885574d700e5efce1e59cfdb359069ac500ce9a640c55a8e927a3eebabcf1233d42247b6
7
+ data.tar.gz: 56ce4cb3011d19e6740bfc7b2a16c007bc37641d112d087c4ff3930ec422f74986dc785ad271a09e9fe389d1ea5fc49e2416c64d5569524156c6b73348b8ebc8
@@ -3,6 +3,10 @@
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
+ ## [4.0.1]
7
+ - dynamically get git user name and email in starter project
8
+ - update cli help menus
9
+
6
10
  ## [4.0.0]
7
11
  - use zeitwerk for autoload
8
12
 
data/README.md CHANGED
@@ -14,25 +14,28 @@ The generated CLI project comes with:
14
14
 
15
15
  ## Usage
16
16
 
17
- ```sh
18
- cli-template new mycli
19
- cd mycli
20
- exe/mycli hello world
21
- exe/mycli sub:goodbye world # namespaced command with colons
22
- ```
17
+ cli-template new mycli
18
+ cd mycli
19
+ exe/mycli hello world
23
20
 
24
21
  The above generated a starter CLI project called `mycli` with a working hello command. The created project also has starter specs for you 😁
25
22
 
26
- ```sh
27
- $ rake
28
- Mycli::CLI
29
- mycli
30
- should hello world
31
- should goodbye world
23
+ $ rake
24
+ Mycli::CLI
25
+ mycli
26
+ should hello world
27
+ should goodbye world
32
28
 
33
- Finished in 1.12 seconds (files took 0.71706 seconds to load)
34
- 2 examples, 0 failures
35
- ```
29
+ Finished in 1.12 seconds (files took 0.71706 seconds to load)
30
+ 2 examples, 0 failures
31
+
32
+ ### Subcommands
33
+
34
+ Use the `--subcommand` to have the generator also include a subcommand example.
35
+
36
+ cli-template new mycli --subcommand
37
+ cd mycli
38
+ exe/foo sub goodbye # subcommand example
36
39
 
37
40
  ## Release
38
41
 
@@ -44,9 +47,7 @@ Once you are satisfied with the CLI tool, you can release it as a gem.
44
47
 
45
48
  And run:
46
49
 
47
- ```
48
- rake release
49
- ```
50
+ rake release
50
51
 
51
52
  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.
52
53
 
@@ -59,11 +60,9 @@ There are 2 different templates that the tool generates from:
59
60
 
60
61
  To use the different templates:
61
62
 
62
- ```
63
- TEMPLATE=colon_namespaces cli-template new mycli
64
- TEMPLATE=default cli-template new mycli
65
- cli-template new mycli # same as TEMPLATE=default
66
- ```
63
+ TEMPLATE=colon_namespaces cli-template new mycli
64
+ TEMPLATE=default cli-template new mycli
65
+ cli-template new mycli # same as TEMPLATE=default
67
66
 
68
67
  ## Auto Completion
69
68
 
@@ -73,13 +72,11 @@ There is support for TAB completion in the newly generated CLI project for the d
73
72
 
74
73
  Remember to re-load the shell. Note, the auto completion will only work if the cli command is avaialble in your PATH. You can do this by installing the gem. You can also create a wrapper bash script that calls to your development cli command like so:
75
74
 
76
- ```
77
- cat > /usr/local/bin/mycli << 'EOL'
78
- #!/bin/bash
79
- exec ~/src/mycli/exe/mycli "$@"
80
- EOL
81
- chmod a+x /usr/local/bin/mycli
82
- ```
75
+ cat > /usr/local/bin/mycli << 'EOL'
76
+ #!/bin/bash
77
+ exec ~/src/mycli/exe/mycli "$@"
78
+ EOL
79
+ chmod a+x /usr/local/bin/mycli
83
80
 
84
81
  ### Experimental Auto Completion Support for colon_namespaces Template
85
82
 
@@ -94,9 +91,7 @@ Suggestions to are appreciated!
94
91
 
95
92
  ## Installation
96
93
 
97
- ```sh
98
- gem install cli-template
99
- ```
94
+ gem install cli-template
100
95
 
101
96
  ## Contributing
102
97
 
@@ -0,0 +1,22 @@
1
+ module CliTemplate
2
+ class Git
3
+ class << self
4
+ def user_name
5
+ sh "git config --get user.name"
6
+ end
7
+
8
+ def user_email
9
+ sh "git config --get user.email"
10
+ end
11
+
12
+ def sh(command)
13
+ puts "=> #{command}"
14
+ stdout = `#{command}`
15
+ out = stdout.strip
16
+ puts "stdout #{stdout.inspect}"
17
+ puts "out #{out.inspect}"
18
+ return out if !out&.empty?
19
+ end
20
+ end
21
+ end
22
+ end
@@ -1,3 +1,3 @@
1
1
  module CliTemplate
2
- VERSION = "4.0.0"
2
+ VERSION = "4.0.1"
3
3
  end
@@ -1,2 +1,3 @@
1
+ --require spec_helper
1
2
  --color
2
3
  --format documentation
@@ -5,7 +5,7 @@
5
5
  [![Dependency Status](https://gemnasium.com/USER/REPO.png)](https://gemnasium.com/USER/REPO)
6
6
  [![Coverage Status](https://coveralls.io/repos/USER/REPO/badge.png)](https://coveralls.io/r/USER/REPO)
7
7
  [![Join the chat at https://gitter.im/USER/REPO](https://badges.gitter.im/USER/REPO.svg)](https://gitter.im/USER/REPO?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
8
- [![Support](https://img.shields.io/badge/get-support-blue.svg)](https://boltops.com?utm_source=badge&utm_medium=badge&utm_campaign=cli-template)
8
+ [![Support](https://img.shields.io/badge/get-support-blue.svg)](https://boltops.com?utm_source=badge&utm_medium=badge&utm_campaign=<%= project_name %>)
9
9
 
10
10
  TODO: Write a gem description
11
11
 
@@ -1,18 +1,18 @@
1
1
  Prints words for TAB auto-completion.
2
2
 
3
- Examples:
3
+ ## Examples
4
4
 
5
- <%= project_name %> completions
6
- <%= project_name %> completions hello
7
- <%= project_name %> completions hello name
5
+ <%= project_name %> completions
6
+ <%= project_name %> completions hello
7
+ <%= project_name %> completions hello name
8
8
 
9
9
  To enable, TAB auto-completion add the following to your profile:
10
10
 
11
- eval $(<%= project_name %> completions:script)
11
+ eval $(<%= project_name %> completions:script)
12
12
 
13
13
  Auto-completion example usage:
14
14
 
15
- <%= project_name %> [TAB]
16
- <%= project_name %> hello [TAB]
17
- <%= project_name %> hello name [TAB]
18
- <%= project_name %> hello name --[TAB]
15
+ <%= project_name %> [TAB]
16
+ <%= project_name %> hello [TAB]
17
+ <%= project_name %> hello name [TAB]
18
+ <%= project_name %> hello name --[TAB]
@@ -1,3 +1,3 @@
1
1
  To use, add the following to your ~/.bashrc or ~/.profile
2
2
 
3
- eval $(<%= project_name %> completions:script)
3
+ eval $(<%= project_name %> completions:script)
@@ -1,4 +1,4 @@
1
- Examples:
1
+ ## Examples
2
2
 
3
3
  <%= project_name %> hello
4
4
  <%= project_name %> hello NAME
@@ -1,4 +1,6 @@
1
- Add -h to any of the commands for more help. Examples:
1
+ Add -h to any of the commands for more help.
2
+
3
+ ## Examples
2
4
 
3
5
  <%= project_name %> hello -h
4
6
  <%= project_name %> version
@@ -1,5 +1,5 @@
1
- Examples:
1
+ ## Examples
2
2
 
3
- <%= project_name %> sub:goodbye
4
- <%= project_name %> sub:goodbye NAME
5
- <%= project_name %> sub:goodbye NAME --from me
3
+ <%= project_name %> sub:goodbye
4
+ <%= project_name %> sub:goodbye NAME
5
+ <%= project_name %> sub:goodbye NAME --from me
@@ -1,5 +1,3 @@
1
- require "spec_helper"
2
-
3
1
  describe <%= project_class_name %>::CLI do
4
2
  before(:all) do
5
3
  @args = "--from Tung"
@@ -6,12 +6,12 @@ require "<%= underscored_name %>/version"
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = "<%= project_name %>"
8
8
  spec.version = <%= project_class_name %>::VERSION
9
- spec.authors = ["Tung Nguyen"]
10
- spec.email = ["tongueroo@gmail.com"]
9
+ spec.authors = ["<%= CliTemplate::Git.user_name %>"]
10
+ spec.email = ["<%= CliTemplate::Git.user_email %>"]
11
11
  spec.summary = "Generated with cli-template tool. Please write a gem summary"
12
12
  spec.description = "Generated with cli-template tool. Write a longer description or delete this line."
13
- spec.homepage = ""
14
- spec.license = "MIT"
13
+ spec.homepage = "https://github.com/USERNAME/<%= project_name %>" # TODO: changeme
14
+ spec.license = ""
15
15
 
16
16
  spec.files = `git ls-files`.split($/)
17
17
  spec.bindir = "exe"
@@ -29,4 +29,17 @@ Gem::Specification.new do |spec|
29
29
  spec.add_development_dependency "cli_markdown"
30
30
  spec.add_development_dependency "rake"
31
31
  spec.add_development_dependency "rspec"
32
+
33
+ # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
34
+ # to allow pushing to a single host or delete this section to allow pushing to any host.
35
+ if spec.respond_to?(:metadata)
36
+ # spec.metadata["allowed_push_host"] = ""
37
+
38
+ spec.metadata["homepage_uri"] = spec.homepage
39
+
40
+ # spec.metadata["source_code_uri"] = ""
41
+ # spec.metadata["changelog_uri"] = ""
42
+ else
43
+ raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
44
+ end
32
45
  end
@@ -1,2 +1,3 @@
1
+ --require spec_helper
1
2
  --color
2
3
  --format documentation
@@ -5,7 +5,7 @@
5
5
  [![Dependency Status](https://gemnasium.com/USER/REPO.png)](https://gemnasium.com/USER/REPO)
6
6
  [![Coverage Status](https://coveralls.io/repos/USER/REPO/badge.png)](https://coveralls.io/r/USER/REPO)
7
7
  [![Join the chat at https://gitter.im/USER/REPO](https://badges.gitter.im/USER/REPO.svg)](https://gitter.im/USER/REPO?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
8
- [![Support](https://img.shields.io/badge/get-support-blue.svg)](https://boltops.com?utm_source=badge&utm_medium=badge&utm_campaign=cli-template)
8
+ [![Support](https://img.shields.io/badge/get-support-blue.svg)](https://boltops.com?utm_source=badge&utm_medium=badge&utm_campaign=<%= project_name %>)
9
9
 
10
10
  TODO: Write a gem description
11
11
 
@@ -1,11 +1,9 @@
1
- Example:
1
+ ## Examples
2
2
 
3
3
  <%= project_name %> completion
4
4
 
5
5
  Prints words for TAB auto-completion.
6
6
 
7
- Examples:
8
-
9
7
  <%= project_name %> completion
10
8
  <%= project_name %> completion hello
11
9
  <%= project_name %> completion hello name
@@ -1,4 +1,4 @@
1
- Examples:
1
+ ## Examples
2
2
 
3
3
  <%= project_name %> hello
4
4
  <%= project_name %> hello NAME
@@ -1,4 +1,4 @@
1
- Examples:
1
+ ## Examples
2
2
 
3
3
  <%= project_name %> sub:goodbye
4
4
  <%= project_name %> sub:goodbye NAME
@@ -1,5 +1,3 @@
1
- require "spec_helper"
2
-
3
1
  describe <%= project_class_name %>::CLI do
4
2
  before(:all) do
5
3
  @args = "--from Tung"
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: 4.0.0
4
+ version: 4.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tung Nguyen
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-08-11 00:00:00.000000000 Z
11
+ date: 2019-11-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rainbow
@@ -174,6 +174,7 @@ files:
174
174
  - lib/cli_template/autoloader.rb
175
175
  - lib/cli_template/cli.rb
176
176
  - lib/cli_template/command.rb
177
+ - lib/cli_template/git.rb
177
178
  - lib/cli_template/help.rb
178
179
  - lib/cli_template/help/new.md
179
180
  - lib/cli_template/helper.rb
@@ -256,7 +257,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
256
257
  - !ruby/object:Gem::Version
257
258
  version: '0'
258
259
  requirements: []
259
- rubygems_version: 3.0.3
260
+ rubygems_version: 3.0.6
260
261
  signing_key:
261
262
  specification_version: 4
262
263
  summary: Generate a CLI tool quickly