djanowski-helm 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/README.markdown +4 -3
- data/bin/helm +53 -4
- data/lib/helm/commands/command.rb +4 -0
- data/lib/helm/commands/schedule.rb +19 -0
- data/lib/helm/formatter.rb +15 -0
- data/lib/helm/session.rb +18 -5
- data/lib/helm.rb +5 -2
- metadata +5 -2
data/README.markdown
CHANGED
@@ -12,14 +12,14 @@ Although Helm can receive all the parameters it needs from the command line, usu
|
|
12
12
|
|
13
13
|
1. Edit `~/.helm_config` and add your credentials for the account. You can provide a token (recommended) or your username and password (this is necessary if you want to use scraping commands like `upload`).
|
14
14
|
|
15
|
-
http://account.lighthouseapp.com:
|
16
|
-
token: API token
|
15
|
+
http://your-account.lighthouseapp.com:
|
16
|
+
token: your API token
|
17
17
|
username: username
|
18
18
|
password: password
|
19
19
|
|
20
20
|
2. Edit your project's `.helm_config`.
|
21
21
|
|
22
|
-
url: http://account.lighthouseapp.com
|
22
|
+
url: http://your-account.lighthouseapp.com
|
23
23
|
project: "Your project's full name"
|
24
24
|
|
25
25
|
3. Try it.
|
@@ -35,6 +35,7 @@ This *will* change.
|
|
35
35
|
|
36
36
|
Examples:
|
37
37
|
|
38
|
+
$ helm list
|
38
39
|
$ helm list state:open
|
39
40
|
$ helm list "responsible:me state:open"
|
40
41
|
|
data/bin/helm
CHANGED
@@ -1,8 +1,42 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
+
if ARGV.empty?
|
4
|
+
puts <<-eos
|
5
|
+
Available helm commands:
|
6
|
+
# List tickets. The default filter
|
7
|
+
# is "responsible:me state:open milestone:next".
|
8
|
+
$ helm list [filter]
|
9
|
+
|
10
|
+
# Display information about a particular ticket.
|
11
|
+
$ helm info [ticket id]
|
12
|
+
|
13
|
+
# Display information about a particular milestone.
|
14
|
+
$ helm show [milestone id]
|
15
|
+
|
16
|
+
# Assign a ticket to self.
|
17
|
+
$ helm assign [ticket id]
|
18
|
+
|
19
|
+
# Assign a ticket to another user.
|
20
|
+
$ helm assign [ticket id] [user id]
|
21
|
+
|
22
|
+
|
23
|
+
# Assign a ticket to a milestone.
|
24
|
+
$ helm assign [ticket id] [milestone name]
|
25
|
+
|
26
|
+
# Create a new ticket.
|
27
|
+
$ echo "Ticket description" | helm create
|
28
|
+
|
29
|
+
Check http://github.com/djanowski/helm/ for more information.
|
30
|
+
eos
|
31
|
+
exit
|
32
|
+
end
|
33
|
+
|
3
34
|
require 'rubygems'
|
35
|
+
|
36
|
+
gem 'soveran-drawer', '>= 0.0.5'
|
4
37
|
require 'drawer'
|
5
|
-
|
38
|
+
|
39
|
+
require File.join(File.dirname(__FILE__), '..', 'lib', 'helm')
|
6
40
|
|
7
41
|
def argv(key)
|
8
42
|
start = "--#{key}="
|
@@ -13,14 +47,29 @@ end
|
|
13
47
|
def append_arguments(args)
|
14
48
|
args.each do |k, v|
|
15
49
|
ARGV << "--#{k}=#{v}" unless argv(k)
|
16
|
-
end
|
50
|
+
end if args
|
17
51
|
end
|
18
52
|
|
19
|
-
|
53
|
+
def configure(file)
|
54
|
+
puts <<-eos
|
55
|
+
The configuration file #{file} doesn't exist.
|
56
|
+
Please refer to the documentation to see what to
|
57
|
+
write in that file.
|
58
|
+
eos
|
59
|
+
exit
|
60
|
+
end
|
61
|
+
|
62
|
+
custom_config = File.expand_path('.helm_config')
|
63
|
+
global_config = File.expand_path('~/.helm/config')
|
64
|
+
|
65
|
+
configure(custom_config) unless File.exists?(custom_config)
|
66
|
+
configure(global_config) unless File.exists?(global_config)
|
67
|
+
|
68
|
+
Drawer.open(custom_config) do |config|
|
20
69
|
append_arguments(config.cache)
|
21
70
|
end
|
22
71
|
|
23
|
-
Drawer.open(
|
72
|
+
Drawer.open(global_config) do |config|
|
24
73
|
append_arguments(config.get(argv(:url)))
|
25
74
|
end
|
26
75
|
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Helm
|
2
|
+
module Commands
|
3
|
+
class Schedule < Command
|
4
|
+
def run
|
5
|
+
parameters :ticket, :milestone
|
6
|
+
|
7
|
+
ticket = session.ticket
|
8
|
+
|
9
|
+
current_milestone = session.milestone(ticket.milestone_id)
|
10
|
+
|
11
|
+
ticket.milestone_id = session.milestone.id
|
12
|
+
|
13
|
+
if ticket.save
|
14
|
+
puts format.ticket_change(ticket, :milestone, current_milestone, session.milestone)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Helm
|
2
|
+
class Formatter
|
3
|
+
def ticket_number(ticket)
|
4
|
+
"##{ticket.id}".rjust(4)
|
5
|
+
end
|
6
|
+
|
7
|
+
def ticket_with_title(ticket)
|
8
|
+
"#{ticket_number(ticket)} #{ticket.title}"
|
9
|
+
end
|
10
|
+
|
11
|
+
def ticket_change(ticket, attribute, old_value, new_value)
|
12
|
+
"#{ticket_number(ticket)} #{attribute} changed: #{old_value || '(none)'} => #{new_value}"
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
data/lib/helm/session.rb
CHANGED
@@ -36,7 +36,7 @@ module Helm
|
|
36
36
|
end
|
37
37
|
|
38
38
|
@options = Choice.choices
|
39
|
-
@cache = Drawer.open!('
|
39
|
+
@cache = Drawer.open!('~/.helm/cache')
|
40
40
|
|
41
41
|
configure
|
42
42
|
end
|
@@ -71,14 +71,27 @@ module Helm
|
|
71
71
|
project.tickets(:q => filter)
|
72
72
|
end
|
73
73
|
|
74
|
-
def milestone(
|
75
|
-
|
76
|
-
|
74
|
+
def milestone(*args)
|
75
|
+
# TODO: ugly
|
76
|
+
debugger
|
77
|
+
|
78
|
+
if args.empty?
|
79
|
+
milestone_by_title(self[:milestone])
|
80
|
+
elsif args.first.nil?
|
81
|
+
nil
|
82
|
+
elsif args.first.to_i.to_s == args.first.to_s
|
83
|
+
Lighthouse::Milestone.find(args.first, :params => {:project_id => project.id})
|
77
84
|
else
|
78
|
-
|
85
|
+
milestone_by_title(args.first)
|
79
86
|
end
|
80
87
|
end
|
81
88
|
|
89
|
+
def milestone_by_title(title)
|
90
|
+
title = title.to_s
|
91
|
+
|
92
|
+
Lighthouse::Milestone.find(:all, :params => {:project_id => project.id}).detect {|m| m.title == title }
|
93
|
+
end
|
94
|
+
|
82
95
|
def user(id = nil)
|
83
96
|
if id
|
84
97
|
Lighthouse::User.find(id)
|
data/lib/helm.rb
CHANGED
@@ -1,11 +1,14 @@
|
|
1
1
|
require File.dirname(__FILE__) + '/helm/lighthouse'
|
2
2
|
require File.dirname(__FILE__) + '/helm/session'
|
3
|
+
require File.dirname(__FILE__) + '/helm/formatter'
|
3
4
|
|
4
5
|
require File.dirname(__FILE__) + '/helm/commands/command'
|
5
|
-
|
6
|
+
|
6
7
|
require File.dirname(__FILE__) + '/helm/commands/assign'
|
7
8
|
require File.dirname(__FILE__) + '/helm/commands/create'
|
9
|
+
require File.dirname(__FILE__) + '/helm/commands/info'
|
10
|
+
require File.dirname(__FILE__) + '/helm/commands/list'
|
8
11
|
require File.dirname(__FILE__) + '/helm/commands/resolve'
|
12
|
+
require File.dirname(__FILE__) + '/helm/commands/schedule'
|
9
13
|
require File.dirname(__FILE__) + '/helm/commands/show'
|
10
|
-
require File.dirname(__FILE__) + '/helm/commands/list'
|
11
14
|
require File.dirname(__FILE__) + '/helm/commands/upload'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: djanowski-helm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Damian Janowski
|
@@ -28,7 +28,7 @@ dependencies:
|
|
28
28
|
requirements:
|
29
29
|
- - ">="
|
30
30
|
- !ruby/object:Gem::Version
|
31
|
-
version: 0.0.
|
31
|
+
version: 0.0.5
|
32
32
|
version:
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: activeresource
|
@@ -54,14 +54,17 @@ files:
|
|
54
54
|
- lib/helm/commands/info.rb
|
55
55
|
- lib/helm/commands/list.rb
|
56
56
|
- lib/helm/commands/resolve.rb
|
57
|
+
- lib/helm/commands/schedule.rb
|
57
58
|
- lib/helm/commands/show.rb
|
58
59
|
- lib/helm/commands/upload.rb
|
60
|
+
- lib/helm/formatter.rb
|
59
61
|
- lib/helm/lighthouse.rb
|
60
62
|
- lib/helm/project.rb
|
61
63
|
- lib/helm/session.rb
|
62
64
|
- lib/helm.rb
|
63
65
|
- README.html
|
64
66
|
- README.markdown
|
67
|
+
- README.textile
|
65
68
|
- LICENSE
|
66
69
|
- Rakefile
|
67
70
|
has_rdoc: false
|