redmine-cli 0.1.0 → 0.1.1
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/.gitignore +1 -0
- data/Gemfile.lock +30 -1
- data/README.markdown +1 -1
- data/bin/git-redmine +9 -0
- data/bin/redmine +1 -1
- data/features/install.feature +28 -0
- data/features/step_definitions/install_steps.rb +3 -0
- data/features/support/setup.rb +1 -0
- data/lib/redmine-cli.rb +3 -1
- data/lib/redmine-cli/cli.rb +27 -8
- data/lib/redmine-cli/generators/.redmine +2 -1
- data/lib/redmine-cli/generators/install.rb +5 -4
- data/lib/redmine-cli/git.rb +19 -0
- data/lib/redmine-cli/issue.rb +10 -4
- data/lib/redmine-cli/version.rb +1 -1
- data/redmine-cli.gemspec +3 -0
- metadata +52 -4
data/.gitignore
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
redmine-cli (0.0
|
4
|
+
redmine-cli (0.1.0)
|
5
5
|
activeresource (~> 3.0.0)
|
6
6
|
thor
|
7
7
|
|
@@ -16,15 +16,41 @@ GEM
|
|
16
16
|
activemodel (= 3.0.1)
|
17
17
|
activesupport (= 3.0.1)
|
18
18
|
activesupport (3.0.1)
|
19
|
+
aruba (0.2.3)
|
20
|
+
background_process
|
21
|
+
cucumber (~> 0.9.0)
|
22
|
+
background_process (1.2)
|
19
23
|
builder (2.1.2)
|
20
24
|
columnize (0.3.1)
|
25
|
+
cucumber (0.9.3)
|
26
|
+
builder (~> 2.1.2)
|
27
|
+
diff-lcs (~> 1.1.2)
|
28
|
+
gherkin (~> 2.2.9)
|
29
|
+
json (~> 1.4.6)
|
30
|
+
term-ansicolor (~> 1.0.5)
|
31
|
+
diff-lcs (1.1.2)
|
32
|
+
gherkin (2.2.9)
|
33
|
+
json (~> 1.4.6)
|
34
|
+
term-ansicolor (~> 1.0.5)
|
21
35
|
i18n (0.4.2)
|
36
|
+
json (1.4.6)
|
22
37
|
linecache (0.43)
|
38
|
+
rspec (2.0.1)
|
39
|
+
rspec-core (~> 2.0.1)
|
40
|
+
rspec-expectations (~> 2.0.1)
|
41
|
+
rspec-mocks (~> 2.0.1)
|
42
|
+
rspec-core (2.0.1)
|
43
|
+
rspec-expectations (2.0.1)
|
44
|
+
diff-lcs (>= 1.1.2)
|
45
|
+
rspec-mocks (2.0.1)
|
46
|
+
rspec-core (~> 2.0.1)
|
47
|
+
rspec-expectations (~> 2.0.1)
|
23
48
|
ruby-debug (0.10.3)
|
24
49
|
columnize (>= 0.1)
|
25
50
|
ruby-debug-base (~> 0.10.3.0)
|
26
51
|
ruby-debug-base (0.10.3)
|
27
52
|
linecache (>= 0.3)
|
53
|
+
term-ansicolor (1.0.5)
|
28
54
|
thor (0.14.3)
|
29
55
|
|
30
56
|
PLATFORMS
|
@@ -32,6 +58,9 @@ PLATFORMS
|
|
32
58
|
|
33
59
|
DEPENDENCIES
|
34
60
|
activeresource (~> 3.0.0)
|
61
|
+
aruba
|
62
|
+
cucumber
|
35
63
|
redmine-cli!
|
64
|
+
rspec
|
36
65
|
ruby-debug
|
37
66
|
thor
|
data/README.markdown
CHANGED
data/bin/git-redmine
ADDED
data/bin/redmine
CHANGED
@@ -0,0 +1,28 @@
|
|
1
|
+
Feature: Install configuration file
|
2
|
+
In order to use the command line interface
|
3
|
+
Users need to be able to setup their config file
|
4
|
+
|
5
|
+
@announce
|
6
|
+
Scenario: Generate config file
|
7
|
+
When I run "redmine install example.com user --test" interactively
|
8
|
+
And I type "pass"
|
9
|
+
|
10
|
+
Then the output should match /create.*\.redmine/
|
11
|
+
And the following files should exist:
|
12
|
+
| .redmine |
|
13
|
+
And the file ".redmine" should contain:
|
14
|
+
"""
|
15
|
+
url: "http://example.com"
|
16
|
+
username: "user"
|
17
|
+
password: "pass"
|
18
|
+
default_project_id: 1
|
19
|
+
user_mappings:
|
20
|
+
"admin": 1
|
21
|
+
status_mappings:
|
22
|
+
"new": 1
|
23
|
+
"in-progress": 2
|
24
|
+
"resolved": 3
|
25
|
+
"feedback": 4
|
26
|
+
"closed": 5
|
27
|
+
"rejected": 6
|
28
|
+
"""
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'aruba'
|
data/lib/redmine-cli.rb
CHANGED
data/lib/redmine-cli/cli.rb
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
require 'thor'
|
2
|
+
require 'redmine-cli/issue'
|
3
|
+
require 'redmine-cli/generators/install'
|
4
|
+
|
1
5
|
module Redmine
|
2
6
|
module Cli
|
3
7
|
class CLI < Thor
|
@@ -23,7 +27,7 @@ module Redmine
|
|
23
27
|
print_table(issues)
|
24
28
|
end
|
25
29
|
else
|
26
|
-
say collection.collect(&:id).join("
|
30
|
+
say collection.collect(&:id).join(" ")
|
27
31
|
end
|
28
32
|
end
|
29
33
|
|
@@ -60,17 +64,15 @@ module Redmine
|
|
60
64
|
say e.message, :red
|
61
65
|
end
|
62
66
|
|
63
|
-
method_option :tickets, :aliases => "-l", :desc => "list of tickets"
|
67
|
+
method_option :tickets, :aliases => "-l", :desc => "list of tickets", :type => :array
|
64
68
|
method_option :status, :aliases => "-s", :desc => "id or name of status for ticket"
|
65
69
|
method_option :subject, :aliases => "-t", :desc => "subject for ticket (title)"
|
66
70
|
method_option :description, :aliases => "-d", :desc => "description for ticket"
|
67
71
|
method_option :assigned_to, :aliases => "-a", :desc => "id or user name of person the ticket is assigned to"
|
68
72
|
desc "update [TICKETS]", "Update tickets"
|
69
|
-
def update(tickets
|
73
|
+
def update(*tickets)
|
70
74
|
tickets = options.tickets if tickets.blank? && options.tickets.present?
|
71
75
|
|
72
|
-
tickets = tickets.split(",")
|
73
|
-
|
74
76
|
if tickets.empty?
|
75
77
|
say "No tickets to update", :red
|
76
78
|
exit 1
|
@@ -79,10 +81,21 @@ module Redmine
|
|
79
81
|
tickets.collect { |ticket| Thread.new { update_ticket(ticket, options) } }.each(&:join)
|
80
82
|
end
|
81
83
|
|
82
|
-
desc "install [URL][USERNAME]
|
83
|
-
|
84
|
+
desc "install [URL][USERNAME]", "Generates a default configuration file"
|
85
|
+
method_option :test, :type => :boolean
|
86
|
+
def install(url = "localhost:3000", username = "")
|
84
87
|
url = "http://#{url}" unless url =~ /\Ahttp/
|
85
|
-
|
88
|
+
|
89
|
+
if username.blank?
|
90
|
+
username = ask("Username?")
|
91
|
+
end
|
92
|
+
|
93
|
+
password = ask_password("Password?")
|
94
|
+
|
95
|
+
arguments = [url, username, password]
|
96
|
+
arguments.concat(["--test"]) if options.test
|
97
|
+
|
98
|
+
Redmine::Cli::Generators::Install.start(arguments)
|
86
99
|
end
|
87
100
|
|
88
101
|
no_tasks do
|
@@ -141,6 +154,12 @@ module Redmine
|
|
141
154
|
say "Could not find ticket: #{ticket}", :red
|
142
155
|
end
|
143
156
|
|
157
|
+
def ask_password(prompt)
|
158
|
+
system "stty -echo"
|
159
|
+
password = ask(prompt)
|
160
|
+
system "stty echo"
|
161
|
+
password
|
162
|
+
end
|
144
163
|
end
|
145
164
|
end
|
146
165
|
end
|
@@ -1,6 +1,7 @@
|
|
1
1
|
url: "<%= url %>"
|
2
2
|
username: "<%= username %>"
|
3
3
|
password: "<%= password %>"
|
4
|
+
default_project_id: 1
|
4
5
|
user_mappings:
|
5
6
|
"admin": 1
|
6
7
|
status_mappings:
|
@@ -9,4 +10,4 @@ status_mappings:
|
|
9
10
|
"resolved": 3
|
10
11
|
"feedback": 4
|
11
12
|
"closed": 5
|
12
|
-
"rejected": 6
|
13
|
+
"rejected": 6
|
@@ -9,11 +9,12 @@ module Redmine::Cli::Generators
|
|
9
9
|
File.dirname(__FILE__)
|
10
10
|
end
|
11
11
|
|
12
|
-
argument :url,
|
13
|
-
argument :username,
|
14
|
-
argument :password,
|
12
|
+
argument :url, :type => :string
|
13
|
+
argument :username, :type => :string
|
14
|
+
argument :password, :type => :string
|
15
|
+
class_option :test, :type => :boolean
|
15
16
|
def copy_configuration_file
|
16
|
-
self.destination_root = File.expand_path("~")
|
17
|
+
self.destination_root = File.expand_path("~") unless options.test
|
17
18
|
template(".redmine")
|
18
19
|
end
|
19
20
|
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'thor'
|
2
|
+
require 'redmine-cli/issue'
|
3
|
+
|
4
|
+
module Redmine
|
5
|
+
module Cli
|
6
|
+
class Git < Thor
|
7
|
+
|
8
|
+
desc "new TICKET", "Generate branch from ticket's information"
|
9
|
+
def new(ticket)
|
10
|
+
issue = Issue.find(ticket)
|
11
|
+
subject = issue.subject.gsub(/[^a-z0-9\-]+/i, "-").gsub(/-{1,}/,'-').gsub(/-$|^-/, '').downcase
|
12
|
+
`git checkout -b #{ticket}-#{subject}`
|
13
|
+
rescue ActiveResource::ResourceNotFound
|
14
|
+
say "No ticket with number: #{ticket}", :red
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
data/lib/redmine-cli/issue.rb
CHANGED
@@ -1,11 +1,17 @@
|
|
1
|
+
require 'thor'
|
2
|
+
require 'active_resource'
|
3
|
+
|
1
4
|
module Redmine
|
2
5
|
module Cli
|
3
6
|
class Issue < ActiveResource::Base
|
4
7
|
def self.config
|
5
|
-
@config ||=
|
6
|
-
|
7
|
-
|
8
|
-
|
8
|
+
@config ||=
|
9
|
+
begin
|
10
|
+
Thor::CoreExt::HashWithIndifferentAccess.new(YAML.load_file(File.expand_path("~/.redmine")))
|
11
|
+
rescue Errno::ENOENT
|
12
|
+
puts "You need to create the file .redmine in your home with your username, password and url"
|
13
|
+
Thor::CoreExt::HashWithIndifferentAccess.new
|
14
|
+
end
|
9
15
|
end
|
10
16
|
|
11
17
|
self.site = config.url
|
data/lib/redmine-cli/version.rb
CHANGED
data/redmine-cli.gemspec
CHANGED
@@ -22,4 +22,7 @@ Gem::Specification.new do |s|
|
|
22
22
|
s.add_dependency "activeresource", "~>3.0.0"
|
23
23
|
s.add_dependency "thor"
|
24
24
|
s.add_development_dependency "ruby-debug"
|
25
|
+
s.add_development_dependency "rspec"
|
26
|
+
s.add_development_dependency "cucumber"
|
27
|
+
s.add_development_dependency "aruba"
|
25
28
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: redmine-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 25
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 1
|
10
|
+
version: 0.1.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Jorge Dias
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-
|
18
|
+
date: 2010-11-01 00:00:00 +01:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -62,10 +62,53 @@ dependencies:
|
|
62
62
|
version: "0"
|
63
63
|
type: :development
|
64
64
|
version_requirements: *id003
|
65
|
+
- !ruby/object:Gem::Dependency
|
66
|
+
name: rspec
|
67
|
+
prerelease: false
|
68
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
69
|
+
none: false
|
70
|
+
requirements:
|
71
|
+
- - ">="
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
hash: 3
|
74
|
+
segments:
|
75
|
+
- 0
|
76
|
+
version: "0"
|
77
|
+
type: :development
|
78
|
+
version_requirements: *id004
|
79
|
+
- !ruby/object:Gem::Dependency
|
80
|
+
name: cucumber
|
81
|
+
prerelease: false
|
82
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
83
|
+
none: false
|
84
|
+
requirements:
|
85
|
+
- - ">="
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
hash: 3
|
88
|
+
segments:
|
89
|
+
- 0
|
90
|
+
version: "0"
|
91
|
+
type: :development
|
92
|
+
version_requirements: *id005
|
93
|
+
- !ruby/object:Gem::Dependency
|
94
|
+
name: aruba
|
95
|
+
prerelease: false
|
96
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
98
|
+
requirements:
|
99
|
+
- - ">="
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
hash: 3
|
102
|
+
segments:
|
103
|
+
- 0
|
104
|
+
version: "0"
|
105
|
+
type: :development
|
106
|
+
version_requirements: *id006
|
65
107
|
description: A simple command line interface for redmine for easy scripting
|
66
108
|
email:
|
67
109
|
- jorge@mrdias.com
|
68
110
|
executables:
|
111
|
+
- git-redmine
|
69
112
|
- redmine
|
70
113
|
extensions: []
|
71
114
|
|
@@ -77,11 +120,16 @@ files:
|
|
77
120
|
- Gemfile.lock
|
78
121
|
- README.markdown
|
79
122
|
- Rakefile
|
123
|
+
- bin/git-redmine
|
80
124
|
- bin/redmine
|
125
|
+
- features/install.feature
|
126
|
+
- features/step_definitions/install_steps.rb
|
127
|
+
- features/support/setup.rb
|
81
128
|
- lib/redmine-cli.rb
|
82
129
|
- lib/redmine-cli/cli.rb
|
83
130
|
- lib/redmine-cli/generators/.redmine
|
84
131
|
- lib/redmine-cli/generators/install.rb
|
132
|
+
- lib/redmine-cli/git.rb
|
85
133
|
- lib/redmine-cli/issue.rb
|
86
134
|
- lib/redmine-cli/version.rb
|
87
135
|
- redmine-cli.gemspec
|