gitignore-cli 0.8.0 → 0.10.0

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: 8e07aa2ec001c621f14a6eef3e74d49bf0bb69465ab55673e381736ac94c600e
4
- data.tar.gz: f4b14180acd819db1d34578ae608d30ebba2ad41d33c0335a5791395274e337c
3
+ metadata.gz: a54075d4b25dad8fddb685af3fbd3c07c4cd5a8ebebc5d06a93662baace7529f
4
+ data.tar.gz: 403b99cb5747de0a87a5ce37807b59c809b12321ca6ecf8975015d7479486050
5
5
  SHA512:
6
- metadata.gz: a82aceae0e37b673038ac16c3c7d02e1b8887562a7943d7262e88ce71109a569f8093aadf6c51e84a2861a23a0d8ef0f71772d8996adeeecdcaf481f2ebcbb4e
7
- data.tar.gz: ae95b57dd95145abe3afdc2598597589167912e0cb25ccde94d92c9cdeda1a169f3cac6d2ae8aeb83cd83ab488acbeb830dc7a8d2bb422be0710f134a9969538
6
+ metadata.gz: dbaf6c3af11944c9049a3867a6096174544bc076b1f61aa1277f9ee45bf183dc0e846a074aa092aa420d1b5f33213b29005094355b83d34ea2ed45c4c9d36676
7
+ data.tar.gz: '068758c2ee95ad18b262dcbfc805cf7a5f4b8a721d72370806547798564a9c44bfc1a46fbd2e464656060c6f19f63dfef5e4029a927ec8b534cbe19543ad3aeb'
data/README.md CHANGED
@@ -1,39 +1,51 @@
1
1
  # gitignore-cli
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/gitignore-cli.svg)](https://badge.fury.io/rb/gitignore-cli)
4
+ [![Maintainability](https://api.codeclimate.com/v1/badges/48ed1e9f5ee6d37590f5/maintainability)](https://codeclimate.com/github/dvinciguerra/gitignore-cli/maintainability)
5
+ [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT)
4
6
 
5
7
  Provides a simple CLI that uses the fantastic `gitignore.io` tool to generate `.gitignore` files for your project.
6
8
 
9
+ [![asciicast](https://asciinema.org/a/299023.svg)](https://asciinema.org/a/299023?autoplay=1&speed=2)
10
+
11
+
7
12
  ## Installation
8
13
 
9
14
  You will need to have `ruby >= 2.3`, or running on Docker.
10
15
 
11
- ```ruby
12
- $ gem install gitignore-cli
16
+ ```shellscript
17
+ $ gem install gitignore-cli
13
18
  ```
14
19
 
15
20
  ## Usage
16
21
 
17
22
  You can use the following commands:
18
23
 
19
- #### list
24
+ #### gitignore list
20
25
 
21
26
  The command `list` will return all available environments.
22
27
 
23
28
  **Example:**
24
29
 
25
30
  ```shellscript
26
- $ gitignore list
31
+ $ gitignore list
27
32
  ```
28
33
 
34
+ #### gitignore create
35
+
36
+ Generates the .gitignore output using an interactive term ui.
37
+
38
+ ```shellscript
39
+ $ gitignore create
40
+ ```
29
41
 
30
42
 
31
- #### generate
43
+ #### gitignore generate [environments]
32
44
 
33
45
  Generates the .gitignore output to stdout using all environments that you choose.
34
46
 
35
47
  ```shellscript
36
- $ gitignore generate ruby vim node > .gitignore
48
+ $ gitignore generate ruby vim node > .gitignore
37
49
  ```
38
50
 
39
51
  ## Author
@@ -1,46 +1,52 @@
1
1
  #!ruby
2
-
3
- require "gitignore"
4
- require "tty-prompt"
5
-
6
- command = ARGV[0]
7
-
8
- case command
9
- when "list"
10
- Gitignore.list.each do |env|
11
- puts " - #{env}"
2
+ # frozen_string_literal: true
3
+
4
+ require 'thor'
5
+ require 'gitignore'
6
+ require 'tty-prompt'
7
+
8
+ module Gitignore
9
+ class CLI < Thor
10
+ desc 'list', 'list all environment options'
11
+ def list
12
+ formatted_envs = Gitignore.list.map { |env| " - #{env}\n" }.join('')
13
+
14
+ puts <<~OUTPUT
15
+ Available Environments:
16
+ #{formatted_envs}
17
+
18
+ Now you can generate your .gitignore file using choosed envs:
19
+ $ gitignore generate vim ruby node > .gitignore
20
+ OUTPUT
21
+ end
22
+
23
+ desc 'generate', 'generate a .gitignore and print to STDOUT'
24
+ def generate(*envs)
25
+ puts Gitignore.generate(envs)
26
+ end
27
+
28
+ desc 'create', 'generate a .gitignore file using a interactive term ui'
29
+ option :out, type: :string, default: '.gitignore', desc: 'OUTPUT_FILE'
30
+ def create
31
+ prompt = TTY::Prompt.new
32
+
33
+ env_list = Gitignore.list
34
+ results = prompt.multi_select(
35
+ 'Select envs to generate the .gitignore?', env_list, filter: true
36
+ )
37
+
38
+ unless results.any?
39
+ puts 'No environment selected... exiting!'
40
+ exit
41
+ end
42
+
43
+ file = File.open(options[:out], 'w')
44
+ file.write(Gitignore.generate(results))
45
+ file.close
46
+
47
+ puts 'The .gitignore is generated!'
48
+ end
12
49
  end
13
-
14
- when "generate", "g"
15
- envs = ARGV[1..-1]
16
- puts Gitignore.generate(envs)
17
-
18
- when "create"
19
- prompt = TTY::Prompt.new
20
-
21
- env_list = Gitignore.list
22
- results = prompt.multi_select(
23
- "Select envs to generate the .gitignore?", env_list, filter: true
24
- )
25
-
26
- unless results.any?
27
- puts "No environment selected... exiting!"
28
- exit
29
- end
30
-
31
- file = File.open('.gitignore', 'w')
32
- file.write(Gitignore.generate(results))
33
- file.close
34
-
35
- puts "The .gitignore is generated!"
36
-
37
- else
38
- puts <<~HELP
39
- Usage: #{File.basename($0)} [command] [options]
40
-
41
- Commonly used command are:
42
- list : list all environment options
43
- create : generate a .gitignore file using a interactive term ui
44
- generate : generate a .gitignore file by all environment that you choose
45
- HELP
46
50
  end
51
+
52
+ Gitignore::CLI.start(ARGV)
@@ -1,30 +1,33 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'lib/gitignore/version'
2
4
 
3
5
  Gem::Specification.new do |spec|
4
- spec.name = "gitignore-cli"
6
+ spec.name = 'gitignore-cli'
5
7
  spec.version = Gitignore::VERSION
6
- spec.authors = ["Daniel Vinciguerra"]
7
- spec.email = ["daniel.vinciguerra@bivee.com.br"]
8
+ spec.authors = ['Daniel Vinciguerra']
9
+ spec.email = ['daniel.vinciguerra@bivee.com.br']
8
10
 
9
- spec.summary = %q{Simple Ruby CLI to generate .gitignore files}
10
- spec.description = %q{A Ruby CLI tool that use fantastic gitignore.io to generate .gitignore files to your projects}
11
- spec.homepage = "https://github.com/dvinciguerra/gitignore-cli"
12
- spec.license = "MIT"
13
- spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
11
+ spec.summary = 'Simple Ruby CLI to generate .gitignore files'
12
+ spec.description = 'A Ruby CLI tool that use fantastic gitignore.io to generate .gitignore files to your projects'
13
+ spec.homepage = 'https://github.com/dvinciguerra/gitignore-cli'
14
+ spec.license = 'MIT'
15
+ spec.required_ruby_version = Gem::Requirement.new('>= 2.3.0')
14
16
 
15
- spec.metadata["homepage_uri"] = spec.homepage
16
- spec.metadata["source_code_uri"] = "https://github.com/dvinciguerra/gitignore-cli"
17
+ spec.metadata['homepage_uri'] = spec.homepage
18
+ spec.metadata['source_code_uri'] = 'https://github.com/dvinciguerra/gitignore-cli'
17
19
 
18
20
  # Specify which files should be added to the gem when it is released.
19
21
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
20
- spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
22
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
21
23
  `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
22
24
  end
23
25
 
24
- spec.bindir = "bin"
26
+ spec.bindir = 'bin'
25
27
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
26
- spec.require_paths = ["lib"]
28
+ spec.require_paths = ['lib']
27
29
 
28
30
  spec.add_runtime_dependency 'http', '~> 4.3', '>= 4.3.0'
31
+ spec.add_runtime_dependency 'thor', '~> 1.0', '>= 1.0.1'
29
32
  spec.add_runtime_dependency 'tty-prompt', '~> 0.20.0'
30
33
  end
@@ -1,4 +1,6 @@
1
- require "gitignore/version"
1
+ # frozen_string_literal: true
2
+
3
+ require 'gitignore/version'
2
4
 
3
5
  require 'http'
4
6
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Gitignore
2
- VERSION = "0.8.0"
4
+ VERSION = '0.10.0'
3
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gitignore-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Vinciguerra
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-02-06 00:00:00.000000000 Z
11
+ date: 2020-02-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: http
@@ -30,6 +30,26 @@ dependencies:
30
30
  - - ">="
31
31
  - !ruby/object:Gem::Version
32
32
  version: 4.3.0
33
+ - !ruby/object:Gem::Dependency
34
+ name: thor
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: '1.0'
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ version: 1.0.1
43
+ type: :runtime
44
+ prerelease: false
45
+ version_requirements: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - "~>"
48
+ - !ruby/object:Gem::Version
49
+ version: '1.0'
50
+ - - ">="
51
+ - !ruby/object:Gem::Version
52
+ version: 1.0.1
33
53
  - !ruby/object:Gem::Dependency
34
54
  name: tty-prompt
35
55
  requirement: !ruby/object:Gem::Requirement