overcommit 0.1.0

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.
Files changed (45) hide show
  1. checksums.yaml +7 -0
  2. data/bin/hooks/commit-msg +8 -0
  3. data/bin/hooks/post-checkout +8 -0
  4. data/bin/hooks/post-merge +23 -0
  5. data/bin/hooks/pre-commit +8 -0
  6. data/bin/hooks/prepare-commit-msg +160 -0
  7. data/bin/overcommit +11 -0
  8. data/bin/run-hook +8 -0
  9. data/bin/scripts/csslint-rhino.js +9080 -0
  10. data/bin/scripts/gerrit-change-id +174 -0
  11. data/bin/scripts/index-tags +19 -0
  12. data/bin/scripts/jshint.js +5921 -0
  13. data/bin/scripts/jshint_runner.js +48 -0
  14. data/config/templates.yml +12 -0
  15. data/lib/overcommit.rb +8 -0
  16. data/lib/overcommit/cli.rb +95 -0
  17. data/lib/overcommit/configuration.rb +58 -0
  18. data/lib/overcommit/console_methods.rb +23 -0
  19. data/lib/overcommit/git_hook.rb +50 -0
  20. data/lib/overcommit/hook_specific_check.rb +81 -0
  21. data/lib/overcommit/hooks/commit_msg.rb +7 -0
  22. data/lib/overcommit/hooks/pre_commit.rb +9 -0
  23. data/lib/overcommit/installer.rb +59 -0
  24. data/lib/overcommit/plugins/commit_msg/change_id.rb +14 -0
  25. data/lib/overcommit/plugins/commit_msg/release_note.rb +14 -0
  26. data/lib/overcommit/plugins/commit_msg/russian_novel.rb +16 -0
  27. data/lib/overcommit/plugins/commit_msg/text_width.rb +20 -0
  28. data/lib/overcommit/plugins/commit_msg/trailing_period.rb +13 -0
  29. data/lib/overcommit/plugins/pre_commit/author_name.rb +16 -0
  30. data/lib/overcommit/plugins/pre_commit/causes_email.rb +15 -0
  31. data/lib/overcommit/plugins/pre_commit/css_linter.rb +17 -0
  32. data/lib/overcommit/plugins/pre_commit/erb_syntax.rb +21 -0
  33. data/lib/overcommit/plugins/pre_commit/haml_syntax.rb +23 -0
  34. data/lib/overcommit/plugins/pre_commit/js_console_log.rb +16 -0
  35. data/lib/overcommit/plugins/pre_commit/js_syntax.rb +18 -0
  36. data/lib/overcommit/plugins/pre_commit/restricted_paths.rb +15 -0
  37. data/lib/overcommit/plugins/pre_commit/ruby_syntax.rb +19 -0
  38. data/lib/overcommit/plugins/pre_commit/scss_lint.rb +20 -0
  39. data/lib/overcommit/plugins/pre_commit/test_history.rb +58 -0
  40. data/lib/overcommit/plugins/pre_commit/whitespace.rb +19 -0
  41. data/lib/overcommit/plugins/pre_commit/yaml_syntax.rb +22 -0
  42. data/lib/overcommit/reporter.rb +80 -0
  43. data/lib/overcommit/utils.rb +60 -0
  44. data/lib/overcommit/version.rb +3 -0
  45. metadata +88 -0
@@ -0,0 +1,60 @@
1
+ module Overcommit
2
+ module Utils
3
+ class << self
4
+ include ConsoleMethods
5
+
6
+ @@hooks = []
7
+
8
+ def register_hook(hook)
9
+ @@hooks << hook
10
+ end
11
+
12
+ def run_hooks(*args)
13
+ @@hooks.each { |hook| hook.new.run(*args) }
14
+ end
15
+
16
+ def hook_name
17
+ File.basename($0).tr('-', '_')
18
+ end
19
+
20
+ def load_hooks
21
+ require File.expand_path("../hooks/#{hook_name}", __FILE__)
22
+ rescue LoadError
23
+ error "No hook definition found for #{hook_name}"
24
+ exit 1
25
+ end
26
+
27
+ def script_path(script)
28
+ File.join(File.expand_path('../../hooks/scripts', $0), script)
29
+ end
30
+
31
+ def absolute_path(path)
32
+ File.join(File.expand_path('../../..', __FILE__), path)
33
+ end
34
+
35
+ # File.expand_path takes one more '..' than you're used to... we want to
36
+ # go two directories up from the caller (which will be .git/hooks/something)
37
+ # to the root of the git repo.
38
+ def repo_path(path)
39
+ File.join(File.expand_path('../../..', $0), path)
40
+ end
41
+
42
+ # Shamelessly stolen from:
43
+ # http://stackoverflow.com/questions/1509915/converting-camel-case-to-underscore-case-in-ruby
44
+ def underscorize(str)
45
+ str.gsub(/::/, '/').
46
+ gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2').
47
+ gsub(/([a-z\d])([A-Z])/, '\1_\2').
48
+ tr('-', '_').
49
+ downcase
50
+ end
51
+
52
+ # Get a list of staged Added, Copied, or Modified files (ignore renames
53
+ # and deletions, since there should be nothing to check).
54
+ def modified_files
55
+ @modified_files ||=
56
+ `git diff --cached --name-only --diff-filter=ACM`.split "\n"
57
+ end
58
+ end
59
+ end
60
+ end
@@ -0,0 +1,3 @@
1
+ module Overcommit
2
+ VERSION = '0.1.0'
3
+ end
metadata ADDED
@@ -0,0 +1,88 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: overcommit
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Causes Engineering
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-05-23 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Overcommit is a utility to install and extend git hooks
14
+ email: eng@causes.com
15
+ executables:
16
+ - overcommit
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - lib/overcommit.rb
21
+ - lib/overcommit/utils.rb
22
+ - lib/overcommit/console_methods.rb
23
+ - lib/overcommit/plugins/pre_commit/scss_lint.rb
24
+ - lib/overcommit/plugins/pre_commit/causes_email.rb
25
+ - lib/overcommit/plugins/pre_commit/ruby_syntax.rb
26
+ - lib/overcommit/plugins/pre_commit/haml_syntax.rb
27
+ - lib/overcommit/plugins/pre_commit/test_history.rb
28
+ - lib/overcommit/plugins/pre_commit/yaml_syntax.rb
29
+ - lib/overcommit/plugins/pre_commit/restricted_paths.rb
30
+ - lib/overcommit/plugins/pre_commit/js_console_log.rb
31
+ - lib/overcommit/plugins/pre_commit/js_syntax.rb
32
+ - lib/overcommit/plugins/pre_commit/author_name.rb
33
+ - lib/overcommit/plugins/pre_commit/whitespace.rb
34
+ - lib/overcommit/plugins/pre_commit/css_linter.rb
35
+ - lib/overcommit/plugins/pre_commit/erb_syntax.rb
36
+ - lib/overcommit/plugins/commit_msg/text_width.rb
37
+ - lib/overcommit/plugins/commit_msg/trailing_period.rb
38
+ - lib/overcommit/plugins/commit_msg/release_note.rb
39
+ - lib/overcommit/plugins/commit_msg/russian_novel.rb
40
+ - lib/overcommit/plugins/commit_msg/change_id.rb
41
+ - lib/overcommit/reporter.rb
42
+ - lib/overcommit/git_hook.rb
43
+ - lib/overcommit/hook_specific_check.rb
44
+ - lib/overcommit/hooks/commit_msg.rb
45
+ - lib/overcommit/hooks/pre_commit.rb
46
+ - lib/overcommit/configuration.rb
47
+ - lib/overcommit/installer.rb
48
+ - lib/overcommit/cli.rb
49
+ - lib/overcommit/version.rb
50
+ - bin/scripts/jshint.js
51
+ - bin/scripts/gerrit-change-id
52
+ - bin/scripts/jshint_runner.js
53
+ - bin/scripts/index-tags
54
+ - bin/scripts/csslint-rhino.js
55
+ - bin/hooks/pre-commit
56
+ - bin/hooks/commit-msg
57
+ - bin/hooks/prepare-commit-msg
58
+ - bin/hooks/post-checkout
59
+ - bin/hooks/post-merge
60
+ - bin/overcommit
61
+ - bin/run-hook
62
+ - config/templates.yml
63
+ homepage: http://github.com/causes/overcommit
64
+ licenses:
65
+ - MIT
66
+ metadata: {}
67
+ post_install_message:
68
+ rdoc_options: []
69
+ require_paths:
70
+ - lib
71
+ required_ruby_version: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ required_rubygems_version: !ruby/object:Gem::Requirement
77
+ requirements:
78
+ - - '>='
79
+ - !ruby/object:Gem::Version
80
+ version: '0'
81
+ requirements: []
82
+ rubyforge_project:
83
+ rubygems_version: 2.0.2
84
+ signing_key:
85
+ specification_version: 4
86
+ summary: Opinionated git hook manager
87
+ test_files: []
88
+ has_rdoc: