climine 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +47 -9
- data/config.yml +2 -1
- data/lib/climine/command/base.rb +4 -1
- data/lib/climine/command/config.rb +5 -13
- data/lib/climine/command/issue.rb +25 -13
- data/lib/climine/command/member.rb +2 -4
- data/lib/climine/command/project.rb +9 -8
- data/lib/climine/command/status.rb +2 -3
- data/lib/climine/command/tracker.rb +2 -4
- data/lib/climine/command/user.rb +8 -8
- data/lib/climine/version.rb +1 -1
- data/vendor/bundle/ruby/2.0.0/gems/thor-0.18.1/lib/thor.rb +3 -3
- metadata +2 -3
- data/templates/#issue.erb# +0 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 73c2ae7d410ea2c4f64734edc0c725702318fdc7
|
4
|
+
data.tar.gz: 6e7f7504d53ad53eab3d742f007c61271bb3b3cb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2544c127566dd18abffcca99ee972591a57a595f6dcc3d36964bf1be3c48e95f821e9e7d1307541b81ac0bbe598f0d046e1763a2e59effbd027daa65d4e418ef
|
7
|
+
data.tar.gz: 6b8351506800c2f4eed1cd50690811fba4fa617e81e8cb0abf3bea56c4c395d2965420c7c11b5aa99f11b2d2717fb2489fcd1a3d1c64b56e0c561110af9266e9
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -23,12 +23,13 @@ Or install it yourself as:
|
|
23
23
|
create `config.yml`
|
24
24
|
|
25
25
|
```
|
26
|
-
$ climine init -k xxxx -u http://xxxx.xxx.xx/
|
26
|
+
$ climine init -k xxxx -u http://xxxx.xxx.xx/ -e `which emacs`
|
27
27
|
```
|
28
28
|
|
29
29
|
```config.yml
|
30
30
|
url: http://xxxx.xxx.xx/
|
31
31
|
apikey: xxxx
|
32
|
+
editor: /path/to/emacs
|
32
33
|
```
|
33
34
|
|
34
35
|
### Help
|
@@ -53,17 +54,19 @@ $ climine help [COMMAND]
|
|
53
54
|
|
54
55
|
### Issues
|
55
56
|
|
56
|
-
#### get
|
57
|
+
#### get issue list
|
57
58
|
|
58
59
|
```
|
59
60
|
Usage:
|
60
|
-
climine
|
61
|
+
climine list [TICKET_NO]
|
61
62
|
|
62
63
|
Options:
|
63
64
|
-s, [--sort=SORT_KEYS] # default asc. ex) 'id,category:desc,updated_on'
|
64
65
|
-l, [--limit=LIMIT] # limit of search result (default: 25)
|
65
66
|
-o, [--offset=OFFSET] # page of seach result(0 origin) (default: 0)
|
66
67
|
-p, [--project-id=PROJECT_ID] # id of RedmineProject ( Please search by `climine project` ) (default: all project)
|
68
|
+
[--status-id=STATUS_ID] # id of issue status. ( Please search by `climine status` ) (default: all status)
|
69
|
+
# Default: *
|
67
70
|
-u, [--assigned-to-id=USER_ID] # ID of the user being assigned ( Please search by `climine user` )
|
68
71
|
-c, [--created-on=CREATED_DATE] # ex) >=2013-10-01, >2013-10-01, <2013-10-01, 2013-10-01
|
69
72
|
-r, [--updated-on=LAST_UPDATED_DATE] # ex) >=2013-10-01, >2013-10-01, <2013-10-01, 2013-10-01
|
@@ -73,10 +76,22 @@ Options:
|
|
73
76
|
get Redmine Issues. see) http://www.redmine.org/projects/redmine/wiki/Rest_Issues#Listing-issues
|
74
77
|
```
|
75
78
|
|
79
|
+
#### get issue
|
80
|
+
|
81
|
+
```
|
82
|
+
Usage:
|
83
|
+
climine get [TICKET_NO]
|
84
|
+
|
85
|
+
Options:
|
86
|
+
-t, [--template=TEMPLATE_PATH] # rendering by given template
|
87
|
+
|
88
|
+
get Redmine Issues. see) http://www.redmine.org/projects/redmine/wiki/Rest_Issues#Listing-issues
|
89
|
+
```
|
90
|
+
|
76
91
|
You can be rendered using the your own ERB template file.
|
77
92
|
|
78
93
|
```
|
79
|
-
$ climine issue get -t [template_path]
|
94
|
+
$ climine issue (get|issue) -t [template_path]
|
80
95
|
```
|
81
96
|
|
82
97
|
#### create issue
|
@@ -100,38 +115,61 @@ create Issue
|
|
100
115
|
|
101
116
|
```
|
102
117
|
Usage:
|
103
|
-
climine user
|
118
|
+
climine user list
|
104
119
|
|
105
120
|
Options:
|
106
121
|
-n, [--name=NAME] # filter users on their login, firstname, lastname and mail
|
107
122
|
```
|
108
123
|
|
124
|
+
```
|
125
|
+
Usage:
|
126
|
+
climine user get [ID]
|
127
|
+
|
128
|
+
get Redmine User
|
129
|
+
```
|
130
|
+
|
109
131
|
### Projects
|
110
132
|
|
111
133
|
```
|
112
134
|
Usage:
|
113
|
-
climine project
|
135
|
+
climine project list
|
136
|
+
|
137
|
+
get Redmine Projects.
|
138
|
+
```
|
139
|
+
|
140
|
+
```
|
141
|
+
Usage:
|
142
|
+
climine project get [PROJECT_ID]
|
143
|
+
|
144
|
+
get Redmine Project.
|
114
145
|
```
|
115
146
|
|
116
147
|
### Ticket Statauses
|
117
148
|
|
118
149
|
```
|
119
150
|
Usage:
|
120
|
-
climine status
|
151
|
+
climine status list
|
152
|
+
|
153
|
+
Options:
|
154
|
+
-t, [--table] # default asc. ex) 'id,category:desc,updated_on'
|
155
|
+
|
156
|
+
get Redmine IssueStatuses.
|
121
157
|
```
|
122
158
|
|
123
159
|
### Ticket Trackers
|
124
160
|
|
125
161
|
```
|
126
162
|
Usage:
|
127
|
-
climine tracker
|
163
|
+
climine tracker list
|
164
|
+
|
165
|
+
get Redmine Trackers.
|
128
166
|
```
|
129
167
|
|
130
168
|
### Project Members
|
131
169
|
|
132
170
|
```
|
133
171
|
Usage:
|
134
|
-
climine
|
172
|
+
climine member list -p, --project-id=PROJECT_ID
|
135
173
|
|
136
174
|
Options:
|
137
175
|
-p, --project-id=PROJECT_ID # see) http://www.redmine.org/projects/redmine/wiki/Rest_Memberships#GET
|
data/config.yml
CHANGED
data/lib/climine/command/base.rb
CHANGED
@@ -2,8 +2,11 @@ module Climine::Command
|
|
2
2
|
class Base < Thor
|
3
3
|
|
4
4
|
no_commands {
|
5
|
+
def config
|
6
|
+
@config ||= Climine::Config.new
|
7
|
+
end
|
5
8
|
def redmine
|
6
|
-
@redmine ||= Climine::Redmine.new(
|
9
|
+
@redmine ||= Climine::Redmine.new(config)
|
7
10
|
end
|
8
11
|
def render template_name, response
|
9
12
|
unless response.error
|
@@ -6,6 +6,9 @@ module Climine::Command
|
|
6
6
|
TEMPLATE = <<-ERB
|
7
7
|
url: <%= options[:url] %>
|
8
8
|
apikey: <%= options[:key] %>
|
9
|
+
<% if options[:editor] -%>
|
10
|
+
editor: <%= options[:editor] %>
|
11
|
+
<% end -%>
|
9
12
|
ERB
|
10
13
|
|
11
14
|
default_command :init
|
@@ -13,22 +16,11 @@ apikey: <%= options[:key] %>
|
|
13
16
|
desc "init ", "initialize config.yml"
|
14
17
|
option :url, required: true, type: :string, aliases: '-u', banner: "RedmineURL", desc: "Your Redmine's URL"
|
15
18
|
option :key, required: true, type: :string, aliases: '-k', banner: "API-Access-Key", desc: "Your API Access Key"
|
19
|
+
option :editor, required: false, type: :string, aliases: '-e', banner: "Editor command or path", desc: "Your favorite editor ex) emacs or vim or /usr/bin/emacs etc..."
|
16
20
|
def init
|
17
|
-
open(CONFIG, 'w'){|file| file.write(ERB.new(TEMPLATE).result(binding)) }
|
21
|
+
open(CONFIG, 'w'){|file| file.write(ERB.new(TEMPLATE, nil, "-").result(binding)) }
|
18
22
|
puts "create [ #{File.expand_path(CONFIG)} ]"
|
19
23
|
end
|
20
|
-
# def self.included base
|
21
|
-
# base.class_eval do
|
22
24
|
|
23
|
-
# desc "init ", "initialize config.yml"
|
24
|
-
# option :url, required: true, type: :string, aliases: '-u', banner: "RedmineURL", desc: "Your Redmine's URL"
|
25
|
-
# option :key, required: true, type: :string, aliases: '-k', banner: "API-Access-Key", desc: "Your API Access Key"
|
26
|
-
# def init
|
27
|
-
# open(CONFIG, 'w'){|file| file.write(ERB.new(TEMPLATE).result(binding)) }
|
28
|
-
# puts "create [ #{File.expand_path(CONFIG)} ]"
|
29
|
-
# end
|
30
|
-
|
31
|
-
# end
|
32
|
-
# end
|
33
25
|
end
|
34
26
|
end
|
@@ -1,9 +1,10 @@
|
|
1
1
|
require "date"
|
2
|
+
require 'tempfile'
|
2
3
|
|
3
4
|
module Climine::Command
|
4
5
|
class Issue < Base
|
5
6
|
|
6
|
-
desc "
|
7
|
+
desc "list [TICKET_NO]", "get Redmine Issues. see) http://www.redmine.org/projects/redmine/wiki/Rest_Issues#Listing-issues"
|
7
8
|
option :sort, type: :string, aliases: '-s', banner: "SORT_KEYS", desc: "default asc. ex) 'id,category:desc,updated_on'"
|
8
9
|
option :limit, type: :numeric, aliases: '-l', banner: "LIMIT", desc: "limit of search result (default: 25)", deafult: 25
|
9
10
|
option :offset, type: :numeric, aliases: '-o', banner: "OFFSET", desc: "page of seach result(0 origin) (default: 0)"
|
@@ -14,12 +15,15 @@ module Climine::Command
|
|
14
15
|
option :updated_on, type: :string, aliases: '-r', banner: "LAST_UPDATED_DATE", desc: "ex) >=2013-10-01, >2013-10-01, <2013-10-01, 2013-10-01"
|
15
16
|
option :before_week, type: :numeric, aliases: '-w', banner: "WEEKS", desc: "search tickets that has been updated in the last X weeks"
|
16
17
|
option :template, type: :string, aliases: '-t', banner: "TEMPLATE_PATH", desc: "rendering by given template"
|
18
|
+
def list
|
19
|
+
render (options["template"] || :issues), redmine.issues(before_weeek_to_update_date(options.to_hash))
|
20
|
+
end
|
21
|
+
|
22
|
+
desc "get [TICKET_NO]", "get Redmine Issues. see) http://www.redmine.org/projects/redmine/wiki/Rest_Issues#Listing-issues"
|
23
|
+
option :template, type: :string, aliases: '-t', banner: "TEMPLATE_PATH", desc: "rendering by given template"
|
17
24
|
def get(id=nil)
|
18
|
-
|
19
|
-
|
20
|
-
else
|
21
|
-
render (options["template"] || :issues), redmine.issues(before_weeek_to_update_date(options.to_hash))
|
22
|
-
end
|
25
|
+
say("required ticket number!", :red) unless id
|
26
|
+
render (options["template"] || :issue), redmine.issue(id)
|
23
27
|
end
|
24
28
|
|
25
29
|
desc "new", "create Issue"
|
@@ -58,18 +62,13 @@ module Climine::Command
|
|
58
62
|
user_id = ask("Who do you assigned?")
|
59
63
|
end
|
60
64
|
|
61
|
-
# subject
|
62
|
-
subject = ask_not_empty("subject > ")
|
63
|
-
# description
|
64
|
-
description = ask_not_empty("description > ")
|
65
|
-
|
66
65
|
res = redmine.create_issue(
|
67
66
|
project_id: project_id,
|
68
67
|
tracker_id: tracker_id,
|
69
68
|
status_id: status_id,
|
70
69
|
assigned_to_id: user_id,
|
71
|
-
subject: subject,
|
72
|
-
description:
|
70
|
+
subject: ask_not_empty("subject > ").force_encoding('utf-8'),
|
71
|
+
description: ask_description
|
73
72
|
)
|
74
73
|
|
75
74
|
unless res.error
|
@@ -97,6 +96,19 @@ module Climine::Command
|
|
97
96
|
end
|
98
97
|
answer
|
99
98
|
end
|
99
|
+
|
100
|
+
def ask_description
|
101
|
+
editor = config.editor
|
102
|
+
if editor.nil? or editor.empty?
|
103
|
+
description = ask_not_empty("description > ")
|
104
|
+
else
|
105
|
+
tmp = Tempfile.new('description_tmp')
|
106
|
+
system "#{editor} #{tmp.path}"
|
107
|
+
description = open(tmp.path){|f| f.read.force_encoding('utf-8') }
|
108
|
+
tmp.unlink
|
109
|
+
end
|
110
|
+
description
|
111
|
+
end
|
100
112
|
}
|
101
113
|
end
|
102
114
|
end
|
@@ -1,10 +1,8 @@
|
|
1
1
|
module Climine::Command
|
2
2
|
class Member < Base
|
3
|
-
|
4
|
-
|
5
|
-
desc "get", "get Project Members"
|
3
|
+
desc "list", "get Project Members"
|
6
4
|
option :project_id, type: :numeric, aliases: '-p', banner: "PROJECT_ID", required: true, desc: "see) http://www.redmine.org/projects/redmine/wiki/Rest_Memberships#GET"
|
7
|
-
def
|
5
|
+
def list
|
8
6
|
render :members, redmine.members(options["project_id"])
|
9
7
|
end
|
10
8
|
end
|
@@ -1,14 +1,15 @@
|
|
1
1
|
module Climine::Command
|
2
2
|
class Project < Base
|
3
|
-
default_command :project
|
4
3
|
|
5
|
-
desc "
|
6
|
-
def
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
4
|
+
desc "get [PROJECT_ID]", "get Redmine Project."
|
5
|
+
def get id
|
6
|
+
say("required project id!", :red) unless id
|
7
|
+
render :project, redmine.project(id)
|
8
|
+
end
|
9
|
+
|
10
|
+
desc "list", "get Redmine Projects."
|
11
|
+
def list
|
12
|
+
render :projects, redmine.projects(options.to_hash)
|
12
13
|
end
|
13
14
|
end
|
14
15
|
end
|
@@ -2,11 +2,10 @@ require "hashie"
|
|
2
2
|
|
3
3
|
module Climine::Command
|
4
4
|
class Status < Base
|
5
|
-
default_command :status
|
6
5
|
|
7
|
-
desc "
|
6
|
+
desc "list", "get Redmine IssueStatuses."
|
8
7
|
option :table, type: :boolean, aliases: '-t', desc: "default asc. ex) 'id,category:desc,updated_on'", default: false
|
9
|
-
def
|
8
|
+
def list
|
10
9
|
unless options[:table]
|
11
10
|
render :statuses, redmine.statuses
|
12
11
|
else
|
data/lib/climine/command/user.rb
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
module Climine::Command
|
2
2
|
class User < Base
|
3
|
-
|
3
|
+
desc "get [ID]", "get Redmine User"
|
4
|
+
def get(id=nil)
|
5
|
+
say("required user id!", :red) unless id
|
6
|
+
render :user, redmine.user(id)
|
7
|
+
end
|
4
8
|
|
5
|
-
desc "
|
9
|
+
desc "list", "get Redmine Users"
|
6
10
|
option :name, type: :string, aliases: '-n', banner: "NAME", desc: "filter users on their login, firstname, lastname and mail"
|
7
|
-
def
|
8
|
-
|
9
|
-
render :user, redmine.user(id)
|
10
|
-
else
|
11
|
-
render :users, redmine.users(options.to_hash)
|
12
|
-
end
|
11
|
+
def list
|
12
|
+
render :users, redmine.users(options.to_hash)
|
13
13
|
end
|
14
14
|
end
|
15
15
|
end
|
data/lib/climine/version.rb
CHANGED
@@ -165,13 +165,13 @@ class Thor
|
|
165
165
|
# shell<Thor::Shell>
|
166
166
|
# command_name<String>
|
167
167
|
#
|
168
|
-
def command_help(shell, command_name)
|
168
|
+
def command_help(shell, command_name, subcommand = false)
|
169
169
|
meth = normalize_command_name(command_name)
|
170
170
|
command = all_commands[meth]
|
171
171
|
handle_no_command_error(meth) unless command
|
172
172
|
|
173
173
|
shell.say "Usage:"
|
174
|
-
shell.say " #{banner(command)}"
|
174
|
+
shell.say " #{banner(command, command_name, subcommand)}"
|
175
175
|
shell.say
|
176
176
|
class_options_help(shell, nil => command.options.map { |_, o| o })
|
177
177
|
if command.long_description
|
@@ -468,6 +468,6 @@ class Thor
|
|
468
468
|
|
469
469
|
desc "help [COMMAND]", "Describe available commands or one specific command"
|
470
470
|
def help(command = nil, subcommand = false)
|
471
|
-
command ? self.class.command_help(shell, command) : self.class.help(shell, subcommand)
|
471
|
+
command ? self.class.command_help(shell, command, subcommand) : self.class.help(shell, subcommand)
|
472
472
|
end
|
473
473
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: climine
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- yagince
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-01-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -162,7 +162,6 @@ files:
|
|
162
162
|
- LICENSE.txt
|
163
163
|
- Rakefile
|
164
164
|
- README.md
|
165
|
-
- templates/#issue.erb#
|
166
165
|
- templates/issue.erb
|
167
166
|
- vendor/bundle/ruby/2.0.0/bin/climine
|
168
167
|
- vendor/bundle/ruby/2.0.0/bin/httpclient
|
data/templates/#issue.erb#
DELETED