jenkins-plugin-runtime 0.1.11 → 0.1.13
Sign up to get free protection for your applications and to get access to all the features.
data/lib/jenkins/model/build.rb
CHANGED
@@ -66,6 +66,12 @@ module Jenkins
|
|
66
66
|
@native.getEnvironment(nil)
|
67
67
|
end
|
68
68
|
|
69
|
+
def build_wrapper_environment(cls)
|
70
|
+
@native.getEnvironmentList().find do |e|
|
71
|
+
e.instance_of?(Jenkins::Plugin::Proxies::EnvironmentWrapper) && e.build_wrapper.instance_of?(cls)
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
69
75
|
Jenkins::Plugin::Proxies.register self, Java.hudson.model.AbstractBuild
|
70
76
|
end
|
71
77
|
|
@@ -33,6 +33,7 @@ module Jenkins
|
|
33
33
|
|
34
34
|
|
35
35
|
class EnvironmentWrapper < Java.hudson.tasks.BuildWrapper::Environment
|
36
|
+
attr_accessor :env
|
36
37
|
|
37
38
|
def initialize(build_wrapper, plugin, impl)
|
38
39
|
super(build_wrapper)
|
@@ -40,6 +41,11 @@ module Jenkins
|
|
40
41
|
@impl = impl
|
41
42
|
end
|
42
43
|
|
44
|
+
# build wrapper that created this environment
|
45
|
+
def build_wrapper
|
46
|
+
@impl
|
47
|
+
end
|
48
|
+
|
43
49
|
def tearDown(build, listener)
|
44
50
|
@impl.teardown(@plugin.import(build), @plugin.import(listener))
|
45
51
|
true
|
@@ -4,26 +4,50 @@ require 'pathname'
|
|
4
4
|
module Jenkins
|
5
5
|
class Plugin
|
6
6
|
class Specification
|
7
|
+
GITHUB_URL_FORMAT = 'git://github.com/%s/%s.git'
|
7
8
|
|
8
9
|
# The name of this plugin. Will be used as a globally
|
9
10
|
# unique identifier inside the Jenkins server
|
10
11
|
attr_accessor :name
|
11
12
|
|
13
|
+
# The name of this plugin, used for display to end-users.
|
14
|
+
# Defaults to name, capitalized.
|
15
|
+
attr_writer :display_name
|
16
|
+
|
12
17
|
# Plugin version. This is used during dependency resolution
|
13
18
|
attr_accessor :version
|
14
19
|
|
15
20
|
# Free form text description of the plugin. No character limit, but please, keep it civil.
|
16
21
|
attr_accessor :description
|
17
22
|
|
23
|
+
# URL to the wiki page of the plugin
|
24
|
+
attr_accessor :url
|
25
|
+
|
26
|
+
# A hash of developers, 'id' => 'name <email>' or 'id' => 'name'
|
27
|
+
attr_accessor :developers
|
28
|
+
|
18
29
|
# A hash of dependencies, like 'foo' => '1.2.3', 'bar' => '0.0.1'
|
19
30
|
# Our dependency handling is not smart (yet).
|
20
31
|
attr_accessor :dependencies
|
21
32
|
|
33
|
+
# A hash of :type => [:svn, :git], :url => url to repo
|
34
|
+
attr_reader :repository
|
35
|
+
|
22
36
|
def initialize
|
23
37
|
@dependencies = {}
|
38
|
+
@developers = {}
|
24
39
|
yield(self) if block_given?
|
25
40
|
end
|
26
41
|
|
42
|
+
# Retrieves the display name of the plugin.
|
43
|
+
def display_name
|
44
|
+
if @display_name
|
45
|
+
@display_name
|
46
|
+
else
|
47
|
+
self.name.capitalize
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
27
51
|
# Adds `plugin_name` as a pre-requisite of
|
28
52
|
# this plugin. This can be the name of any Jenkins plugin
|
29
53
|
# written in Ruby, Java, or any other language. Version right
|
@@ -32,6 +56,44 @@ module Jenkins
|
|
32
56
|
dependencies[plugin_name] = version
|
33
57
|
end
|
34
58
|
|
59
|
+
# Adds `id` to the list of developers - this is your jenkins-ci.org
|
60
|
+
# account, with the displayed name of `name`. `name` can be "Your Name" or
|
61
|
+
# "Your Name <yname@example.com>" if you want to include your e-mail.
|
62
|
+
def developed_by(id, name=nil)
|
63
|
+
developers[id] = name || id
|
64
|
+
end
|
65
|
+
|
66
|
+
# Sets your repository to be `repo`.
|
67
|
+
# `repo` is a hash of :type => url
|
68
|
+
# Where :type is one of [:github, :git, :svn]
|
69
|
+
#
|
70
|
+
# Valid uses:
|
71
|
+
# * uses_repository :github => 'me/my-plugin'
|
72
|
+
# * uses_repository :github => 'my-plugin'
|
73
|
+
# * * Same as :github => 'jenkinsci/my-plugin'.
|
74
|
+
# * uses_repository :git => 'git://repo.or.cz/my-plugin.git'
|
75
|
+
# * uses_repository :svn =>
|
76
|
+
# 'https://svn.jenkins-ci.org/trunk/hudson/plugins/my-plugin'
|
77
|
+
def uses_repository(repo)
|
78
|
+
if @repository or repo.length != 1
|
79
|
+
fail SpecificationError , "You can only specify one repository"
|
80
|
+
end
|
81
|
+
|
82
|
+
type, url = repo.first
|
83
|
+
case type.to_sym
|
84
|
+
when :github
|
85
|
+
org = 'jenkinsci'
|
86
|
+
if url.include?('/')
|
87
|
+
org, url = url.split('/', 2)
|
88
|
+
end
|
89
|
+
|
90
|
+
url = GITHUB_URL_FORMAT % [org, url]
|
91
|
+
@repository = {:type => :git, :url => url}.freeze
|
92
|
+
when :git, :svn
|
93
|
+
@repository = {:type => type.to_sym, :url => url}.freeze
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
35
97
|
# Make sure that your specification is not corrupt.
|
36
98
|
def validate!
|
37
99
|
[:name, :version, :description].each do |field|
|
@@ -72,4 +134,4 @@ module Jenkins
|
|
72
134
|
SpecificationError = Class.new(StandardError)
|
73
135
|
SpecificationNotFound = Class.new(SpecificationError)
|
74
136
|
end
|
75
|
-
end
|
137
|
+
end
|
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.13
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Charles Lowell
|
@@ -10,8 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-
|
14
|
-
default_executable:
|
13
|
+
date: 2011-11-14 00:00:00 Z
|
15
14
|
dependencies:
|
16
15
|
- !ruby/object:Gem::Dependency
|
17
16
|
name: json
|
@@ -132,7 +131,6 @@ files:
|
|
132
131
|
- spec/spec_helper.rb
|
133
132
|
- src/jenkins/ruby/DoDynamic.java
|
134
133
|
- src/jenkins/ruby/Get.java
|
135
|
-
has_rdoc: true
|
136
134
|
homepage: http://github.com/cowboyd/jenkins-plugins.rb
|
137
135
|
licenses: []
|
138
136
|
|
@@ -156,7 +154,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
156
154
|
requirements: []
|
157
155
|
|
158
156
|
rubyforge_project: jenkins-plugin-runtime
|
159
|
-
rubygems_version: 1.
|
157
|
+
rubygems_version: 1.8.9
|
160
158
|
signing_key:
|
161
159
|
specification_version: 3
|
162
160
|
summary: Runtime support libraries for Jenkins Ruby plugins
|