djanowski-helm 0.0.3 → 0.0.4

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/README.markdown ADDED
@@ -0,0 +1,65 @@
1
+ Helm – a command line tool for Lighthouse
2
+ =========================================
3
+
4
+ _Disclaimer_: This is alpha software. Seriously. Expect breakages and changes in the way configuration is made. We'll do our best to alert you and keep things as backwards-compatible as possible.
5
+
6
+ Lighthouse is pretty cool, but it'd be nice if we had a way to interact with it from the command line.
7
+
8
+ Configuration
9
+ -------------
10
+
11
+ Although Helm can receive all the parameters it needs from the command line, usually you'll want to use the configuration files. Our recommended usage is that you have a `.helm_config` in your home directory, where you store your Lighthouse credentials, and another `.helm_config` that lives in the root of your project's directory (this file contains general information about the project and can be pushed to your SCM of choice.
12
+
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
+
15
+ http://account.lighthouseapp.com:
16
+ token: API token
17
+ username: username
18
+ password: password
19
+
20
+ 2. Edit your project's `.helm_config`.
21
+
22
+ url: http://account.lighthouseapp.com
23
+ project: "Your project's full name"
24
+
25
+ 3. Try it.
26
+
27
+ $ helm list
28
+
29
+ Commands
30
+ --------
31
+
32
+ This *will* change.
33
+
34
+ ### `helm list` ###
35
+
36
+ Examples:
37
+
38
+ $ helm list state:open
39
+ $ helm list "responsible:me state:open"
40
+
41
+ ### `helm create` ###
42
+
43
+ Parses STDIN and creates tickets.
44
+
45
+ Examples:
46
+
47
+ $ echo "As a User I want a UI" | helm create
48
+ $ cat stories.txt | helm create
49
+
50
+ ### `helm show` ###
51
+
52
+ Displays information about a ticket.
53
+
54
+ Examples:
55
+
56
+ $ helm show 13
57
+
58
+ ### `helm assign` ###
59
+
60
+ Changes the assignee of a ticket. If no user is provided, assign to self.
61
+
62
+ Examples:
63
+
64
+ $ helm assign 13
65
+ $ helm assign 13 [Lighthouse user ID]
data/bin/helm CHANGED
@@ -1,41 +1,27 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  require 'rubygems'
4
-
5
- require File.dirname(__FILE__) + '/../lib/helm'
6
-
7
- require 'yaml'
4
+ require 'drawer'
5
+ require 'helm'
8
6
 
9
7
  def argv(key)
10
8
  start = "--#{key}="
11
-
12
- value = ARGV.detect do |v|
13
- v =~ /^#{Regexp.escape(start)}/
14
- end
15
-
9
+ value = ARGV.detect { |v| v =~ /^#{Regexp.escape(start)}/ }
16
10
  value[start.size..-1] if value
17
11
  end
18
12
 
19
- def load_config(file)
20
- file = File.expand_path(file)
21
-
22
- return {} unless File.exist?(file)
23
-
24
- yaml = YAML::load_file(file)
25
-
26
- yaml = yield(yaml) if block_given?
27
-
28
- yaml.each do |k,v|
13
+ def append_arguments(args)
14
+ args.each do |k, v|
29
15
  ARGV << "--#{k}=#{v}" unless argv(k)
30
- end if yaml
31
-
32
- yaml
16
+ end
33
17
  end
34
18
 
35
- local_config = load_config('.helm_config')
19
+ Drawer.open('.helm/config') do |config|
20
+ append_arguments(config.cache)
21
+ end
36
22
 
37
- load_config('~/.helm_config') do |opts|
38
- opts[argv(:url)]
23
+ Drawer.open('~/.helm_config') do |config|
24
+ append_arguments(config.get(argv(:url)))
39
25
  end
40
26
 
41
27
  Helm::Commands.const_get(ARGV.first.capitalize).new(Helm::Session.new).run
@@ -2,6 +2,10 @@ module Helm
2
2
  module Commands
3
3
  class Command
4
4
  attr_reader :session
5
+
6
+ def cache
7
+ session.cache
8
+ end
5
9
 
6
10
  def parameters(*names)
7
11
  session.configure_params(*names)
@@ -8,9 +8,16 @@ module Helm
8
8
 
9
9
  puts "Tickets with filter \"#{filter}\""
10
10
  session.tickets(filter).each do |ticket|
11
- puts " ##{ticket.id} #{ticket.title}"
11
+ assignee = ticket.assigned_user_id ?
12
+ find_user(ticket.assigned_user_id).name : "Unassigned"
13
+ puts " ##{ticket.id} #{ticket.title} (#{assignee})"
12
14
  end
13
15
  end
16
+
17
+ def find_user(id)
18
+ user_id = "user-%s" % id
19
+ cache.get(user_id) || cache.set(user_id, session.user(id))
20
+ end
14
21
  end
15
22
  end
16
23
  end
@@ -14,9 +14,7 @@ module Helm
14
14
  form.file_uploads.first.file_name = filename
15
15
 
16
16
  agent.submit(form)
17
- end if false
18
-
19
- puts "EMBED" if argv('--embed')
17
+ end
20
18
  end
21
19
 
22
20
  protected
@@ -1,5 +1,7 @@
1
1
  require 'rubygems'
2
- require 'activesupport'
2
+
3
+ gem 'activeresource', '>= 2.2.2'
4
+
3
5
  require 'activeresource'
4
6
 
5
7
  # Ruby lib for working with the Lighthouse API's XML interface.
data/lib/helm/session.rb CHANGED
@@ -4,6 +4,7 @@ require 'choice'
4
4
  module Helm
5
5
  class Session
6
6
  attr_reader :options
7
+ attr_reader :cache
7
8
 
8
9
  def initialize
9
10
  Choice.options do
@@ -35,6 +36,7 @@ module Helm
35
36
  end
36
37
 
37
38
  @options = Choice.choices
39
+ @cache = Drawer.open!('.helm/cache')
38
40
 
39
41
  configure
40
42
  end
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.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Damian Janowski
@@ -21,6 +21,24 @@ dependencies:
21
21
  - !ruby/object:Gem::Version
22
22
  version: 0.1.2
23
23
  version:
24
+ - !ruby/object:Gem::Dependency
25
+ name: soveran-drawer
26
+ version_requirement:
27
+ version_requirements: !ruby/object:Gem::Requirement
28
+ requirements:
29
+ - - ">="
30
+ - !ruby/object:Gem::Version
31
+ version: 0.0.4
32
+ version:
33
+ - !ruby/object:Gem::Dependency
34
+ name: activeresource
35
+ version_requirement:
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: 2.2.2
41
+ version:
24
42
  description:
25
43
  email: damian.janowski@gmail.com
26
44
  executables:
@@ -28,7 +46,7 @@ executables:
28
46
  extensions: []
29
47
 
30
48
  extra_rdoc_files:
31
- - README.textile
49
+ - README.markdown
32
50
  files:
33
51
  - lib/helm/commands/assign.rb
34
52
  - lib/helm/commands/command.rb
@@ -42,7 +60,8 @@ files:
42
60
  - lib/helm/project.rb
43
61
  - lib/helm/session.rb
44
62
  - lib/helm.rb
45
- - README.textile
63
+ - README.html
64
+ - README.markdown
46
65
  - LICENSE
47
66
  - Rakefile
48
67
  has_rdoc: false
@@ -54,7 +73,7 @@ rdoc_options:
54
73
  - --title
55
74
  - helm
56
75
  - --main
57
- - README.textile
76
+ - README.markdown
58
77
  require_paths:
59
78
  - lib
60
79
  required_ruby_version: !ruby/object:Gem::Requirement
data/README.textile DELETED
@@ -1 +0,0 @@
1
- Helm