jenkins-plugin-runtime 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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(path = nil)
32
- path.nil? ? @path : @path = path.to_s
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
@@ -6,7 +6,6 @@ module Jenkins
6
6
  #
7
7
  class Build
8
8
 
9
- ##
10
9
  # the Hudson::Model::AbstractBuild represented by this build
11
10
  attr_reader :native
12
11
 
@@ -0,0 +1,9 @@
1
+
2
+ module Jenkins
3
+ module Model
4
+ class RootAction
5
+ include Jenkins::Model::Action
6
+
7
+ end
8
+ end
9
+ end
@@ -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
@@ -4,6 +4,7 @@ require 'jenkins/plugin/proxy'
4
4
  require 'jenkins/plugin/proxies'
5
5
  require 'jenkins/model'
6
6
  require 'jenkins/model/action'
7
+ require 'jenkins/model/root_action'
7
8
  require 'jenkins/model/build'
8
9
  require 'jenkins/model/descriptor'
9
10
  require 'jenkins/model/listener'
@@ -1,7 +1,7 @@
1
1
  module Jenkins
2
2
  class Plugin
3
3
  module Runtime
4
- VERSION = "0.1.0"
4
+ VERSION = "0.1.1"
5
5
  end
6
6
  end
7
7
  end
@@ -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 icon_file" do
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 "url_name" do
25
- it "can be configured"
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.0
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-02 00:00:00 -05:00
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