capistrano-redmine 0.0.3 → 0.0.4

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.
data/README.md CHANGED
@@ -29,29 +29,42 @@ Or install it yourself as:
29
29
  3. Change directory to RAILS_ROOT of your app.
30
30
  3. Add this variables in `config/deploy.rb`:
31
31
 
32
- ```ruby
33
- # settings for capistrano-redmine
34
- set :redmine_site, "http://localhost:3000" # Redmine app host and port
35
- set :redmine_token, "376ba30fca80867d10a0ec0b505e5c97834901e3" # Redmine API key
36
- set :redmine_projects, "test-project" # you project identifier or array of.
37
- set :redmine_from_status, 1 # Redmine status ID "from"
38
- set :redmine_to_status, 3 # Redmine status ID "to"
39
- require "capistrano-redmine"
40
- ```
41
-
42
- and
43
-
44
- ```ruby
45
- after "deploy", "redmine:update"
46
- ```
47
-
48
- Specify the necessary settings for your Redmine.
32
+ ```ruby
33
+ # settings for capistrano-redmine
34
+ set :redmine_site, "http://localhost:3000" # Redmine app host and port
35
+ set :redmine_token, "376ba30fca80867d10a0ec0b505e5c97834901e3" # Redmine API key
36
+ set :redmine_options, {}
37
+ set :redmine_projects, "test-project" # you project identifier or array of.
38
+ set :redmine_from_status, 1 # Redmine status ID "from"
39
+ set :redmine_to_status, 3 # Redmine status ID "to"
40
+ require "capistrano-redmine"
41
+ ```
42
+
43
+ and
44
+
45
+ ```ruby
46
+ after "deploy", "redmine:update"
47
+ ```
48
+
49
+ Specify the necessary settings for your Redmine.
50
+
51
+ If you want to use specific options of ActiveResource (some HTTP of SSL options), you can add the following settings. Specify `:ssl` options if you use HTTPS connection to Redmine. Specify `:proxy` URL if you use HTTP-proxy.
52
+
53
+ ```ruby
54
+ set :redmine_options, {
55
+ :ssl => {
56
+ :cert => OpenSSL::X509::Certificate.new(File.read("cert.pem")),
57
+ :key => OpenSSL::PKey::RSA.new(File.read("key.pem"))
58
+ },
59
+ :proxy => 'http://user:password@proxy.people.com:8080'
60
+ }
61
+ ```
49
62
 
50
63
  4. Check installation with command
51
64
 
52
65
  `bundle exec cap -T redmine`
53
66
 
54
- You should see line:
67
+ You should see line:
55
68
 
56
69
  `cap redmine:update # Update Redmine issues statuses.`
57
70
 
@@ -60,7 +73,7 @@ Or install it yourself as:
60
73
 
61
74
  ## Redmine API config
62
75
 
63
- 1. To enable the API-style authentication, you have to check Enable REST API in Administration → Settings → Authentication.
76
+ 1. To enable the API-style authentication, you have to check Enable REST API in **Administration → Settings → Authentication**.
64
77
  2. Create new user named like 'deploy' (or other) and login with this.
65
78
  3. You can find your API key on your account page ( /my/account ) when logged in, on the right-hand pane of the default layout.
66
79
  4. Copy and paste API key to the `config/deploy.rb` on `set :redmine_token`.
@@ -4,17 +4,19 @@ require "capistrano-redmine/version"
4
4
  module Capistrano
5
5
  module Redmine
6
6
 
7
- def Redmine.configure(site, token)
7
+ def Redmine.configure(site, token, options = {})
8
8
  RedmineClient::Base.configure do
9
9
  self.site = site
10
10
  self.format = :xml
11
11
  self.user = token
12
12
  self.password = ""
13
+ self.ssl_options = options[:ssl] if options[:ssl]
14
+ self.proxy = options[:proxy] if options[:proxy]
13
15
  end
14
16
  end
15
17
 
16
- def Redmine.update(site, token, projects, from_status, to_status, logger)
17
- Redmine.configure(site, token)
18
+ def Redmine.update(site, token, options, projects, from_status, to_status, logger)
19
+ Redmine.configure(site, token, options)
18
20
  projects = [projects] unless projects.is_a? Array
19
21
 
20
22
  projects.each do |p|
@@ -37,13 +39,17 @@ module Capistrano
37
39
  return
38
40
  end
39
41
 
40
- statuses = RedmineClient::IssueStatus.find(:all).inject({}) do |memo, s|
41
- memo.merge s.id => s.name
42
- end
42
+ if issue_statuses = RedmineClient::IssueStatus.all
43
+ statuses = issue_statuses.inject({}) do |memo, s|
44
+ memo.merge s.id => s.name
45
+ end
43
46
 
44
- if statuses[from_status.to_s].nil? || statuses[to_status.to_s].nil?
45
- logger.important "Redmine error: Invalid issue status (or statuses)."
46
- return
47
+ if statuses[from_status.to_s].nil? || statuses[to_status.to_s].nil?
48
+ logger.important "Redmine error: Invalid issue status (or statuses)."
49
+ return
50
+ end
51
+ else
52
+ logger.debug "Redmine notice: Failed to get a list of possible statuses."
47
53
  end
48
54
 
49
55
  begin
@@ -80,6 +86,7 @@ configuration.load do
80
86
  Capistrano::Redmine.update(
81
87
  redmine_site,
82
88
  redmine_token,
89
+ exists?('redmine_options') ? redmine_options : {},
83
90
  redmine_projects,
84
91
  redmine_from_status,
85
92
  redmine_to_status,
@@ -1,5 +1,5 @@
1
1
  module Capistrano
2
2
  module Redmine
3
- VERSION = "0.0.3"
3
+ VERSION = "0.0.4"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano-redmine
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-07-17 00:00:00.000000000 Z
12
+ date: 2012-07-18 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: ! "This gem contains a Capistrano :task, which allows to\n update
15
15
  the Redmine issues statuses when you do deploy with Capistrano."