tracker-client 0.5 → 0.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,12 @@
1
+ #!/bin/sh
2
+
3
+ # Call git send-email
4
+ git send-email $@
5
+
6
+ GIT_EXIT_STATUS = $?
7
+
8
+ # If send-email succeed then record the patches
9
+
10
+ if [[ $GIT_EXIT_STATUS == 0 ]]; then
11
+ tracker record
12
+ end
data/bin/tracker CHANGED
@@ -13,6 +13,7 @@ opts = Trollop::options do
13
13
  opt :dir, "GIT directory to use", :short => 'd', :default => '.'
14
14
  opt :config, "Tracker config file location", :short => 'c', :default => "#{File.join(ENV['HOME'], '.trackerrc')}"
15
15
  opt :obsolete, "Used when recording new revision of patchset", :short => 'o', :type => :int
16
+ opt :message, "Add short message to actions", :short => 'm', :type => :string
16
17
  end
17
18
 
18
19
  Tracker::Cmd.config(:set, :file => opts[:config])
@@ -36,9 +37,9 @@ end
36
37
 
37
38
  puts case ARGV[0]
38
39
  when 'record' then Tracker::Cmd.record(opts[:dir], opts[:obsolete])
39
- when 'ack' then Tracker::Cmd.ack(opts[:dir])
40
- when 'nack' then Tracker::Cmd.nack(opts[:dir])
41
- when 'push' then Tracker::Cmd.push(opts[:dir])
40
+ when 'ack' then Tracker::Cmd.ack(opts[:dir], :message => opts[:message])
41
+ when 'nack' then Tracker::Cmd.nack(opts[:dir], :message => opts[:message])
42
+ when 'push' then Tracker::Cmd.push(opts[:dir], :message => opts[:message])
42
43
  when 'status' then Tracker::Cmd.status(opts[:dir])
43
44
  else print_usage
44
45
  end
data/lib/command.rb CHANGED
@@ -97,14 +97,17 @@ module Tracker
97
97
  # * +name+ - Action name (:ack, :nack, :push)
98
98
  # * +directory+ - If given, cmd app will 'chdir' into that directory (default: nil)
99
99
  #
100
- def self.action(name, directory)
100
+ def self.action(name, directory, options={})
101
101
  patches = JSON::parse(patches_to_json(directory))
102
102
  messages = patches.pop
103
103
  puts
104
104
  patches.each do |p|
105
105
  begin
106
106
  RestClient.post(
107
- config[:url] + ('/patches/%s/%s' % [p['hashes']['commit'], name]), '',
107
+ config[:url] + ('/patches/%s/%s' % [p['hashes']['commit'], name]),
108
+ {
109
+ :message => options[:message]
110
+ },
108
111
  {
109
112
  :content_type => 'application/json',
110
113
  'Authorization' => "Basic #{basic_auth}"
@@ -118,9 +121,9 @@ module Tracker
118
121
  " |\n |--------> [%s]\n\n" % config[:url]
119
122
  end
120
123
 
121
- def self.ack(directory); action(:ack, directory); end
122
- def self.nack(directory); action(:nack, directory); end
123
- def self.push(directory); action(:push, directory); end
124
+ def self.ack(directory, opts={}); action(:ack, directory, opts); end
125
+ def self.nack(directory, opts={}); action(:nack, directory, opts); end
126
+ def self.push(directory, opts={}); action(:push, directory, opts); end
124
127
 
125
128
  def self.status(directory)
126
129
  patches = JSON::parse(patches_to_json(directory))
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tracker-client
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.5'
4
+ version: '0.6'
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-08-13 00:00:00.000000000 Z
12
+ date: 2012-08-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rest-client
@@ -67,6 +67,7 @@ executables:
67
67
  extensions: []
68
68
  extra_rdoc_files: []
69
69
  files:
70
+ - bin/git-tracker-send
70
71
  - bin/tracker
71
72
  - lib/command.rb
72
73
  homepage: http://github.com/mifo/tracker