jendle 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.document +3 -0
- data/.gitignore +8 -0
- data/.rspec +1 -0
- data/.travis.yml +18 -0
- data/.yardopts +1 -0
- data/ChangeLog.md +4 -0
- data/Gemfile +7 -0
- data/LICENSE.txt +20 -0
- data/README.md +84 -0
- data/Rakefile +25 -0
- data/bin/jendle +6 -0
- data/jendle.gemspec +31 -0
- data/lib/jendle.rb +7 -0
- data/lib/jendle/cli.rb +116 -0
- data/lib/jendle/constants.rb +4 -0
- data/lib/jendle/core.rb +25 -0
- data/lib/jendle/job.rb +62 -0
- data/lib/jendle/plugin.rb +57 -0
- data/lib/jendle/version.rb +4 -0
- data/lib/jendle/view.rb +66 -0
- data/spec/cli_spec.rb +24 -0
- data/spec/core_spec.rb +19 -0
- data/spec/jendle_spec.rb +8 -0
- data/spec/spec_helper.rb +26 -0
- metadata +212 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 89fd8cf54396d4d720edd88a0b9396490e2ba2b0
|
4
|
+
data.tar.gz: b033402fb104f7ceb75f23ac02e270c69de6ae62
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: b157289db77f951f7970a72503bd474ae696995820a83c315c958e4f091e56b75e6a30357cdb37d04b6fb2ff69699907899bb439dc1017a6cc234cb7e2028e10
|
7
|
+
data.tar.gz: 07130a3a284d3312a0a2b3bb3e5180f07800de662733837cb42e1d33ded97b8585e75e1d9d0cb424ae9ec0af8c229d042f89240615108fcc480e78e685bc6943
|
data/.document
ADDED
data/.gitignore
ADDED
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--colour --format documentation
|
data/.travis.yml
ADDED
data/.yardopts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--markup markdown --title "jendle Documentation" --protected
|
data/ChangeLog.md
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2017
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
# jendle
|
2
|
+
|
3
|
+
[![Build Status](https://secure.travis-ci.org/toyama0919/jendle.png?branch=master)](http://travis-ci.org/toyama0919/jendle)
|
4
|
+
[![Gem Version](https://badge.fury.io/rb/jendle.svg)](http://badge.fury.io/rb/jendle)
|
5
|
+
|
6
|
+
Jenkins as code management tool.
|
7
|
+
|
8
|
+
## Setting profile
|
9
|
+
|
10
|
+
```yaml
|
11
|
+
default:
|
12
|
+
server_ip: localhost
|
13
|
+
|
14
|
+
staging:
|
15
|
+
server_ip: staging-server
|
16
|
+
username: admin
|
17
|
+
password: XXXXXXXXXXXXX
|
18
|
+
|
19
|
+
production:
|
20
|
+
server_ip: production-server
|
21
|
+
username: admin
|
22
|
+
password: XXXXXXXXXXXXX
|
23
|
+
```
|
24
|
+
|
25
|
+
## export
|
26
|
+
|
27
|
+
```
|
28
|
+
$ jendle export -p staging
|
29
|
+
```
|
30
|
+
|
31
|
+
* export Jobfile, Viewfile, Pluginfile
|
32
|
+
|
33
|
+
## apply
|
34
|
+
|
35
|
+
```
|
36
|
+
$ jendle apply -p production
|
37
|
+
```
|
38
|
+
|
39
|
+
## apply unit
|
40
|
+
|
41
|
+
```
|
42
|
+
$ jendle apply_plugins -p production
|
43
|
+
$ jendle apply_jobs -p production
|
44
|
+
$ jendle apply_views -p production
|
45
|
+
```
|
46
|
+
|
47
|
+
## install
|
48
|
+
|
49
|
+
Add this line to your application's Gemfile:
|
50
|
+
|
51
|
+
gem 'jendle'
|
52
|
+
|
53
|
+
And then execute:
|
54
|
+
|
55
|
+
$ bundle
|
56
|
+
|
57
|
+
Or install it yourself as:
|
58
|
+
|
59
|
+
$ gem install jendle
|
60
|
+
|
61
|
+
## Synopsis
|
62
|
+
|
63
|
+
$ jendle
|
64
|
+
|
65
|
+
## Contributing
|
66
|
+
|
67
|
+
1. Fork it
|
68
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
69
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
70
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
71
|
+
5. Create new [Pull Request](../../pull/new/master)
|
72
|
+
|
73
|
+
## Information
|
74
|
+
|
75
|
+
* [Homepage](https://github.com/toyama0919/jendle)
|
76
|
+
* [Issues](https://github.com/toyama0919/jendle/issues)
|
77
|
+
* [Documentation](http://rubydoc.info/gems/jendle/frames)
|
78
|
+
* [Email](mailto:toyama0919@gmail.com)
|
79
|
+
|
80
|
+
## Copyright
|
81
|
+
|
82
|
+
Copyright (c) 2017
|
83
|
+
|
84
|
+
See [LICENSE.txt](../LICENSE.txt) for details.
|
data/Rakefile
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
|
5
|
+
begin
|
6
|
+
require 'bundler/setup'
|
7
|
+
rescue LoadError => e
|
8
|
+
abort e.message
|
9
|
+
end
|
10
|
+
|
11
|
+
require 'rake'
|
12
|
+
|
13
|
+
|
14
|
+
require 'rubygems/tasks'
|
15
|
+
Gem::Tasks.new
|
16
|
+
|
17
|
+
require 'rspec/core/rake_task'
|
18
|
+
RSpec::Core::RakeTask.new
|
19
|
+
|
20
|
+
task :test => :spec
|
21
|
+
task :default => :spec
|
22
|
+
|
23
|
+
require 'yard'
|
24
|
+
YARD::Rake::YardocTask.new
|
25
|
+
task :doc => :yard
|
data/bin/jendle
ADDED
data/jendle.gemspec
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
require File.expand_path('../lib/jendle/version', __FILE__)
|
4
|
+
|
5
|
+
Gem::Specification.new do |gem|
|
6
|
+
gem.name = "jendle"
|
7
|
+
gem.version = Jendle::VERSION
|
8
|
+
gem.summary = %q{Jenkins as code management tool.}
|
9
|
+
gem.description = %q{Jenkins as code management tool.}
|
10
|
+
gem.license = "MIT"
|
11
|
+
gem.authors = ["toyama0919"]
|
12
|
+
gem.email = "toyama0919@gmail.com"
|
13
|
+
gem.homepage = "https://github.com/toyama0919/jendle"
|
14
|
+
|
15
|
+
gem.files = `git ls-files`.split($/)
|
16
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
17
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
18
|
+
gem.require_paths = ['lib']
|
19
|
+
|
20
|
+
gem.add_dependency 'thor', '~> 0.19.4'
|
21
|
+
gem.add_dependency 'jenkins_api_client'
|
22
|
+
gem.add_dependency 'diffy'
|
23
|
+
|
24
|
+
gem.add_development_dependency 'bundler', '~> 1.14.6'
|
25
|
+
gem.add_development_dependency 'pry', '~> 0.10.1'
|
26
|
+
gem.add_development_dependency 'rake', '~> 10.3.2'
|
27
|
+
gem.add_development_dependency 'rspec', '~> 3.0'
|
28
|
+
gem.add_development_dependency 'rubocop', '~> 0.24.1'
|
29
|
+
gem.add_development_dependency 'rubygems-tasks', '~> 0.2'
|
30
|
+
gem.add_development_dependency 'yard', '~> 0.8'
|
31
|
+
end
|
data/lib/jendle.rb
ADDED
data/lib/jendle/cli.rb
ADDED
@@ -0,0 +1,116 @@
|
|
1
|
+
require "thor"
|
2
|
+
require "yaml"
|
3
|
+
|
4
|
+
module Jendle
|
5
|
+
class CLI < Thor
|
6
|
+
|
7
|
+
map '--version' => :version
|
8
|
+
|
9
|
+
class_option :config, aliases: '-c', type: :string, default: "#{ENV['HOME']}/.jendle", desc: 'config'
|
10
|
+
class_option :profile, aliases: '-p', type: :string, default: 'default', desc: 'profile'
|
11
|
+
def initialize(args = [], options = {}, config = {})
|
12
|
+
super(args, options, config)
|
13
|
+
@global_options = config[:shell].base.options
|
14
|
+
config = get_config(@global_options[:profile])
|
15
|
+
core = Core.new(config)
|
16
|
+
@job = Job.new(core)
|
17
|
+
@view = View.new(core)
|
18
|
+
@plugin = Plugin.new(core)
|
19
|
+
end
|
20
|
+
|
21
|
+
desc 'export', 'export'
|
22
|
+
def export
|
23
|
+
invoke(:export_plugins, [], [])
|
24
|
+
invoke(:export_jobs, [], [])
|
25
|
+
invoke(:export_views, [], [])
|
26
|
+
end
|
27
|
+
|
28
|
+
desc 'apply', 'apply'
|
29
|
+
option :'dry-run', aliases: '-d', type: :boolean, default: false, desc: 'dry-run'
|
30
|
+
def apply
|
31
|
+
invoke(:apply_plugins, [], ['-d', options[:'dry-run']])
|
32
|
+
invoke(:apply_jobs, [], ['-d', options[:'dry-run']])
|
33
|
+
invoke(:apply_views, [], ['-d', options[:'dry-run']])
|
34
|
+
end
|
35
|
+
|
36
|
+
desc 'restore', 'restore'
|
37
|
+
option :source_profile, type: :string, required: true, desc: 'file'
|
38
|
+
option :'dry-run', aliases: '-d', type: :boolean, default: false, desc: 'dry-run'
|
39
|
+
def restore
|
40
|
+
invoke(:restore_plugins, [], ['-d', options[:'dry-run'], 'source_profile', options[:source_profile]])
|
41
|
+
invoke(:restore_jobs, [], ['-d', options[:'dry-run'], 'source_profile', options[:source_profile]])
|
42
|
+
invoke(:restore_views, [], ['-d', options[:'dry-run'], 'source_profile', options[:source_profile]])
|
43
|
+
end
|
44
|
+
|
45
|
+
desc 'export_plugins', 'export_plugins'
|
46
|
+
option :output, aliases: '-o', type: :string, default: 'Pluginfile', desc: 'output'
|
47
|
+
def export_plugins
|
48
|
+
@plugin.export(options)
|
49
|
+
end
|
50
|
+
|
51
|
+
desc 'apply_plugins', 'apply_plugins'
|
52
|
+
option :file, aliases: '-f', type: :string, default: 'Pluginfile', desc: 'file'
|
53
|
+
option :'dry-run', aliases: '-d', type: :boolean, default: false, desc: 'dry-run'
|
54
|
+
def apply_plugins
|
55
|
+
@plugin.apply(options)
|
56
|
+
end
|
57
|
+
|
58
|
+
desc 'restore_plugins', 'restore_plugins'
|
59
|
+
option :source_profile, type: :string, required: true, desc: 'file'
|
60
|
+
option :'dry-run', aliases: '-d', type: :boolean, default: false, desc: 'dry-run'
|
61
|
+
def restore_plugins
|
62
|
+
@plugin.restore(options, get_config(options[:source_profile]))
|
63
|
+
end
|
64
|
+
|
65
|
+
desc 'export_jobs', 'export_jobs'
|
66
|
+
option :output, aliases: '-o', type: :string, default: 'Jobfile', desc: 'output'
|
67
|
+
def export_jobs
|
68
|
+
@job.export(options)
|
69
|
+
end
|
70
|
+
|
71
|
+
desc 'apply_jobs', 'apply_jobs'
|
72
|
+
option :file, aliases: '-f', type: :string, default: 'Jobfile', desc: 'file'
|
73
|
+
option :'dry-run', aliases: '-d', type: :boolean, default: false, desc: 'dry-run'
|
74
|
+
def apply_jobs
|
75
|
+
@job.apply(options)
|
76
|
+
end
|
77
|
+
|
78
|
+
desc 'restore_jobs', 'restore_jobs'
|
79
|
+
option :source_profile, type: :string, required: true, desc: 'file'
|
80
|
+
option :'dry-run', aliases: '-d', type: :boolean, default: false, desc: 'dry-run'
|
81
|
+
def restore_jobs
|
82
|
+
@job.restore(options, get_config(options[:source_profile]))
|
83
|
+
end
|
84
|
+
|
85
|
+
desc 'export_views', 'export_views'
|
86
|
+
option :output, aliases: '-o', type: :string, default: 'Viewfile', desc: 'output'
|
87
|
+
def export_views
|
88
|
+
@view.export(options)
|
89
|
+
end
|
90
|
+
|
91
|
+
desc 'apply_views', 'apply_views'
|
92
|
+
option :file, aliases: '-f', type: :string, default: 'Viewfile', desc: 'file'
|
93
|
+
option :'dry-run', aliases: '-d', type: :boolean, default: false, desc: 'dry-run'
|
94
|
+
def apply_views
|
95
|
+
@view.apply(options)
|
96
|
+
end
|
97
|
+
|
98
|
+
desc 'restore_views', 'restore_views'
|
99
|
+
option :source_profile, type: :string, required: true, desc: 'file'
|
100
|
+
option :'dry-run', aliases: '-d', type: :boolean, default: false, desc: 'dry-run'
|
101
|
+
def restore_views
|
102
|
+
@view.restore(options, get_config(options[:source_profile]))
|
103
|
+
end
|
104
|
+
|
105
|
+
desc 'version', 'show version'
|
106
|
+
def version
|
107
|
+
puts VERSION
|
108
|
+
end
|
109
|
+
|
110
|
+
private
|
111
|
+
|
112
|
+
def get_config(profile)
|
113
|
+
YAML.load_file(@global_options[:config])[profile]
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|
data/lib/jendle/core.rb
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'logger'
|
2
|
+
require "diffy"
|
3
|
+
require "jenkins_api_client"
|
4
|
+
|
5
|
+
module Jendle
|
6
|
+
class Core
|
7
|
+
|
8
|
+
attr_accessor :client
|
9
|
+
attr_accessor :logger
|
10
|
+
|
11
|
+
def initialize(config)
|
12
|
+
@client = get_client(config['server_ip'], config['username'], config['password'])
|
13
|
+
@logger = Logger.new(STDOUT)
|
14
|
+
end
|
15
|
+
|
16
|
+
def get_client(server_ip, username, password)
|
17
|
+
params = {
|
18
|
+
:server_ip => server_ip
|
19
|
+
}
|
20
|
+
params[:username] = username if username
|
21
|
+
params[:password] = password if password
|
22
|
+
@client = JenkinsApi::Client.new(params)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
data/lib/jendle/job.rb
ADDED
@@ -0,0 +1,62 @@
|
|
1
|
+
module Jendle
|
2
|
+
class Job
|
3
|
+
|
4
|
+
def initialize(core)
|
5
|
+
@core = core
|
6
|
+
@client = core.client
|
7
|
+
@logger = core.logger
|
8
|
+
end
|
9
|
+
|
10
|
+
def restore(options, source_config)
|
11
|
+
source_client = @core.get_client(
|
12
|
+
source_config['server_ip'],
|
13
|
+
source_config['username'],
|
14
|
+
source_config['password']
|
15
|
+
)
|
16
|
+
get_config_pairs(source_client).each do |job_name, xml|
|
17
|
+
apply_proc(job_name, xml, options[:'dry-run'])
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def export(options)
|
22
|
+
File.write(options[:output], get_config_pairs.to_yaml)
|
23
|
+
@logger.info("exported => #{options[:output]}")
|
24
|
+
end
|
25
|
+
|
26
|
+
def apply(options)
|
27
|
+
jobs = YAML.load_file(options[:file])
|
28
|
+
jobs.each do |job_name, xml|
|
29
|
+
apply_proc(job_name, xml, options[:'dry-run'])
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
private
|
34
|
+
|
35
|
+
def get_config_pairs(client = @client)
|
36
|
+
hash = {}
|
37
|
+
client.job.list_all_with_details.each do |job|
|
38
|
+
hash[job['name']] = client.job.get_config(job['name'])
|
39
|
+
end
|
40
|
+
hash
|
41
|
+
end
|
42
|
+
|
43
|
+
def apply_proc(job_name, xml, dryrun)
|
44
|
+
before_xml = if @client.job.exists?(job_name)
|
45
|
+
@client.job.get_config(job_name)
|
46
|
+
else
|
47
|
+
nil
|
48
|
+
end
|
49
|
+
|
50
|
+
if (before_xml == xml)
|
51
|
+
@logger.info("no change => #{job_name}")
|
52
|
+
else
|
53
|
+
puts Diffy::Diff.new(before_xml, xml, :context => 3).to_s(:color)
|
54
|
+
unless dryrun
|
55
|
+
@client.job.create_or_update(job_name, xml)
|
56
|
+
end
|
57
|
+
@logger.info("applied => #{job_name}")
|
58
|
+
end
|
59
|
+
sleep 3
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
module Jendle
|
2
|
+
class Plugin
|
3
|
+
|
4
|
+
def initialize(core)
|
5
|
+
@core = core
|
6
|
+
@client = core.client
|
7
|
+
@logger = core.logger
|
8
|
+
end
|
9
|
+
|
10
|
+
def restore(options, source_config)
|
11
|
+
source_client = @core.get_client(
|
12
|
+
source_config['server_ip'],
|
13
|
+
source_config['username'],
|
14
|
+
source_config['password']
|
15
|
+
)
|
16
|
+
plugins = source_client.plugin.list_installed
|
17
|
+
plugins.each do |k, v|
|
18
|
+
apply_proc(k)
|
19
|
+
end
|
20
|
+
restart
|
21
|
+
end
|
22
|
+
|
23
|
+
def export(options)
|
24
|
+
plugins = @client.plugin.list_installed
|
25
|
+
File.open(options[:output],'w:utf-8') { |file|
|
26
|
+
plugins.each do |k, v|
|
27
|
+
file.puts k
|
28
|
+
end
|
29
|
+
}
|
30
|
+
@logger.info("exported => #{options[:output]}")
|
31
|
+
end
|
32
|
+
|
33
|
+
def apply(options)
|
34
|
+
File.read(options[:file]).lines.each do |plugin|
|
35
|
+
plugin = plugin.strip
|
36
|
+
apply_proc(plugin)
|
37
|
+
end
|
38
|
+
restart
|
39
|
+
end
|
40
|
+
|
41
|
+
def apply_proc(plugin)
|
42
|
+
if !(@client.plugin.list_installed.key?(plugin))
|
43
|
+
@client.plugin.install(plugin)
|
44
|
+
sleep 3
|
45
|
+
else
|
46
|
+
@logger.info("already installed #{plugin}")
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
def restart
|
51
|
+
if @client.plugin.restart_required?
|
52
|
+
@logger.info("restarting...")
|
53
|
+
@client.system.restart(true)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
data/lib/jendle/view.rb
ADDED
@@ -0,0 +1,66 @@
|
|
1
|
+
module Jendle
|
2
|
+
class View
|
3
|
+
|
4
|
+
def initialize(core)
|
5
|
+
@core = core
|
6
|
+
@client = core.client
|
7
|
+
@logger = core.logger
|
8
|
+
end
|
9
|
+
|
10
|
+
def restore(options, source_config)
|
11
|
+
source_client = @core.get_client(
|
12
|
+
source_config['server_ip'],
|
13
|
+
source_config['username'],
|
14
|
+
source_config['password']
|
15
|
+
)
|
16
|
+
get_config_pairs(source_client).each do |job_name, xml|
|
17
|
+
apply_proc(job_name, xml, options[:'dry-run'])
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def export(options)
|
22
|
+
File.write(options[:output], get_config_pairs.to_yaml)
|
23
|
+
@logger.info("exported => #{options[:output]}")
|
24
|
+
end
|
25
|
+
|
26
|
+
def apply(options)
|
27
|
+
jobs = YAML.load_file(options[:file])
|
28
|
+
jobs.each do |view_name, xml|
|
29
|
+
apply_proc(view_name, xml, options[:'dry-run'])
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
private
|
34
|
+
|
35
|
+
def get_config_pairs(client = @client)
|
36
|
+
hash = {}
|
37
|
+
client.view.list('.*').each do |view|
|
38
|
+
hash[view] = client.view.get_config(view)
|
39
|
+
end
|
40
|
+
hash
|
41
|
+
end
|
42
|
+
|
43
|
+
def apply_proc(view_name, xml, dryrun)
|
44
|
+
before_xml = if @client.view.exists?(view_name)
|
45
|
+
@client.view.get_config(view_name)
|
46
|
+
else
|
47
|
+
nil
|
48
|
+
end
|
49
|
+
|
50
|
+
if (before_xml == xml)
|
51
|
+
@logger.info("no change => #{view_name}")
|
52
|
+
else
|
53
|
+
puts Diffy::Diff.new(before_xml, xml, :context => 3).to_s(:color)
|
54
|
+
unless dryrun
|
55
|
+
if @client.view.exists?(view_name)
|
56
|
+
@client.view.post_config(view_name, xml)
|
57
|
+
else
|
58
|
+
@client.post_config("/createView?name=#{view_name}", xml)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
@logger.info("applied => #{view_name}")
|
63
|
+
sleep 3
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
data/spec/cli_spec.rb
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'jendle'
|
3
|
+
|
4
|
+
describe Jendle::CLI do
|
5
|
+
before do
|
6
|
+
end
|
7
|
+
|
8
|
+
it "should stdout sample" do
|
9
|
+
output = capture_stdout do
|
10
|
+
Jendle::CLI.start(['help'])
|
11
|
+
end
|
12
|
+
expect(output).not_to eq(nil)
|
13
|
+
end
|
14
|
+
|
15
|
+
it "include" do
|
16
|
+
output = capture_stdout do
|
17
|
+
Jendle::CLI.start(['help', 'sample'])
|
18
|
+
end
|
19
|
+
expect(output).to include('--fields')
|
20
|
+
end
|
21
|
+
|
22
|
+
after do
|
23
|
+
end
|
24
|
+
end
|
data/spec/core_spec.rb
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'jendle'
|
3
|
+
|
4
|
+
describe Jendle::Core do
|
5
|
+
before do
|
6
|
+
@core = Core.new
|
7
|
+
end
|
8
|
+
|
9
|
+
it "core not nil" do
|
10
|
+
expect(@core).not_to eq(nil)
|
11
|
+
end
|
12
|
+
|
13
|
+
it "private method" do
|
14
|
+
@core.send(:sample, []).should == []
|
15
|
+
end
|
16
|
+
|
17
|
+
after do
|
18
|
+
end
|
19
|
+
end
|
data/spec/jendle_spec.rb
ADDED
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'rspec'
|
2
|
+
require 'jendle/version'
|
3
|
+
|
4
|
+
include Jendle
|
5
|
+
|
6
|
+
def capture_stdout
|
7
|
+
out = StringIO.new
|
8
|
+
$stdout = out
|
9
|
+
yield
|
10
|
+
return out.string
|
11
|
+
ensure
|
12
|
+
$stdout = STDOUT
|
13
|
+
end
|
14
|
+
|
15
|
+
def capture_stderr
|
16
|
+
out = StringIO.new
|
17
|
+
$stderr = out
|
18
|
+
yield
|
19
|
+
return out.string
|
20
|
+
ensure
|
21
|
+
$stderr = STDERR
|
22
|
+
end
|
23
|
+
|
24
|
+
def clear_env
|
25
|
+
ENV['PASSPHRASE'] = nil
|
26
|
+
end
|
metadata
ADDED
@@ -0,0 +1,212 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: jendle
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- toyama0919
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-05-22 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: thor
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.19.4
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.19.4
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: jenkins_api_client
|
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: diffy
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: bundler
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 1.14.6
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 1.14.6
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: pry
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 0.10.1
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 0.10.1
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rake
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 10.3.2
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 10.3.2
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rspec
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '3.0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '3.0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: rubocop
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: 0.24.1
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: 0.24.1
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: rubygems-tasks
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - "~>"
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0.2'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - "~>"
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0.2'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: yard
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - "~>"
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0.8'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - "~>"
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0.8'
|
153
|
+
description: Jenkins as code management tool.
|
154
|
+
email: toyama0919@gmail.com
|
155
|
+
executables:
|
156
|
+
- jendle
|
157
|
+
extensions: []
|
158
|
+
extra_rdoc_files: []
|
159
|
+
files:
|
160
|
+
- ".document"
|
161
|
+
- ".gitignore"
|
162
|
+
- ".rspec"
|
163
|
+
- ".travis.yml"
|
164
|
+
- ".yardopts"
|
165
|
+
- ChangeLog.md
|
166
|
+
- Gemfile
|
167
|
+
- LICENSE.txt
|
168
|
+
- README.md
|
169
|
+
- Rakefile
|
170
|
+
- bin/jendle
|
171
|
+
- jendle.gemspec
|
172
|
+
- lib/jendle.rb
|
173
|
+
- lib/jendle/cli.rb
|
174
|
+
- lib/jendle/constants.rb
|
175
|
+
- lib/jendle/core.rb
|
176
|
+
- lib/jendle/job.rb
|
177
|
+
- lib/jendle/plugin.rb
|
178
|
+
- lib/jendle/version.rb
|
179
|
+
- lib/jendle/view.rb
|
180
|
+
- spec/cli_spec.rb
|
181
|
+
- spec/core_spec.rb
|
182
|
+
- spec/jendle_spec.rb
|
183
|
+
- spec/spec_helper.rb
|
184
|
+
homepage: https://github.com/toyama0919/jendle
|
185
|
+
licenses:
|
186
|
+
- MIT
|
187
|
+
metadata: {}
|
188
|
+
post_install_message:
|
189
|
+
rdoc_options: []
|
190
|
+
require_paths:
|
191
|
+
- lib
|
192
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
193
|
+
requirements:
|
194
|
+
- - ">="
|
195
|
+
- !ruby/object:Gem::Version
|
196
|
+
version: '0'
|
197
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
198
|
+
requirements:
|
199
|
+
- - ">="
|
200
|
+
- !ruby/object:Gem::Version
|
201
|
+
version: '0'
|
202
|
+
requirements: []
|
203
|
+
rubyforge_project:
|
204
|
+
rubygems_version: 2.6.11
|
205
|
+
signing_key:
|
206
|
+
specification_version: 4
|
207
|
+
summary: Jenkins as code management tool.
|
208
|
+
test_files:
|
209
|
+
- spec/cli_spec.rb
|
210
|
+
- spec/core_spec.rb
|
211
|
+
- spec/jendle_spec.rb
|
212
|
+
- spec/spec_helper.rb
|