sentia_git_hooks 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 70c897e37abc0d07107f7b350ad6f25bf6839070
4
+ data.tar.gz: c9bb725d943aaeb59f8aecbe97110493a91875d2
5
+ SHA512:
6
+ metadata.gz: aa0c4e608cca9ff4e41d0a3d34cef160b54d66fac655dc7d9f69c0172232e1df4b0557a1005455102855918cfdafef1fd9a82867d2ce428998e7554cdfe03a46
7
+ data.tar.gz: 37b11be8fc6ce2536723447e4b630ea4d56d05a66f0c7307ca218a54584ce95fbcfcacbb40e231b26fabad9b4506f6144ec5be33150c66d7720e23d5383845a2
data/.gitignore ADDED
@@ -0,0 +1,10 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.gem
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/.travis.yml ADDED
@@ -0,0 +1,3 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.2.0
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in sentia_git_hooks.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Sia. S.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,4 @@
1
+ # Git hooks for enforcing various policies
2
+
3
+ ## Pre Update
4
+ - Commit message formatting
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "sentia_git_hooks"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env ruby
2
+ dir = File.expand_path "../../lib/scripts/", __FILE__
3
+
4
+ command = "cp -n #{dir + '/*'} '.git/hooks/'"
5
+
6
+ puts "Issuing command: #{command}"
7
+
8
+ `#{command}`
9
+
10
+ if $?.exitstatus == 1
11
+ puts "Success"
12
+ exit 0
13
+ else
14
+ puts "Failed"
15
+ exit 1
16
+ end
data/bin/setup ADDED
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
6
+
7
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,71 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ def arrow(args)
4
+ arrow = "===> "
5
+ if args.respond_to?(:each)
6
+ puts args.map! { |r| arrow + r }.join("\n")
7
+ else
8
+ puts arrow + args
9
+ end
10
+ end
11
+
12
+ commit_file = ARGV[0]
13
+
14
+ message = `cat #{commit_file}`
15
+
16
+ filter = /\A(\d[\d ,]+) - ([^\n]+)(\n{2,}(.+))?\z/m
17
+ # matches either
18
+ #
19
+ # "123 - Some Message"
20
+ #
21
+ # Or
22
+ #
23
+ # "123 - Some Message
24
+ #
25
+ # Definitely something here
26
+ # More optional stuff"
27
+
28
+ match = filter.match message
29
+
30
+ if match
31
+ exit 0
32
+ else
33
+ puts ""
34
+ arrow "==============================================
35
+ Enforcing Sentia Commit Message Policy
36
+ ==============================================
37
+ Fall in line soldier, correct commit format is
38
+
39
+ <id or ids> - Summary Message
40
+ o <newline>
41
+ p <Specific Message>
42
+ t <Specific Message>
43
+ i <Specific Message>
44
+ o <Specific Message>
45
+ n <Specific Message>
46
+ a <Specific Message>
47
+ l <Specific Message>
48
+
49
+ where
50
+
51
+ id = trello card/tracker issue id/number
52
+
53
+ eg
54
+
55
+ 456 - Fix user.company nilclass issue with NullCompany
56
+
57
+ or
58
+
59
+ 123 - Add archive post action
60
+
61
+ Add POST posts#archive action
62
+ Add GET posts#archived action
63
+ Add 'Archive' button to /posts/:id/edit page
64
+ Add hide archived posts from GET /posts
65
+ Add GET /posts/archived route and << views,
66
+ view styling is changed to make it obvious that
67
+ the post is archived".split("\n")
68
+ puts ""
69
+
70
+ exit 1
71
+ end
@@ -0,0 +1,5 @@
1
+ require "sentia_git_hooks/version"
2
+
3
+ module SentiaGitHooks
4
+ # Your code goes here...
5
+ end
@@ -0,0 +1,3 @@
1
+ module SentiaGitHooks
2
+ VERSION = "0.1.0"
3
+ end
@@ -0,0 +1,24 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'sentia_git_hooks/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "sentia_git_hooks"
8
+ spec.version = SentiaGitHooks::VERSION
9
+ spec.authors = ["Sia. S."]
10
+ spec.email = ["sia.s.saj@gmail.com"]
11
+
12
+ spec.summary = "Some git hooks for Sentia"
13
+ spec.description = ""
14
+ spec.homepage = "http://github.com/Sentia/git-hooks"
15
+ spec.license = "MIT"
16
+
17
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
18
+ spec.executables = ["sentia_git_hooks_install"]
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.9"
22
+ spec.add_development_dependency "rake", "~> 10.0"
23
+ spec.add_development_dependency "pry"
24
+ end
metadata ADDED
@@ -0,0 +1,101 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sentia_git_hooks
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Sia. S.
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-07-01 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.9'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.9'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: pry
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ description: ''
56
+ email:
57
+ - sia.s.saj@gmail.com
58
+ executables:
59
+ - sentia_git_hooks_install
60
+ extensions: []
61
+ extra_rdoc_files: []
62
+ files:
63
+ - ".gitignore"
64
+ - ".rspec"
65
+ - ".travis.yml"
66
+ - Gemfile
67
+ - LICENSE.txt
68
+ - README.md
69
+ - Rakefile
70
+ - bin/console
71
+ - bin/sentia_git_hooks_install
72
+ - bin/setup
73
+ - lib/scripts/commit-msg
74
+ - lib/sentia_git_hooks.rb
75
+ - lib/sentia_git_hooks/version.rb
76
+ - sentia_git_hooks.gemspec
77
+ homepage: http://github.com/Sentia/git-hooks
78
+ licenses:
79
+ - MIT
80
+ metadata: {}
81
+ post_install_message:
82
+ rdoc_options: []
83
+ require_paths:
84
+ - lib
85
+ required_ruby_version: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ required_rubygems_version: !ruby/object:Gem::Requirement
91
+ requirements:
92
+ - - ">="
93
+ - !ruby/object:Gem::Version
94
+ version: '0'
95
+ requirements: []
96
+ rubyforge_project:
97
+ rubygems_version: 2.4.5
98
+ signing_key:
99
+ specification_version: 4
100
+ summary: Some git hooks for Sentia
101
+ test_files: []