backlog 0.35.1 → 0.35.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -78,7 +78,7 @@ class WorksControllerTest < Test::Unit::TestCase
78
78
  def test_create
79
79
  num_works = Work.count
80
80
 
81
- post :create, :work => {:task_id => 1, :started_on => Date.today.to_s, :start_time => Time.now.time_of_day.to_s, :work_account_id => '1'}
81
+ post :create, :work => {:task_id => '1', :started_on => Date.today.to_s, :start_time => Time.now.time_of_day.to_s, :work_account_id => '1'}
82
82
 
83
83
  assert_response :redirect
84
84
  assert_redirected_to :controller => 'periods', :action => 'show', :id => periods(:past).id, :task_id => 1
@@ -89,7 +89,7 @@ class WorksControllerTest < Test::Unit::TestCase
89
89
  def test_create_without_start_date
90
90
  num_works = Work.count
91
91
 
92
- post :create, :work => {:task_id => 1, :start_time => Time.now.time_of_day.to_s, :work_account_id => '1'}
92
+ post :create, :work => {:task_id => '1', :start_time => Time.now.time_of_day.to_s, :work_account_id => '1'}
93
93
 
94
94
  assert_response :redirect
95
95
  assert_redirected_to :controller => 'periods', :action => 'show', :id => periods(:past).id, :task_id => 1
@@ -100,7 +100,7 @@ class WorksControllerTest < Test::Unit::TestCase
100
100
  def test_create_with_old_start_date
101
101
  num_works = Work.count
102
102
 
103
- post :create, :work => {:task_id => 1, :started_on => '2007-07-31', :work_account_id => '1',
103
+ post :create, :work => {:task_id => '1', :started_on => '2007-07-31', :work_account_id => '1',
104
104
  :start_time => '12:00', :completed_at => '2007-07-31 12:20'}
105
105
 
106
106
  assert_response :redirect
@@ -113,7 +113,7 @@ class WorksControllerTest < Test::Unit::TestCase
113
113
  def test_create_with_old_start_date_and_completed_at_time
114
114
  num_works = Work.count
115
115
 
116
- post :create, :work => {:task_id => 1, :started_on => '2007-07-31', :work_account_id => '1',
116
+ post :create, :work => {:task_id => '1', :started_on => '2007-07-31', :work_account_id => '1',
117
117
  :start_time => '12:00', :completed_at_time => '12:20'}
118
118
 
119
119
  assert_response :redirect
@@ -1,58 +1,61 @@
1
1
  require 'sidebar'
2
2
  require 'mechanize'
3
+ require 'hpricot'
3
4
 
4
5
  class ::Sidebar
5
6
  def blocks_with_jira_issues(*args)
6
7
  blocks = blocks_without_jira_issues(*args)
7
8
 
8
- app_conf = YAML::load(ERB.new(IO.read(APP_CONFIG_FILE)).result) || {}
9
- if jira_conf = app_conf['jira']
10
- jira_url = jira_conf['url'].chomp('/')
11
- jira_user = jira_conf['user']
12
- jira_password = jira_conf['password']
13
- jira_pids = jira_conf['pids'].to_s.split(',').map{|p| "&pid=#{p.strip}"}
14
- fix_version = jira_conf['fix_version'].to_s
15
- limit = 20
16
- assignee = '' # "&assigneeSelect=specificuser&assignee=#{jira_user}"
17
- sorting = '&sorter/field=priority&sorter/order=DESC'
18
- resolution = 'resolution=-1'
19
-
20
- agent = WWW::Mechanize.new { |a| a.log = Logger.new("jira.log") }
21
- agent.user_agent_alias = 'Mechanize'
22
-
23
- login_url = "#{jira_url}/login.jsp?os_username=#{jira_user}&os_password=#{jira_password}"
24
- login_page = agent.get(login_url)
25
- login_form = login_page.forms.name("loginform").first
26
- login_form.fields.name("os_username").value = jira_user
27
- login_form.fields.name("os_username").value = jira_user
28
- agent.submit(login_form)
29
-
30
- search_path = 'sr/jira.issueviews:searchrequest-xml/temp/SearchRequest.xml'
31
- url = "#{jira_url}/#{search_path}?#{resolution}#{jira_pids}#{assignee}#{sorting}&tempMax=#{limit}&fixfor=#{fix_version}"
32
- search_results = agent.get(url)
33
-
34
- xml_search_doc = Hpricot.XML(search_results.body)
35
- items = (xml_search_doc/"item")
36
- issues = items.map do |item|
37
- title = (item/'title').inner_html
38
- link = (item/'link').first.inner_html
39
- [title, link]
40
- end
41
-
42
- list = "<ul>\n"
43
- issues.each do |issue|
44
- list << "<li>\n"
45
- list << link_to(issue[0], issue[1])
46
- list << " [" + link_to('Add', :controller => :tasks, :action => :new, :task => {:backlog_id => 1, :period_id => @period, :description => issue[0]})
47
- list << "]</li>\n"
9
+ if File.exists?(APP_CONFIG_FILE)
10
+ app_conf = YAML::load(ERB.new(IO.read(APP_CONFIG_FILE)).result) || {}
11
+ if jira_conf = app_conf['jira']
12
+ jira_url = jira_conf['url'].chomp('/')
13
+ jira_user = jira_conf['user']
14
+ jira_password = jira_conf['password']
15
+ jira_pids = jira_conf['pids'].to_s.split(',').map{|p| "&pid=#{p.strip}"}
16
+ fix_version = jira_conf['fix_version'].to_s
17
+ limit = 20
18
+ assignee = '' # "&assigneeSelect=specificuser&assignee=#{jira_user}"
19
+ sorting = '&sorter/field=priority&sorter/order=DESC'
20
+ resolution = 'resolution=-1'
21
+
22
+ agent = WWW::Mechanize.new { |a| a.log = Logger.new("jira.log") }
23
+ agent.user_agent_alias = 'Mechanize'
24
+
25
+ login_url = "#{jira_url}/login.jsp?os_username=#{jira_user}&os_password=#{jira_password}"
26
+ login_page = agent.get(login_url)
27
+ login_form = login_page.form_with(:name => 'loginform')
28
+ login_form["os_username"] = jira_user
29
+ login_form["os_username"] = jira_user
30
+ agent.submit(login_form)
31
+
32
+ search_path = 'sr/jira.issueviews:searchrequest-xml/temp/SearchRequest.xml'
33
+ url = "#{jira_url}/#{search_path}?#{resolution}#{jira_pids}#{assignee}#{sorting}&tempMax=#{limit}&fixfor=#{fix_version}"
34
+ search_results = agent.get(url)
35
+
36
+ xml_search_doc = Hpricot.XML(search_results.body)
37
+ items = (xml_search_doc/"item")
38
+ issues = items.map do |item|
39
+ title = (item/'title').inner_html
40
+ link = (item/'link').first.inner_html
41
+ [title, link]
42
+ end
43
+
44
+ list = "<ul>\n"
45
+ issues.each do |issue|
46
+ list << "<li>\n"
47
+ list << link_to(issue[0], issue[1])
48
+ list << " [" + link_to('Add', :controller => :tasks, :action => :new, :task => {:backlog_id => 1, :period_id => @period, :description => issue[0]})
49
+ list << "]</li>\n"
50
+ end
51
+ list << "</ul>\n"
52
+ blocks << {
53
+ :id => 1,
54
+ :title => "JIRA Issues",
55
+ :options => jira_url,
56
+ :content => list
57
+ }
48
58
  end
49
- list << "</ul>\n"
50
- blocks << {
51
- :id => 1,
52
- :title => "JIRA Issues",
53
- :options => jira_url,
54
- :content => list
55
- }
56
59
  end
57
60
  end
58
61
  alias_method_chain :blocks, :jira_issues
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: backlog
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.35.1
4
+ version: 0.35.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Uwe Kubosch
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-12-24 00:00:00 +01:00
12
+ date: 2009-01-06 00:00:00 +01:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency