Class: Durt::Plugin
- Inherits:
-
Object
show all
- Defined in:
- lib/durt/plugin.rb
Defined Under Namespace
Classes: NotConfiguredError
Constant Summary
collapse
- PLUGINS =
%w[Upwork Pivotal Jira Github Ebs Notify Local].freeze
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(project, config = nil) ⇒ Plugin
Returns a new instance of Plugin.
19
20
21
22
|
# File 'lib/durt/plugin.rb', line 19
def initialize(project, config = nil)
@project = project
@config = config
end
|
Instance Attribute Details
#config ⇒ Object
Returns the value of attribute config.
7
8
9
|
# File 'lib/durt/plugin.rb', line 7
def config
@config
end
|
#project ⇒ Object
Returns the value of attribute project.
7
8
9
|
# File 'lib/durt/plugin.rb', line 7
def project
@project
end
|
Class Method Details
.all ⇒ Object
11
12
13
14
15
16
17
|
# File 'lib/durt/plugin.rb', line 11
def self.all
PLUGINS.map do |plugin_name|
klass = "Durt::#{plugin_name}Plugin"
klass.constantize
end
end
|
.demo_config ⇒ Object
32
33
34
|
# File 'lib/durt/plugin.rb', line 32
def self.demo_config
nil
end
|
.find_by_plugin_name(plugin_name) ⇒ Object
24
25
26
|
# File 'lib/durt/plugin.rb', line 24
def self.find_by_plugin_name(plugin_name)
all.find { |plugin| plugin.plugin_name == plugin_name.to_s }
end
|
.plugin_name ⇒ Object
28
29
30
|
# File 'lib/durt/plugin.rb', line 28
def self.plugin_name
name.split('::').last.sub('Plugin', '')
end
|
Instance Method Details
#before_enter(value) ⇒ Object
52
53
54
|
# File 'lib/durt/plugin.rb', line 52
def before_enter(value)
value
end
|
#bug_tracker ⇒ Object
84
85
86
87
88
89
90
|
# File 'lib/durt/plugin.rb', line 84
def bug_tracker
if config_required? && not_configured?
raise NotConfiguredError, "#{plugin_name} plugin is not configured"
end
bug_tracker_class.new(project, @config)
end
|
#enter(issue) ⇒ Object
56
57
58
|
# File 'lib/durt/plugin.rb', line 56
def enter(issue)
issue
end
|
#fetch_issues ⇒ Object
40
41
42
|
# File 'lib/durt/plugin.rb', line 40
def fetch_issues
bug_tracker.fetch_issues
end
|
#filter(value) ⇒ Object
36
37
38
|
# File 'lib/durt/plugin.rb', line 36
def filter(value)
value
end
|
#issues ⇒ Object
76
77
78
|
# File 'lib/durt/plugin.rb', line 76
def issues
bug_tracker.issues
end
|
#plugin_name ⇒ Object
44
45
46
|
# File 'lib/durt/plugin.rb', line 44
def plugin_name
self.class.plugin_name
end
|
#push_issue(issue) ⇒ Object
68
69
70
|
# File 'lib/durt/plugin.rb', line 68
def push_issue(issue)
issue.key
end
|
#source_name ⇒ Object
72
73
74
|
# File 'lib/durt/plugin.rb', line 72
def source_name
bug_tracker.source_name
end
|
#start(issue) ⇒ Object
60
61
62
|
# File 'lib/durt/plugin.rb', line 60
def start(issue)
issue
end
|
#stop(issue) ⇒ Object
64
65
66
|
# File 'lib/durt/plugin.rb', line 64
def stop(issue)
issue
end
|
#switch_project ⇒ Object
48
49
50
|
# File 'lib/durt/plugin.rb', line 48
def switch_project
time_tracker.switch_project(project)
end
|
#time_tracker ⇒ Object
80
81
82
|
# File 'lib/durt/plugin.rb', line 80
def time_tracker
time_tracker_class
end
|