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 +4 -4
- data/README.md +18 -6
- data/bin/gitignore +49 -43
- data/gitignore-cli.gemspec +16 -13
- data/lib/gitignore.rb +3 -1
- data/lib/gitignore/version.rb +3 -1
- metadata +22 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a54075d4b25dad8fddb685af3fbd3c07c4cd5a8ebebc5d06a93662baace7529f
|
4
|
+
data.tar.gz: 403b99cb5747de0a87a5ce37807b59c809b12321ca6ecf8975015d7479486050
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
```
|
12
|
-
|
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
|
-
|
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
|
-
|
48
|
+
$ gitignore generate ruby vim node > .gitignore
|
37
49
|
```
|
38
50
|
|
39
51
|
## Author
|
data/bin/gitignore
CHANGED
@@ -1,46 +1,52 @@
|
|
1
1
|
#!ruby
|
2
|
-
|
3
|
-
|
4
|
-
require
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
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)
|
data/gitignore-cli.gemspec
CHANGED
@@ -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 =
|
6
|
+
spec.name = 'gitignore-cli'
|
5
7
|
spec.version = Gitignore::VERSION
|
6
|
-
spec.authors = [
|
7
|
-
spec.email = [
|
8
|
+
spec.authors = ['Daniel Vinciguerra']
|
9
|
+
spec.email = ['daniel.vinciguerra@bivee.com.br']
|
8
10
|
|
9
|
-
spec.summary =
|
10
|
-
spec.description =
|
11
|
-
spec.homepage =
|
12
|
-
spec.license =
|
13
|
-
spec.required_ruby_version = Gem::Requirement.new(
|
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[
|
16
|
-
spec.metadata[
|
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
|
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 =
|
26
|
+
spec.bindir = 'bin'
|
25
27
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
26
|
-
spec.require_paths = [
|
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
|
data/lib/gitignore.rb
CHANGED
data/lib/gitignore/version.rb
CHANGED
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.
|
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-
|
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
|