redminerb 0.8.3 → 0.8.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +2 -1
- data/CHANGELOG.rdoc +6 -2
- data/CONTRIBUTORS.md +7 -0
- data/README.md +36 -38
- data/Rakefile +1 -1
- data/TODO.md +1 -0
- data/lib/redminerb/cli/issues.rb +6 -5
- data/lib/redminerb/client.rb +3 -3
- data/lib/redminerb/version.rb +1 -1
- data/redminerb.gemspec +1 -1
- data/templates/issue_boxie.erb +5 -5
- metadata +11 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cd0185c2de7d0faff680a3e8a2e3dfeac153b230
|
4
|
+
data.tar.gz: c56b99239805b7a73bb8abb9277bd0a8b8b93843
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e44711b8c5840d5025a19cd4ea762561dfda63d553583ddba94a1df8d79779c41885c818c108bc7037327923cf727c7c8f2dd9c6a9e3017a0f3efbe44821232b
|
7
|
+
data.tar.gz: a38bb575b580d4cca4e008751e8e725137403bd85506e1b18bc0a1059b90081c927df21da1b00197fe9a72b3b8521eec30e024586c30fe122a500703944bea91
|
data/.travis.yml
CHANGED
data/CHANGELOG.rdoc
CHANGED
@@ -1,9 +1,13 @@
|
|
1
1
|
= CHANGELOG
|
2
|
+
== 0.8.4, released 2016-10-20
|
3
|
+
|
4
|
+
* Option +fixed_version_id+ added to the _issues_ command.
|
5
|
+
|
2
6
|
== 0.8, released 2015-10-09
|
3
7
|
|
4
8
|
* Users' create now asks for each param unless we use the --no-ask option
|
5
|
-
*
|
6
|
-
*
|
9
|
+
* <tt>redminerb project [show] <id></tt> to see a project's info
|
10
|
+
* <tt>redminerb projects list [--name <FILTER>]</tt> to see our projects
|
7
11
|
* +--project_id+, +assigned_to+ and +--closed+ options to filter *issues*
|
8
12
|
* Minor fixes
|
9
13
|
|
data/CONTRIBUTORS.md
ADDED
data/README.md
CHANGED
@@ -18,40 +18,50 @@ Work in progress with RDD[1]: README > Spec > Implementation
|
|
18
18
|
|
19
19
|
## Installation
|
20
20
|
|
21
|
-
|
22
|
-
|
23
|
-
```ruby
|
24
|
-
gem 'redminerb'
|
25
|
-
```
|
26
|
-
|
27
|
-
And then execute:
|
21
|
+
$ gem install redminerb
|
28
22
|
|
29
|
-
|
23
|
+
## Usage
|
30
24
|
|
31
|
-
|
25
|
+
redminerb [COMMAND] [SUBCOMMAND|<id>]
|
32
26
|
|
33
|
-
|
27
|
+
Behind the scenes `redminerb` uses the gem Thor, so calling it without params is the same as asking for help:
|
34
28
|
|
35
|
-
|
29
|
+
$ redminerb
|
30
|
+
Commands:
|
31
|
+
redminerb config # Shows this session current configuration
|
32
|
+
redminerb help [COMMAND] # Describe available commands or one specific command
|
33
|
+
redminerb issues [list|<id>] # Manage Redmine's issues
|
34
|
+
redminerb projects [list|<id>] # Manage Redmine's projects
|
35
|
+
redminerb users [list|<id>] # Manage Redmine's users
|
36
36
|
|
37
37
|
In order to use `redminerb` the URL and the API key of your Redmine REST API must be available in one of the following places:
|
38
38
|
|
39
|
-
1. **In your environment**: using *REDMINERB_URL* and *REDMINERB_API_KEY*
|
40
|
-
2. **In `~/.redminerb.yml`**: as values of *url* and *api_key
|
39
|
+
1. **In your environment**: using *REDMINERB_URL* and *REDMINERB_API_KEY* environment variables.
|
40
|
+
2. **In `~/.redminerb.yml`**: as values of *url* and *api_key* keys.
|
41
41
|
|
42
42
|
For example, this `~/.redminerb.yml`:
|
43
43
|
|
44
|
-
url:
|
44
|
+
url: https://redmine.ruby-lang.org/
|
45
45
|
api_key: 69b47d74e36a6757bac5d45f8398dd23bfa8f52c
|
46
46
|
|
47
47
|
Would be the same as having the following in your environment (declared in `~/.bashrc`, for example):
|
48
48
|
|
49
|
-
export REDMINERB_URL=
|
49
|
+
export REDMINERB_URL=https://redmine.ruby-lang.org/
|
50
50
|
export REDMINERB_API_KEY=69b47d74e36a6757bac5d45f8398dd23bfa8f52c
|
51
51
|
|
52
|
-
If both present **environment variables have priority
|
52
|
+
If both present **environment variables have priority** (remember that you can remove them from the environment running `unset NAME-OF-VARIABLE`).
|
53
53
|
|
54
|
-
As a general rule
|
54
|
+
As **a general rule**, the `list` subcommand is the one assumed when omitted, but if a number is given then the `show` subcommand will be call using that number as param. For example, `redminerb issues` will show us the **list** of the last issues availables for our user, and `redminerb issue 11962` will **show** us the info of the the issue with id number 11962 (notice that also the singular, *issue* here, can be used as the command, which sounds more natural for this feature -thanks Thor!)
|
55
|
+
|
56
|
+
You can find your API key on your account page in Redmine ( /my/account ) when logged in, on the right-hand pane of the default layout.
|
57
|
+
|
58
|
+
### Configuration (config)
|
59
|
+
|
60
|
+
To see the current configuration used by Redminerb run the `config` command:
|
61
|
+
|
62
|
+
$ redminerb config
|
63
|
+
URL: https://redmine.ruby-lang.org/
|
64
|
+
API-KEY: 69b47d74e36a6757bac5d45f8398dd23bfa8f52c
|
55
65
|
|
56
66
|
### Pagination
|
57
67
|
|
@@ -70,28 +80,26 @@ Because `list` is the default subcommand for the `users` command.
|
|
70
80
|
|
71
81
|
### Custom ERB templates
|
72
82
|
|
73
|
-
The output of **a single resource** obtained with **the `show` subcommand can be customized creating the corresponding `.erb` file** in the
|
83
|
+
The output of **a single resource** obtained with **the `show` subcommand can be customized creating the corresponding `.erb` file** in the `.redminerb/templates` directory. The `.redminerb` directory will be searched **first in the current directory and then in your home directory**.
|
74
84
|
|
75
|
-
The default templates could be found in the *templates* directory.
|
85
|
+
Into the template we access the resource using its generic name (`user`, `issue`, `project`...). The default templates used by *redminerb* and other examples could be found in the *templates* directory of this repository.
|
76
86
|
|
77
|
-
For example, to customize the output of an issue, we write the following content in the `.redminerb/issue.erb` file:
|
87
|
+
For example, to customize the output of an issue, we write the following content in the `.redminerb/templates/issue.erb` file:
|
78
88
|
|
79
89
|
Number: <%= issue.id %>
|
80
90
|
Title: <%= issue.subject %>
|
81
91
|
|
82
|
-
|
83
|
-
|
84
|
-
We can also create other templates and use them through **the `--template` option**. For example:
|
92
|
+
We can also create a template to be used only when asked through **the `--template` option**. For example:
|
85
93
|
|
86
|
-
$ redminerb
|
94
|
+
$ redminerb user show 34 --template user_in_a_box
|
87
95
|
|
88
|
-
Will use the file `.redminerb/user_in_a_box.erb` as template, whose content could be the following:
|
96
|
+
Will use the file `.redminerb/templates/user_in_a_box.erb` as template, whose content could be the following:
|
89
97
|
|
90
98
|
<%= Redminerb.top %>
|
91
99
|
<%= Redminerb.line user.login %>
|
92
100
|
<%= Redminerb.bottom %>
|
93
101
|
|
94
|
-
|
102
|
+
...which will give us an output similar to this:
|
95
103
|
|
96
104
|
┌────────────────────────────────────┐
|
97
105
|
│ roger.williams │
|
@@ -105,21 +113,11 @@ As you can see Redminerb give us also **some functions to draw** its output usin
|
|
105
113
|
* **Redminerb.line** *string*: content into the box (i.e. `│ Example │`).
|
106
114
|
* **Redminerb.separator**: a line from left to right (like *middle* wo/ box borders).
|
107
115
|
|
108
|
-
Have fun with them!
|
109
|
-
|
110
|
-
### Configuration (config)
|
111
|
-
|
112
|
-
To see the current configuration used by Redminerb we have the `config` command:
|
113
|
-
|
114
|
-
$ redminerb config
|
115
|
-
URL: http://localhost:3000/
|
116
|
-
API-KEY: 69b47d74e36a6757bac5d45f8398dd23bfa8f52c
|
117
|
-
|
118
116
|
### Users
|
119
117
|
|
120
118
|
The **users** command is the wrapper for part of the [Users resource](http://www.redmine.org/projects/redmine/wiki/Rest_Users) of the Redmine REST API.
|
121
119
|
|
122
|
-
**IMPORTANT:
|
120
|
+
**IMPORTANT: This is an admin command so be sure that your API key's user have that permission in the Redmine server. Otherwise a 403 exception will be thrown.**
|
123
121
|
|
124
122
|
#### List current users
|
125
123
|
|
@@ -184,7 +182,7 @@ The **issues** command is the wrapper for part of the [Issues resource](http://w
|
|
184
182
|
|
185
183
|
#### List issues
|
186
184
|
|
187
|
-
$ redminerb issues [list] [--closed|-c] [--project_id|-p <id>] [--assigned_to_id|-a <id>]
|
185
|
+
$ redminerb issues [list] [--closed|-c] [--project_id|-p <id>] [--assigned_to_id|-a <id>] [--fixed_version_id|-v <id>]
|
188
186
|
|
189
187
|
Examples:
|
190
188
|
|
data/Rakefile
CHANGED
data/TODO.md
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
* Format output w/ [terminal-table](https://github.com/tj/terminal-table) (recommended by @jsayar)
|
data/lib/redminerb/cli/issues.rb
CHANGED
@@ -10,11 +10,12 @@ module Redminerb
|
|
10
10
|
# rubocop:disable Metrics/AbcSize
|
11
11
|
# (disabled to let the "closed" option be managed here)
|
12
12
|
desc 'list', 'Shows open issues in our Redmine'
|
13
|
-
option :offset,
|
14
|
-
option :limit,
|
15
|
-
option :closed,
|
16
|
-
option :assigned_to_id,
|
17
|
-
option :project_id,
|
13
|
+
option :offset, aliases: :o
|
14
|
+
option :limit, aliases: :l
|
15
|
+
option :closed, aliases: :c, type: :boolean
|
16
|
+
option :assigned_to_id, aliases: :a
|
17
|
+
option :project_id, aliases: :p
|
18
|
+
option :fixed_version_id, aliases: :v
|
18
19
|
def list(issue_id = nil)
|
19
20
|
if issue_id
|
20
21
|
show(issue_id)
|
data/lib/redminerb/client.rb
CHANGED
@@ -39,10 +39,10 @@ module Redminerb
|
|
39
39
|
def get_json(path, params = {})
|
40
40
|
Redminerb.init_required!
|
41
41
|
res = _get(path, params)
|
42
|
-
if res.
|
43
|
-
fail Redminerb::NotFoundError, path
|
44
|
-
else
|
42
|
+
if res.success?
|
45
43
|
JSON.parse(res.body)
|
44
|
+
else
|
45
|
+
fail StandardError, "ERROR (status code #{res.status})"
|
46
46
|
end
|
47
47
|
rescue JSON::ParserError => e
|
48
48
|
raise e, "HTTP status code #{res.status}"
|
data/lib/redminerb/version.rb
CHANGED
data/redminerb.gemspec
CHANGED
@@ -42,7 +42,7 @@ Gem::Specification.new do |spec|
|
|
42
42
|
spec.add_development_dependency 'minitest'
|
43
43
|
spec.add_development_dependency 'climate_control' # fake ENV
|
44
44
|
spec.add_development_dependency 'minitest-vcr'
|
45
|
-
spec.add_development_dependency 'webmock'
|
45
|
+
spec.add_development_dependency 'webmock', '= 1.24.6'
|
46
46
|
|
47
47
|
spec.add_development_dependency 'rubocop'
|
48
48
|
|
data/templates/issue_boxie.erb
CHANGED
@@ -4,11 +4,11 @@
|
|
4
4
|
Redminerb.line("[#{issue.tracker.name}][#{issue.project.name}:##{issue.id}] #{issue.subject}"),
|
5
5
|
Redminerb.middle,
|
6
6
|
[
|
7
|
-
"Author: #{issue.author.name}",
|
8
|
-
"Assigned to: #{issue.assigned_to.name}",
|
9
|
-
"Status: #{issue.status.name}",
|
10
|
-
"Priority: #{issue.priority.name}"
|
11
|
-
].map{|l| Redminerb.line l },
|
7
|
+
issue.author ? "Author: #{issue.author.name}" : nil,
|
8
|
+
issue.assigned_to ? "Assigned to: #{issue.assigned_to.name}" : nil,
|
9
|
+
issue.status ? "Status: #{issue.status.name}" : nil,
|
10
|
+
issue.priority ? "Priority: #{issue.priority.name}" : nil
|
11
|
+
].compact.map{|l| Redminerb.line l },
|
12
12
|
Redminerb.middle,
|
13
13
|
issue.description.lines.map {|raw_line| Redminerb.line raw_line.chomp },
|
14
14
|
Redminerb.middle,
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: redminerb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Fernando Garcia Samblas
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-10-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -154,16 +154,16 @@ dependencies:
|
|
154
154
|
name: webmock
|
155
155
|
requirement: !ruby/object:Gem::Requirement
|
156
156
|
requirements:
|
157
|
-
- -
|
157
|
+
- - '='
|
158
158
|
- !ruby/object:Gem::Version
|
159
|
-
version:
|
159
|
+
version: 1.24.6
|
160
160
|
type: :development
|
161
161
|
prerelease: false
|
162
162
|
version_requirements: !ruby/object:Gem::Requirement
|
163
163
|
requirements:
|
164
|
-
- -
|
164
|
+
- - '='
|
165
165
|
- !ruby/object:Gem::Version
|
166
|
-
version:
|
166
|
+
version: 1.24.6
|
167
167
|
- !ruby/object:Gem::Dependency
|
168
168
|
name: rubocop
|
169
169
|
requirement: !ruby/object:Gem::Requirement
|
@@ -192,8 +192,8 @@ dependencies:
|
|
192
192
|
- - ">="
|
193
193
|
- !ruby/object:Gem::Version
|
194
194
|
version: '0'
|
195
|
-
description:
|
196
|
-
|
195
|
+
description: " Redminerb is a command-line tool to speak with a Redmine server
|
196
|
+
using its REST API.\n"
|
197
197
|
email:
|
198
198
|
- fernando.garcia@the-cocktail.com
|
199
199
|
executables:
|
@@ -206,11 +206,13 @@ files:
|
|
206
206
|
- ".travis.yml"
|
207
207
|
- CHANGELOG.rdoc
|
208
208
|
- CODE_OF_CONDUCT.md
|
209
|
+
- CONTRIBUTORS.md
|
209
210
|
- Gemfile
|
210
211
|
- LICENCE.txt
|
211
212
|
- LICENSE.txt
|
212
213
|
- README.md
|
213
214
|
- Rakefile
|
215
|
+
- TODO.md
|
214
216
|
- bin/console
|
215
217
|
- bin/setup
|
216
218
|
- exe/redminerb
|
@@ -251,7 +253,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
251
253
|
version: '0'
|
252
254
|
requirements: []
|
253
255
|
rubyforge_project:
|
254
|
-
rubygems_version: 2.
|
256
|
+
rubygems_version: 2.5.1
|
255
257
|
signing_key:
|
256
258
|
specification_version: 4
|
257
259
|
summary: Redminerb is a command-line Redmine client.
|