overcommit 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/overcommit.rb +1 -0
- data/lib/overcommit/cli.rb +24 -10
- data/lib/overcommit/errors.rb +3 -0
- data/lib/overcommit/installer.rb +5 -2
- data/lib/overcommit/version.rb +1 -1
- metadata +19 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b5f41c5306262e275c34566f2d7973a7993c3ef5
|
4
|
+
data.tar.gz: d89300cc765a7e790c94241265dcaecb6a8f2882
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b51462c1ea6bac7cde51b99e91d6b67cd77e521cb9d78dfd909b5d743ab6d1aa7582e6c393c8bc1f148d869017c1b9041057bbcac3343833c8fd81635c03a238
|
7
|
+
data.tar.gz: abee8bd8ee6e00ad8d06bccad9c3d0a3d0d2a5b616decd98c63dd501cf141305e6a62cb8f88199b6640057368ee169f4062a482d4e08e3ad506de215ba61585a
|
data/lib/overcommit.rb
CHANGED
data/lib/overcommit/cli.rb
CHANGED
@@ -2,13 +2,16 @@ require 'optparse'
|
|
2
2
|
|
3
3
|
module Overcommit
|
4
4
|
class CLI
|
5
|
+
include ConsoleMethods
|
6
|
+
attr_reader :options
|
7
|
+
|
5
8
|
def initialize(arguments = [])
|
6
9
|
@arguments = arguments
|
7
10
|
@options = {}
|
8
11
|
end
|
9
12
|
|
10
13
|
def parse_arguments
|
11
|
-
parser = OptionParser.new do |opts|
|
14
|
+
@parser = OptionParser.new do |opts|
|
12
15
|
opts.banner = "Usage: #{opts.program_name} [options] target"
|
13
16
|
|
14
17
|
opts.on_tail('-h', '--help', 'Show this message') do
|
@@ -20,6 +23,14 @@ module Overcommit
|
|
20
23
|
exit 0
|
21
24
|
end
|
22
25
|
|
26
|
+
opts.on('-l', '--list-templates', 'List built-in templates') do
|
27
|
+
Overcommit.config.templates.each_pair do |name, configuration|
|
28
|
+
bold name
|
29
|
+
puts YAML.dump(configuration), ''
|
30
|
+
end
|
31
|
+
exit 0
|
32
|
+
end
|
33
|
+
|
23
34
|
opts.on('-a', '--all', 'Include all git hooks') do
|
24
35
|
@options[:template] = 'all'
|
25
36
|
end
|
@@ -54,40 +65,43 @@ module Overcommit
|
|
54
65
|
end
|
55
66
|
|
56
67
|
begin
|
57
|
-
parser.parse!(@arguments)
|
68
|
+
@parser.parse!(@arguments)
|
58
69
|
|
59
70
|
# Unconsumed arguments are our targets
|
60
71
|
@options[:targets] = @arguments
|
61
72
|
rescue OptionParser::InvalidOption => ex
|
62
|
-
print_help parser.help, ex
|
73
|
+
print_help @parser.help, ex
|
63
74
|
end
|
64
75
|
end
|
65
76
|
|
66
77
|
def run
|
67
78
|
if @options[:targets].nil? || @options[:targets].empty?
|
68
|
-
|
69
|
-
puts
|
70
|
-
puts " #{File.basename($0)} <target directory>"
|
79
|
+
warning 'You must supply at least one directory to install into'
|
80
|
+
puts @parser.help
|
71
81
|
exit 2
|
72
82
|
end
|
73
83
|
|
74
84
|
installer = Installer.new(@options)
|
75
85
|
|
76
86
|
@options[:targets].each do |target|
|
77
|
-
|
87
|
+
begin
|
88
|
+
installer.install(target)
|
89
|
+
rescue NotAGitRepoError => e
|
90
|
+
warning "Skipping #{target}: #{e}"
|
91
|
+
end
|
78
92
|
end
|
79
93
|
|
80
|
-
|
94
|
+
success 'Installation complete'
|
81
95
|
|
82
96
|
rescue ArgumentError => ex
|
83
|
-
|
97
|
+
error "Installation failed: #{ex}"
|
84
98
|
exit 3
|
85
99
|
end
|
86
100
|
|
87
101
|
private
|
88
102
|
|
89
103
|
def print_help(message, ex = nil)
|
90
|
-
|
104
|
+
error ex, '' if ex
|
91
105
|
puts message
|
92
106
|
exit 0
|
93
107
|
end
|
data/lib/overcommit/installer.rb
CHANGED
@@ -9,9 +9,12 @@ module Overcommit
|
|
9
9
|
|
10
10
|
def install(target)
|
11
11
|
absolute_target = File.expand_path(target)
|
12
|
-
unless File.directory?
|
12
|
+
unless File.directory? absolute_target
|
13
|
+
raise NotAGitRepoError, 'is a directory'
|
14
|
+
end
|
13
15
|
|
14
|
-
|
16
|
+
unless File.directory?(File.join(absolute_target, '.git'))
|
17
|
+
raise NotAGitRepoError, 'does not appear to be a git repository'
|
15
18
|
end
|
16
19
|
|
17
20
|
puts "Installing hooks into #{target}"
|
data/lib/overcommit/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: overcommit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Causes Engineering
|
@@ -9,8 +9,22 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
date: 2013-05-23 00:00:00.000000000 Z
|
12
|
-
dependencies:
|
13
|
-
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rspec
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
description: Overcommit is a utility to install and extend Git hooks
|
14
28
|
email: eng@causes.com
|
15
29
|
executables:
|
16
30
|
- overcommit
|
@@ -19,6 +33,7 @@ extra_rdoc_files: []
|
|
19
33
|
files:
|
20
34
|
- lib/overcommit.rb
|
21
35
|
- lib/overcommit/utils.rb
|
36
|
+
- lib/overcommit/errors.rb
|
22
37
|
- lib/overcommit/console_methods.rb
|
23
38
|
- lib/overcommit/plugins/pre_commit/scss_lint.rb
|
24
39
|
- lib/overcommit/plugins/pre_commit/causes_email.rb
|
@@ -83,6 +98,6 @@ rubyforge_project:
|
|
83
98
|
rubygems_version: 2.0.2
|
84
99
|
signing_key:
|
85
100
|
specification_version: 4
|
86
|
-
summary: Opinionated
|
101
|
+
summary: Opinionated Git hook manager
|
87
102
|
test_files: []
|
88
103
|
has_rdoc:
|