commit 0.7.0 → 0.7.1

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: 525332be2b7dd147395cdc951b849ea9bd41c96824c3140264de5bb7f531d0c0
4
- data.tar.gz: '019c86addf56a91823cb337bc3438c9c6e8a002d453ed2383a429fcc77432df1'
3
+ metadata.gz: b6138776dedeea471b341c2527dcaedeeee7c19439a86caf860b5149c04e5906
4
+ data.tar.gz: 3dae4a041ea54fe55a0ca7b28b66f143933452cf8784cd9bbf9bf623d1ff9798
5
5
  SHA512:
6
- metadata.gz: 8b1e74b61b336af2aa2793fd0749062f2ccdc434841dd2022ad78c6311527062f48a82f2ae16e2e238670dd18194ff01e84702c38ab0c5c66948fcf1515ad594
7
- data.tar.gz: 857d5edf90f4022dd4a71e66dcdfdabee3607edfe811e520b5a94f7fd8bbe3db5dd4bdd4f8e5993d0e1443f352d9908f6f5d86f9b5e452eea07fd0c8b7ba9ddd
6
+ metadata.gz: 2a89c5efac58799f9cedd29610cdad9b3d66d193e96174e495dea13efa1422cdd5fb1ac39cd634172250ecc7861eba88db1f4e620f0db63dd3c3050acf11e2c6
7
+ data.tar.gz: 8dcac30b3732564994a60553059fe75fbcfaec2e0d4fb9cad288fff9b1cc59832b7b86eaecb266d3633e8933c4fc3da5e950f5e1427f968d41c2c6944895ed5a
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Change Log
2
2
 
3
+ ## 0.7.1 / 2025-0-30
4
+
5
+ * Now processes deleted files properly
6
+ * Using enums for verbosity
7
+
8
+
3
9
  ## 0.7.0 / 2025-06-14
4
10
 
5
11
  * Options are processed once again; this broke in v0.6.0.
data/exe/commit CHANGED
@@ -2,4 +2,9 @@
2
2
 
3
3
  require_relative '../lib/commit'
4
4
 
5
+ trap "SIGINT" do
6
+ puts "Exiting"
7
+ exit 130
8
+ end
9
+
5
10
  Commit.main
@@ -36,11 +36,12 @@ class GitCommit
36
36
  msg = @options[:commit_message] if @options[:commit_message]
37
37
  discover_branch
38
38
 
39
- puts "Committing with message '#{msg}'".green unless @options[:verbosity].zero?
40
- run("git commit -m '#{msg}' 2>&1 | sed -e '/^X11/d' -e '/^Warning:/d'", verbose: @options[:verbosity] >= 2)
39
+ puts "Committing with message '#{msg}'".green unless @options[:verbosity] == QUIET
40
+ run "git commit -m '#{msg}' 2>&1 | sed -e '/^X11/d' -e '/^Warning:/d'", verbose: @options[:verbosity] >= VERBOSE
41
41
  # @repo.push 'origin', ['refs/heads/master'] # Needs a callback to handle authentication
42
- puts "Pushing to origin #{@branch}".green unless @options[:verbosity].zero?
43
- run("git push origin #{@branch} --tags 3>&1 1>&2 2>&3 | sed -e '/^X11/d' -e '/^Warning:/d'", verbose: @options[:verbosity] >= 2)
42
+ puts "Pushing to origin #{@branch}".green unless @options[:verbosity] == QUIET
43
+ run "git push origin #{@branch} --tags 3>&1 1>&2 2>&3 | sed -e '/^X11/d' -e '/^Warning:/d'",
44
+ verbose: @options[:verbosity] >= VERBOSE
44
45
  @change_count = 0
45
46
  @commit_size = 0
46
47
  end
@@ -62,7 +63,7 @@ class GitCommit
62
63
  def large_files
63
64
  large = []
64
65
  @repo.status do |path, flags|
65
- puts "#{path} #{flags}" if @options[:verbosity].positive?
66
+ puts "#{path} #{flags}" if @options[:verbosity] >= NORMAL
66
67
  if File(path).dir?
67
68
  scan_dir path
68
69
  elsif large_file?(filename)
@@ -91,8 +92,8 @@ class GitCommit
91
92
  tag = @options[:tag]
92
93
  return unless tag
93
94
 
94
- run("git tag -a #{tag} -m 'v#{tag}'", verbose: @options[:verbosity] >= 2)
95
- run('git push origin --tags', verbose: @options[:verbosity] >= 2)
95
+ run "git tag -a #{tag} -m 'v#{tag}'", verbose: @options[:verbosity] >= VERBOSE
96
+ run 'git push origin --tags', verbose: @options[:verbosity] >= VERBOSE
96
97
  exit
97
98
  end
98
99
 
data/lib/commit/helper.rb CHANGED
@@ -1,4 +1,11 @@
1
1
  class GitCommit
2
+ QUIET = 0
3
+ NORMAL = 1
4
+ VERBOSE = 2
5
+ ANNOYING = 3
6
+ STFU = 4
7
+
8
+
2
9
  # Needs absolute path or the path relative to the current directory, not just the name of the directory
3
10
  def add_recursively(name)
4
11
  Dir.entries(name).each do |entry|
@@ -28,7 +35,7 @@ class GitCommit
28
35
  however the file is #{@nh.to_human file_size}.
29
36
  The file will be added to .gitignore.
30
37
  MESSAGE
31
- puts msg.yellow unless @options[:verbosity].zero?
38
+ puts msg.yellow unless @options[:verbosity] == QUIET
32
39
 
33
40
  newline = needs_newline('.gitignore') ? "\n" : ''
34
41
  File.write('.gitignore', "#{newline}#{filename}\n", mode: 'a')
@@ -36,9 +43,12 @@ class GitCommit
36
43
  elsif filename == '.gitignore'
37
44
  @gitignore_dirty = true
38
45
  else
39
- commit_push('A portion of the files to be committed is being pushed now because they are large.') if @commit_size + file_size >= MAX_SIZE / 2.0
40
- puts "Adding '#{escape filename}'".green unless @options[:verbosity].zero?
41
- run ['git', 'add', escape(filename)], verbose: @options[:verbosity] >= 2
46
+ if @commit_size + file_size >= MAX_SIZE / 2.0
47
+ # Defeat formatter
48
+ commit_push 'A portion of the files to be committed is being pushed now because they are large.'
49
+ end
50
+ puts "Adding '#{escape filename}'".green unless @options[:verbosity] == QUIET
51
+ run ['git', 'add', escape(filename)], verbose: @options[:verbosity] >= VERBOSE
42
52
  end
43
53
  @change_count += 1
44
54
  @commit_size += file_size
@@ -66,6 +76,7 @@ class GitCommit
66
76
  # - +:worktree_deleted+: the file has been deleted from the working directory
67
77
  def recursive_add
68
78
  @change_count = 0
79
+ run ['git', 'add', '--all'], verbose: @options[:verbosity] >= VERBOSE
69
80
  @repo.status do |path, flags|
70
81
  next if flags.include? :ignored
71
82
 
@@ -76,13 +87,13 @@ class GitCommit
76
87
  end
77
88
  end
78
89
  if @gitignore_dirty
79
- puts 'Changing .gitignore'.green unless @options[:verbosity].zero?
90
+ puts 'Changing .gitignore'.green unless @options[:verbosity] == QUIET
80
91
  run 'git add .gitignore', verbose: @options[:verbosity] >= 2
81
92
  @change_count += 1
82
93
  end
83
94
  return unless @change_count.zero?
84
95
 
85
- puts 'No changes were detected to this git repository.'.green if @options[:verbosity].positive?
96
+ puts 'No changes were detected to this git repository.'.green if @options[:verbosity] >= VERBOSE
86
97
  exit
87
98
  end
88
99
 
@@ -1,3 +1,3 @@
1
1
  module Commit
2
- VERSION = '0.7.0'.freeze unless defined? VERSION
2
+ VERSION = '0.7.1'.freeze unless defined? VERSION
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: commit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Slinn