fit-commit 2.1.0 → 2.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +0 -1
- data/.rubocop.yml +42 -0
- data/CHANGELOG.md +3 -0
- data/README.md +1 -1
- data/Rakefile +1 -1
- data/bin/fit-commit +3 -6
- data/fit-commit.gemspec +1 -1
- data/lib/{fit-commit.rb → fit_commit.rb} +1 -1
- data/lib/fit_commit/cli.rb +48 -0
- data/lib/{fit-commit → fit_commit}/has_errors.rb +0 -0
- data/lib/{fit-commit → fit_commit}/installer.rb +0 -2
- data/lib/{fit-commit → fit_commit}/line.rb +1 -1
- data/lib/fit_commit/message_parser.rb +32 -0
- data/lib/{fit-commit → fit_commit}/runner.rb +9 -21
- data/lib/{fit-commit → fit_commit}/validators/base.rb +1 -1
- data/lib/{fit-commit → fit_commit}/validators/frathouse.rb +1 -1
- data/lib/{fit-commit → fit_commit}/validators/line_length.rb +1 -1
- data/lib/{fit-commit → fit_commit}/validators/summary_period.rb +2 -2
- data/lib/{fit-commit → fit_commit}/validators/tense.rb +1 -1
- data/lib/{fit-commit → fit_commit}/validators/wip.rb +1 -1
- data/lib/{fit-commit → fit_commit}/version.rb +1 -1
- data/templates/hooks/commit-msg +17 -7
- data/test/message_parser_test.rb +74 -0
- data/test/runner_test.rb +7 -7
- data/test/validators/frathouse_test.rb +2 -2
- data/test/validators/line_length_test.rb +2 -2
- data/test/validators/summary_period_test.rb +2 -2
- data/test/validators/tense_test.rb +2 -2
- data/test/validators/wip_test.rb +2 -2
- metadata +19 -15
- data/lib/fit-commit/cli.rb +0 -26
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b61a440527e95be121a746fd0e4b84746cce7c43
|
4
|
+
data.tar.gz: 3012b5cb04cdd7793709dab36150bd7af6802cb9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0507857c7b47a8695e2649b39bb6b4db45ff3e78945be33bf1061c846794fe846e0e380bc2360592560cdad8abc6fb8d98e48ed9f7c5940fa8c9c1df0305919c
|
7
|
+
data.tar.gz: 9bb562f150c27b9204dc893c9dc691cd479499ed841325d3428f8e09e9b91f69706b5562e4db32650680bb4ddfde83881aa662b0f409e7cc9dd82ba4e2bf301f
|
data/.gitignore
CHANGED
data/.rubocop.yml
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
AllCops:
|
2
|
+
DisplayCopNames: true
|
3
|
+
DisplayStyleGuide: true
|
4
|
+
|
5
|
+
Style/StringLiterals:
|
6
|
+
EnforcedStyle: double_quotes
|
7
|
+
|
8
|
+
Style/StringLiteralsInInterpolation:
|
9
|
+
Enabled: false
|
10
|
+
|
11
|
+
Metrics/AbcSize:
|
12
|
+
Enabled: false
|
13
|
+
|
14
|
+
Metrics/CyclomaticComplexity:
|
15
|
+
Enabled: false
|
16
|
+
|
17
|
+
Metrics/LineLength:
|
18
|
+
Enabled: false
|
19
|
+
|
20
|
+
Metrics/MethodLength:
|
21
|
+
Enabled: false
|
22
|
+
|
23
|
+
Metrics/PerceivedComplexity:
|
24
|
+
Enabled: false
|
25
|
+
|
26
|
+
Style/Documentation:
|
27
|
+
Enabled: false
|
28
|
+
|
29
|
+
Style/MultilineOperationIndentation:
|
30
|
+
Enabled: false
|
31
|
+
|
32
|
+
Style/AlignArray:
|
33
|
+
Enabled: false
|
34
|
+
|
35
|
+
Style/AlignParameters:
|
36
|
+
Enabled: false
|
37
|
+
|
38
|
+
Style/GuardClause:
|
39
|
+
Enabled: false
|
40
|
+
|
41
|
+
Style/FileName:
|
42
|
+
Enabled: false
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
data/Rakefile
CHANGED
data/bin/fit-commit
CHANGED
@@ -1,9 +1,6 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
require
|
3
|
+
require "fit_commit/cli"
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
end
|
8
|
-
|
9
|
-
FitCommit::Cli.new(*ARGV).execute or exit 1
|
5
|
+
exit_code = FitCommit::Cli.new(*ARGV).execute
|
6
|
+
exit(exit_code)
|
data/fit-commit.gemspec
CHANGED
@@ -0,0 +1,48 @@
|
|
1
|
+
require "fit_commit/installer"
|
2
|
+
require "fit_commit/version"
|
3
|
+
|
4
|
+
module FitCommit
|
5
|
+
class Cli
|
6
|
+
EXIT_CODE_SUCCESS = 0
|
7
|
+
EXIT_CODE_FAILURE = 1
|
8
|
+
|
9
|
+
attr_accessor :args
|
10
|
+
def initialize(*args)
|
11
|
+
self.args = args
|
12
|
+
end
|
13
|
+
|
14
|
+
def execute
|
15
|
+
action_name = in_git_repo? ? args.shift : :fail_git_repo
|
16
|
+
action_name = :help unless respond_to?(action_name, :include_private)
|
17
|
+
send(action_name)
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
def help
|
23
|
+
$stderr.puts "fit-commit v#{FitCommit::VERSION}"
|
24
|
+
$stderr.puts "Usage: fit-commit install"
|
25
|
+
$stderr.puts "Usage: fit-commit uninstall"
|
26
|
+
EXIT_CODE_FAILURE
|
27
|
+
end
|
28
|
+
|
29
|
+
def install
|
30
|
+
FitCommit::Installer.new.install
|
31
|
+
EXIT_CODE_SUCCESS
|
32
|
+
end
|
33
|
+
|
34
|
+
def uninstall
|
35
|
+
FitCommit::Installer.new.uninstall
|
36
|
+
EXIT_CODE_SUCCESS
|
37
|
+
end
|
38
|
+
|
39
|
+
def in_git_repo?
|
40
|
+
File.exist?(".git")
|
41
|
+
end
|
42
|
+
|
43
|
+
def fail_git_repo
|
44
|
+
$stderr.puts "fit-commit: .git directory not found. Please run from your Git repository root."
|
45
|
+
EXIT_CODE_FAILURE
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
File without changes
|
@@ -9,7 +9,6 @@ module FitCommit
|
|
9
9
|
FileUtils.cp(HOOK_TEMPLATE_PATH, hook_path)
|
10
10
|
FileUtils.chmod(0755, hook_path)
|
11
11
|
$stdout.puts "Installed hook to #{hook_path}"
|
12
|
-
true
|
13
12
|
end
|
14
13
|
|
15
14
|
def uninstall
|
@@ -18,7 +17,6 @@ module FitCommit
|
|
18
17
|
else
|
19
18
|
$stdout.puts "Hook not found at #{hook_path}"
|
20
19
|
end
|
21
|
-
true
|
22
20
|
end
|
23
21
|
|
24
22
|
private
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require "fit_commit/line"
|
2
|
+
|
3
|
+
module FitCommit
|
4
|
+
class MessageParser
|
5
|
+
attr_accessor :message_path
|
6
|
+
def initialize(message_path)
|
7
|
+
self.message_path = message_path
|
8
|
+
end
|
9
|
+
|
10
|
+
def lines
|
11
|
+
FitCommit::Line.from_text_array(relevant_lines)
|
12
|
+
end
|
13
|
+
|
14
|
+
private
|
15
|
+
|
16
|
+
GIT_VERBOSE_MARKER = "# ------------------------ >8 ------------------------"
|
17
|
+
COMMENT_REGEX = /\A#/
|
18
|
+
|
19
|
+
def relevant_lines
|
20
|
+
message_text.lines.each_with_object([]) do |line, relevant_lines|
|
21
|
+
line.chomp!
|
22
|
+
break relevant_lines if line == GIT_VERBOSE_MARKER
|
23
|
+
next if line =~ COMMENT_REGEX
|
24
|
+
relevant_lines << line.chomp
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def message_text
|
29
|
+
File.read(message_path)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -1,5 +1,5 @@
|
|
1
|
-
require "
|
2
|
-
require "
|
1
|
+
require "fit_commit/has_errors"
|
2
|
+
require "fit_commit/message_parser"
|
3
3
|
|
4
4
|
module FitCommit
|
5
5
|
class Runner
|
@@ -38,8 +38,7 @@ module FitCommit
|
|
38
38
|
private
|
39
39
|
|
40
40
|
def run_validators
|
41
|
-
|
42
|
-
FitCommit::Validators::Base.all.each do |validator_class|
|
41
|
+
validator_classes.each do |validator_class|
|
43
42
|
validator = validator_class.new(lines, branch_name)
|
44
43
|
validator.validate
|
45
44
|
merge_errors(validator.errors)
|
@@ -47,6 +46,11 @@ module FitCommit
|
|
47
46
|
end
|
48
47
|
end
|
49
48
|
|
49
|
+
def validator_classes
|
50
|
+
Dir[File.dirname(__FILE__) + "/validators/*.rb"].each { |file| require file }
|
51
|
+
FitCommit::Validators::Base.all
|
52
|
+
end
|
53
|
+
|
50
54
|
def print_results
|
51
55
|
unless errors.empty?
|
52
56
|
stdout.puts lines
|
@@ -64,23 +68,7 @@ module FitCommit
|
|
64
68
|
end
|
65
69
|
|
66
70
|
def lines
|
67
|
-
@lines ||= FitCommit::
|
68
|
-
end
|
69
|
-
|
70
|
-
GIT_VERBOSE_MARKER = "# ------------------------ >8 ------------------------"
|
71
|
-
COMMENT_REGEX = /\A#/
|
72
|
-
|
73
|
-
def relevant_message_lines
|
74
|
-
message_text.lines.each_with_object([]) do |line, relevant_lines|
|
75
|
-
line.chomp!
|
76
|
-
break relevant_lines if line == GIT_VERBOSE_MARKER
|
77
|
-
next if line =~ COMMENT_REGEX
|
78
|
-
relevant_lines << line.chomp
|
79
|
-
end
|
80
|
-
end
|
81
|
-
|
82
|
-
def message_text
|
83
|
-
File.read(message_path)
|
71
|
+
@lines ||= FitCommit::MessageParser.new(message_path).lines
|
84
72
|
end
|
85
73
|
|
86
74
|
def empty_commit?
|
@@ -1,9 +1,9 @@
|
|
1
|
-
require "
|
1
|
+
require "fit_commit/validators/base"
|
2
2
|
|
3
3
|
module FitCommit
|
4
4
|
module Validators
|
5
5
|
class SummaryPeriod < Base
|
6
|
-
def validate_line(lineno, text,
|
6
|
+
def validate_line(lineno, text, _branch_name)
|
7
7
|
if lineno == 1 && text.end_with?(".")
|
8
8
|
add_error(lineno, "Do not end your summary with a period.")
|
9
9
|
end
|
data/templates/hooks/commit-msg
CHANGED
@@ -2,32 +2,42 @@
|
|
2
2
|
#
|
3
3
|
# This hook will attempt to setup your environment before running checks.
|
4
4
|
|
5
|
-
if which rvm
|
5
|
+
if which rvm > /dev/null 2>&1
|
6
6
|
then cmd="rvm default do ruby"
|
7
|
-
elif which rbenv
|
7
|
+
elif which rbenv > /dev/null 2>&1
|
8
8
|
then cmd="rbenv exec ruby"
|
9
9
|
else cmd="ruby"
|
10
10
|
fi
|
11
11
|
|
12
12
|
export COMMIT_MESSAGE_PATH=$1
|
13
|
-
if
|
13
|
+
if [ -z "$COMMIT_MESSAGE_PATH" ]; then
|
14
14
|
>&2 echo "fit-commit: WARNING: Skipping checks because the Git hook was not passed the"
|
15
15
|
>&2 echo "fit-commit: commit message file path. This is usually \`.git/COMMIT_EDITMSG\`."
|
16
16
|
>&2 echo "fit-commit: This hook was called via: $0 $*"
|
17
|
-
>&2 echo "fit-commit: Please submit a bug report with the project
|
17
|
+
>&2 echo "fit-commit: Please submit a bug report with the project:"
|
18
|
+
>&2 echo "fit-commit: https://github.com/m1foley/fit-commit/issues"
|
19
|
+
exit 0
|
20
|
+
fi
|
21
|
+
if [ ! -r "$COMMIT_MESSAGE_PATH" ]; then
|
22
|
+
>&2 echo "fit-commit: WARNING: Skipping checks because the commit message file cannot be read:"
|
23
|
+
>&2 echo "fit-commit: $COMMIT_MESSAGE_PATH"
|
24
|
+
>&2 echo "fit-commit: This hook was called via: $0 $*"
|
25
|
+
>&2 echo "fit-commit: Please submit a bug report with the project:"
|
26
|
+
>&2 echo "fit-commit: https://github.com/m1foley/fit-commit/issues"
|
18
27
|
exit 0
|
19
28
|
fi
|
20
29
|
|
21
30
|
export GIT_BRANCH_NAME=`git name-rev --name-only HEAD`
|
22
|
-
if
|
31
|
+
if [ -z "$GIT_BRANCH_NAME" ]; then
|
23
32
|
>&2 echo "fit-commit: WARNING: Skipping checks because the Git branch cannot be determined."
|
24
|
-
>&2 echo "fit-commit: Please submit a bug report with the project
|
33
|
+
>&2 echo "fit-commit: Please submit a bug report with the project:"
|
34
|
+
>&2 echo "fit-commit: https://github.com/m1foley/fit-commit/issues"
|
25
35
|
exit 0
|
26
36
|
fi
|
27
37
|
|
28
38
|
${cmd} -rrubygems -e '
|
29
39
|
begin
|
30
|
-
require "
|
40
|
+
require "fit_commit"
|
31
41
|
true
|
32
42
|
rescue LoadError => e
|
33
43
|
$stderr.puts <<-MESSAGE
|
@@ -0,0 +1,74 @@
|
|
1
|
+
require "minitest/autorun"
|
2
|
+
require "fit_commit/message_parser"
|
3
|
+
|
4
|
+
describe FitCommit::MessageParser do
|
5
|
+
after do
|
6
|
+
commit_msg_file.unlink
|
7
|
+
end
|
8
|
+
|
9
|
+
let(:commit_msg_file) do
|
10
|
+
Tempfile.new("test-commit-msg").tap do |f|
|
11
|
+
f.write(commit_msg)
|
12
|
+
f.close
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
let(:lines) do
|
17
|
+
FitCommit::MessageParser.new(commit_msg_file.path).lines
|
18
|
+
end
|
19
|
+
|
20
|
+
describe "empty commit msg" do
|
21
|
+
let(:commit_msg) { "" }
|
22
|
+
it "returns empty array" do
|
23
|
+
assert_equal [], lines
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
describe "commit msg consists of all comments" do
|
28
|
+
let(:commit_msg) { "#\n#hi\n#yo\n#" }
|
29
|
+
it "returns empty array" do
|
30
|
+
assert_equal [], lines
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
describe "commit msg is one line" do
|
35
|
+
let(:commit_msg) { "foo" }
|
36
|
+
it "parses text" do
|
37
|
+
assert_equal 1, lines.size
|
38
|
+
assert_equal [1], lines.map(&:lineno)
|
39
|
+
assert_equal ["foo"], lines.map(&:text)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
describe "commit msg is one line plus comments" do
|
44
|
+
let(:commit_msg) { "foo\n#hi\n#yo\n#" }
|
45
|
+
it "parses text and ignores comments" do
|
46
|
+
assert_equal 1, lines.size
|
47
|
+
assert_equal [1], lines.map(&:lineno)
|
48
|
+
assert_equal ["foo"], lines.map(&:text)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
describe "multi-line commit msg" do
|
53
|
+
let(:commit_msg) { "a\n\nb\n#" }
|
54
|
+
it "parses text and ignores comments" do
|
55
|
+
assert_equal 3, lines.size
|
56
|
+
assert_equal [1, 2, 3], lines.map(&:lineno)
|
57
|
+
assert_equal ["a", "", "b"], lines.map(&:text)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
describe "commit msg in verbose format" do
|
62
|
+
let(:commit_msg) do
|
63
|
+
["foo", "", "#",
|
64
|
+
"# ------------------------ >8 ------------------------",
|
65
|
+
"this difftext should be ignored."
|
66
|
+
].join("\n")
|
67
|
+
end
|
68
|
+
it "ignores text after verbose marker" do
|
69
|
+
assert_equal 2, lines.size
|
70
|
+
assert_equal [1, 2], lines.map(&:lineno)
|
71
|
+
assert_equal ["foo", ""], lines.map(&:text)
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
data/test/runner_test.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
require "minitest/autorun"
|
2
|
-
require "
|
2
|
+
require "fit_commit/runner"
|
3
3
|
|
4
4
|
describe FitCommit::Runner do
|
5
5
|
after do
|
@@ -27,7 +27,7 @@ describe FitCommit::Runner do
|
|
27
27
|
|
28
28
|
describe "empty commit msg" do
|
29
29
|
let(:commit_msg) { "" }
|
30
|
-
it "
|
30
|
+
it "allows commit without printing to stdout" do
|
31
31
|
assert_equal FitCommit::Runner::EXIT_CODE_ALLOW_COMMIT, call_runner
|
32
32
|
assert stdout.read.empty?
|
33
33
|
end
|
@@ -35,7 +35,7 @@ describe FitCommit::Runner do
|
|
35
35
|
|
36
36
|
describe "commit msg consists of all comments" do
|
37
37
|
let(:commit_msg) { "\n#hi\n#yo\n#" }
|
38
|
-
it "
|
38
|
+
it "allows commit without printing to stdout" do
|
39
39
|
assert_equal FitCommit::Runner::EXIT_CODE_ALLOW_COMMIT, call_runner
|
40
40
|
assert stdout.read.empty?
|
41
41
|
end
|
@@ -43,7 +43,7 @@ describe FitCommit::Runner do
|
|
43
43
|
|
44
44
|
describe "commit msg is present but no errors" do
|
45
45
|
let(:commit_msg) { "hello\n\nhi\n#" }
|
46
|
-
it "
|
46
|
+
it "allows commit without printing to stdout" do
|
47
47
|
assert_equal FitCommit::Runner::EXIT_CODE_ALLOW_COMMIT, call_runner
|
48
48
|
assert stdout.read.empty?
|
49
49
|
end
|
@@ -56,7 +56,7 @@ describe FitCommit::Runner do
|
|
56
56
|
"this difftext should be ignored." * 3
|
57
57
|
].join("\n")
|
58
58
|
end
|
59
|
-
it "
|
59
|
+
it "allows commit without printing to stdout" do
|
60
60
|
assert_equal FitCommit::Runner::EXIT_CODE_ALLOW_COMMIT, call_runner
|
61
61
|
assert stdout.read.empty?
|
62
62
|
end
|
@@ -78,14 +78,14 @@ describe FitCommit::Runner do
|
|
78
78
|
|
79
79
|
describe "user does not force commit" do
|
80
80
|
let(:stdin) { StringIO.new("n") }
|
81
|
-
it "prints errors to stdout and
|
81
|
+
it "prints errors to stdout and rejects commit" do
|
82
82
|
assert_equal FitCommit::Runner::EXIT_CODE_REJECT_COMMIT, call_runner
|
83
83
|
assert_error_output
|
84
84
|
end
|
85
85
|
end
|
86
86
|
describe "user forces commit" do
|
87
87
|
let(:stdin) { StringIO.new("y") }
|
88
|
-
it "prints errors to stdout and
|
88
|
+
it "prints errors to stdout and allows commit" do
|
89
89
|
assert_equal FitCommit::Runner::EXIT_CODE_ALLOW_COMMIT, call_runner
|
90
90
|
assert_error_output
|
91
91
|
end
|
@@ -1,9 +1,9 @@
|
|
1
1
|
require "minitest/autorun"
|
2
|
-
require "
|
2
|
+
require "fit_commit/validators/frathouse"
|
3
3
|
|
4
4
|
describe FitCommit::Validators::Frathouse do
|
5
5
|
let(:validator) { FitCommit::Validators::Frathouse.new(commit_lines, branch_name) }
|
6
|
-
let(:commit_lines) { FitCommit::Line.
|
6
|
+
let(:commit_lines) { FitCommit::Line.from_text_array(commit_msg.split("\n")) }
|
7
7
|
|
8
8
|
describe "master branch" do
|
9
9
|
let(:branch_name) { "master" }
|
@@ -1,9 +1,9 @@
|
|
1
1
|
require "minitest/autorun"
|
2
|
-
require "
|
2
|
+
require "fit_commit/validators/line_length"
|
3
3
|
|
4
4
|
describe FitCommit::Validators::LineLength do
|
5
5
|
let(:validator) { FitCommit::Validators::LineLength.new(commit_lines, branch_name) }
|
6
|
-
let(:commit_lines) { FitCommit::Line.
|
6
|
+
let(:commit_lines) { FitCommit::Line.from_text_array(commit_msg.split("\n")) }
|
7
7
|
|
8
8
|
let(:branch_name) { "any" }
|
9
9
|
|
@@ -1,9 +1,9 @@
|
|
1
1
|
require "minitest/autorun"
|
2
|
-
require "
|
2
|
+
require "fit_commit/validators/summary_period"
|
3
3
|
|
4
4
|
describe FitCommit::Validators::SummaryPeriod do
|
5
5
|
let(:validator) { FitCommit::Validators::SummaryPeriod.new(commit_lines, branch_name) }
|
6
|
-
let(:commit_lines) { FitCommit::Line.
|
6
|
+
let(:commit_lines) { FitCommit::Line.from_text_array(commit_msg.split("\n")) }
|
7
7
|
let(:branch_name) { "any" }
|
8
8
|
|
9
9
|
describe "summary ends with period" do
|
@@ -1,9 +1,9 @@
|
|
1
1
|
require "minitest/autorun"
|
2
|
-
require "
|
2
|
+
require "fit_commit/validators/tense"
|
3
3
|
|
4
4
|
describe FitCommit::Validators::Tense do
|
5
5
|
let(:validator) { FitCommit::Validators::Tense.new(commit_lines, branch_name) }
|
6
|
-
let(:commit_lines) { FitCommit::Line.
|
6
|
+
let(:commit_lines) { FitCommit::Line.from_text_array(commit_msg.split("\n")) }
|
7
7
|
|
8
8
|
let(:branch_name) { "anybranch" }
|
9
9
|
|
data/test/validators/wip_test.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
require "minitest/autorun"
|
2
|
-
require "
|
2
|
+
require "fit_commit/validators/wip"
|
3
3
|
|
4
4
|
describe FitCommit::Validators::Wip do
|
5
5
|
let(:validator) { FitCommit::Validators::Wip.new(commit_lines, branch_name) }
|
6
|
-
let(:commit_lines) { FitCommit::Line.
|
6
|
+
let(:commit_lines) { FitCommit::Line.from_text_array(commit_msg.split("\n")) }
|
7
7
|
|
8
8
|
describe "master branch" do
|
9
9
|
let(:branch_name) { "master" }
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fit-commit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Foley
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-08-
|
11
|
+
date: 2015-08-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: swearjar
|
@@ -63,6 +63,7 @@ extra_rdoc_files:
|
|
63
63
|
- README.md
|
64
64
|
files:
|
65
65
|
- ".gitignore"
|
66
|
+
- ".rubocop.yml"
|
66
67
|
- CHANGELOG.md
|
67
68
|
- Gemfile
|
68
69
|
- LICENSE
|
@@ -70,20 +71,22 @@ files:
|
|
70
71
|
- Rakefile
|
71
72
|
- bin/fit-commit
|
72
73
|
- fit-commit.gemspec
|
73
|
-
- lib/
|
74
|
-
- lib/
|
75
|
-
- lib/
|
76
|
-
- lib/
|
77
|
-
- lib/
|
78
|
-
- lib/
|
79
|
-
- lib/
|
80
|
-
- lib/
|
81
|
-
- lib/
|
82
|
-
- lib/
|
83
|
-
- lib/
|
84
|
-
- lib/
|
85
|
-
- lib/
|
74
|
+
- lib/fit_commit.rb
|
75
|
+
- lib/fit_commit/cli.rb
|
76
|
+
- lib/fit_commit/has_errors.rb
|
77
|
+
- lib/fit_commit/installer.rb
|
78
|
+
- lib/fit_commit/line.rb
|
79
|
+
- lib/fit_commit/message_parser.rb
|
80
|
+
- lib/fit_commit/runner.rb
|
81
|
+
- lib/fit_commit/validators/base.rb
|
82
|
+
- lib/fit_commit/validators/frathouse.rb
|
83
|
+
- lib/fit_commit/validators/line_length.rb
|
84
|
+
- lib/fit_commit/validators/summary_period.rb
|
85
|
+
- lib/fit_commit/validators/tense.rb
|
86
|
+
- lib/fit_commit/validators/wip.rb
|
87
|
+
- lib/fit_commit/version.rb
|
86
88
|
- templates/hooks/commit-msg
|
89
|
+
- test/message_parser_test.rb
|
87
90
|
- test/runner_test.rb
|
88
91
|
- test/validators/frathouse_test.rb
|
89
92
|
- test/validators/line_length_test.rb
|
@@ -123,6 +126,7 @@ signing_key:
|
|
123
126
|
specification_version: 4
|
124
127
|
summary: A Git hook to validate your commit messages
|
125
128
|
test_files:
|
129
|
+
- test/message_parser_test.rb
|
126
130
|
- test/runner_test.rb
|
127
131
|
- test/validators/frathouse_test.rb
|
128
132
|
- test/validators/line_length_test.rb
|
data/lib/fit-commit/cli.rb
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
require "fit-commit/installer"
|
2
|
-
require "fit-commit/version"
|
3
|
-
|
4
|
-
module FitCommit
|
5
|
-
class Cli
|
6
|
-
attr_accessor :args
|
7
|
-
def initialize(*args)
|
8
|
-
self.args = args
|
9
|
-
end
|
10
|
-
|
11
|
-
def execute
|
12
|
-
action_name = args.shift
|
13
|
-
case action_name
|
14
|
-
when "install"
|
15
|
-
FitCommit::Installer.new.install
|
16
|
-
when "uninstall"
|
17
|
-
FitCommit::Installer.new.uninstall
|
18
|
-
else
|
19
|
-
warn "fit-commit v#{FitCommit::VERSION}"
|
20
|
-
warn "Usage: fit-commit install"
|
21
|
-
warn "Usage: fit-commit uninstall"
|
22
|
-
false
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|