jenkinson 0.0.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.
- checksums.yaml +7 -0
- data/.gitignore +22 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +32 -0
- data/Rakefile +2 -0
- data/bin/jenkinson +5 -0
- data/jenkinson.gemspec +25 -0
- data/lib/jenkinson/api.rb +37 -0
- data/lib/jenkinson/cli.rb +19 -0
- data/lib/jenkinson/version.rb +3 -0
- data/lib/jenkinson.rb +20 -0
- metadata +112 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: c4f52ddef078e8ba62aa25ccd3a8b149201b1155
|
|
4
|
+
data.tar.gz: bf561589a97b55093184a5c69eeef5bfc271a9ba
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: c19dfe9431779a63f60ebbc6c6e55adb96383760c0d638145c0e9e51f9f2957c2dd2a0ce08bea1fcd07c63baa266cd67af76105ffcb3d155d2de4dd302d4367b
|
|
7
|
+
data.tar.gz: 3ddaf6eddbe1927558b53da9809a4310069353442379fc88fc1d02ce88e219dd2c980f30063e5130ef2d9e26c26f1ffb90af5ab57d2aea5040f7a50decde90ed
|
data/.gitignore
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
*.gem
|
|
2
|
+
*.rbc
|
|
3
|
+
.bundle
|
|
4
|
+
.config
|
|
5
|
+
.yardoc
|
|
6
|
+
Gemfile.lock
|
|
7
|
+
InstalledFiles
|
|
8
|
+
_yardoc
|
|
9
|
+
coverage
|
|
10
|
+
doc/
|
|
11
|
+
lib/bundler/man
|
|
12
|
+
pkg
|
|
13
|
+
rdoc
|
|
14
|
+
spec/reports
|
|
15
|
+
test/tmp
|
|
16
|
+
test/version_tmp
|
|
17
|
+
tmp
|
|
18
|
+
*.bundle
|
|
19
|
+
*.so
|
|
20
|
+
*.o
|
|
21
|
+
*.a
|
|
22
|
+
mkmf.log
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
Copyright (c) 2014 torkale
|
|
2
|
+
|
|
3
|
+
MIT License
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
+
a copy of this software and associated documentation files (the
|
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
11
|
+
the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be
|
|
14
|
+
included in all copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Jenkinson
|
|
2
|
+
|
|
3
|
+
TODO: Write a gem description
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
Add this line to your application's Gemfile:
|
|
8
|
+
|
|
9
|
+
gem 'jenkinson'
|
|
10
|
+
|
|
11
|
+
And then execute:
|
|
12
|
+
|
|
13
|
+
$ bundle
|
|
14
|
+
|
|
15
|
+
Or install it yourself as:
|
|
16
|
+
|
|
17
|
+
$ gem install jenkinson
|
|
18
|
+
|
|
19
|
+
## Usage
|
|
20
|
+
|
|
21
|
+
`jenkinson get_jobs TARGET_FOLDER # download jobs configuration into target_dir (config/jobs)`
|
|
22
|
+
`jenkinson help [COMMAND] # Describe available commands or one specific command`
|
|
23
|
+
`jenkinson install PLUGINS # install jenkins plugins (comma seperated)`
|
|
24
|
+
`jenkinson set_jobs FROM_FOLDER # create (or update) jobs from specified folder (config/jobs)`
|
|
25
|
+
|
|
26
|
+
## Contributing
|
|
27
|
+
|
|
28
|
+
1. Fork it ( https://github.com/[my-github-username]/jenkinson/fork )
|
|
29
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
|
30
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
|
31
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
|
32
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
data/bin/jenkinson
ADDED
data/jenkinson.gemspec
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
|
+
require 'jenkinson/version'
|
|
5
|
+
|
|
6
|
+
Gem::Specification.new do |spec|
|
|
7
|
+
spec.name = "jenkinson"
|
|
8
|
+
spec.version = Jenkinson::VERSION
|
|
9
|
+
spec.authors = ["torkale"]
|
|
10
|
+
spec.email = ["torkale@gmail.com"]
|
|
11
|
+
spec.summary = %q{Jenkinson is a simple tool to sync jenkins server}
|
|
12
|
+
spec.description = %q{Jenkinson helps in installation of jenkins plugins}
|
|
13
|
+
spec.homepage = ""
|
|
14
|
+
spec.license = "MIT"
|
|
15
|
+
|
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
|
19
|
+
spec.require_paths = ["lib"]
|
|
20
|
+
|
|
21
|
+
spec.add_dependency "jenkins_api_client"
|
|
22
|
+
spec.add_dependency "thor"
|
|
23
|
+
spec.add_development_dependency "bundler", "~> 1.6"
|
|
24
|
+
spec.add_development_dependency "rake"
|
|
25
|
+
end
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
require 'jenkins_api_client'
|
|
2
|
+
module Jenkinson
|
|
3
|
+
class API
|
|
4
|
+
attr_reader :client
|
|
5
|
+
|
|
6
|
+
def initialize(config)
|
|
7
|
+
@client = JenkinsApi::Client.new(config)
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def create_or_update_jobs(jobs)
|
|
11
|
+
jobs.each do |job|
|
|
12
|
+
File.open(job, "rb") do |xml_file|
|
|
13
|
+
jobname = File.basename( job, ".*")
|
|
14
|
+
client.job.create_or_update(jobname, xml_file.read)
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def get_jobs_config(target_dir)
|
|
20
|
+
client.job.list_all.each do |jobname|
|
|
21
|
+
job_on_server = client.job.get_config(jobname) rescue nil
|
|
22
|
+
job = "#{target_dir}/#{jobname}.xml"
|
|
23
|
+
next if job_on_server.nil?
|
|
24
|
+
File.open(job, "w") do |xml_file|
|
|
25
|
+
xml_file << job_on_server
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def install_plugins(plugins_str)
|
|
31
|
+
plugins = plugins_str.split(',')
|
|
32
|
+
plugins.each do |plugin|
|
|
33
|
+
client.plugin.install(plugin)
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
require "thor"
|
|
2
|
+
module Jenkinson
|
|
3
|
+
class CLI < Thor
|
|
4
|
+
desc "set_jobs FROM_FOLDER", "create (or update) jobs from the ./jobs folder"
|
|
5
|
+
def set_jobs(from = nil)
|
|
6
|
+
Jenkinson::Hub.create_or_update_jobs(Dir["#{from}/*.xml"])
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
desc "get_jobs TARGET_FOLDER", "get jobs configurations"
|
|
10
|
+
def get_jobs(target = nil)
|
|
11
|
+
Jenkinson::Hub.get_jobs_config(target)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
desc "install PLUGINS", "install jenkins plugins (comma separated)"
|
|
15
|
+
def install(plugins = nil)
|
|
16
|
+
Jenkinson::Hub.install_plugins(plugins)
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
data/lib/jenkinson.rb
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
require "jenkinson/version"
|
|
2
|
+
require 'yaml'
|
|
3
|
+
require 'jenkinson/api'
|
|
4
|
+
require 'jenkinson/cli'
|
|
5
|
+
|
|
6
|
+
module Jenkinson
|
|
7
|
+
def self.configure(&block)
|
|
8
|
+
yield(config)
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def self.config
|
|
12
|
+
@@config ||= {
|
|
13
|
+
'server_url' => ENV['JENKINSON_URL'] || "localhost",
|
|
14
|
+
'username' => ENV['JENKINSON_USER'],
|
|
15
|
+
'password' => ENV['JENKINSON_PASSWORD']
|
|
16
|
+
}
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
Hub = API.new(self.config)
|
|
20
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: jenkinson
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.0.1
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- torkale
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2014-07-01 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: jenkins_api_client
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - '>='
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '0'
|
|
20
|
+
type: :runtime
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - '>='
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '0'
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: thor
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - '>='
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '0'
|
|
34
|
+
type: :runtime
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - '>='
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '0'
|
|
41
|
+
- !ruby/object:Gem::Dependency
|
|
42
|
+
name: bundler
|
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - ~>
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: '1.6'
|
|
48
|
+
type: :development
|
|
49
|
+
prerelease: false
|
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
+
requirements:
|
|
52
|
+
- - ~>
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
54
|
+
version: '1.6'
|
|
55
|
+
- !ruby/object:Gem::Dependency
|
|
56
|
+
name: rake
|
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
|
58
|
+
requirements:
|
|
59
|
+
- - '>='
|
|
60
|
+
- !ruby/object:Gem::Version
|
|
61
|
+
version: '0'
|
|
62
|
+
type: :development
|
|
63
|
+
prerelease: false
|
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
65
|
+
requirements:
|
|
66
|
+
- - '>='
|
|
67
|
+
- !ruby/object:Gem::Version
|
|
68
|
+
version: '0'
|
|
69
|
+
description: Jenkinson helps in installation of jenkins plugins
|
|
70
|
+
email:
|
|
71
|
+
- torkale@gmail.com
|
|
72
|
+
executables:
|
|
73
|
+
- jenkinson
|
|
74
|
+
extensions: []
|
|
75
|
+
extra_rdoc_files: []
|
|
76
|
+
files:
|
|
77
|
+
- .gitignore
|
|
78
|
+
- Gemfile
|
|
79
|
+
- LICENSE.txt
|
|
80
|
+
- README.md
|
|
81
|
+
- Rakefile
|
|
82
|
+
- bin/jenkinson
|
|
83
|
+
- jenkinson.gemspec
|
|
84
|
+
- lib/jenkinson.rb
|
|
85
|
+
- lib/jenkinson/api.rb
|
|
86
|
+
- lib/jenkinson/cli.rb
|
|
87
|
+
- lib/jenkinson/version.rb
|
|
88
|
+
homepage: ''
|
|
89
|
+
licenses:
|
|
90
|
+
- MIT
|
|
91
|
+
metadata: {}
|
|
92
|
+
post_install_message:
|
|
93
|
+
rdoc_options: []
|
|
94
|
+
require_paths:
|
|
95
|
+
- lib
|
|
96
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
97
|
+
requirements:
|
|
98
|
+
- - '>='
|
|
99
|
+
- !ruby/object:Gem::Version
|
|
100
|
+
version: '0'
|
|
101
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
102
|
+
requirements:
|
|
103
|
+
- - '>='
|
|
104
|
+
- !ruby/object:Gem::Version
|
|
105
|
+
version: '0'
|
|
106
|
+
requirements: []
|
|
107
|
+
rubyforge_project:
|
|
108
|
+
rubygems_version: 2.2.2
|
|
109
|
+
signing_key:
|
|
110
|
+
specification_version: 4
|
|
111
|
+
summary: Jenkinson is a simple tool to sync jenkins server
|
|
112
|
+
test_files: []
|