poper 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +21 -0
- data/README.md +24 -0
- data/bin/poper +6 -0
- data/lib/poper.rb +8 -0
- data/lib/poper/cli.rb +30 -0
- data/lib/poper/rule/banned.rb +12 -0
- data/lib/poper/rule/capitalization.rb +11 -0
- data/lib/poper/rule/fifty_char_summary.rb +11 -0
- data/lib/poper/rule/rule.rb +15 -0
- data/lib/poper/rule/seventy_two_char_limit.rb +11 -0
- data/lib/poper/rule/single_word.rb +11 -0
- data/lib/poper/runner.rb +41 -0
- data/lib/poper/version.rb +3 -0
- metadata +114 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: b7153ad540eeef4da3f86fd9a67254ca040bc3eb
|
4
|
+
data.tar.gz: 71a62ce9a84843f339e2a80d5fc925193252626d
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 26e4417bd8841090135832e04e8162c896f7d25e8b92c088dc5843e346d56277af3adba03fbd7f2e797f092cd207953aae65d61e460a6d5b6cf387c93489bea7
|
7
|
+
data.tar.gz: 9fa2595e63b97637797c83f1553270c437f8492946173496b1fd70e7ad76cfdd7b8062dff7625f135832a09b61083fa2540a0682bcf42179b34a302d5e950b9c
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2013 Mindaugas Mozūras
|
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,24 @@
|
|
1
|
+
# Poper
|
2
|
+
|
3
|
+
Poper makes sure that your git commit messages are well-formed
|
4
|
+
|
5
|
+
[![Code Climate](https://codeclimate.com/github/mmozuras/poper.png)](https://codeclimate.com/github/mmozuras/poper)
|
6
|
+
[![Build Status](https://travis-ci.org/mmozuras/poper.png)](https://travis-ci.org/mmozuras/poper)
|
7
|
+
[![Dependency Status](https://gemnasium.com/mmozuras/poper.png)](https://gemnasium.com/mmozuras/poper)
|
8
|
+
|
9
|
+
## Usage
|
10
|
+
|
11
|
+
Poper is partly inspired by an [article](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html) written by [tpope](https://twitter.com/tpope). That's where the name comes from actually. Rules from the article form the basis of [Poper rules](https://github.com/mmozuras/poper/tree/master/lib/poper/rule).
|
12
|
+
|
13
|
+
![Poper demo](poper.gif "")
|
14
|
+
|
15
|
+
Install Poper like any other gem and then run it from your terminal, specifying
|
16
|
+
a commit:
|
17
|
+
|
18
|
+
```bash
|
19
|
+
gem install poper
|
20
|
+
cd /repo/which/commits/you/want/to/check
|
21
|
+
poper run 86ae550
|
22
|
+
```
|
23
|
+
|
24
|
+
Every commit between current HEAD and specified commit will be checked.
|
data/bin/poper
ADDED
data/lib/poper.rb
ADDED
data/lib/poper/cli.rb
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'thor'
|
2
|
+
|
3
|
+
module Poper
|
4
|
+
class CLI < Thor
|
5
|
+
require 'poper'
|
6
|
+
require 'poper/version'
|
7
|
+
|
8
|
+
class << self
|
9
|
+
def is_thor_reserved_word?(word, type)
|
10
|
+
return false if word == 'run'
|
11
|
+
super
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
desc 'run COMMIT', 'Run Poper, checking commits from HEAD to it'
|
16
|
+
|
17
|
+
def run(commit)
|
18
|
+
Runner.new(commit).run.each do |message|
|
19
|
+
puts "#{message.commit[0..6]}: #{message.message}"
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
desc 'version', 'Show the Poper version'
|
24
|
+
map %w(-v --version) => :version
|
25
|
+
|
26
|
+
def version
|
27
|
+
puts "Poper version #{::Poper::VERSION}"
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
module Poper
|
2
|
+
module Rule
|
3
|
+
class Banned < Rule
|
4
|
+
MSG = 'Consider writing a more detailed commit summary'
|
5
|
+
BANNED = %w(fix fixed oops todo fixme commit changes hmm hmmm quickfix)
|
6
|
+
|
7
|
+
def check(message)
|
8
|
+
MSG if BANNED.include?(message.lines.first.strip.downcase)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
data/lib/poper/runner.rb
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
require 'ostruct'
|
2
|
+
|
3
|
+
module Poper
|
4
|
+
class Runner
|
5
|
+
def initialize(commit, repo_path = '.')
|
6
|
+
@repo = Rugged::Repository.new(repo_path)
|
7
|
+
@commit = @repo.lookup(commit)
|
8
|
+
end
|
9
|
+
|
10
|
+
def run
|
11
|
+
commits.map { |c| check(c) }
|
12
|
+
.flatten
|
13
|
+
.compact
|
14
|
+
end
|
15
|
+
|
16
|
+
private
|
17
|
+
|
18
|
+
def check(commit)
|
19
|
+
rules.map do |rule|
|
20
|
+
result = rule.check(commit.message)
|
21
|
+
OpenStruct.new(commit: commit.oid, message: result) if result
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def rules
|
26
|
+
Rule::Rule.all.map { |rule| rule.new }
|
27
|
+
end
|
28
|
+
|
29
|
+
def commits
|
30
|
+
@commits ||= begin
|
31
|
+
walker.reset
|
32
|
+
walker.push(@repo.last_commit)
|
33
|
+
walker.take_while { |c| c.oid != @commit.oid } << @commit
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
def walker
|
38
|
+
@walker ||= Rugged::Walker.new(@repo)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
metadata
ADDED
@@ -0,0 +1,114 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: poper
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Mindaugas Mozūras
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-10-16 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rugged
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.19.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.19.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: thor
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.18.0
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 0.18.0
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ~>
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 10.1.0
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 10.1.0
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 2.14.0
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ~>
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 2.14.0
|
69
|
+
description:
|
70
|
+
email: mindaugas.mozuras@gmail.com
|
71
|
+
executables:
|
72
|
+
- poper
|
73
|
+
extensions: []
|
74
|
+
extra_rdoc_files: []
|
75
|
+
files:
|
76
|
+
- lib/poper/cli.rb
|
77
|
+
- lib/poper/rule/banned.rb
|
78
|
+
- lib/poper/rule/capitalization.rb
|
79
|
+
- lib/poper/rule/fifty_char_summary.rb
|
80
|
+
- lib/poper/rule/rule.rb
|
81
|
+
- lib/poper/rule/seventy_two_char_limit.rb
|
82
|
+
- lib/poper/rule/single_word.rb
|
83
|
+
- lib/poper/runner.rb
|
84
|
+
- lib/poper/version.rb
|
85
|
+
- lib/poper.rb
|
86
|
+
- LICENSE
|
87
|
+
- README.md
|
88
|
+
- bin/poper
|
89
|
+
homepage: http://github.org/mmozuras/poper
|
90
|
+
licenses:
|
91
|
+
- MIT
|
92
|
+
metadata: {}
|
93
|
+
post_install_message:
|
94
|
+
rdoc_options: []
|
95
|
+
require_paths:
|
96
|
+
- lib
|
97
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
98
|
+
requirements:
|
99
|
+
- - '>='
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: '0'
|
102
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
103
|
+
requirements:
|
104
|
+
- - '>='
|
105
|
+
- !ruby/object:Gem::Version
|
106
|
+
version: 1.3.6
|
107
|
+
requirements: []
|
108
|
+
rubyforge_project:
|
109
|
+
rubygems_version: 2.0.7
|
110
|
+
signing_key:
|
111
|
+
specification_version: 4
|
112
|
+
summary: Poper makes sure that your git commit messages are well-formed
|
113
|
+
test_files: []
|
114
|
+
has_rdoc:
|