redminerb 0.4.0 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 86ab53553c2c822bbd2eca3a1509d0cbf5398e55
4
- data.tar.gz: 4fa29701cab649703cb0e724530e5a21b43b2de1
3
+ metadata.gz: e9f4f24f3042eab942ba77d07143a61b70bbed04
4
+ data.tar.gz: 83f92876f8e3f995bf552e42edefd631f9a59c46
5
5
  SHA512:
6
- metadata.gz: a1fa0e876a7043e7c7276b097647c6572e97ad90bbf97f658c10a85ece9f3281401c05e372cd72045d51c3fc0e3da2e79e5704d181e39da89b87de1aca5ec075
7
- data.tar.gz: 1b73b40315e6d8c78c265811d7d2719c49413898b57afe601272e5240cb7435268003b1469b69e4dce9ee11c0d848402388f8c1ff88af7182dbce6edfcf91775
6
+ metadata.gz: d077f662066d6838ab71cd26877358deb77a4d87980f14b2f702f455d5fabd7f6693db270daa9493112dd24705067e0be67bca386dd1a80fa4f562f7e2a8b315
7
+ data.tar.gz: a64a0ee960d56e34ee43282c6a2712cf20266b87c111c7fc3a6aeb97377d98ca7961b106ee519a038573b5bf4e4c224b0429bc29b0cef3c1f413614f92d8a423
data/CHANGELOG.rdoc CHANGED
@@ -1,17 +1,21 @@
1
+ == 0.5, released 2015-09-23
2
+
3
+ * Local or home +.redminerb/templates+ directory for resource output customizations
4
+
1
5
  == 0.4, released 2015-09-22
2
6
 
3
- * 'redminerb users show <id>' to see a user's info.
7
+ * +redminerb users show <id>+ to see a user's info
4
8
 
5
9
  == 0.3, released 2015-09-22
6
10
 
7
- * 'redminerb issues [show] <number>' to see an issue's info
8
- * 'redminerb issues list' to see open issues
11
+ * +redminerb issues [show] <number>+ to see an issue's info
12
+ * +redminerb issues list+ to see open issues
9
13
 
10
14
  == 0.2, released 2015-09-17
11
15
 
12
- * 'redminerb users create' to create a brand new user!
16
+ * +redminerb users create+ to create a brand new user!
13
17
 
14
18
  == 0.1, released 2015-09-16
15
19
 
16
- * 'redminerb config' to get current config
17
- * 'redminerb users [list]' to see current users
20
+ * +redminerb config+ to get current config
21
+ * +redminerb users [list]+ to see current users
data/README.md CHANGED
@@ -34,27 +34,35 @@ Or install it yourself as:
34
34
 
35
35
  ## Usage
36
36
 
37
- The URL and the API key of your Redmine REST API must be in your environment
38
- using *REDMINERB_URL* and *REDMINERB_API_KEY*, or in the `~/.redminerb.yml` as values
39
- of the *url* and *api_key* keys.
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
+
39
+
40
+ 1. **In your environment**: using *REDMINERB_URL* and *REDMINERB_API_KEY* env. vars.
41
+ 2. **In `~/.redminerb.yml`**: as values of *url* and *api_key*.
40
42
 
41
43
  For example, this `~/.redminerb.yml`:
42
44
 
43
45
  url: http://localhost:3000/
44
46
  api_key: 69b47d74e36a6757bac5d45f8398dd23bfa8f52c
45
47
 
46
- Would be the same as having the following in your `.bashrc`:
48
+ Would be the same as having the following in your environment (declared in `.bashrc`, for example):
47
49
 
48
50
  export REDMINERB_URL=http://localhost:3000/
49
51
  export REDMINERB_API_KEY=69b47d74e36a6757bac5d45f8398dd23bfa8f52c
50
52
 
51
- GET request on a collection ressources give us the results as indicated by the
52
- [Redmine pagination documentation](http://www.redmine.org/projects/redmine/wiki/Rest_api#Collection-resources-and-pagination). You can use the *--limit (-l)* and *--offset (-o)* options.
53
+ If both present environment variables have priority.
54
+
55
+ Collections of resources will give us the results as indicated by the
56
+ [Redmine pagination documentation](http://www.redmine.org/projects/redmine/wiki/Rest_api#Collection-resources-and-pagination) and the *--limit (-l)* and *--offset (-o)* options can be used.
53
57
 
54
- For example, you can see the third user of your Redmine with:
58
+ For example, you could see the third user of your Redmine with:
55
59
 
56
60
  $ redminerb users -o 3 -l 1
57
61
 
62
+ The output of particular resources can be customized creating the corresponding `.erb` file in the *.redminerb/templates* directory (the default templates could be found in the *templates* directory).
63
+
64
+ The *.redminerb* directory will be search in your current directory first, and then in your home directory.
65
+
58
66
  ### Configuration (config)
59
67
 
60
68
  To see the current configuration used by Redminerb we have the `config` command:
@@ -2,8 +2,10 @@
2
2
  require 'erb'
3
3
 
4
4
  module Redminerb
5
- # Class to read Redminerb's ERB templates
5
+ # Class to render Redminerb's ERB templates
6
6
  class Template
7
+ TEMPLATES_DIR = '.redminerb/templates'
8
+
7
9
  class << self
8
10
  # Renders the template +name+ using +resource+ assigned to a local
9
11
  # variable with that same name in its binding (i.e. the template will
@@ -44,8 +46,24 @@ module Redminerb
44
46
  end
45
47
 
46
48
  def _filepath(name)
49
+ _localfile(name) || _homefile(name) || _gemfile(name)
50
+ end
51
+
52
+ def _localfile(name)
53
+ _filepath_or_nil "#{TEMPLATES_DIR}/#{name}.erb"
54
+ end
55
+
56
+ def _homefile(name)
57
+ _filepath_or_nil "#{ENV['HOME']}/#{TEMPLATES_DIR}/#{name}.erb"
58
+ end
59
+
60
+ def _gemfile(name)
47
61
  File.join(File.dirname(__FILE__)[0..-15], 'templates', "#{name}.erb")
48
62
  end
63
+
64
+ def _filepath_or_nil(filepath)
65
+ filepath if File.exist?(filepath)
66
+ end
49
67
  end
50
68
  end
51
69
  end
@@ -1,4 +1,4 @@
1
1
  # Copyright (c) The Cocktail Experience S.L. (2015)
2
2
  module Redminerb
3
- VERSION = '0.4.0'
3
+ VERSION = '0.5.0'
4
4
  end
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.0
4
+ version: 0.5.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-22 00:00:00.000000000 Z
11
+ date: 2015-09-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor