jenkins-plugin 0.1.12 → 0.1.13
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.
data/lib/jenkins/plugin/cli.rb
CHANGED
@@ -18,15 +18,17 @@ module Jenkins
|
|
18
18
|
|
19
19
|
desc "build", "build plugin into .hpi file suitable for distribution"
|
20
20
|
def build
|
21
|
-
|
21
|
+
require 'jenkins/plugin/tools/package'
|
22
|
+
Tools::Package.new("pkg").build
|
22
23
|
end
|
23
24
|
|
24
25
|
desc "server", "run a test server with plugin"
|
25
26
|
method_option :home, :desc => "set server work directory", :default => 'work'
|
26
27
|
method_option :port, :desc => "server http port (currently ignored)", :default => 8080
|
28
|
+
method_option :war, :desc => "specify a custom jenkins.war to run the plugin with"
|
27
29
|
def server
|
28
30
|
require 'jenkins/plugin/tools/server'
|
29
|
-
server =
|
31
|
+
server = Tools::Server.new(spec, options[:home], options[:war])
|
30
32
|
server.run!
|
31
33
|
end
|
32
34
|
map "s" => "server"
|
@@ -0,0 +1,58 @@
|
|
1
|
+
|
2
|
+
module Jenkins
|
3
|
+
class Plugin
|
4
|
+
module Tools
|
5
|
+
class Bundle
|
6
|
+
|
7
|
+
def initialize(target)
|
8
|
+
@target = target
|
9
|
+
end
|
10
|
+
|
11
|
+
def install
|
12
|
+
require 'java'
|
13
|
+
require 'bundler'
|
14
|
+
require 'bundler/cli'
|
15
|
+
puts "bundling..."
|
16
|
+
ENV['BUNDLE_APP_CONFIG'] = "#{@target}/vendor/bundle"
|
17
|
+
Bundler::CLI.start ["--path", "#{@target}/vendor/gems", "--without", "development"]
|
18
|
+
|
19
|
+
generate_standalone([])
|
20
|
+
end
|
21
|
+
|
22
|
+
# this code lifted from Bundler::Installer v1.1, so that it will work with 1.0
|
23
|
+
def generate_standalone(groups)
|
24
|
+
standalone_path = Bundler.settings[:path]
|
25
|
+
bundler_path = File.join(standalone_path, "bundler")
|
26
|
+
FileUtils.mkdir_p(bundler_path)
|
27
|
+
|
28
|
+
paths = []
|
29
|
+
|
30
|
+
if groups.empty?
|
31
|
+
specs = Bundler.definition.requested_specs
|
32
|
+
else
|
33
|
+
specs = Bundler.definition.specs_for groups.map { |g| g.to_sym }
|
34
|
+
end
|
35
|
+
|
36
|
+
specs.each do |spec|
|
37
|
+
next if spec.name == "bundler"
|
38
|
+
|
39
|
+
spec.require_paths.each do |path|
|
40
|
+
full_path = File.join(spec.full_gem_path, path)
|
41
|
+
paths << Pathname.new(full_path).relative_path_from(Bundler.root.join(bundler_path))
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
|
46
|
+
File.open File.join(bundler_path, "setup.rb"), "w" do |file|
|
47
|
+
file.puts "path = File.expand_path('..', __FILE__)"
|
48
|
+
paths.each do |path|
|
49
|
+
file.puts %{$:.unshift File.expand_path("\#{path}/#{path}")}
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
require 'jenkins/plugin/tools/bundle'
|
2
|
+
require 'jenkins/plugin/tools/manifest'
|
3
|
+
require 'zip/zip'
|
4
|
+
|
5
|
+
module Jenkins
|
6
|
+
class Plugin
|
7
|
+
module Tools
|
8
|
+
class Package
|
9
|
+
|
10
|
+
def initialize(target)
|
11
|
+
@target = target
|
12
|
+
end
|
13
|
+
|
14
|
+
def build
|
15
|
+
FileUtils.mkdir_p @target
|
16
|
+
spec = Jenkins::Plugin::Specification.find!
|
17
|
+
|
18
|
+
Bundle.new(@target).install
|
19
|
+
|
20
|
+
manifest = Manifest.new(spec)
|
21
|
+
|
22
|
+
file_name = "#{@target}/#{spec.name}.hpi"
|
23
|
+
File.delete file_name if File.exists?(file_name)
|
24
|
+
|
25
|
+
Zip::ZipFile.open(file_name, Zip::ZipFile::CREATE) do |zipfile|
|
26
|
+
zipfile.get_output_stream("META-INF/MANIFEST.MF") do |f|
|
27
|
+
manifest.write_hpi(f)
|
28
|
+
f.puts "Bundle-Path: vendor/gems"
|
29
|
+
end
|
30
|
+
zipfile.mkdir("WEB-INF/classes")
|
31
|
+
|
32
|
+
["lib","models","views", "#{@target}/vendor"].each do |d|
|
33
|
+
Dir.glob("#{d}/**/*") do |f|
|
34
|
+
if !File.directory? f
|
35
|
+
zipfile.add("WEB-INF/classes/#{f.gsub("#{@target}/",'')}",f)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
puts "#{spec.name} plugin #{spec.version} built to #{file_name}"
|
41
|
+
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -9,10 +9,11 @@ module Jenkins
|
|
9
9
|
module Tools
|
10
10
|
class Server
|
11
11
|
|
12
|
-
def initialize(spec, workdir)
|
12
|
+
def initialize(spec, workdir, war)
|
13
13
|
@spec = spec
|
14
14
|
@workdir = workdir
|
15
15
|
@plugindir = "#{workdir}/plugins"
|
16
|
+
@war = war || Jenkins::War::LOCATION
|
16
17
|
end
|
17
18
|
|
18
19
|
def run!
|
@@ -36,11 +37,13 @@ module Jenkins
|
|
36
37
|
args << "-DJENKINS_HOME=#{@workdir}"
|
37
38
|
args << "-Dstapler.trace=true"
|
38
39
|
args << "-Ddebug.YUI=true"
|
40
|
+
# args << "-Djruby.debug.loadService=true"
|
41
|
+
# args << "-Djruby.debug.loadService.timing=true"
|
39
42
|
args << "-jar"
|
40
|
-
args <<
|
43
|
+
args << @war
|
41
44
|
exec *args
|
42
45
|
end
|
43
46
|
end
|
44
47
|
end
|
45
48
|
end
|
46
|
-
end
|
49
|
+
end
|
data/lib/jenkins/rake.rb
CHANGED
@@ -34,41 +34,10 @@ module Jenkins
|
|
34
34
|
puts loadpath.to_path
|
35
35
|
end
|
36
36
|
|
37
|
-
directory target = "pkg"
|
38
|
-
desc "bundle gems"
|
39
|
-
task :bundle => [target] do
|
40
|
-
fail "we still need to backport some features from bundler 1.1 prereleases for this feature to work"
|
41
|
-
require 'java'
|
42
|
-
require 'bundler'
|
43
|
-
require 'bundler/cli'
|
44
|
-
|
45
|
-
puts "bundling..."
|
46
|
-
ENV['BUNDLE_APP_CONFIG'] = "#{target}/vendor/bundle"
|
47
|
-
Bundler::CLI.start ["--standalone", "--path", "#{target}/vendor/gems", "--without", "development"]
|
48
|
-
end
|
49
|
-
|
50
37
|
desc "package up stuff into HPI file"
|
51
|
-
task :package
|
52
|
-
|
53
|
-
|
54
|
-
File.delete file_name if File.exists?(file_name)
|
55
|
-
|
56
|
-
Zip::ZipFile.open(file_name, Zip::ZipFile::CREATE) do |zipfile|
|
57
|
-
zipfile.get_output_stream("META-INF/MANIFEST.MF") do |f|
|
58
|
-
Jenkins.generate_manifest(f)
|
59
|
-
f.puts "Bundle-Path: vendor/gems"
|
60
|
-
end
|
61
|
-
zipfile.mkdir("WEB-INF/classes")
|
62
|
-
|
63
|
-
["lib","models","views", "#{target}/vendor"].each do |d|
|
64
|
-
Dir.glob("#{d}/**/*") do |f|
|
65
|
-
if !File.directory? f
|
66
|
-
zipfile.add("WEB-INF/classes/#{f.gsub("#{target}/",'')}",f)
|
67
|
-
end
|
68
|
-
end
|
69
|
-
end
|
70
|
-
end
|
71
|
-
puts "#{Jenkins.spec.name} plugin #{Jenkins.spec.version} built to #{file_name}"
|
38
|
+
task :package do
|
39
|
+
require 'jenkins/plugin/tools/package'
|
40
|
+
Jenkins::Plugin::Tools::Package.new("pkg").build
|
72
41
|
end
|
73
42
|
|
74
43
|
desc "run a Jenkins server with this plugin"
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jenkins-plugin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 1
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 13
|
10
|
+
version: 0.1.13
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Charles Lowell
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-10-
|
18
|
+
date: 2011-10-21 00:00:00 -05:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -148,9 +148,11 @@ files:
|
|
148
148
|
- lib/jenkins/plugin/cli/templates/Gemfile.tt
|
149
149
|
- lib/jenkins/plugin/cli/templates/build_step.tt
|
150
150
|
- lib/jenkins/plugin/cli/templates/pluginspec.tt
|
151
|
+
- lib/jenkins/plugin/tools/bundle.rb
|
151
152
|
- lib/jenkins/plugin/tools/hpi.rb
|
152
153
|
- lib/jenkins/plugin/tools/loadpath.rb
|
153
154
|
- lib/jenkins/plugin/tools/manifest.rb
|
155
|
+
- lib/jenkins/plugin/tools/package.rb
|
154
156
|
- lib/jenkins/plugin/tools/resolver.rb
|
155
157
|
- lib/jenkins/plugin/tools/server.rb
|
156
158
|
- lib/jenkins/plugin/version.rb
|
@@ -185,7 +187,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
185
187
|
requirements: []
|
186
188
|
|
187
189
|
rubyforge_project: jenkins-plugin
|
188
|
-
rubygems_version: 1.6.
|
190
|
+
rubygems_version: 1.6.0
|
189
191
|
signing_key:
|
190
192
|
specification_version: 3
|
191
193
|
summary: Tools for creating and building Jenkins Ruby plugins
|