Module: Backlogs
- Defined in:
- lib/color.rb,
lib/backlogs_setup.rb,
lib/backlogs_user_patch.rb,
lib/backlogs_issue_patch.rb,
lib/backlogs_query_patch.rb,
lib/backlogs_merged_array.rb,
lib/backlogs_version_patch.rb,
lib/backlogs_tracker_patch.rb,
lib/backlogs_project_patch.rb,
lib/backlogs_issue_status_patch.rb,
lib/backlogs_my_controller_patch.rb
Overview
Implements a color (r,g,b + a) with conversion to/from web format (eg
#aabbcc), and with a number of utilities to lighten, darken and blend
values.
Defined Under Namespace
Modules: IssuePatch, IssueStatusPatch, MyControllerPatch, ProjectPatch, QueryPatch, TrackerPatch, UserPatch, VersionPatch
Classes: Color, MergedArray, RbERB, SettingsProxy, Statistics
Instance Method Summary
(collapse)
Instance Method Details
86
87
88
89
90
|
# File 'lib/backlogs_setup.rb', line 86
def configured?
return false if Backlogs.gems.values.reject{|installed| installed}.size > 0
return false if Backlogs.trackers.values.reject{|configured| configured}.size > 0
return true
end
|
- (Object) gems
48
49
50
51
52
53
54
55
56
57
58
59
|
# File 'lib/backlogs_setup.rb', line 48
def gems
installed = Hash[*(['system_timer', 'nokogiri', 'open-uri/cached', 'holidays', 'icalendar', 'prawn'].collect{|gem| [gem, false]}.flatten)]
installed.delete('system_timer') unless os == :unix && RUBY_VERSION =~ /^1\.8\./
installed.keys.each{|gem|
begin
require gem
installed[gem] = true
rescue LoadError
end
}
return installed
end
|
- (Object) os
40
41
42
43
44
45
|
# File 'lib/backlogs_setup.rb', line 40
def os
return :windows if RUBY_PLATFORM =~ /cygwin|windows|mswin|mingw|bccwin|wince|emx/
return :unix if RUBY_PLATFORM =~ /darwin|linux/
return :java if RUBY_PLATFORM =~ /java/
return nil
end
|
93
94
95
96
97
98
99
100
101
102
103
|
# File 'lib/backlogs_setup.rb', line 93
def platform
unless @platform
begin
ChiliProject::VERSION
@platform = :chiliproject
rescue NameError
@platform = :redmine
end
end
return @platform
end
|
25
26
27
28
29
30
31
32
33
34
35
36
37
|
# File 'lib/backlogs_setup.rb', line 25
def platform_support(raise_error = false)
case platform
when :redmine
return "#{Redmine::VERSION} (supported)" if Redmine::VERSION.to_a[0,2] == [1,3]
return "#{Redmine::VERSION} (not supported, but it will work)" if Redmine::VERSION::MAJOR == 1 && Redmine::VERSION::MINOR == 2 && Redmine::VERSION::TINY > 0
return "#{Redmine::VERSION} (NOT SUPPORTED)" unless raise_error
raise "#{Redmine::VERSION} (NOT SUPPORTED)"
when :chiliproject
return "#{Redmine::VERSION} (supported)" if Redmine::VERSION.to_a[0,3] == [2,6,0]
return "#{Redmine::VERSION} (NOT SUPPORTED)" unless raise_error
raise "#{Redmine::VERSION} (NOT SUPPORTED)"
end
end
|
- (Object) rgb(*args)
"Global" method for creating Color objects, eg:
new_color = rgb(params[:new_color])
style="border: 1px solid <%= rgb(10,50,80).lighten %>"
247
248
249
|
# File 'lib/color.rb', line 247
def rgb(*args)
Color.parse(*args)
end
|
- (Object) setting
138
139
140
|
# File 'lib/backlogs_setup.rb', line 138
def setting
SettingsProxy.instance
end
|
- (Object) settings
142
143
144
|
# File 'lib/backlogs_setup.rb', line 142
def settings
SettingsProxy.instance.to_h
end
|
- (Object) task_workflow(project)
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
# File 'lib/backlogs_setup.rb', line 67
def task_workflow(project)
return true if User.current.admin?
return false unless RbTask.tracker
roles = User.current.roles_for_project(@project)
tracker = Tracker.find(RbTask.tracker)
[false, true].each{|creator|
[false, true].each{|assignee|
tracker.issue_statuses.each {|status|
status.new_statuses_allowed_to(roles, tracker, creator, assignee).each{|s|
return true
}
}
}
}
end
|
- (Object) trackers
62
63
64
|
# File 'lib/backlogs_setup.rb', line 62
def trackers
return {:task => !RbTask.tracker.nil?, :story => RbStory.trackers.size != 0, :default_priority => !IssuePriority.default.nil?}
end
|
- (Object) version
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/backlogs_setup.rb', line 6
def version
root = File.expand_path('..', File.dirname(__FILE__))
git = File.join(root, '.git')
v = Redmine::Plugin.find(:redmine_backlogs).version
g = nil
if File.directory?(git)
Dir.chdir(root)
g = `git log | head -1 | awk '{print $2}'`
g.strip!
g = "(#{g})"
end
v = [v, g].compact.join(' ')
v = '?' if v == ''
return v
end
|