git_month_commits 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/.gitignore +14 -0
- data/Gemfile +4 -0
- data/README.md +23 -0
- data/Rakefile +2 -0
- data/bin/git-month-commits +10 -0
- data/git_month_commits.gemspec +28 -0
- data/lib/git_month_commits.rb +44 -0
- data/lib/git_month_commits/cli.rb +18 -0
- data/lib/git_month_commits/version.rb +3 -0
- data/spec/git_month_commits_spec.rb +27 -0
- metadata +155 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 02218ef038e26ac4d983570987b88bc09914632a
|
4
|
+
data.tar.gz: 6165ad5ec09566e50a5627d7d5b2758aa03ef0b7
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: ce729e250e1cc5425627a64a4608d3f77294ff0163f7bbc0d5da2c284b7a7d4c87d1da9d0acb790af7d49362b68f0b50afd9bc0a39b6bef02c5b84214f0302c0
|
7
|
+
data.tar.gz: b6da4df29c3af36be2f43dfc2010e24a244a566af13fc3b17f4f36559c515dbe5cf274c629c67bdb284ebc8bb1431324f430d80e4e440027bc2a2df80518459f
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# GitMonthCommits
|
2
|
+
|
3
|
+
show last month commit log and open github
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Or install it yourself as:
|
8
|
+
|
9
|
+
$ gem install git_month_commits
|
10
|
+
|
11
|
+
## Usage
|
12
|
+
|
13
|
+
```
|
14
|
+
$ git month-commits open
|
15
|
+
```
|
16
|
+
|
17
|
+
## Contributing
|
18
|
+
|
19
|
+
1. Fork it ( https://github.com/eiel/git_month_commits/fork )
|
20
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
21
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
22
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
23
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'git_month_commits/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "git_month_commits"
|
8
|
+
spec.version = GitMonthCommits::VERSION
|
9
|
+
spec.authors = ["Tomohiko Himura"]
|
10
|
+
spec.email = ["eiel.hal@gmail.com"]
|
11
|
+
spec.summary = %q{show last month git log}
|
12
|
+
spec.description = %q{show last month git log}
|
13
|
+
spec.homepage = ""
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_dependency "rugged", "~> 0.21"
|
22
|
+
spec.add_dependency "activesupport", "~> 4.2"
|
23
|
+
spec.add_dependency "launchy", "~> 2.4.3"
|
24
|
+
spec.add_development_dependency "bundler", "~> 1.7"
|
25
|
+
spec.add_development_dependency "pry", "~> 0.10"
|
26
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
27
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
28
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
require "git_month_commits/version"
|
2
|
+
require 'rugged'
|
3
|
+
require 'active_support/all'
|
4
|
+
|
5
|
+
class GitMonthCommits
|
6
|
+
attr_writer :time
|
7
|
+
|
8
|
+
def github_url
|
9
|
+
repo_url = repo.config["remote.origin.url"]
|
10
|
+
raise "not found remote.origin.url" if repo_url.nil?
|
11
|
+
|
12
|
+
if match = repo_url.match(/git@github.com:(.*).git/)
|
13
|
+
url = "https://github.com/#{match[1]}/compare/"
|
14
|
+
end
|
15
|
+
url + compare
|
16
|
+
end
|
17
|
+
|
18
|
+
def compare
|
19
|
+
since = nil
|
20
|
+
untill = nil
|
21
|
+
repo.walk(repo.last_commit).each do |commit|
|
22
|
+
untill = commit if untill.nil? && commit.time < until_time
|
23
|
+
break if commit.time < since_time
|
24
|
+
since = commit
|
25
|
+
end
|
26
|
+
"#{since.oid}...#{untill.oid}"
|
27
|
+
end
|
28
|
+
|
29
|
+
def since_time
|
30
|
+
time.last_month.beginning_of_month
|
31
|
+
end
|
32
|
+
|
33
|
+
def until_time
|
34
|
+
time.last_month.end_of_month
|
35
|
+
end
|
36
|
+
|
37
|
+
def time
|
38
|
+
@time ||= Time.new
|
39
|
+
end
|
40
|
+
|
41
|
+
def repo
|
42
|
+
@repo ||= Rugged::Repository.discover(".")
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'git_month_commits'
|
2
|
+
|
3
|
+
class GitMonthCommits::CLI
|
4
|
+
def open
|
5
|
+
require 'launchy'
|
6
|
+
Launchy.open commits.github_url
|
7
|
+
end
|
8
|
+
|
9
|
+
def log
|
10
|
+
system("git log #{commits.compare}")
|
11
|
+
end
|
12
|
+
|
13
|
+
private
|
14
|
+
|
15
|
+
def commits
|
16
|
+
@commits ||= GitMonthCommits.new
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
$LOAD_PATH << File.join(File.dirname(__FILE__),"..","lib")
|
2
|
+
|
3
|
+
require 'git_month_commits'
|
4
|
+
|
5
|
+
RSpec.describe GitMonthCommits do
|
6
|
+
describe '#github_url' do
|
7
|
+
let(:commits) { GitMonthCommits.new }
|
8
|
+
subject { commits.github_url }
|
9
|
+
|
10
|
+
before(:each) do
|
11
|
+
Dir.chdir(".")
|
12
|
+
end
|
13
|
+
|
14
|
+
context "when 2015-02-02" do
|
15
|
+
before(:each) do
|
16
|
+
commits.time = Time.new(2015,2,2)
|
17
|
+
end
|
18
|
+
|
19
|
+
let(:compare_url) { "https://github.com/eiel/git_month_commits/compare/"}
|
20
|
+
let(:since) { "e13422ceb12ed87346a7c760e5db8c9c5466b572" }
|
21
|
+
let(:untill) { "e13422ceb12ed87346a7c760e5db8c9c5466b572" }
|
22
|
+
|
23
|
+
it { is_expected.to eq("#{compare_url}#{since}...#{untill}") }
|
24
|
+
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
metadata
ADDED
@@ -0,0 +1,155 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: git_month_commits
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Tomohiko Himura
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-01-05 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.21'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0.21'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: activesupport
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '4.2'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '4.2'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: launchy
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 2.4.3
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 2.4.3
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: bundler
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '1.7'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '1.7'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: pry
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0.10'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0.10'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rake
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '10.0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '10.0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rspec
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '3.0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '3.0'
|
111
|
+
description: show last month git log
|
112
|
+
email:
|
113
|
+
- eiel.hal@gmail.com
|
114
|
+
executables:
|
115
|
+
- git-month-commits
|
116
|
+
extensions: []
|
117
|
+
extra_rdoc_files: []
|
118
|
+
files:
|
119
|
+
- ".gitignore"
|
120
|
+
- Gemfile
|
121
|
+
- README.md
|
122
|
+
- Rakefile
|
123
|
+
- bin/git-month-commits
|
124
|
+
- git_month_commits.gemspec
|
125
|
+
- lib/git_month_commits.rb
|
126
|
+
- lib/git_month_commits/cli.rb
|
127
|
+
- lib/git_month_commits/version.rb
|
128
|
+
- spec/git_month_commits_spec.rb
|
129
|
+
homepage: ''
|
130
|
+
licenses:
|
131
|
+
- MIT
|
132
|
+
metadata: {}
|
133
|
+
post_install_message:
|
134
|
+
rdoc_options: []
|
135
|
+
require_paths:
|
136
|
+
- lib
|
137
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
138
|
+
requirements:
|
139
|
+
- - ">="
|
140
|
+
- !ruby/object:Gem::Version
|
141
|
+
version: '0'
|
142
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
143
|
+
requirements:
|
144
|
+
- - ">="
|
145
|
+
- !ruby/object:Gem::Version
|
146
|
+
version: '0'
|
147
|
+
requirements: []
|
148
|
+
rubyforge_project:
|
149
|
+
rubygems_version: 2.4.5
|
150
|
+
signing_key:
|
151
|
+
specification_version: 4
|
152
|
+
summary: show last month git log
|
153
|
+
test_files:
|
154
|
+
- spec/git_month_commits_spec.rb
|
155
|
+
has_rdoc:
|