redminerb 0.3.0 → 0.4.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 +4 -4
- data/CHANGELOG.rdoc +4 -0
- data/README.md +9 -0
- data/lib/redminerb/cli.rb +1 -1
- data/lib/redminerb/cli/issues.rb +1 -4
- data/lib/redminerb/cli/users.rb +8 -2
- data/lib/redminerb/template.rb +33 -7
- data/lib/redminerb/users.rb +4 -0
- data/lib/redminerb/version.rb +1 -1
- data/templates/user.erb +13 -0
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 86ab53553c2c822bbd2eca3a1509d0cbf5398e55
|
4
|
+
data.tar.gz: 4fa29701cab649703cb0e724530e5a21b43b2de1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a1fa0e876a7043e7c7276b097647c6572e97ad90bbf97f658c10a85ece9f3281401c05e372cd72045d51c3fc0e3da2e79e5704d181e39da89b87de1aca5ec075
|
7
|
+
data.tar.gz: 1b73b40315e6d8c78c265811d7d2719c49413898b57afe601272e5240cb7435268003b1469b69e4dce9ee11c0d848402388f8c1ff88af7182dbce6edfcf91775
|
data/CHANGELOG.rdoc
CHANGED
data/README.md
CHANGED
@@ -100,6 +100,11 @@ You can see **all the fields available** with `redminerb users me`.
|
|
100
100
|
Will show the data in the Redmine server associated with the account that has
|
101
101
|
the API key used to access the Rest API (hopefully your data :).
|
102
102
|
|
103
|
+
#### Show user's data
|
104
|
+
|
105
|
+
$ redminerb users show <id>
|
106
|
+
|
107
|
+
Will give us the info associated with the user with the given *id*.
|
103
108
|
|
104
109
|
#### Create new user
|
105
110
|
|
@@ -122,6 +127,10 @@ So, the previous command is the same as the following:
|
|
122
127
|
$ redminerb users create -l wadus -p ultrasecret -fn Wadux -ln Wallace \
|
123
128
|
-m wadus@waduxwallace.out
|
124
129
|
|
130
|
+
### Issues
|
131
|
+
|
132
|
+
The **issues** command is the wrapper for part of the [Issues resource](http://www.redmine.org/projects/redmine/wiki/Rest_Issues) of the Redmine REST API.
|
133
|
+
|
125
134
|
#### List issues
|
126
135
|
|
127
136
|
$ redminerb issues list
|
data/lib/redminerb/cli.rb
CHANGED
@@ -21,7 +21,7 @@ module Redminerb
|
|
21
21
|
# The subcommad's classes are defined in lib/redminerb/cli
|
22
22
|
desc 'users [list]', "Manage Redmine's users"
|
23
23
|
subcommand 'users', Cli::Users
|
24
|
-
desc 'issues [
|
24
|
+
desc 'issues [show] <id>', "Manage Redmine's issues"
|
25
25
|
subcommand 'issues', Cli::Issues
|
26
26
|
end
|
27
27
|
end
|
data/lib/redminerb/cli/issues.rb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
# Copyright (c) The Cocktail Experience S.L. (2015)
|
2
|
-
require 'erb'
|
3
2
|
require_relative '../issues'
|
4
3
|
|
5
4
|
module Redminerb
|
@@ -21,9 +20,7 @@ module Redminerb
|
|
21
20
|
desc 'show <number>', 'Shows the data of the issue which id match with #<number>'
|
22
21
|
def show(issue_id)
|
23
22
|
Redminerb.init!
|
24
|
-
issue
|
25
|
-
template = Redminerb::Template.read(:issue)
|
26
|
-
puts ERB.new(template).result(binding)
|
23
|
+
puts Redminerb::Template.render(:issue, Redminerb::Issues.read(issue_id))
|
27
24
|
end
|
28
25
|
end
|
29
26
|
end
|
data/lib/redminerb/cli/users.rb
CHANGED
@@ -7,7 +7,7 @@ module Redminerb
|
|
7
7
|
class Users < Thor
|
8
8
|
default_command :list
|
9
9
|
|
10
|
-
desc 'list', 'Shows the current users in our Redmine'
|
10
|
+
desc 'list', 'Shows the current users in our Redmine.'
|
11
11
|
option :fields, aliases: :f, banner: 'id:login:email'
|
12
12
|
option :name, aliases: [:q, '--query'], banner: '<FILTER>'
|
13
13
|
option :offset, aliases: :o
|
@@ -31,13 +31,19 @@ module Redminerb
|
|
31
31
|
puts Redminerb::Users.create(options).green
|
32
32
|
end
|
33
33
|
|
34
|
-
desc 'me', 'Shows the info of the owner of the API key'
|
34
|
+
desc 'me', 'Shows the info of the owner of the API key.'
|
35
35
|
def me
|
36
36
|
Redminerb.init!
|
37
37
|
Redminerb::Users.me.each do |field, value|
|
38
38
|
puts "#{field}: ".blue + value.to_s.green
|
39
39
|
end
|
40
40
|
end
|
41
|
+
|
42
|
+
desc 'show <id>', 'Shows the info of the user with id <id>.'
|
43
|
+
def show(user_id)
|
44
|
+
Redminerb.init!
|
45
|
+
puts Redminerb::Template.render(:user, Redminerb::Users.read(user_id))
|
46
|
+
end
|
41
47
|
end
|
42
48
|
end
|
43
49
|
end
|
data/lib/redminerb/template.rb
CHANGED
@@ -1,23 +1,49 @@
|
|
1
1
|
# Copyright (c) The Cocktail Experience S.L. (2015)
|
2
|
-
require '
|
2
|
+
require 'erb'
|
3
3
|
|
4
4
|
module Redminerb
|
5
5
|
# Class to read Redminerb's ERB templates
|
6
6
|
class Template
|
7
7
|
class << self
|
8
|
-
#
|
8
|
+
# Renders the template +name+ using +resource+ assigned to a local
|
9
|
+
# variable with that same name in its binding (i.e. the template will
|
10
|
+
# have a local variable with the same name of the template that let
|
11
|
+
# us access to the resource).
|
12
|
+
#
|
13
|
+
# ==== Parameters
|
14
|
+
#
|
15
|
+
# * +name+ - Filename (without the erb extension) of the template in the
|
16
|
+
# templates directory.
|
17
|
+
#
|
18
|
+
# * +resource+ - The object that will be available into the template with
|
19
|
+
# the same name as the the template itself.
|
20
|
+
#
|
21
|
+
# ==== Example:
|
22
|
+
#
|
23
|
+
# # With this content in templates/issue.erb:
|
9
24
|
#
|
10
|
-
#
|
11
|
-
#
|
25
|
+
# Title: <%= issue[:subject] %>
|
26
|
+
#
|
27
|
+
# # ...we could call +render+ this way:
|
28
|
+
#
|
29
|
+
# Redminerb::Template.render(:issue, {subject: 'Fixme!'})
|
12
30
|
#
|
13
31
|
|
14
|
-
def
|
15
|
-
|
32
|
+
def render(name, resource)
|
33
|
+
b = binding
|
34
|
+
b.local_variable_set(name, resource)
|
35
|
+
template = _read_template(name)
|
36
|
+
ERB.new(template).result(b)
|
16
37
|
end
|
17
38
|
|
18
39
|
private
|
19
40
|
|
20
|
-
|
41
|
+
# Returns the content of the given ERB file in the templates directory.
|
42
|
+
def _read_template(name)
|
43
|
+
File.read(_filepath(name))
|
44
|
+
end
|
45
|
+
|
46
|
+
def _filepath(name)
|
21
47
|
File.join(File.dirname(__FILE__)[0..-15], 'templates', "#{name}.erb")
|
22
48
|
end
|
23
49
|
end
|
data/lib/redminerb/users.rb
CHANGED
data/lib/redminerb/version.rb
CHANGED
data/templates/user.erb
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
<%= Redminerb.separator %>
|
2
|
+
<%= user.login.upcase.green %>
|
3
|
+
<%= Redminerb.separator %>
|
4
|
+
* Id: <%= user.id.to_s.blue %>
|
5
|
+
* Firstname: <%= user.firstname.red %>
|
6
|
+
* Lastname: <%= user.lastname.red %>
|
7
|
+
* Login: <%= user.login.red %>
|
8
|
+
* E-Mail: <%= user.mail.red %>
|
9
|
+
<%= Redminerb.separator %>
|
10
|
+
* Created: <%= user.created_on.blue %>
|
11
|
+
* Last login: <%= user.last_login_on.blue %>
|
12
|
+
* Status: <%= user.status.to_s.blue %>
|
13
|
+
<%= Redminerb.separator %>
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: redminerb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Fernando Garcia Samblas
|
@@ -184,6 +184,7 @@ files:
|
|
184
184
|
- lib/redminerb/version.rb
|
185
185
|
- redminerb.gemspec
|
186
186
|
- templates/issue.erb
|
187
|
+
- templates/user.erb
|
187
188
|
homepage: http://github.com/nando/redminerb
|
188
189
|
licenses: []
|
189
190
|
metadata: {}
|