acuforce 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +1 -1
- data/Rakefile +2 -0
- data/VERSION +1 -1
- data/acuforce.gemspec +6 -2
- data/lib/acuforce.rb +1 -0
- data/lib/acunote_connection.rb +1 -0
- data/lib/acunote_sprint.rb +30 -1
- data/lib/acunote_task.rb +23 -0
- metadata +76 -66
data/Gemfile
CHANGED
data/Rakefile
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.4.0
|
data/acuforce.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{acuforce}
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.4.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Harrison Strowd"]
|
12
|
-
s.date = %q{2012-
|
12
|
+
s.date = %q{2012-02-11}
|
13
13
|
s.description = %q{
|
14
14
|
Provides an API for the following actions:
|
15
15
|
* Logging in and Logging out
|
@@ -34,6 +34,7 @@ Provides an API for the following actions:
|
|
34
34
|
"lib/acunote_connection.rb",
|
35
35
|
"lib/acunote_project.rb",
|
36
36
|
"lib/acunote_sprint.rb",
|
37
|
+
"lib/acunote_task.rb",
|
37
38
|
"spec/acuforce_spec.rb",
|
38
39
|
"spec/spec_helper.rb"
|
39
40
|
]
|
@@ -47,12 +48,14 @@ Provides an API for the following actions:
|
|
47
48
|
s.specification_version = 3
|
48
49
|
|
49
50
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
51
|
+
s.add_runtime_dependency(%q<psych>, [">= 0"])
|
50
52
|
s.add_runtime_dependency(%q<mechanize>, [">= 0"])
|
51
53
|
s.add_development_dependency(%q<rspec>, ["~> 2.3.0"])
|
52
54
|
s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
|
53
55
|
s.add_development_dependency(%q<jeweler>, ["~> 1.6.4"])
|
54
56
|
s.add_development_dependency(%q<rcov>, [">= 0"])
|
55
57
|
else
|
58
|
+
s.add_dependency(%q<psych>, [">= 0"])
|
56
59
|
s.add_dependency(%q<mechanize>, [">= 0"])
|
57
60
|
s.add_dependency(%q<rspec>, ["~> 2.3.0"])
|
58
61
|
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
@@ -60,6 +63,7 @@ Provides an API for the following actions:
|
|
60
63
|
s.add_dependency(%q<rcov>, [">= 0"])
|
61
64
|
end
|
62
65
|
else
|
66
|
+
s.add_dependency(%q<psych>, [">= 0"])
|
63
67
|
s.add_dependency(%q<mechanize>, [">= 0"])
|
64
68
|
s.add_dependency(%q<rspec>, ["~> 2.3.0"])
|
65
69
|
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
data/lib/acuforce.rb
CHANGED
data/lib/acunote_connection.rb
CHANGED
@@ -19,6 +19,7 @@ class AcunoteConnection
|
|
19
19
|
|
20
20
|
LOGIN_FIELDS = ['login[username]', 'login[password]'] unless defined? LOGIN_FIELDS
|
21
21
|
LOGIN_FORM_NAME = "login_form" unless defined? LOGIN_FORM_NAME
|
22
|
+
DEBUG = false unless defined? DEBUG
|
22
23
|
|
23
24
|
# The home_url must be set after the instance is first retrieved.
|
24
25
|
def home_url
|
data/lib/acunote_sprint.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'acunote_connection'
|
2
2
|
|
3
|
-
# API for accessing Acunote
|
3
|
+
# API for accessing Acunote sprints.
|
4
4
|
class AcunoteSprint
|
5
5
|
def self.acu_conn
|
6
6
|
AcunoteConnection.instance
|
@@ -56,6 +56,35 @@ class AcunoteSprint
|
|
56
56
|
sprints.links_with(:text => name).first if sprints
|
57
57
|
end
|
58
58
|
|
59
|
+
# Note: This is extremely brittle to the structure of the acunote sprint page, but I
|
60
|
+
# couldn't find any other way to do it.
|
61
|
+
def self.find_task_id_by_name(proj_id, sprint_id, task_name)
|
62
|
+
sprint_page = acu_conn.get_page(url(proj_id,sprint_id)+'/show')
|
63
|
+
all_tasks = sprint_page.parser.search('span.descr_edit')
|
64
|
+
matches = all_tasks.select { |task_node| task_node.text.match(task_name) }
|
65
|
+
STDOUT.puts("Found #{all_tasks.size} tasks in this sprint. Out of those #{matches.size} matched the task name provided.") if DEBUG
|
66
|
+
if matches.size == 1
|
67
|
+
STDOUT.puts("Found match: #{matches[0]}") if DEBUG
|
68
|
+
prop = matches[0].search('span.task_properties')[0]
|
69
|
+
prop_id_str = prop.attribute('id').text
|
70
|
+
STDOUT.puts("Found a properties span with: #{prop_id_str}") if DEBUG
|
71
|
+
if prop_id_str =~ /^task_propertires_([0-9]*)$/
|
72
|
+
task_prop = $1
|
73
|
+
links = sprint_page.links_with(:id => "issue_number_for_#{task_prop}")
|
74
|
+
STDOUT.puts "Found the following links matching the property for this task: #{links.inspect}" if DEBUG
|
75
|
+
if links.size == 1
|
76
|
+
links[0].text
|
77
|
+
else
|
78
|
+
nil
|
79
|
+
end
|
80
|
+
else
|
81
|
+
nil
|
82
|
+
end
|
83
|
+
else
|
84
|
+
nil
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
59
88
|
def self.upload_csv(proj_id, sprint_id, raw_data)
|
60
89
|
import_page = acu_conn.get_page(url(proj_id,sprint_id)+"/import")
|
61
90
|
import_form = import_page.form_with({:name => 'import_form'})
|
data/lib/acunote_task.rb
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'acunote_connection'
|
2
|
+
|
3
|
+
# API for accessing Acunote tasks.
|
4
|
+
class AcunoteTask
|
5
|
+
def self.acu_conn
|
6
|
+
AcunoteConnection.instance
|
7
|
+
end
|
8
|
+
|
9
|
+
def self.url(proj_id, task_id)
|
10
|
+
"#{acu_conn.home_url}/projects/#{proj_id}/tasks/#{task_id}"
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.mark_complete(proj_id, task_id)
|
14
|
+
task_page = acu_conn.get_page(url(proj_id,task_id))
|
15
|
+
if task_page.root.to_s =~ /FORM_AUTH_TOKEN = '(.*=)';/
|
16
|
+
form_auth_token = $1
|
17
|
+
acu_conn.mech.post("#{acu_conn.home_url}/issues/update", {'number'=>task_id,'field'=>'status','view'=>'task_details','value'=>'In Progress','old_value'=>'Not Started','authenticity_token'=>form_auth_token,'project_id'=>proj_id,'_method'=>'post'})
|
18
|
+
true
|
19
|
+
else
|
20
|
+
nil
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
metadata
CHANGED
@@ -1,94 +1,100 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: acuforce
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.0
|
3
|
+
version: !ruby/object:Gem::Version
|
5
4
|
prerelease:
|
5
|
+
version: 0.4.0
|
6
6
|
platform: ruby
|
7
|
-
authors:
|
7
|
+
authors:
|
8
8
|
- Harrison Strowd
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
|
12
|
+
|
13
|
+
date: 2012-02-11 00:00:00 -06:00
|
13
14
|
default_executable:
|
14
|
-
dependencies:
|
15
|
-
- !ruby/object:Gem::Dependency
|
15
|
+
dependencies:
|
16
|
+
- !ruby/object:Gem::Dependency
|
17
|
+
name: psych
|
18
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
19
|
+
none: false
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: "0"
|
24
|
+
type: :runtime
|
25
|
+
prerelease: false
|
26
|
+
version_requirements: *id001
|
27
|
+
- !ruby/object:Gem::Dependency
|
16
28
|
name: mechanize
|
17
|
-
requirement: &
|
29
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
18
30
|
none: false
|
19
|
-
requirements:
|
20
|
-
- -
|
21
|
-
- !ruby/object:Gem::Version
|
22
|
-
version:
|
31
|
+
requirements:
|
32
|
+
- - ">="
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: "0"
|
23
35
|
type: :runtime
|
24
36
|
prerelease: false
|
25
|
-
version_requirements: *
|
26
|
-
- !ruby/object:Gem::Dependency
|
37
|
+
version_requirements: *id002
|
38
|
+
- !ruby/object:Gem::Dependency
|
27
39
|
name: rspec
|
28
|
-
requirement: &
|
40
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
29
41
|
none: false
|
30
|
-
requirements:
|
42
|
+
requirements:
|
31
43
|
- - ~>
|
32
|
-
- !ruby/object:Gem::Version
|
44
|
+
- !ruby/object:Gem::Version
|
33
45
|
version: 2.3.0
|
34
46
|
type: :development
|
35
47
|
prerelease: false
|
36
|
-
version_requirements: *
|
37
|
-
- !ruby/object:Gem::Dependency
|
48
|
+
version_requirements: *id003
|
49
|
+
- !ruby/object:Gem::Dependency
|
38
50
|
name: bundler
|
39
|
-
requirement: &
|
51
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
40
52
|
none: false
|
41
|
-
requirements:
|
53
|
+
requirements:
|
42
54
|
- - ~>
|
43
|
-
- !ruby/object:Gem::Version
|
55
|
+
- !ruby/object:Gem::Version
|
44
56
|
version: 1.0.0
|
45
57
|
type: :development
|
46
58
|
prerelease: false
|
47
|
-
version_requirements: *
|
48
|
-
- !ruby/object:Gem::Dependency
|
59
|
+
version_requirements: *id004
|
60
|
+
- !ruby/object:Gem::Dependency
|
49
61
|
name: jeweler
|
50
|
-
requirement: &
|
62
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
51
63
|
none: false
|
52
|
-
requirements:
|
64
|
+
requirements:
|
53
65
|
- - ~>
|
54
|
-
- !ruby/object:Gem::Version
|
66
|
+
- !ruby/object:Gem::Version
|
55
67
|
version: 1.6.4
|
56
68
|
type: :development
|
57
69
|
prerelease: false
|
58
|
-
version_requirements: *
|
59
|
-
- !ruby/object:Gem::Dependency
|
70
|
+
version_requirements: *id005
|
71
|
+
- !ruby/object:Gem::Dependency
|
60
72
|
name: rcov
|
61
|
-
requirement: &
|
73
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
62
74
|
none: false
|
63
|
-
requirements:
|
64
|
-
- -
|
65
|
-
- !ruby/object:Gem::Version
|
66
|
-
version:
|
75
|
+
requirements:
|
76
|
+
- - ">="
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: "0"
|
67
79
|
type: :development
|
68
80
|
prerelease: false
|
69
|
-
version_requirements: *
|
70
|
-
description:
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
*
|
75
|
-
|
76
|
-
*
|
77
|
-
|
78
|
-
* Finding a sprint
|
79
|
-
|
80
|
-
* Uploading tasks to a sprint from a CSV file
|
81
|
-
|
82
|
-
* Exporting tasks in a sprint to a CSV file
|
83
|
-
|
84
|
-
'
|
81
|
+
version_requirements: *id006
|
82
|
+
description: "\n\
|
83
|
+
Provides an API for the following actions:\n\
|
84
|
+
* Logging in and Logging out\n\
|
85
|
+
* Creating a sprint\n\
|
86
|
+
* Finding a sprint\n\
|
87
|
+
* Uploading tasks to a sprint from a CSV file\n\
|
88
|
+
* Exporting tasks in a sprint to a CSV file\n"
|
85
89
|
email: hstrowd@gmail.com
|
86
90
|
executables: []
|
91
|
+
|
87
92
|
extensions: []
|
88
|
-
|
93
|
+
|
94
|
+
extra_rdoc_files:
|
89
95
|
- LICENSE.txt
|
90
96
|
- README.rdoc
|
91
|
-
files:
|
97
|
+
files:
|
92
98
|
- Gemfile
|
93
99
|
- LICENSE.txt
|
94
100
|
- README.rdoc
|
@@ -99,35 +105,39 @@ files:
|
|
99
105
|
- lib/acunote_connection.rb
|
100
106
|
- lib/acunote_project.rb
|
101
107
|
- lib/acunote_sprint.rb
|
108
|
+
- lib/acunote_task.rb
|
102
109
|
- spec/acuforce_spec.rb
|
103
110
|
- spec/spec_helper.rb
|
104
111
|
has_rdoc: true
|
105
112
|
homepage: http://github.com/hstrowd/AcuForce
|
106
|
-
licenses:
|
113
|
+
licenses:
|
107
114
|
- MIT
|
108
115
|
post_install_message:
|
109
116
|
rdoc_options: []
|
110
|
-
|
117
|
+
|
118
|
+
require_paths:
|
111
119
|
- lib
|
112
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
120
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
113
121
|
none: false
|
114
|
-
requirements:
|
115
|
-
- -
|
116
|
-
- !ruby/object:Gem::Version
|
117
|
-
|
118
|
-
segments:
|
122
|
+
requirements:
|
123
|
+
- - ">="
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
hash: -616021078157183817
|
126
|
+
segments:
|
119
127
|
- 0
|
120
|
-
|
121
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
128
|
+
version: "0"
|
129
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
122
130
|
none: false
|
123
|
-
requirements:
|
124
|
-
- -
|
125
|
-
- !ruby/object:Gem::Version
|
126
|
-
version:
|
131
|
+
requirements:
|
132
|
+
- - ">="
|
133
|
+
- !ruby/object:Gem::Version
|
134
|
+
version: "0"
|
127
135
|
requirements: []
|
136
|
+
|
128
137
|
rubyforge_project:
|
129
138
|
rubygems_version: 1.6.2
|
130
139
|
signing_key:
|
131
140
|
specification_version: 3
|
132
141
|
summary: Client API for performing actions on an Acunote site.
|
133
142
|
test_files: []
|
143
|
+
|