gitignores 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4137f3ee5e7252e4a21dd063ee66d6aff600d91a40176123fb1617c31c7adb4d
4
- data.tar.gz: 33b576db764596fcb3f3599c4d2a041e784a44f481f6c47f1df20bca197f1d07
3
+ metadata.gz: 5a2c227bbcd01fc5db4de822d7fbb850c8d49427f0e09166f0e5a3578cd5db82
4
+ data.tar.gz: 8b62d2036dba2ec308cf162ef23fa6f1a0cbc9e862f9201f9a76162f0f60a3ee
5
5
  SHA512:
6
- metadata.gz: b353d55a750199b592aabdd5b3e5fce773c7059b0f45ff260dbe12ca661856fc3bc5d96c795ec0e6d9cc8ec5b71b7eab8a04d9e1d5df133e9424c694af132dfa
7
- data.tar.gz: 5f8fdf97265decc4d6b6ad1cb2859300060d29730d593abf7589b3ae437e9f61d9e5a6d4c0d7a31e8f404c1dd6a783cc670242735277e3da227f0f4602af89ef
6
+ metadata.gz: b352a098f1efe529bee8f45e99a9634e3b519581cfc96496ed07eec9e17914e7e6affaf04ea636df643d8f347a09af3405cd252dbd959a088037a26832859ab7
7
+ data.tar.gz: bbd5907f97d298cbfb8581554631c054144b088ef2f64639e69e395e51f5e6a68f184d6c4a7d1f89213dcee17a38abf2f7afce00fbbe92470d249f8ef95bbab5
data/CHANGELOG.md CHANGED
@@ -1,3 +1,25 @@
1
+ ## 0.1.2 (2025-07-11)
2
+
3
+ Compatibility:
4
+
5
+ - Add Ruby 3.x compatibility by replacing deprecated `Dir.exists?` and `File.exists?` methods
6
+ - Update GLI gem from 2.13.3 to 2.21.5 to fix ERB deprecation warnings
7
+ - Fix deprecated `Rake::RDocTask`, now uses `RDoc::Task`
8
+ - Add Ruby version requirement (>= 2.5.0) to gemspec
9
+
10
+ Security:
11
+
12
+ - Fix potential shell command injection vulnerability by using `system()` instead of backticks
13
+
14
+ Features:
15
+
16
+ - Update OS gitignore name from 'OSX' to 'macOS' to match current GitHub repository structure
17
+
18
+ Development:
19
+
20
+ - Update RSpec stubbing syntax to modern `allow().to receive()` pattern
21
+ - Add proper error handling for git operations with custom exception classes
22
+
1
23
  ## 0.0.3 (2015-05-25)
2
24
 
3
25
  Features:
data/Gemfile.lock CHANGED
@@ -1,14 +1,14 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- gitignores (0.1.1)
5
- gli (= 2.13.3)
4
+ gitignores (0.1.2)
5
+ gli (= 2.21.5)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
10
  diff-lcs (1.4.4)
11
- gli (2.13.3)
11
+ gli (2.21.5)
12
12
  rake (13.0.3)
13
13
  rdoc (6.3.0)
14
14
  rspec (3.10.0)
@@ -35,4 +35,4 @@ DEPENDENCIES
35
35
  rspec
36
36
 
37
37
  BUNDLED WITH
38
- 2.1.4
38
+ 2.6.9
data/Rakefile CHANGED
@@ -1,3 +1,4 @@
1
+ require 'bundler/gem_tasks'
1
2
  require 'rake/clean'
2
3
  require 'rubygems'
3
4
  require 'rubygems/package_task'
@@ -6,7 +7,7 @@ require 'rspec/core/rake_task'
6
7
 
7
8
  CLEAN << 'tmp'
8
9
 
9
- Rake::RDocTask.new do |rd|
10
+ RDoc::Task.new do |rd|
10
11
  rd.main = "README.rdoc"
11
12
  rd.rdoc_files.include("README.rdoc","lib/**/*.rb","bin/**/*")
12
13
  rd.title = 'gitignores'
@@ -14,14 +15,9 @@ end
14
15
 
15
16
  include Rake::DSL
16
17
 
17
- Bundler::GemHelper.install_tasks
18
18
 
19
19
  RSpec::Core::RakeTask.new do |t|
20
20
  end
21
21
 
22
- spec = eval(File.read('gitignores.gemspec'))
23
-
24
- Gem::PackageTask.new(spec) do |pkg|
25
- end
26
22
 
27
23
  task :default => [:spec]
data/bin/gitignores CHANGED
@@ -33,11 +33,11 @@ Use the list command to show possible values for snippet names.
33
33
  )
34
34
  arg 'snippet', :multiple
35
35
  command :add do |c|
36
- c.desc 'include snippets for operating systems OSX, Windows, Linux'
36
+ c.desc 'include snippets for operating systems macOS, Windows, Linux'
37
37
  c.switch :os, :negatable => false
38
38
  c.action do |global_options,options,args|
39
39
  if (options[:os])
40
- args.concat ['OSX', 'Windows', 'Linux']
40
+ args.concat ['macOS', 'Windows', 'Linux']
41
41
  end
42
42
  args.uniq!
43
43
  $gitignores.add(args)
data/gitignores.gemspec CHANGED
@@ -9,6 +9,7 @@ Gem::Specification.new do |gem|
9
9
  gem.platform = Gem::Platform::RUBY
10
10
  gem.summary = Gitignores::SUMMARY
11
11
  gem.homepage = 'https://github.com/gilday/gitignore-builder'
12
+ gem.required_ruby_version = '>= 2.5.0'
12
13
 
13
14
  gem.files = `git ls-files`.split("
14
15
  ")
@@ -18,6 +19,6 @@ Gem::Specification.new do |gem|
18
19
  gem.add_development_dependency('rake')
19
20
  gem.add_development_dependency('rdoc')
20
21
  gem.add_development_dependency('rspec')
21
- gem.add_runtime_dependency('gli','2.13.3')
22
+ gem.add_runtime_dependency('gli','2.21.5')
22
23
  end
23
24
 
@@ -15,8 +15,8 @@ module Gitignores
15
15
 
16
16
  def find_gitignores_by_name(ignores)
17
17
  ignores.collect { |x|
18
- path = File.exists?("#{@local_repository}/#{x}.gitignore") ? "#{@local_repository}/#{x}.gitignore" : "#{@local_repository}/Global/#{x}.gitignore"
19
- unless File.exists? path
18
+ path = File.exist?("#{@local_repository}/#{x}.gitignore") ? "#{@local_repository}/#{x}.gitignore" : "#{@local_repository}/Global/#{x}.gitignore"
19
+ unless File.exist? path
20
20
  raise GitignoreNotFoundException.new(x), "File #{path} does not exist"
21
21
  end
22
22
  File.expand_path(path)
@@ -5,4 +5,7 @@ module Gitignores
5
5
  @ignore_name = ignore_name
6
6
  end
7
7
  end
8
+
9
+ class GitCloneError < RuntimeError; end
10
+ class GitPullError < RuntimeError; end
8
11
  end
@@ -1,4 +1,5 @@
1
1
  require 'gitignores'
2
+ require 'shellwords'
2
3
 
3
4
  module Gitignores
4
5
  class GitignoreFetcher
@@ -16,7 +17,7 @@ module Gitignores
16
17
  # If @update_ignores? is set, will try to update the latest gitignores
17
18
  # Will store all gitignores in the @local_repository
18
19
  def fetch_gitignores()
19
- unless (Dir.exists?(@local_repository))
20
+ unless (Dir.exist?(@local_repository))
20
21
  @git.clone @remote_repository, @local_repository
21
22
  end
22
23
  if @update_ignores
@@ -37,12 +38,14 @@ module Gitignores
37
38
  class Git
38
39
 
39
40
  def clone(repository, directory)
40
- `git clone #{repository} #{directory}`
41
+ system('git', 'clone', repository, directory)
42
+ raise GitCloneError, "Failed to clone #{repository}" unless $?.success?
41
43
  end
42
44
 
43
45
  def pull(directory)
44
46
  Dir.chdir(directory) {
45
- `git pull`
47
+ system('git', 'pull')
48
+ raise GitPullError, "Failed to pull in #{directory}" unless $?.success?
46
49
  }
47
50
  end
48
51
  end
@@ -1,5 +1,5 @@
1
1
  module Gitignores
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
 
4
4
  SUMMARY = "Generates .gitignore"
5
5
 
@@ -11,7 +11,7 @@ describe Git do
11
11
  FileUtils.rm_rf(test_repository)
12
12
  @git.clone '.', test_repository
13
13
 
14
- expect(File.exists?(test_repository)).to be true
14
+ expect(File.exist?(test_repository)).to be true
15
15
  expect(Dir[test_repository].empty?).to be false
16
16
  end
17
17
  end
@@ -34,7 +34,7 @@ describe GitignoreFetcher do
34
34
 
35
35
  it "updates the repository when given update flag" do
36
36
  @fetcher.update_ignores = true
37
- @mockGit.stub(:clone)
37
+ allow(@mockGit).to receive(:clone)
38
38
  expect(@mockGit).to receive(:pull).with(anything())
39
39
 
40
40
  @fetcher.fetch_gitignores
@@ -44,7 +44,7 @@ describe GitignoreFetcher do
44
44
  describe "#list_gitignores" do
45
45
 
46
46
  it "finds all gitignores in the directory and returns their names in a list" do
47
- @mockGit.stub(:clone)
47
+ allow(@mockGit).to receive(:clone)
48
48
  @fetcher.local_repository = FAKE_IGNORES
49
49
  ignores = @fetcher.list_gitignores
50
50
 
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gitignores
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Johnathan Gilday
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2021-03-05 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: rake
@@ -58,15 +57,14 @@ dependencies:
58
57
  requirements:
59
58
  - - '='
60
59
  - !ruby/object:Gem::Version
61
- version: 2.13.3
60
+ version: 2.21.5
62
61
  type: :runtime
63
62
  prerelease: false
64
63
  version_requirements: !ruby/object:Gem::Requirement
65
64
  requirements:
66
65
  - - '='
67
66
  - !ruby/object:Gem::Version
68
- version: 2.13.3
69
- description:
67
+ version: 2.21.5
70
68
  email: me@johnathangilday.com
71
69
  executables:
72
70
  - gitignores
@@ -96,7 +94,6 @@ files:
96
94
  homepage: https://github.com/gilday/gitignore-builder
97
95
  licenses: []
98
96
  metadata: {}
99
- post_install_message:
100
97
  rdoc_options: []
101
98
  require_paths:
102
99
  - lib
@@ -105,15 +102,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
105
102
  requirements:
106
103
  - - ">="
107
104
  - !ruby/object:Gem::Version
108
- version: '0'
105
+ version: 2.5.0
109
106
  required_rubygems_version: !ruby/object:Gem::Requirement
110
107
  requirements:
111
108
  - - ">="
112
109
  - !ruby/object:Gem::Version
113
110
  version: '0'
114
111
  requirements: []
115
- rubygems_version: 3.1.4
116
- signing_key:
112
+ rubygems_version: 3.6.9
117
113
  specification_version: 4
118
114
  summary: Generates .gitignore
119
115
  test_files: []