gitignore-cli 0.4.0 → 0.11.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: 9f82ec2b974ac7833f10db0b36617fb047e2145d7d4e114f6818532c72b0d8b5
4
- data.tar.gz: ba94d390600d2692d7f163302c4611aac9f6b400835f494adcf97cf6e9c56bc2
3
+ metadata.gz: 053aa4b5355ff54d69041e0707df470772caf454592f9cf596da33c1a4af8a9f
4
+ data.tar.gz: 721b764015430237691d982e269a78b3595fe5ab79a6e9e0bdbe1c574e66aa73
5
5
  SHA512:
6
- metadata.gz: b78383cc183f0a559ab532fa7b5254895893eaa5c3031d3382fc946aa6bea31c53c8e3265873bc9f7477a9b6381ebf15650949d71cc2dc81b6a82cb389bd096b
7
- data.tar.gz: 550a2126d403735fe334a316657e965029826f883c67fbbd35efcf2439f18b96f540a7a30ecb6d70cd3e85b4f9dbaa55d4029dbbf6f92097fbcd8fef3d191d0a
6
+ metadata.gz: c59548b4cde89e7df874923333634edee90e292e67a14f3cfff5d7380de12f2d43803abce777d3b8ff1d3c074fdf452e0d419898d1a1ca3c87da8248d68f183c
7
+ data.tar.gz: b52860ceaafa567deaa900fbb8afdf44709943a65a6b7d57a8aeacbd97fb8c21ae88c7da7245a7a23a947f1a7c5ba44891fbbd4fa437bb390c61aba5051c77ff
data/.gitignore CHANGED
@@ -1,11 +1,88 @@
1
- /.bundle/
2
- /.yardoc
3
- /_yardoc/
1
+
2
+ # Created by https://www.gitignore.io/api/ruby,vim
3
+ # Edit at https://www.gitignore.io/?templates=ruby,vim
4
+
5
+ ### Ruby ###
6
+ *.gem
7
+ *.rbc
8
+ /.config
4
9
  /coverage/
5
- /doc/
10
+ /InstalledFiles
6
11
  /pkg/
7
12
  /spec/reports/
13
+ /spec/examples.txt
14
+ /test/tmp/
15
+ /test/version_tmp/
8
16
  /tmp/
9
17
 
10
- # rspec failure tracking
11
- .rspec_status
18
+ # Used by dotenv library to load environment variables.
19
+ # .env
20
+
21
+ # Ignore Byebug command history file.
22
+ .byebug_history
23
+
24
+ ## Specific to RubyMotion:
25
+ .dat*
26
+ .repl_history
27
+ build/
28
+ *.bridgesupport
29
+ build-iPhoneOS/
30
+ build-iPhoneSimulator/
31
+
32
+ ## Specific to RubyMotion (use of CocoaPods):
33
+ #
34
+ # We recommend against adding the Pods directory to your .gitignore. However
35
+ # you should judge for yourself, the pros and cons are mentioned at:
36
+ # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
37
+ # vendor/Pods/
38
+
39
+ ## Documentation cache and generated files:
40
+ /.yardoc/
41
+ /_yardoc/
42
+ /doc/
43
+ /rdoc/
44
+
45
+ ## Environment normalization:
46
+ /.bundle/
47
+ /vendor/bundle
48
+ /lib/bundler/man/
49
+
50
+ # for a library or gem, you might want to ignore these files since the code is
51
+ # intended to run in multiple environments; otherwise, check them in:
52
+ # Gemfile.lock
53
+ # .ruby-version
54
+ # .ruby-gemset
55
+
56
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
57
+ .rvmrc
58
+
59
+ ### Ruby Patch ###
60
+ # Used by RuboCop. Remote config files pulled in from inherit_from directive.
61
+ # .rubocop-https?--*
62
+
63
+ ### Vim ###
64
+ # Swap
65
+ [._]*.s[a-v][a-z]
66
+ [._]*.sw[a-p]
67
+ [._]s[a-rt-v][a-z]
68
+ [._]ss[a-gi-z]
69
+ [._]sw[a-p]
70
+
71
+ # Session
72
+ Session.vim
73
+ Sessionx.vim
74
+
75
+ # Temporary
76
+ .netrwhist
77
+ *~
78
+
79
+ # Auto-generated tag files
80
+ tags
81
+
82
+ # Persistent undo
83
+ [._]*.un~
84
+
85
+ # Coc configuration directory
86
+ .vim
87
+
88
+ # End of https://www.gitignore.io/api/ruby,vim
data/Gemfile CHANGED
@@ -3,5 +3,5 @@ source "https://rubygems.org"
3
3
  # Specify your gem's dependencies in gitignore.gemspec
4
4
  gemspec
5
5
 
6
- gem "rake", "~> 12.0"
6
+ gem "rake", "~> 13.0"
7
7
  gem "rspec", "~> 3.0"
@@ -0,0 +1,77 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ gitignore-cli (0.11.0)
5
+ http (~> 4.3, >= 4.3.0)
6
+ thor (~> 1.0, >= 1.0.1)
7
+ tty-prompt (>= 0.20, < 0.23)
8
+
9
+ GEM
10
+ remote: https://rubygems.org/
11
+ specs:
12
+ addressable (2.7.0)
13
+ public_suffix (>= 2.0.2, < 5.0)
14
+ diff-lcs (1.3)
15
+ domain_name (0.5.20190701)
16
+ unf (>= 0.0.5, < 1.0.0)
17
+ equatable (0.6.1)
18
+ ffi (1.13.1)
19
+ ffi-compiler (1.0.1)
20
+ ffi (>= 1.0.0)
21
+ rake
22
+ http (4.4.1)
23
+ addressable (~> 2.3)
24
+ http-cookie (~> 1.0)
25
+ http-form_data (~> 2.2)
26
+ http-parser (~> 1.2.0)
27
+ http-cookie (1.0.3)
28
+ domain_name (~> 0.5)
29
+ http-form_data (2.3.0)
30
+ http-parser (1.2.1)
31
+ ffi-compiler (>= 1.0, < 2.0)
32
+ necromancer (0.5.1)
33
+ pastel (0.7.3)
34
+ equatable (~> 0.6)
35
+ tty-color (~> 0.5)
36
+ public_suffix (4.0.5)
37
+ rake (13.0.1)
38
+ rspec (3.9.0)
39
+ rspec-core (~> 3.9.0)
40
+ rspec-expectations (~> 3.9.0)
41
+ rspec-mocks (~> 3.9.0)
42
+ rspec-core (3.9.2)
43
+ rspec-support (~> 3.9.3)
44
+ rspec-expectations (3.9.2)
45
+ diff-lcs (>= 1.2.0, < 2.0)
46
+ rspec-support (~> 3.9.0)
47
+ rspec-mocks (3.9.1)
48
+ diff-lcs (>= 1.2.0, < 2.0)
49
+ rspec-support (~> 3.9.0)
50
+ rspec-support (3.9.3)
51
+ thor (1.0.1)
52
+ tty-color (0.5.1)
53
+ tty-cursor (0.7.1)
54
+ tty-prompt (0.20.0)
55
+ necromancer (~> 0.5.0)
56
+ pastel (~> 0.7.0)
57
+ tty-reader (~> 0.7.0)
58
+ tty-reader (0.7.0)
59
+ tty-cursor (~> 0.7)
60
+ tty-screen (~> 0.7)
61
+ wisper (~> 2.0.0)
62
+ tty-screen (0.7.1)
63
+ unf (0.1.4)
64
+ unf_ext
65
+ unf_ext (0.0.7.7)
66
+ wisper (2.0.1)
67
+
68
+ PLATFORMS
69
+ ruby
70
+
71
+ DEPENDENCIES
72
+ gitignore-cli!
73
+ rake (~> 13.0)
74
+ rspec (~> 3.0)
75
+
76
+ BUNDLED WITH
77
+ 2.1.4
data/README.md CHANGED
@@ -1,38 +1,62 @@
1
- # AddGitignore
1
+ # gitignore-cli
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/add_gitignore`. To experiment with that code, run `bin/console` for an interactive prompt.
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)
6
+
7
+ Provides a simple CLI that uses the fantastic `gitignore.io` tool to generate `.gitignore` files for your project.
8
+
9
+ [![asciicast](https://asciinema.org/a/299023.svg)](https://asciinema.org/a/299023?autoplay=1&speed=2)
4
10
 
5
- TODO: Delete this and the text above, and describe your gem
6
11
 
7
12
  ## Installation
8
13
 
9
- Add this line to your application's Gemfile:
14
+ You will need to have `ruby >= 2.3`, or running on Docker.
10
15
 
11
- ```ruby
12
- gem 'add_gitignore'
16
+ ```shellscript
17
+ $ gem install gitignore-cli
13
18
  ```
14
19
 
15
- And then execute:
20
+ ## Usage
16
21
 
17
- $ bundle install
22
+ You can use the following commands:
18
23
 
19
- Or install it yourself as:
24
+ #### gitignore list
20
25
 
21
- $ gem install add_gitignore
26
+ The command `list` will return all available environments.
22
27
 
23
- ## Usage
28
+ **Example:**
29
+
30
+ ```shellscript
31
+ $ gitignore list
32
+ ```
33
+
34
+ #### gitignore create
24
35
 
25
- TODO: Write usage instructions here
36
+ Generates the .gitignore output using an interactive term ui.
37
+
38
+ ```shellscript
39
+ $ gitignore create
40
+ ```
41
+
42
+
43
+ #### gitignore generate [environments]
44
+
45
+ Generates the .gitignore output to stdout using all environments that you choose.
46
+
47
+ ```shellscript
48
+ $ gitignore generate ruby vim node > .gitignore
49
+ ```
26
50
 
27
- ## Development
51
+ ## Author
28
52
 
29
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
53
+ Daniel Vinciguerra <daniel.vinciguerra@bivee.com.br>
30
54
 
31
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
55
 
33
- ## Contributing
56
+ ### Special Thanks
34
57
 
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/dvinciguerra/add_gitignore.
58
+ * [Joe Blau](https://github.com/joeblau) for [gitignore.io](https://gitignore.io).
59
+ * [Tejas Kumar](https://github.com/TejasQ) for the inspiration, [at TejasQ/add-gitignore](https://github.com/TejasQ/add-gitignore)
36
60
 
37
61
 
38
62
  ## License
@@ -1,25 +1,56 @@
1
1
  #!ruby
2
+ # frozen_string_literal: true
2
3
 
3
- require "gitignore"
4
+ require 'thor'
5
+ require 'gitignore'
6
+ require 'tty-prompt'
4
7
 
5
- command = ARGV[0]
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('')
6
13
 
7
- case command
8
- when "list"
9
- Gitignore.list.each do |env|
10
- puts " - #{env}"
11
- end
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(interrupt: :exit)
12
32
 
13
- when "generate", "g"
14
- envs = ARGV[1..-1]
15
- puts Gitignore.generate(envs)
33
+ prompt.on(:keyescape) do
34
+ exit
35
+ end
16
36
 
17
- else
18
- puts <<~HELP
19
- Usage: #{File.basename($0)} [command] [options]
37
+ env_list = Gitignore.list
38
+ results = prompt.multi_select(
39
+ 'Select envs to generate the .gitignore?', env_list, filter: true
40
+ )
20
41
 
21
- Commonly used command are:
22
- list : list all environment options
23
- generate : generate a .gitignore file by all environment that you choose
24
- HELP
42
+ unless results.any?
43
+ puts 'No environment selected... exiting!'
44
+ exit
45
+ end
46
+
47
+ file = File.open(options[:out], 'w')
48
+ file.write(Gitignore.generate(results))
49
+ file.close
50
+
51
+ puts 'The .gitignore is generated!'
52
+ end
53
+ end
25
54
  end
55
+
56
+ Gitignore::CLI.start(ARGV)
@@ -1,29 +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{A ruby cli tool that use gitignore.io to generate your gitignore files}
10
- spec.description = %q{A ruby cli tool that use gitignore.io to generate your gitignore files}
11
- spec.homepage = "https://github.com/dvinciguerra/gitignore"
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"
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'
32
+ spec.add_runtime_dependency 'tty-prompt', '>= 0.20', '< 0.23'
29
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
 
@@ -6,7 +8,7 @@ module Gitignore
6
8
  class Error < StandardError; end
7
9
 
8
10
  class << self
9
- GITIGNORE_HOST = ENV['GITIGNORE_HOST'] || 'https://www.gitignore.io'
11
+ GITIGNORE_HOST = ENV['GITIGNORE_HOST'] || 'https://www.toptal.com/developers/gitignore'
10
12
 
11
13
  def list
12
14
  response = HTTP.get("#{GITIGNORE_HOST}/api/list")
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Gitignore
2
- VERSION = "0.4.0"
4
+ VERSION = '0.11.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.4.0
4
+ version: 0.11.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-08-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: http
@@ -30,7 +30,48 @@ dependencies:
30
30
  - - ">="
31
31
  - !ruby/object:Gem::Version
32
32
  version: 4.3.0
33
- description: A ruby cli tool that use gitignore.io to generate your gitignore files
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
53
+ - !ruby/object:Gem::Dependency
54
+ name: tty-prompt
55
+ requirement: !ruby/object:Gem::Requirement
56
+ requirements:
57
+ - - ">="
58
+ - !ruby/object:Gem::Version
59
+ version: '0.20'
60
+ - - "<"
61
+ - !ruby/object:Gem::Version
62
+ version: '0.23'
63
+ type: :runtime
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - ">="
68
+ - !ruby/object:Gem::Version
69
+ version: '0.20'
70
+ - - "<"
71
+ - !ruby/object:Gem::Version
72
+ version: '0.23'
73
+ description: A Ruby CLI tool that use fantastic gitignore.io to generate .gitignore
74
+ files to your projects
34
75
  email:
35
76
  - daniel.vinciguerra@bivee.com.br
36
77
  executables:
@@ -42,6 +83,7 @@ files:
42
83
  - ".rspec"
43
84
  - ".travis.yml"
44
85
  - Gemfile
86
+ - Gemfile.lock
45
87
  - LICENSE.txt
46
88
  - README.md
47
89
  - Rakefile
@@ -49,12 +91,12 @@ files:
49
91
  - gitignore-cli.gemspec
50
92
  - lib/gitignore.rb
51
93
  - lib/gitignore/version.rb
52
- homepage: https://github.com/dvinciguerra/gitignore
94
+ homepage: https://github.com/dvinciguerra/gitignore-cli
53
95
  licenses:
54
96
  - MIT
55
97
  metadata:
56
- homepage_uri: https://github.com/dvinciguerra/gitignore
57
- source_code_uri: https://github.com/dvinciguerra/gitignore
98
+ homepage_uri: https://github.com/dvinciguerra/gitignore-cli
99
+ source_code_uri: https://github.com/dvinciguerra/gitignore-cli
58
100
  post_install_message:
59
101
  rdoc_options: []
60
102
  require_paths:
@@ -74,5 +116,5 @@ rubyforge_project:
74
116
  rubygems_version: 2.7.6
75
117
  signing_key:
76
118
  specification_version: 4
77
- summary: A ruby cli tool that use gitignore.io to generate your gitignore files
119
+ summary: Simple Ruby CLI to generate .gitignore files
78
120
  test_files: []