gitmine 0.1.16 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +1 -0
- data/Gemfile.lock +4 -0
- data/README.rdoc +5 -0
- data/VERSION +1 -1
- data/gitmine.gemspec +5 -2
- data/lib/gitmine.rb +35 -0
- data/lib/gitmine/cli.rb +18 -0
- data/lib/gitmine/config.rb +4 -2
- metadata +36 -13
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
GEM
|
2
2
|
remote: http://rubygems.org/
|
3
3
|
specs:
|
4
|
+
addressable (2.2.6)
|
4
5
|
crack (0.1.8)
|
5
6
|
diff-lcs (1.1.2)
|
6
7
|
grit (2.0.0)
|
@@ -8,6 +9,8 @@ GEM
|
|
8
9
|
mime-types (>= 1.15)
|
9
10
|
httparty (0.6.1)
|
10
11
|
crack (= 0.1.8)
|
12
|
+
launchy (2.0.5)
|
13
|
+
addressable (~> 2.2.6)
|
11
14
|
mime-types (1.16)
|
12
15
|
rspec (2.5.0)
|
13
16
|
rspec-core (~> 2.5.0)
|
@@ -24,4 +27,5 @@ PLATFORMS
|
|
24
27
|
DEPENDENCIES
|
25
28
|
grit (>= 2.0.0)
|
26
29
|
httparty (>= 0.6.1)
|
30
|
+
launchy (>= 2.0.0)
|
27
31
|
rspec (>= 2.0.0)
|
data/README.rdoc
CHANGED
@@ -14,6 +14,11 @@ Put the config file '.gitmine.yml' at the root of your project. Here is a sample
|
|
14
14
|
github: 'pcreux/gitmine'
|
15
15
|
# Api key is required for private projects only.
|
16
16
|
api_key: 'your_api_key'
|
17
|
+
statuses:
|
18
|
+
# Should be the database id of the closed / deployed status in Redmine
|
19
|
+
reviewed: 5
|
20
|
+
|
21
|
+
You can also put config value in your home directory under '~/.gitmine.yml'. This is a great place to store host, api_key and statuses if they do not change from project to project. Values in the local .gitmine.yml always override those in the home directory.
|
17
22
|
|
18
23
|
== Usage
|
19
24
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.2.0
|
data/gitmine.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{gitmine}
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.2.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Philippe Creux"]
|
12
|
-
s.date = %q{2011-
|
12
|
+
s.date = %q{2011-10-24}
|
13
13
|
s.default_executable = %q{gitmine}
|
14
14
|
s.description = %q{Git log with status of associated redmine tickets}
|
15
15
|
s.email = %q{pcreux@gmail.com}
|
@@ -68,15 +68,18 @@ Gem::Specification.new do |s|
|
|
68
68
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
69
69
|
s.add_runtime_dependency(%q<httparty>, [">= 0.6.1"])
|
70
70
|
s.add_runtime_dependency(%q<grit>, [">= 2.0.0"])
|
71
|
+
s.add_runtime_dependency(%q<launchy>, [">= 2.0.0"])
|
71
72
|
s.add_development_dependency(%q<rspec>, [">= 2.0.0"])
|
72
73
|
else
|
73
74
|
s.add_dependency(%q<httparty>, [">= 0.6.1"])
|
74
75
|
s.add_dependency(%q<grit>, [">= 2.0.0"])
|
76
|
+
s.add_dependency(%q<launchy>, [">= 2.0.0"])
|
75
77
|
s.add_dependency(%q<rspec>, [">= 2.0.0"])
|
76
78
|
end
|
77
79
|
else
|
78
80
|
s.add_dependency(%q<httparty>, [">= 0.6.1"])
|
79
81
|
s.add_dependency(%q<grit>, [">= 2.0.0"])
|
82
|
+
s.add_dependency(%q<launchy>, [">= 2.0.0"])
|
80
83
|
s.add_dependency(%q<rspec>, [">= 2.0.0"])
|
81
84
|
end
|
82
85
|
end
|
data/lib/gitmine.rb
CHANGED
@@ -3,6 +3,7 @@ require 'rubygems'
|
|
3
3
|
require 'grit'
|
4
4
|
require 'yaml'
|
5
5
|
require 'httparty'
|
6
|
+
require 'launchy'
|
6
7
|
|
7
8
|
class Gitmine
|
8
9
|
|
@@ -15,6 +16,27 @@ class Gitmine
|
|
15
16
|
end
|
16
17
|
end
|
17
18
|
|
19
|
+
def self.status
|
20
|
+
Gitmine.new.status
|
21
|
+
end
|
22
|
+
|
23
|
+
def status
|
24
|
+
if issue
|
25
|
+
puts "#{bold(issue.status)} - #{issue.subject} #{blue("(#{issue.assigned_to})")}"
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.open
|
30
|
+
Gitmine.new.open
|
31
|
+
end
|
32
|
+
|
33
|
+
def open
|
34
|
+
issue_url = "#{Config.redmine_host}/issues/#{issue_id}"
|
35
|
+
if issue
|
36
|
+
Launchy.open issue_url
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
18
40
|
def initialize
|
19
41
|
@repo = Grit::Repo.new(ENV['PWD'])
|
20
42
|
@branch = File.read('./.git/HEAD').match(/^ref: refs\/heads\/(.+)/)[1]
|
@@ -26,6 +48,19 @@ class Gitmine
|
|
26
48
|
end
|
27
49
|
end
|
28
50
|
|
51
|
+
def issue_id
|
52
|
+
@branch[/^\d+/]
|
53
|
+
end
|
54
|
+
|
55
|
+
# Return issue for current branch or nil
|
56
|
+
def issue
|
57
|
+
if issue_id
|
58
|
+
Issue.find(issue_id)
|
59
|
+
else
|
60
|
+
puts "No issue found for branch #{@branch}"
|
61
|
+
nil
|
62
|
+
end
|
63
|
+
end
|
29
64
|
|
30
65
|
# TODO specs
|
31
66
|
def self.branch(branch_name)
|
data/lib/gitmine/cli.rb
CHANGED
@@ -11,6 +11,10 @@ class Gitmine::CLI
|
|
11
11
|
delete
|
12
12
|
when "for_deploy", "reviewed"
|
13
13
|
reviewed
|
14
|
+
when "open"
|
15
|
+
open
|
16
|
+
when "status"
|
17
|
+
status
|
14
18
|
else
|
15
19
|
puts <<-EOS
|
16
20
|
Usage:
|
@@ -30,6 +34,12 @@ gitmine delete ISSUE_ID
|
|
30
34
|
Delete remote branch starting with ISSUE_ID
|
31
35
|
Example: gitmine delete 1234
|
32
36
|
|
37
|
+
gitmine status
|
38
|
+
Show status of the current branch's issue
|
39
|
+
|
40
|
+
gitmine open
|
41
|
+
Open current branch's issue in web browser
|
42
|
+
|
33
43
|
gitmine log
|
34
44
|
Displays latest 10 commits and the status of their associated Redmine tickets
|
35
45
|
EOS
|
@@ -55,4 +65,12 @@ EOS
|
|
55
65
|
def self.reviewed
|
56
66
|
Gitmine.reviewed(ARGV[1])
|
57
67
|
end
|
68
|
+
|
69
|
+
def self.open
|
70
|
+
Gitmine.open
|
71
|
+
end
|
72
|
+
|
73
|
+
def self.status
|
74
|
+
Gitmine.status
|
75
|
+
end
|
58
76
|
end
|
data/lib/gitmine/config.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
class Gitmine
|
2
2
|
class Config
|
3
|
+
HOME_CONFIG_FILE = "#{ENV['HOME']}/.gitmine.yml"
|
3
4
|
CONFIG_FILE = './.gitmine.yml'
|
4
5
|
|
5
6
|
class << self
|
@@ -29,8 +30,9 @@ class Gitmine
|
|
29
30
|
end
|
30
31
|
|
31
32
|
def initialize
|
32
|
-
|
33
|
-
|
33
|
+
# Read from the home .gitmine.yml file first, then merge the local file on top of it to provide proper overrides
|
34
|
+
home_config = File.exists?(HOME_CONFIG_FILE) ? YAML.load_file(HOME_CONFIG_FILE) : {}
|
35
|
+
@config = home_config.merge(YAML.load_file(CONFIG_FILE))
|
34
36
|
end
|
35
37
|
|
36
38
|
def [](key)
|
metadata
CHANGED
@@ -1,13 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gitmine
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
-
|
10
|
-
|
8
|
+
- 2
|
9
|
+
- 0
|
10
|
+
segments_generated: true
|
11
|
+
version: 0.2.0
|
11
12
|
platform: ruby
|
12
13
|
authors:
|
13
14
|
- Philippe Creux
|
@@ -15,13 +16,10 @@ autorequire:
|
|
15
16
|
bindir: bin
|
16
17
|
cert_chain: []
|
17
18
|
|
18
|
-
date: 2011-
|
19
|
+
date: 2011-10-24 00:00:00 +02:00
|
19
20
|
default_executable: gitmine
|
20
21
|
dependencies:
|
21
22
|
- !ruby/object:Gem::Dependency
|
22
|
-
prerelease: false
|
23
|
-
type: :runtime
|
24
|
-
name: httparty
|
25
23
|
version_requirements: &id001 !ruby/object:Gem::Requirement
|
26
24
|
none: false
|
27
25
|
requirements:
|
@@ -32,12 +30,13 @@ dependencies:
|
|
32
30
|
- 0
|
33
31
|
- 6
|
34
32
|
- 1
|
33
|
+
segments_generated: true
|
35
34
|
version: 0.6.1
|
36
35
|
requirement: *id001
|
37
|
-
- !ruby/object:Gem::Dependency
|
38
36
|
prerelease: false
|
39
37
|
type: :runtime
|
40
|
-
name:
|
38
|
+
name: httparty
|
39
|
+
- !ruby/object:Gem::Dependency
|
41
40
|
version_requirements: &id002 !ruby/object:Gem::Requirement
|
42
41
|
none: false
|
43
42
|
requirements:
|
@@ -48,12 +47,13 @@ dependencies:
|
|
48
47
|
- 2
|
49
48
|
- 0
|
50
49
|
- 0
|
50
|
+
segments_generated: true
|
51
51
|
version: 2.0.0
|
52
52
|
requirement: *id002
|
53
|
-
- !ruby/object:Gem::Dependency
|
54
53
|
prerelease: false
|
55
|
-
type: :
|
56
|
-
name:
|
54
|
+
type: :runtime
|
55
|
+
name: grit
|
56
|
+
- !ruby/object:Gem::Dependency
|
57
57
|
version_requirements: &id003 !ruby/object:Gem::Requirement
|
58
58
|
none: false
|
59
59
|
requirements:
|
@@ -64,8 +64,29 @@ dependencies:
|
|
64
64
|
- 2
|
65
65
|
- 0
|
66
66
|
- 0
|
67
|
+
segments_generated: true
|
67
68
|
version: 2.0.0
|
68
69
|
requirement: *id003
|
70
|
+
prerelease: false
|
71
|
+
type: :runtime
|
72
|
+
name: launchy
|
73
|
+
- !ruby/object:Gem::Dependency
|
74
|
+
version_requirements: &id004 !ruby/object:Gem::Requirement
|
75
|
+
none: false
|
76
|
+
requirements:
|
77
|
+
- - ">="
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
hash: 15
|
80
|
+
segments:
|
81
|
+
- 2
|
82
|
+
- 0
|
83
|
+
- 0
|
84
|
+
segments_generated: true
|
85
|
+
version: 2.0.0
|
86
|
+
requirement: *id004
|
87
|
+
prerelease: false
|
88
|
+
type: :development
|
89
|
+
name: rspec
|
69
90
|
description: Git log with status of associated redmine tickets
|
70
91
|
email: pcreux@gmail.com
|
71
92
|
executables:
|
@@ -120,6 +141,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
120
141
|
hash: 3
|
121
142
|
segments:
|
122
143
|
- 0
|
144
|
+
segments_generated: true
|
123
145
|
version: "0"
|
124
146
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
125
147
|
none: false
|
@@ -129,6 +151,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
129
151
|
hash: 3
|
130
152
|
segments:
|
131
153
|
- 0
|
154
|
+
segments_generated: true
|
132
155
|
version: "0"
|
133
156
|
requirements: []
|
134
157
|
|