redminerb 0.5.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.rdoc +4 -0
- data/README.md +1 -1
- data/lib/redminerb.rb +2 -1
- data/lib/redminerb/client.rb +16 -6
- data/lib/redminerb/issues.rb +2 -2
- data/lib/redminerb/version.rb +1 -1
- data/redminerb.gemspec +1 -0
- data/templates/issue.erb +5 -5
- data/templates/user.erb +1 -1
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 347a49accfc5f3a6e6d4eea8e48976443773c6ab
|
4
|
+
data.tar.gz: 1352e7491d1e6675829e95e2b1c94ade493a9aa3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a98f2a26498d4a7a1fce4b1f160901d755114b4b9d62d855389648657152144a06967688029fca52e0894e6b541e5bbb45761ca80c5490ba08a9c7717a0df600
|
7
|
+
data.tar.gz: e5958d2ad1fa6406815482acfb90068fa68e0f7eff5f3e925fdedc8d3248f7ef4c12df4e7c2b525be4696e392b2cbbd1575d448f31854fd38038d026c5107cfc
|
data/CHANGELOG.rdoc
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
== 0.6, released 2015-09-28
|
2
|
+
|
3
|
+
* +templates/issue.erb+ uses a recursive OStruct for internal objects -letting us for example say +issue.author.name+ instead of +issue.author['name']+
|
4
|
+
|
1
5
|
== 0.5, released 2015-09-23
|
2
6
|
|
3
7
|
* Local or home +.redminerb/templates+ directory for resource output customizations
|
data/README.md
CHANGED
@@ -45,7 +45,7 @@ For example, this `~/.redminerb.yml`:
|
|
45
45
|
url: http://localhost:3000/
|
46
46
|
api_key: 69b47d74e36a6757bac5d45f8398dd23bfa8f52c
|
47
47
|
|
48
|
-
Would be the same as having the following in your environment (declared in
|
48
|
+
Would be the same as having the following in your environment (declared in `~/.bashrc`, for example):
|
49
49
|
|
50
50
|
export REDMINERB_URL=http://localhost:3000/
|
51
51
|
export REDMINERB_API_KEY=69b47d74e36a6757bac5d45f8398dd23bfa8f52c
|
data/lib/redminerb.rb
CHANGED
@@ -9,6 +9,7 @@ require_relative 'redminerb/template'
|
|
9
9
|
# Main module
|
10
10
|
module Redminerb
|
11
11
|
class UninitializedError < StandardError; end
|
12
|
+
class NotFoundError < StandardError; end
|
12
13
|
|
13
14
|
module_function
|
14
15
|
|
@@ -50,6 +51,6 @@ module Redminerb
|
|
50
51
|
end
|
51
52
|
|
52
53
|
def separator
|
53
|
-
@separator ||= ('
|
54
|
+
@separator ||= ('─' * TermInfo.screen_columns).green
|
54
55
|
end
|
55
56
|
end
|
data/lib/redminerb/client.rb
CHANGED
@@ -20,12 +20,12 @@ module Redminerb
|
|
20
20
|
# response parsed as JSON.
|
21
21
|
def get_json(path, params = {})
|
22
22
|
Redminerb.init_required!
|
23
|
-
res =
|
24
|
-
|
25
|
-
|
26
|
-
|
23
|
+
res = _get(path, params)
|
24
|
+
if res.status == 404
|
25
|
+
fail Redminerb::NotFoundError, path
|
26
|
+
else
|
27
|
+
JSON.parse(res.body)
|
27
28
|
end
|
28
|
-
JSON.parse(res.body)
|
29
29
|
rescue JSON::ParserError => e
|
30
30
|
raise e, "HTTP status code #{res.status}"
|
31
31
|
end
|
@@ -40,7 +40,7 @@ module Redminerb
|
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
43
|
-
# It raises an exception giving the validation messages for 422 responses
|
43
|
+
# It raises an exception giving the validation messages for 422 responses.
|
44
44
|
def self.raise_error!(res)
|
45
45
|
if res.status == 422
|
46
46
|
begin
|
@@ -53,5 +53,15 @@ module Redminerb
|
|
53
53
|
fail StandardError, "ERROR (status code #{res.status})"
|
54
54
|
end
|
55
55
|
end
|
56
|
+
|
57
|
+
private
|
58
|
+
|
59
|
+
def _get(path, params)
|
60
|
+
@connection.get do |req|
|
61
|
+
req.url path
|
62
|
+
req.headers['Content-Type'] = 'application/json'
|
63
|
+
req.body = params.to_json if params.any?
|
64
|
+
end
|
65
|
+
end
|
56
66
|
end
|
57
67
|
end
|
data/lib/redminerb/issues.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
# Copyright (c) The Cocktail Experience S.L. (2015)
|
2
|
-
require '
|
2
|
+
require 'recursive-open-struct'
|
3
3
|
|
4
4
|
module Redminerb
|
5
5
|
# Issues resource wrapper
|
@@ -28,7 +28,7 @@ module Redminerb
|
|
28
28
|
# puts "#{issue.id}: #{issue.subject}"
|
29
29
|
#
|
30
30
|
def read(id)
|
31
|
-
|
31
|
+
RecursiveOpenStruct.new Redminerb.client.get_json("/issues/#{id}.json")['issue']
|
32
32
|
end
|
33
33
|
end
|
34
34
|
end
|
data/lib/redminerb/version.rb
CHANGED
data/redminerb.gemspec
CHANGED
@@ -34,6 +34,7 @@ Gem::Specification.new do |spec|
|
|
34
34
|
spec.add_dependency 'colorize'
|
35
35
|
spec.add_dependency 'faraday'
|
36
36
|
spec.add_dependency 'ruby-terminfo'
|
37
|
+
spec.add_dependency 'recursive-open-struct'
|
37
38
|
|
38
39
|
spec.add_development_dependency 'bundler', '~> 1.10'
|
39
40
|
spec.add_development_dependency 'rake', '~> 10.0'
|
data/templates/issue.erb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
<%= Redminerb.separator %>
|
2
|
-
<%= "[#{issue.tracker
|
2
|
+
<%= "[#{issue.tracker.name}]".blue + "[#{issue.project.name}:##{issue.id}]".green %> <%= issue.subject %>
|
3
3
|
<%= Redminerb.separator %>
|
4
|
-
Author: <%= issue.author
|
5
|
-
Assigned to: <%= issue.assigned_to
|
6
|
-
Status: <%= issue.status
|
7
|
-
Priority: <%= issue.priority
|
4
|
+
Author: <%= issue.author.name.red %>
|
5
|
+
Assigned to: <%= issue.assigned_to.name.red %>
|
6
|
+
Status: <%= issue.status.name.red %>
|
7
|
+
Priority: <%= issue.priority.name.red %>
|
8
8
|
<%= Redminerb.separator %>
|
9
9
|
<%= issue.description %>
|
10
10
|
<%= Redminerb.separator %>
|
data/templates/user.erb
CHANGED
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.
|
4
|
+
version: 0.6.0
|
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: 2015-09-
|
11
|
+
date: 2015-09-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -66,6 +66,20 @@ dependencies:
|
|
66
66
|
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: recursive-open-struct
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
84
|
name: bundler
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|