morale 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/features/tickets.feature +15 -0
- data/lib/morale/account.rb +6 -6
- data/lib/morale/command.rb +1 -1
- data/lib/morale/commands/account.rb +1 -1
- data/lib/morale/commands/project.rb +1 -1
- data/lib/morale/commands/ticket.rb +20 -4
- data/lib/morale.rb +1 -1
- data/morale.gemspec +2 -2
- metadata +3 -3
data/features/tickets.feature
CHANGED
@@ -38,6 +38,21 @@ Feature: Running the tickets command
|
|
38
38
|
No project specified.
|
39
39
|
"""
|
40
40
|
|
41
|
+
@interactive
|
42
|
+
Scenario: Deleting a ticket should return the ticket results
|
43
|
+
Given a file named "credentials" with:
|
44
|
+
"""
|
45
|
+
spartan
|
46
|
+
12345
|
47
|
+
1
|
48
|
+
"""
|
49
|
+
When I run `morale This should be deleted`
|
50
|
+
And I run `morale "d #10"` interactively
|
51
|
+
Then the output should contain:
|
52
|
+
"""
|
53
|
+
This should be deleted
|
54
|
+
"""
|
55
|
+
|
41
56
|
@interactive
|
42
57
|
Scenario: Running tickets should return a list of all active tickets
|
43
58
|
Given a file named "credentials" with:
|
data/lib/morale/account.rb
CHANGED
@@ -9,9 +9,9 @@ module Morale
|
|
9
9
|
include Morale::CredentialsStore
|
10
10
|
include Morale::Flow
|
11
11
|
|
12
|
-
def subdomain
|
12
|
+
def subdomain(ask=true)
|
13
13
|
if @subdomain.nil?
|
14
|
-
get_credentials
|
14
|
+
get_credentials ask
|
15
15
|
@subdomain = @credentials[0]
|
16
16
|
end
|
17
17
|
@subdomain
|
@@ -29,8 +29,8 @@ module Morale
|
|
29
29
|
@credentials[1]
|
30
30
|
end
|
31
31
|
|
32
|
-
def project
|
33
|
-
get_credentials
|
32
|
+
def project(ask=true)
|
33
|
+
get_credentials ask
|
34
34
|
@credentials[2] if !@credentials.nil? && @credentials.length > 2
|
35
35
|
end
|
36
36
|
|
@@ -46,10 +46,10 @@ module Morale
|
|
46
46
|
@login_attempts < 3
|
47
47
|
end
|
48
48
|
|
49
|
-
def get_credentials
|
49
|
+
def get_credentials(ask=true)
|
50
50
|
return if @credentials
|
51
51
|
unless @credentials = read_credentials
|
52
|
-
ask_for_and_save_credentials
|
52
|
+
ask_for_and_save_credentials if ask
|
53
53
|
end
|
54
54
|
@credentials
|
55
55
|
end
|
data/lib/morale/command.rb
CHANGED
@@ -16,7 +16,7 @@ module Morale::Commands
|
|
16
16
|
|
17
17
|
if !accounts.nil?
|
18
18
|
accounts.sort{|a,b| a['account']['group_name'] <=> b['account']['group_name']}.each_with_index do |record, i|
|
19
|
-
say "#{i += 1}. #{record['account']['group_name']}"
|
19
|
+
say "#{i += 1}. #{record['account']['group_name']}#{' *' if Morale::Account.subdomain(false) == record['account']['site_address']}"
|
20
20
|
end
|
21
21
|
|
22
22
|
if change
|
@@ -12,7 +12,7 @@ module Morale::Commands
|
|
12
12
|
projects = Morale::Command.client.projects
|
13
13
|
if !projects.nil?
|
14
14
|
projects.sort{|a,b| a['project']['name'] <=> b['project']['name']}.each_with_index do |record, i|
|
15
|
-
puts "#{i += 1}. #{record['project']['name']}"
|
15
|
+
puts "#{i += 1}. #{record['project']['name']}#{' *' if Morale::Account.project(false) == record['project']['id'].to_s}"
|
16
16
|
end
|
17
17
|
|
18
18
|
if change
|
@@ -11,13 +11,29 @@ module Morale::Commands
|
|
11
11
|
include Morale::Flow
|
12
12
|
|
13
13
|
def command(command)
|
14
|
-
|
15
|
-
|
14
|
+
begin
|
15
|
+
ask_for_project
|
16
|
+
print Morale::Command.client.ticket(Morale::Account.project, command) unless Morale::Account.project.nil?
|
17
|
+
rescue Morale::Client::Unauthorized
|
18
|
+
say "Authentication failure"
|
19
|
+
Morale::Commands::Authorization.login
|
20
|
+
retry if Morale::Authorization.retry_login?
|
21
|
+
rescue Morale::Client::NotFound
|
22
|
+
say "Communication failure"
|
23
|
+
end
|
16
24
|
end
|
17
25
|
|
18
26
|
def list
|
19
|
-
|
20
|
-
|
27
|
+
begin
|
28
|
+
ask_for_project
|
29
|
+
print Morale::Command.client.tickets({ :project_id => Morale::Account.project }) unless Morale::Account.project.nil?
|
30
|
+
rescue Morale::Client::Unauthorized
|
31
|
+
say "Authentication failure"
|
32
|
+
Morale::Commands::Authorization.login
|
33
|
+
retry if Morale::Authorization.retry_login?
|
34
|
+
rescue Morale::Client::NotFound
|
35
|
+
say "Communication failure"
|
36
|
+
end
|
21
37
|
end
|
22
38
|
|
23
39
|
private
|
data/lib/morale.rb
CHANGED
data/morale.gemspec
CHANGED
@@ -5,8 +5,8 @@ Gem::Specification.new do |s|
|
|
5
5
|
s.rubygems_version = '1.3.5'
|
6
6
|
|
7
7
|
s.name = 'morale'
|
8
|
-
s.version = '0.1.
|
9
|
-
s.date = '2011-10-
|
8
|
+
s.version = '0.1.3'
|
9
|
+
s.date = '2011-10-02'
|
10
10
|
s.rubyforge_project = 'morale'
|
11
11
|
|
12
12
|
s.summary = "Command line interface to create & manage tickets on Morale."
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
version: 0.1.
|
8
|
+
- 3
|
9
|
+
version: 0.1.3
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Brilliant Fantastic
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2011-10-
|
17
|
+
date: 2011-10-02 00:00:00 -04:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|