jenkins-plugin-runtime 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/jenkins/model/action.rb +13 -7
- data/lib/jenkins/model/build.rb +0 -1
- data/lib/jenkins/model/root_action.rb +9 -0
- data/lib/jenkins/plugin.rb +28 -1
- data/lib/jenkins/plugin/runtime.rb +1 -0
- data/lib/jenkins/plugin/runtime/version.rb +1 -1
- data/spec/jenkins/model/action_spec.rb +10 -3
- metadata +3 -2
data/lib/jenkins/model/action.rb
CHANGED
@@ -1,4 +1,6 @@
|
|
1
1
|
|
2
|
+
#TODO: does this make more sense as a class? maybe
|
3
|
+
|
2
4
|
module Jenkins
|
3
5
|
module Model
|
4
6
|
module Action
|
@@ -17,19 +19,23 @@ module Jenkins
|
|
17
19
|
end
|
18
20
|
extend Included
|
19
21
|
|
20
|
-
# def included(cls)
|
21
|
-
# super(cls)
|
22
|
-
# cls.send(:include)
|
23
|
-
# end
|
24
22
|
module InstanceMethods
|
25
23
|
def icon
|
26
24
|
self.class.icon
|
27
25
|
end
|
26
|
+
|
27
|
+
def url_path
|
28
|
+
self.class.url_path
|
29
|
+
end
|
28
30
|
end
|
29
|
-
#
|
31
|
+
#
|
30
32
|
module ClassMethods
|
31
|
-
def icon(
|
32
|
-
|
33
|
+
def icon(filename = nil)
|
34
|
+
filename.nil? ? @icon : @icon = filename.to_s
|
35
|
+
end
|
36
|
+
|
37
|
+
def url_path(path = nil)
|
38
|
+
path.nil? ? @url_path : @url_path = path.to_s
|
33
39
|
end
|
34
40
|
end
|
35
41
|
end
|
data/lib/jenkins/model/build.rb
CHANGED
data/lib/jenkins/plugin.rb
CHANGED
@@ -65,6 +65,33 @@ module Jenkins
|
|
65
65
|
@instance
|
66
66
|
end
|
67
67
|
|
68
|
+
# Registers a singleton extension point directly with Jenkins.
|
69
|
+
# Extensions registered via this method are different than
|
70
|
+
# those registered via `register_describable` in that there
|
71
|
+
# are only one instance of them, and so things like configuration
|
72
|
+
# construction, and validation do not apply.
|
73
|
+
#
|
74
|
+
# This method accepts either an instance of the extension point or
|
75
|
+
# a class implementing the extension point. If a class is provided,
|
76
|
+
# it will attempt to construct an instance with the arguments
|
77
|
+
# provided. e.g.
|
78
|
+
# # construct an instance
|
79
|
+
# plugin.register_extension SomeRootAction, "gears.png"
|
80
|
+
# # pass in a preconfigured instance
|
81
|
+
# ext = MyGreatExtension.build do |c|
|
82
|
+
# c.name "fantastic"
|
83
|
+
# c.fizzle :foo
|
84
|
+
# end
|
85
|
+
# plugin.register_extension ext
|
86
|
+
#
|
87
|
+
# @param [Class|Object] extension the extension to register
|
88
|
+
# @param [...] arguments to pass to
|
89
|
+
|
90
|
+
def register_extension(class_or_instance, *args)
|
91
|
+
extension = class_or_instance.is_a?(Class) ? class_or_instance.new : class_or_instance
|
92
|
+
@peer.addExtension(export(extension))
|
93
|
+
end
|
94
|
+
|
68
95
|
# Register a ruby class as a Jenkins extension point of
|
69
96
|
# a particular java type
|
70
97
|
#
|
@@ -75,8 +102,8 @@ module Jenkins
|
|
75
102
|
# @param [java.lang.Class] java_class that Jenkins will see this extention point as
|
76
103
|
def register_describable(ruby_class, java_class)
|
77
104
|
descriptor = Jenkins::Model::Descriptor.new(ruby_class, self, java_class)
|
78
|
-
@peer.addExtension(descriptor)
|
79
105
|
@descriptors[ruby_class] = descriptor
|
106
|
+
@peer.addExtension(descriptor)
|
80
107
|
end
|
81
108
|
|
82
109
|
# unique identifier for this plugin in the Jenkins server
|
@@ -9,7 +9,7 @@ describe Jenkins::Model::Action do
|
|
9
9
|
a.display_name.should eql "CoolAction"
|
10
10
|
end
|
11
11
|
|
12
|
-
describe "its
|
12
|
+
describe "its icon_filename" do
|
13
13
|
it "is nil by default" do
|
14
14
|
new_action.icon.should be_nil
|
15
15
|
end
|
@@ -21,8 +21,15 @@ describe Jenkins::Model::Action do
|
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
24
|
-
describe "
|
25
|
-
it "
|
24
|
+
describe "url_path" do
|
25
|
+
it "is nil by default" do
|
26
|
+
new_action.url_path.should be_nil
|
27
|
+
end
|
28
|
+
it "can be configured" do
|
29
|
+
new_action do
|
30
|
+
url_path "/foo/bar"
|
31
|
+
end.new.url_path.should eql "/foo/bar"
|
32
|
+
end
|
26
33
|
end
|
27
34
|
|
28
35
|
private
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: jenkins-plugin-runtime
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.1.
|
5
|
+
version: 0.1.1
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Charles Lowell
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-09-
|
13
|
+
date: 2011-09-09 00:00:00 -05:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
@@ -101,6 +101,7 @@ files:
|
|
101
101
|
- lib/jenkins/model/describable.rb
|
102
102
|
- lib/jenkins/model/descriptor.rb
|
103
103
|
- lib/jenkins/model/listener.rb
|
104
|
+
- lib/jenkins/model/root_action.rb
|
104
105
|
- lib/jenkins/plugin.rb
|
105
106
|
- lib/jenkins/plugin/cli.rb
|
106
107
|
- lib/jenkins/plugin/proxies.rb
|