gglog 0.0.1

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.
data/.gitignore ADDED
@@ -0,0 +1,4 @@
1
+ *.gem
2
+ .bundle
3
+ pkg/*
4
+ *.*.swp
data/CHANGELOG ADDED
@@ -0,0 +1,3 @@
1
+ ## 0.0.1 (2012-11-06)
2
+
3
+ * first release
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in gglog.gemspec
4
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,63 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ gglog (0.0.1)
5
+ bundler (>= 1.2)
6
+ pager
7
+ rainbow
8
+ rroonga (>= 2.0.6)
9
+ rugged (>= 0.16.0)
10
+ thor (>= 0.16.0)
11
+
12
+ GEM
13
+ remote: http://rubygems.org/
14
+ specs:
15
+ archive-zip (0.5.0)
16
+ io-like (>= 0.3.0)
17
+ aruba (0.5.0)
18
+ childprocess (= 0.2.3)
19
+ cucumber (>= 1.1.1)
20
+ ffi (>= 1.0.11)
21
+ rspec-expectations (>= 2.7.0)
22
+ builder (3.0.4)
23
+ childprocess (0.2.3)
24
+ ffi (~> 1.0.6)
25
+ cucumber (1.2.1)
26
+ builder (>= 2.1.2)
27
+ diff-lcs (>= 1.1.3)
28
+ gherkin (~> 2.11.0)
29
+ json (>= 1.4.6)
30
+ diff-lcs (1.1.3)
31
+ ffi (1.0.11)
32
+ gherkin (2.11.1)
33
+ json (>= 1.4.6)
34
+ io-like (0.3.0)
35
+ json (1.7.5)
36
+ pager (1.0.1)
37
+ pkg-config (1.1.4)
38
+ rainbow (1.1.4)
39
+ rake (0.9.2.2)
40
+ rroonga (2.0.6)
41
+ archive-zip
42
+ json
43
+ pkg-config
44
+ rspec (2.11.0)
45
+ rspec-core (~> 2.11.0)
46
+ rspec-expectations (~> 2.11.0)
47
+ rspec-mocks (~> 2.11.0)
48
+ rspec-core (2.11.1)
49
+ rspec-expectations (2.11.3)
50
+ diff-lcs (~> 1.1.3)
51
+ rspec-mocks (2.11.3)
52
+ rugged (0.16.0)
53
+ thor (0.16.0)
54
+
55
+ PLATFORMS
56
+ ruby
57
+
58
+ DEPENDENCIES
59
+ aruba
60
+ cucumber
61
+ gglog!
62
+ rake
63
+ rspec
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2012 Koji Shimada
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ 'Software'), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,68 @@
1
+ # gglog
2
+
3
+ gglog is your partner for finding a good commit message.
4
+
5
+ ## Motivation
6
+
7
+ (Japanese version only)
8
+
9
+ >「コミットメッセージに悩んだときに、いろんなリポジトリを横断してコミットメッセージを眺めることができたらいいな」
10
+
11
+ 「分かりやすいコミットメッセージを書く」ことは、[ソフトウェア開発で大切にしなくてはならないことの一つ](http://www.clear-code.com/blog/2012/2/21.html)です。
12
+
13
+ けれど、英語で自分が書いた変更を簡潔に表現することは、なかなか簡単にはできなかったりします。
14
+
15
+ ぼくもコミットメッセージを書く際に英語の表現で悩むことの多い一人で、そんなときには、手元にあるプロジェクトやウォッチしているプロジェクトのログを眺めて、似たような変更や作業のコミットがないかを探して、そのコミットメッセージを参考にしていました。
16
+
17
+ ですが、色んなリポジトリを辿ってコミットログを眺めるのはあまり効率的な作業ではなく、簡単にいろんなリポジトリを横断してコミットメッセージを眺めることをできるようにしたいと思っていたので、このツールを作りました。
18
+
19
+ - 参考: [ククログ - コミットメッセージの書き方](http://www.clear-code.com/blog/2012/2/21.html)
20
+
21
+ ## Requirements
22
+
23
+ - [Ruby](http://www.ruby-lang.org/) (1.9.3 or later)
24
+
25
+ ## Installation
26
+
27
+ % gem install gglog
28
+
29
+ ## Usage
30
+
31
+ Register github projects to your seaech targets:
32
+
33
+ % gglog register https://github.com/rails/rails.git
34
+
35
+ Search the text related to the contents which commit:
36
+
37
+ % gglog search "Work on"
38
+ Add support for Object#in? and Object#either? in Active Support [# ... rails 635d991683c439da56fa72853880e88e6ac291ed
39
+ Add support for bare ActiveSupport via config.active_support.bare rails 39034997d1bd1fbaf33ddf1d6e3996b3c298a409
40
+ ...
41
+
42
+ Show detail if you need:
43
+
44
+ % gglog show rails 635d991683c439da56fa72853880e88e6ac291ed
45
+
46
+ Add support for Object#in? and Object#either? in Active Support [#6321 state:committed]
47
+
48
+ This will allow you to check if an object is included in another object
49
+ or the list of objects or not.
50
+ ...
51
+
52
+ Make registered projects follow origin/master and re-index.
53
+
54
+ % gglog sync
55
+
56
+ ## For Vim user
57
+
58
+ I recommend you to use gglog in combination with [Clam.vim](https://github.com/sjl/clam.vim).
59
+
60
+ ## Todo
61
+
62
+ - Improve commit message filter
63
+ - Add diff to result of 'show'
64
+ - Translate Motivation section to English
65
+
66
+ ---
67
+
68
+ © 2012 Koji Shimada, released under the MIT license
data/Rakefile ADDED
@@ -0,0 +1,17 @@
1
+ require 'bundler'
2
+ Bundler::GemHelper.install_tasks
3
+
4
+ require "rspec/core/rake_task"
5
+ require 'cucumber'
6
+ require 'cucumber/rake/task'
7
+
8
+ desc "Run all specs"
9
+ RSpec::Core::RakeTask.new(:spec) do |t|
10
+ t.verbose = true
11
+ end
12
+
13
+ Cucumber::Rake::Task.new(:cucumber) do |t|
14
+ t.cucumber_opts = "features --format pretty"
15
+ end
16
+
17
+ task :default => [:spec, :cucumber]
data/bin/gglog ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ lib = File.expand_path(File.dirname(__FILE__) + '/../lib')
4
+ $LOAD_PATH.unshift(lib) if File.directory?(lib) && !$LOAD_PATH.include?(lib)
5
+
6
+ require 'gglog'
7
+
8
+ Gglog::Command.start
@@ -0,0 +1,9 @@
1
+ #language: ja
2
+ フィーチャ: 登録しているGitリポジトリを確認したい
3
+
4
+ シナリオ: 登録済みのGitリポジトリを一覧できること
5
+ 前提 以下のGitリポジトリが登録されている:
6
+ | URL |
7
+ | https://github.com/snoozer05/gglog.git |
8
+ もし list サブコマンドを実行する
9
+ ならば 一覧に"gglog"が含まれていること
@@ -0,0 +1,6 @@
1
+ #language: ja
2
+ フィーチャ: コミットメッセージに興味のあるGitリポジトリを登録したい
3
+
4
+ シナリオ: Gitリポジトリを登録できること
5
+ もし Gitリポジトリ"https://github.com/snoozer05/gglog.git"を登録する
6
+ ならば 登録リポジトリに"gglog"が追加されていること
@@ -0,0 +1,9 @@
1
+ #language: ja
2
+ フィーチャ: 登録しているGitリポジトリのコミットメッセージを検索したい
3
+
4
+ シナリオ: 登録済みのGitリポジトリに含まれるコミットメッセージを検索できること
5
+ 前提 以下のGitリポジトリが登録されている:
6
+ | URL |
7
+ | https://github.com/snoozer05/gglog.git |
8
+ もし キーワード".gitignore"で検索を行なう
9
+ ならば 検索結果にコミットメッセージ"Add .gitignore"が含まれていること
@@ -0,0 +1,9 @@
1
+ #language: ja
2
+ フィーチャ: 登録しているGitリポジトリのコミットメッセージの詳細を閲覧したい
3
+
4
+ シナリオ: 登録済みのGitリポジトリに含まれるコミットメッセージの詳細を確認できること
5
+ 前提 以下のGitリポジトリが登録されている:
6
+ | URL |
7
+ | https://github.com/snoozer05/gglog.git |
8
+ もし "gglog a36acabd9495b4cf435752553a8524d9715bc5d9"のコミットメッセージの表示を行なう
9
+ ならば 詳細表示に"Add .gitignore"が含まれていること
@@ -0,0 +1,39 @@
1
+ #coding: utf-8
2
+ 前提 /^以下のGitリポジトリが登録されている:$/ do |table|
3
+ command = Gglog::Command.new([], {"gglog-home" => @gglog_home})
4
+ table.hashes.each do |row|
5
+ command.register(row['URL'])
6
+ end
7
+ end
8
+
9
+ もし /^キーワード"(.*?)"で検索を行なう$/ do |keyword|
10
+ run_simple("gglog search #{unescape(keyword)} -h #{@gglog_home}", false)
11
+ end
12
+
13
+ もし /^list サブコマンドを実行する$/ do
14
+ run_simple("gglog list -h #{@gglog_home}", false)
15
+ end
16
+
17
+ もし /^"(.*?)"のコミットメッセージの表示を行なう$/ do |repository_name_and_sha|
18
+ run_simple("gglog show #{unescape(repository_name_and_sha)} -h #{@gglog_home}", false)
19
+ end
20
+
21
+ もし /^Gitリポジトリ"(.*?)"を登録する$/ do |url|
22
+ run_simple("gglog register #{unescape(url)} -h #{@gglog_home}", false)
23
+ end
24
+
25
+ ならば /^検索結果にコミットメッセージ"(.*?)"が含まれていること$/ do |expected|
26
+ assert_partial_output(expected, all_output)
27
+ end
28
+
29
+ ならば /^一覧に"(.*?)"が含まれていること$/ do |expected|
30
+ assert_partial_output(expected, all_output)
31
+ end
32
+
33
+ ならば /^詳細表示に"(.*?)"が含まれていること$/ do |expected|
34
+ assert_partial_output(expected, all_output)
35
+ end
36
+
37
+ ならば /^登録リポジトリに"(.*?)"が追加されていること$/ do |expected|
38
+ Dir["#{@gglog_home}/repositories/*"].include?("#{@gglog_home}/repositories/#{expected}")
39
+ end
@@ -0,0 +1,10 @@
1
+ #coding: utf-8
2
+ $LOAD_PATH.unshift(File.dirname(__FILE__) + '/../../lib')
3
+ require 'aruba/cucumber'
4
+ require 'gglog'
5
+ require 'tmpdir'
6
+
7
+ Before do
8
+ @gglog_home = Dir.mktmpdir
9
+ @aruba_timeout_seconds = 10
10
+ end
data/gglog.gemspec ADDED
@@ -0,0 +1,34 @@
1
+ # coding: utf-8
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "gglog/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "gglog"
7
+ s.version = Gglog::VERSION
8
+ s.authors = ["SHIMADA Koji"]
9
+ s.email = ["koji.shimada@enishi-tech.com"]
10
+ s.homepage = "http://gglog.github.com/"
11
+ s.summary = %q{Your partner for finding a good commit message.}
12
+ s.description = %q{Your partner for finding a good commit message.}
13
+
14
+ s.rubyforge_project = "gglog"
15
+
16
+ s.files = `git ls-files`.split("\n")
17
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
+ s.require_paths = ["lib"]
20
+
21
+ s.required_ruby_version = '>= 1.9.3'
22
+
23
+ s.add_runtime_dependency 'thor', ['>= 0.16.0']
24
+ s.add_runtime_dependency 'bundler', ['>= 1.2']
25
+ s.add_runtime_dependency 'rroonga', ['>= 2.0.6']
26
+ s.add_runtime_dependency 'rugged', ['>= 0.16.0']
27
+ s.add_runtime_dependency 'rainbow'
28
+ s.add_runtime_dependency 'pager'
29
+
30
+ s.add_development_dependency 'rake'
31
+ s.add_development_dependency 'rspec'
32
+ s.add_development_dependency 'cucumber'
33
+ s.add_development_dependency 'aruba'
34
+ end
data/lib/gglog.rb ADDED
@@ -0,0 +1,5 @@
1
+ #coding: utf-8
2
+ require "Gglog/command"
3
+
4
+ module Gglog
5
+ end
@@ -0,0 +1,116 @@
1
+ #coding: utf-8
2
+ require 'thor'
3
+ require 'rugged'
4
+ require 'pager'
5
+ require 'gglog/database'
6
+ require 'gglog/repository'
7
+ require 'gglog/commit_message_decorator'
8
+
9
+ module Gglog
10
+ class Command < Thor
11
+ include Pager
12
+
13
+ class_option "gglog-home", type: :string, aliases: "-h"
14
+
15
+ def initialize(*args)
16
+ super
17
+ @dot_gglog = options["gglog-home"] if options["gglog-home"]
18
+ end
19
+
20
+ desc 'register [CLONE URL]', 'Register git repository on clone url to gglog target'
21
+ def register(clone_url)
22
+ repository_name = File.basename(clone_url, '.git')
23
+ registration_path = repository_path(repository_name)
24
+ repository = Repository.checkout(clone_url, registration_path)
25
+
26
+ setup_database unless File.exists?(db_home)
27
+ Gglog::Database.open(db_home, 'utf-8') do |db|
28
+ repository.commit_messages.each do |commit_message|
29
+ db.add_commit_message(commit_message)
30
+ end
31
+ end
32
+ end
33
+
34
+ desc 'list', 'List git repositories of gglog target'
35
+ def list
36
+ registered_repositories.each do |repository|
37
+ say repository.name
38
+ end
39
+ end
40
+
41
+ desc 'search [WORDS]', 'Search commit message'
42
+ def search(words)
43
+ commit_messages = []
44
+
45
+ setup_database unless File.exists?(db_home)
46
+ Gglog::Database.open(db_home, 'utf-8') do |db|
47
+ commit_messages = db.search(words).map do |cm|
48
+ cm.extend CommitMessageDecorator
49
+ end
50
+ end
51
+
52
+ page
53
+ commit_messages.each do |commit_message|
54
+ say commit_message.display
55
+ end
56
+ end
57
+
58
+ desc 'show [REPOSITORY_NAME] [SHA]', 'Show commit message'
59
+ def show(repository_name, sha)
60
+ repository = Repository.new(repository_path(repository_name))
61
+ commit_message = repository.commit_message(sha).tap do |cm|
62
+ cm.extend CommitMessageDecorator
63
+ end
64
+
65
+ page
66
+ say commit_message.display_detail
67
+ end
68
+
69
+ desc 'sync', 'Sync git repositories of gglog target'
70
+ def sync
71
+ registered_repositories.each do |repository|
72
+ repository.pull
73
+ end
74
+
75
+ setup_database unless File.exists?(db_home)
76
+ Gglog::Database.open(db_home, 'utf-8') do |db|
77
+ db.recreate
78
+ registered_repositories.each do |repository|
79
+ repository.commit_messages.each do |commit_message|
80
+ db.add_commit_message(commit_message)
81
+ end
82
+ end
83
+ end
84
+ end
85
+
86
+ private
87
+ def dot_gglog
88
+ @dot_gglog ||= File.expand_path("~/.gglog")
89
+ end
90
+
91
+ def registered_repositories_path
92
+ File.join(dot_gglog, "repositories")
93
+ end
94
+
95
+ def repository_path(name)
96
+ File.join(registered_repositories_path, name)
97
+ end
98
+
99
+ def db_home
100
+ File.join(dot_gglog, "db")
101
+ end
102
+
103
+ def registered_repositories
104
+ Dir[File.join(registered_repositories_path, "*")].map do |path|
105
+ Repository.new(path)
106
+ end
107
+ end
108
+
109
+ def setup_database
110
+ FileUtils.mkdir_p(db_home)
111
+ Gglog::Database.open(db_home, 'utf-8') do |db|
112
+ db.recreate
113
+ end
114
+ end
115
+ end
116
+ end
@@ -0,0 +1,31 @@
1
+ #coding: utf-8
2
+ module Gglog
3
+ class CommitMessage
4
+ class << self
5
+ def new_from_commit_object(commit, repository_name)
6
+ first_line, _, body = commit.message.split("\n", 3)
7
+ self.new(first_line, body, repository_name, commit.oid)
8
+ end
9
+
10
+ def new_from_record(commit_message)
11
+ self.new(commit_message.first_line, commit_message.body,
12
+ commit_message.repository, commit_message.sha)
13
+ end
14
+ end
15
+ attr_reader :first_line, :body
16
+ attr_reader :repository, :sha
17
+ attr_accessor :first_line_included_snippet
18
+
19
+ def initialize(first_line, body, repository, sha)
20
+ @first_line = first_line || ""
21
+ @body = body || ""
22
+ @repository = repository || ""
23
+ @sha = sha || ""
24
+
25
+ @first_line = @first_line.force_encoding('UTF-8')
26
+ @body = @body.force_encoding('UTF-8')
27
+ @repository = @repository.force_encoding('utf-8')
28
+ @sha = @sha.force_encoding('utf-8')
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,29 @@
1
+ #coding: utf-8
2
+ require 'rainbow'
3
+
4
+ module Gglog
5
+ module CommitMessageDecorator
6
+ def display
7
+ first_line_display_width = 70
8
+ if string_display_width(first_line) < first_line_display_width
9
+ body = sprintf("%-#{first_line_display_width}s", first_line)
10
+ else
11
+ body = first_line[0..(first_line_display_width-5)]+" ..."
12
+ end
13
+ prefix = sprintf("%50s", "#{File.basename(repository)} #{sha}".color("333333"))
14
+ " #{body} #{prefix}"
15
+ end
16
+
17
+ def display_detail
18
+ "\n#{first_line.bright}\n\n#{body}\n\n"
19
+ end
20
+
21
+ def string_display_width(string)
22
+ string.each_char.map{|char| char_display_width(char) }.inject(0, &:+)
23
+ end
24
+
25
+ def char_display_width(char)
26
+ char.bytesize == 1 ? 1 : 2
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,127 @@
1
+ #coding: utf-8
2
+ require 'groonga'
3
+
4
+ module Gglog
5
+ class Database
6
+ class << self
7
+ def open(base_path, encoding, &blk)
8
+ if blk
9
+ Database.new.open(base_path, encoding, &blk)
10
+ else
11
+ Database.new.open(base_path, encoding)
12
+ end
13
+ end
14
+ end
15
+
16
+ def initilize
17
+ @database = nil
18
+ end
19
+
20
+ def open(base_path, encoding)
21
+ reset_groonga_context(encoding)
22
+ open_groonga_db(base_path)
23
+ if block_given?
24
+ begin
25
+ yield(self)
26
+ ensure
27
+ close
28
+ end
29
+ end
30
+ end
31
+
32
+ def close
33
+ close_groonga_db
34
+ end
35
+
36
+ def search(words)
37
+ records_selected = Groonga["commit_messages"].select do |record|
38
+ conditions = [record.first_line =~ words]
39
+ end
40
+ records = records_selected.sort([
41
+ { key: "_score", order: 'descending' },
42
+ { key: "repository", order: 'ascending' },
43
+ { key: "first_line", order: 'ascending' }
44
+ ])
45
+ filtered_records = filter_records(records)
46
+ convert_records_to_commit_messages(filtered_records)
47
+ end
48
+
49
+ def recreate
50
+ remove_tables
51
+ create_tables
52
+ end
53
+
54
+ def add_commit_message(commit_message)
55
+ Groonga["commit_messages"].add(
56
+ first_line: commit_message.first_line,
57
+ body: commit_message.body,
58
+ repository: commit_message.repository,
59
+ sha: commit_message.sha
60
+ )
61
+ end
62
+
63
+ private
64
+ def open_groonga_db(base_path)
65
+ close
66
+ path = File.join(base_path, "gglog.db")
67
+ if File.exist?(path)
68
+ @database =Groonga::Database.open(path)
69
+ else
70
+ FileUtils.mkdir_p(base_path)
71
+ @database =Groonga::Database.create(:path => path)
72
+ end
73
+ end
74
+
75
+ def close_groonga_db
76
+ unless @database.nil?
77
+ @database.close unless @database.closed?
78
+ @database = nil
79
+ end
80
+ end
81
+
82
+ def reset_groonga_context(encoding)
83
+ Groonga::Context.default_options = { encoding: encoding }
84
+ Groonga::Context.default = nil
85
+ end
86
+
87
+ def create_tables
88
+ Groonga::Schema.define do |schema|
89
+ schema.create_table("commit_messages") do |table|
90
+ table.short_text("first_line")
91
+ table.text("body")
92
+ table.short_text("repository")
93
+ table.short_text("sha")
94
+ end
95
+ schema.create_table("terms",
96
+ type: :patricia_trie,
97
+ key_normalize: true,
98
+ default_tokenizer: "TokenBigram"
99
+ ) do |table|
100
+ table.index("commit_messages.first_line")
101
+ end
102
+ end
103
+ end
104
+
105
+ def remove_tables
106
+ Groonga::Schema.define do |schema|
107
+ %w(commit_messages terms).each do |table|
108
+ schema.remove_table(table) if Groonga[table]
109
+ end
110
+ end
111
+ end
112
+
113
+ def filter_records(records)
114
+ records.reject do |record|
115
+ commit_message = record.key
116
+ commit_message.first_line =~ /^Merge (pull request|branch).*/
117
+ end
118
+ end
119
+
120
+ def convert_records_to_commit_messages(records)
121
+ records.map do |record|
122
+ commit_message = record.key
123
+ CommitMessage.new_from_record(commit_message)
124
+ end
125
+ end
126
+ end
127
+ end
@@ -0,0 +1,52 @@
1
+ #coding: utf-8
2
+ require 'rugged'
3
+ require 'gglog/commit_message'
4
+
5
+ module Gglog
6
+ class Repository
7
+ class << self
8
+ def checkout(clone_url, path)
9
+ FileUtils.mkdir_p(path)
10
+ Dir.chdir(path) do
11
+ system "git", "clone", "--quiet", clone_url, path
12
+ end
13
+ new(path)
14
+ end
15
+ end
16
+
17
+ def initialize(path)
18
+ @path = path
19
+ @repo = Rugged::Repository.new(path)
20
+ end
21
+
22
+ def name
23
+ File.basename(@path)
24
+ end
25
+
26
+ def commit_messages
27
+ commits.map do |commit|
28
+ CommitMessage.new_from_commit_object(commit, name)
29
+ end
30
+ end
31
+
32
+ def commit_message(sha)
33
+ commit = @repo.lookup(sha)
34
+ CommitMessage.new_from_commit_object(commit, name)
35
+ end
36
+
37
+ def pull
38
+ Dir.chdir(@path) do
39
+ system "git", "reset", "--hard", "--quiet"
40
+ system "git", "pull", "--force", "--quiet", "origin", "master"
41
+ end
42
+ end
43
+
44
+ private
45
+ def commits
46
+ walker = Rugged::Walker.new(@repo)
47
+ walker.push(@repo.lookup(@repo.head.target).oid)
48
+ walker.sorting(Rugged::SORT_REVERSE)
49
+ walker
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,4 @@
1
+ #coding: utf-8
2
+ module Gglog
3
+ VERSION = '0.0.1'
4
+ end
metadata ADDED
@@ -0,0 +1,185 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: gglog
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - SHIMADA Koji
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-11-05 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: thor
16
+ requirement: &2182997400 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: 0.16.0
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: *2182997400
25
+ - !ruby/object:Gem::Dependency
26
+ name: bundler
27
+ requirement: &2182996720 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '1.2'
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: *2182996720
36
+ - !ruby/object:Gem::Dependency
37
+ name: rroonga
38
+ requirement: &2182996100 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: 2.0.6
44
+ type: :runtime
45
+ prerelease: false
46
+ version_requirements: *2182996100
47
+ - !ruby/object:Gem::Dependency
48
+ name: rugged
49
+ requirement: &2182995300 !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: 0.16.0
55
+ type: :runtime
56
+ prerelease: false
57
+ version_requirements: *2182995300
58
+ - !ruby/object:Gem::Dependency
59
+ name: rainbow
60
+ requirement: &2182994900 !ruby/object:Gem::Requirement
61
+ none: false
62
+ requirements:
63
+ - - ! '>='
64
+ - !ruby/object:Gem::Version
65
+ version: '0'
66
+ type: :runtime
67
+ prerelease: false
68
+ version_requirements: *2182994900
69
+ - !ruby/object:Gem::Dependency
70
+ name: pager
71
+ requirement: &2182994440 !ruby/object:Gem::Requirement
72
+ none: false
73
+ requirements:
74
+ - - ! '>='
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ type: :runtime
78
+ prerelease: false
79
+ version_requirements: *2182994440
80
+ - !ruby/object:Gem::Dependency
81
+ name: rake
82
+ requirement: &2182993880 !ruby/object:Gem::Requirement
83
+ none: false
84
+ requirements:
85
+ - - ! '>='
86
+ - !ruby/object:Gem::Version
87
+ version: '0'
88
+ type: :development
89
+ prerelease: false
90
+ version_requirements: *2182993880
91
+ - !ruby/object:Gem::Dependency
92
+ name: rspec
93
+ requirement: &2182993260 !ruby/object:Gem::Requirement
94
+ none: false
95
+ requirements:
96
+ - - ! '>='
97
+ - !ruby/object:Gem::Version
98
+ version: '0'
99
+ type: :development
100
+ prerelease: false
101
+ version_requirements: *2182993260
102
+ - !ruby/object:Gem::Dependency
103
+ name: cucumber
104
+ requirement: &2182992640 !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
110
+ type: :development
111
+ prerelease: false
112
+ version_requirements: *2182992640
113
+ - !ruby/object:Gem::Dependency
114
+ name: aruba
115
+ requirement: &2182992220 !ruby/object:Gem::Requirement
116
+ none: false
117
+ requirements:
118
+ - - ! '>='
119
+ - !ruby/object:Gem::Version
120
+ version: '0'
121
+ type: :development
122
+ prerelease: false
123
+ version_requirements: *2182992220
124
+ description: Your partner for finding a good commit message.
125
+ email:
126
+ - koji.shimada@enishi-tech.com
127
+ executables:
128
+ - gglog
129
+ extensions: []
130
+ extra_rdoc_files: []
131
+ files:
132
+ - .gitignore
133
+ - CHANGELOG
134
+ - Gemfile
135
+ - Gemfile.lock
136
+ - LICENSE
137
+ - README.md
138
+ - Rakefile
139
+ - bin/gglog
140
+ - features/list.feature
141
+ - features/register.feature
142
+ - features/search.feature
143
+ - features/show.feature
144
+ - features/step_definitions/gglog_steps.rb
145
+ - features/support/env.rb
146
+ - gglog.gemspec
147
+ - lib/gglog.rb
148
+ - lib/gglog/command.rb
149
+ - lib/gglog/commit_message.rb
150
+ - lib/gglog/commit_message_decorator.rb
151
+ - lib/gglog/database.rb
152
+ - lib/gglog/repository.rb
153
+ - lib/gglog/version.rb
154
+ homepage: http://gglog.github.com/
155
+ licenses: []
156
+ post_install_message:
157
+ rdoc_options: []
158
+ require_paths:
159
+ - lib
160
+ required_ruby_version: !ruby/object:Gem::Requirement
161
+ none: false
162
+ requirements:
163
+ - - ! '>='
164
+ - !ruby/object:Gem::Version
165
+ version: 1.9.3
166
+ required_rubygems_version: !ruby/object:Gem::Requirement
167
+ none: false
168
+ requirements:
169
+ - - ! '>='
170
+ - !ruby/object:Gem::Version
171
+ version: '0'
172
+ requirements: []
173
+ rubyforge_project: gglog
174
+ rubygems_version: 1.8.10
175
+ signing_key:
176
+ specification_version: 3
177
+ summary: Your partner for finding a good commit message.
178
+ test_files:
179
+ - features/list.feature
180
+ - features/register.feature
181
+ - features/search.feature
182
+ - features/show.feature
183
+ - features/step_definitions/gglog_steps.rb
184
+ - features/support/env.rb
185
+ has_rdoc: