lighthouse-cli 0.1.0
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.
- checksums.yaml +15 -0
- data/.gitignore +18 -0
- data/Gemfile +3 -0
- data/LICENSE.txt +22 -0
- data/README.md +32 -0
- data/Rakefile +1 -0
- data/bin/lighthouse +41 -0
- data/config/config.yml +2 -0
- data/lib/lighthouse/cli.rb +8 -0
- data/lib/lighthouse/cli/config.rb +23 -0
- data/lib/lighthouse/cli/output.rb +41 -0
- data/lib/lighthouse/cli/project.rb +13 -0
- data/lib/lighthouse/cli/ticket.rb +17 -0
- data/lib/lighthouse/cli/version.rb +5 -0
- data/lighthouse-cli.gemspec +25 -0
- metadata +116 -0
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
MzljYjdmZTgzN2FiZWU1OTVmM2U4YzRiMGQ3MTdhYmVjMzBkNGQ4Yg==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
ODcyMDIyM2MyZTBkNDVkM2Y2NGNkMWNkNWI5Y2JjY2Q4NDgzMWM2YQ==
|
7
|
+
!binary "U0hBNTEy":
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
Y2EyNDkxYzM1MmNhMGY5MGQ3MTA5MWJmNDJhNzEwNWU4YWM1MWE0YzUxNjEz
|
10
|
+
MGRkOWQyZWUxN2Y0YmU4ZDZmNzZmZmY5OGFhNTc3ZjEzOTEwODhmNmJlY2Nm
|
11
|
+
YzdhNGYwNDU5YjhiMzU5MjRiMDZkNzJjZTkyZGRiZjYzNmJiM2M=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
Nzk1Nzc5ZTVmYTIxMzAxNTE1MTAyMmQ5ZmM1ZmY1ZjEyMGRjNWVlZDhhNzkw
|
14
|
+
ODAxNjdjNWM2Njg4M2E1MGEzYmUwN2U2NThiOGQwYjgyOTk1MDA1OTg2NDUw
|
15
|
+
MzlmN2U4OWEwMjIxZDViYjgzMDk4MGEyYjgwNjc4NGFkZjM3NjM=
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Chris Holmes
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
# Lighthouse CLI
|
2
|
+
|
3
|
+
A lightweight and simple CLI for interacting with Lighthouse.
|
4
|
+
|
5
|
+
This is wrapper around the [lighthouse-api](https://github.com/entp/lighthouse-apiouse-api) gem. Show, list and update tickets without leaving the command line.
|
6
|
+
|
7
|
+
## Usage
|
8
|
+
|
9
|
+
Install the gem, add your api key and set the current project.
|
10
|
+
|
11
|
+
```
|
12
|
+
gem install lighthouse-cli
|
13
|
+
lighthouse -api_key your_key_here -current_project project_name_here
|
14
|
+
```
|
15
|
+
|
16
|
+
Here are some commands to give you an idea of what it can do.
|
17
|
+
|
18
|
+
```
|
19
|
+
lighthouse -t 123 # Show ticket
|
20
|
+
lighthouse -t 123 -s resolved # Update ticket state
|
21
|
+
lighthouse -ot 123 -s resolved # Update ticket state, then open in browser
|
22
|
+
```
|
23
|
+
|
24
|
+
## Contributing
|
25
|
+
|
26
|
+
1. Fork it
|
27
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
28
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
29
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
30
|
+
5. Create new Pull Request
|
31
|
+
|
32
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/bin/lighthouse
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require_relative "../lib/Lighthouse/cli"
|
4
|
+
|
5
|
+
CLI_CONFIG = YAML.load_file("#{File.expand_path('../../config/config.yml', __FILE__)}")
|
6
|
+
|
7
|
+
Lighthouse.account = CLI_CONFIG["current_project"]
|
8
|
+
Lighthouse.token = CLI_CONFIG["api_key"]
|
9
|
+
options = {}
|
10
|
+
|
11
|
+
OptionParser.new do |opts|
|
12
|
+
opts.on("-api_key String") do |api_key|
|
13
|
+
options[:api_key] = api_key
|
14
|
+
end
|
15
|
+
|
16
|
+
opts.on("-current_project String") do |current_project|
|
17
|
+
options[:current_project] = current_project
|
18
|
+
end
|
19
|
+
|
20
|
+
opts.on("-t String") do |t|
|
21
|
+
options[:ticket] = t
|
22
|
+
end
|
23
|
+
|
24
|
+
opts.on("-o") do |o|
|
25
|
+
options[:open] = o
|
26
|
+
end
|
27
|
+
|
28
|
+
opts.on("-s String") do |s|
|
29
|
+
options[:state] = s
|
30
|
+
end
|
31
|
+
end.parse!
|
32
|
+
|
33
|
+
if options[:api_key]
|
34
|
+
Lighthouse::CLI::Config.set_api_key(options[:api_key])
|
35
|
+
end
|
36
|
+
|
37
|
+
if options[:current_project]
|
38
|
+
Lighthouse::CLI::Config.set_current_project(options[:current_project])
|
39
|
+
end
|
40
|
+
|
41
|
+
Lighthouse::CLI::Output.new(options)
|
data/config/config.yml
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
module Lighthouse
|
2
|
+
module CLI
|
3
|
+
class Config
|
4
|
+
|
5
|
+
def self.set_api_key(api_key)
|
6
|
+
settings = CLI_CONFIG
|
7
|
+
settings["api_key"] = api_key
|
8
|
+
save(settings)
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.set_current_project(project)
|
12
|
+
settings = CLI_CONFIG
|
13
|
+
settings["current_project"] = project
|
14
|
+
save(settings)
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.save(settings)
|
18
|
+
File.open("#{File.expand_path('../../../../config/config.yml', __FILE__)}", "w+") {|f| f.write(settings.to_yaml) }
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
module Lighthouse
|
2
|
+
module CLI
|
3
|
+
class Output
|
4
|
+
|
5
|
+
def initialize(options)
|
6
|
+
if options[:ticket]
|
7
|
+
self.send(:ticket, options)
|
8
|
+
elsif options[:project]
|
9
|
+
self.send(:project, options)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def ticket(options)
|
14
|
+
ticket = Lighthouse::Ticket.find(options[:ticket], :params => { :project_id => 96940 })
|
15
|
+
|
16
|
+
if options[:state]
|
17
|
+
if Lighthouse::CLI::Ticket.update(ticket, options)
|
18
|
+
puts "** Ticket Updated **"
|
19
|
+
Lighthouse::CLI::Ticket.show(ticket)
|
20
|
+
end
|
21
|
+
else
|
22
|
+
Lighthouse::CLI::Ticket.show(ticket)
|
23
|
+
end
|
24
|
+
|
25
|
+
if options[:open]
|
26
|
+
`open #{ticket.url}`
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def project(options)
|
31
|
+
projects = Lighthouse::Project.find(:all)
|
32
|
+
|
33
|
+
if options[:list]
|
34
|
+
Lighthouse::CLI::Project.list(projects)
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Lighthouse
|
2
|
+
module CLI
|
3
|
+
class Ticket
|
4
|
+
|
5
|
+
def self.show(ticket)
|
6
|
+
pp "Title: #{ticket.title}"
|
7
|
+
pp "State: #{ticket.state}"
|
8
|
+
pp ticket.body
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.update(ticket, options)
|
12
|
+
ticket.state = options[:state]
|
13
|
+
ticket.save
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'lighthouse/cli/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "lighthouse-cli"
|
8
|
+
spec.version = Lighthouse::CLI::VERSION
|
9
|
+
spec.authors = ["Chris Holmes"]
|
10
|
+
spec.email = ["tochrisholmes@gmail.com"]
|
11
|
+
spec.description = %q{A lightweight and simple CLI for interacting with Lighthouse.}
|
12
|
+
spec.summary = %q{This is wrapper around the lightouse-api gem. Show, list and update tickets without leaving the command line.}
|
13
|
+
spec.homepage = ""
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = ["lighthouse"]
|
18
|
+
spec.require_paths = ["lib"]
|
19
|
+
|
20
|
+
spec.add_dependency "lighthouse-api", "~> 2.0"
|
21
|
+
|
22
|
+
spec.add_development_dependency "bundler", "~> 1.2"
|
23
|
+
spec.add_development_dependency "rake"
|
24
|
+
spec.add_development_dependency "addressable"
|
25
|
+
end
|
metadata
ADDED
@@ -0,0 +1,116 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: lighthouse-cli
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Chris Holmes
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-07-09 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: lighthouse-api
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '2.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '2.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.2'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.2'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ! '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: addressable
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ! '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
description: A lightweight and simple CLI for interacting with Lighthouse.
|
70
|
+
email:
|
71
|
+
- tochrisholmes@gmail.com
|
72
|
+
executables:
|
73
|
+
- lighthouse
|
74
|
+
extensions: []
|
75
|
+
extra_rdoc_files: []
|
76
|
+
files:
|
77
|
+
- .gitignore
|
78
|
+
- Gemfile
|
79
|
+
- LICENSE.txt
|
80
|
+
- README.md
|
81
|
+
- Rakefile
|
82
|
+
- bin/lighthouse
|
83
|
+
- config/config.yml
|
84
|
+
- lib/lighthouse/cli.rb
|
85
|
+
- lib/lighthouse/cli/config.rb
|
86
|
+
- lib/lighthouse/cli/output.rb
|
87
|
+
- lib/lighthouse/cli/project.rb
|
88
|
+
- lib/lighthouse/cli/ticket.rb
|
89
|
+
- lib/lighthouse/cli/version.rb
|
90
|
+
- lighthouse-cli.gemspec
|
91
|
+
homepage: ''
|
92
|
+
licenses:
|
93
|
+
- MIT
|
94
|
+
metadata: {}
|
95
|
+
post_install_message:
|
96
|
+
rdoc_options: []
|
97
|
+
require_paths:
|
98
|
+
- lib
|
99
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ! '>='
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
105
|
+
requirements:
|
106
|
+
- - ! '>='
|
107
|
+
- !ruby/object:Gem::Version
|
108
|
+
version: '0'
|
109
|
+
requirements: []
|
110
|
+
rubyforge_project:
|
111
|
+
rubygems_version: 2.0.4
|
112
|
+
signing_key:
|
113
|
+
specification_version: 4
|
114
|
+
summary: This is wrapper around the lightouse-api gem. Show, list and update tickets
|
115
|
+
without leaving the command line.
|
116
|
+
test_files: []
|