jenkins-builder 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.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -2
- data/jenkins-builder.gemspec +7 -0
- data/lib/jenkins/builder/app.rb +12 -4
- data/lib/jenkins/builder/cli.rb +15 -13
- data/lib/jenkins/builder/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b39898848784b84c87559eb63675f51dc4a03823ee35fe2da7dd749edd5d621c
|
4
|
+
data.tar.gz: 39212caecea142e17c80df6d37f94d4494bb30d0694059a983b17e50939c6181
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8cd027c6c46a93b6478e2fa9aed14f5032843a4d9661ed86ee9332c11acf6ad1af083a0aed72ac52c271989213a3fc14820a9f093f02740554a656e83e0cfc36
|
7
|
+
data.tar.gz: c8edb12b96dfdf9ec8e74e445632175c75316bb98113d4b0a74bbb4078d1fa30f6a663a92ff0b56bfec6d1d481009747c8875a28f72c3c41e92202323c221706
|
data/Gemfile.lock
CHANGED
data/jenkins-builder.gemspec
CHANGED
@@ -16,6 +16,13 @@ Gem::Specification.new do |spec|
|
|
16
16
|
|
17
17
|
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
18
18
|
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
19
|
+
if spec.respond_to?(:metadata)
|
20
|
+
spec.metadata["allowed_push_host"] = "https://rubygems.org"
|
21
|
+
else
|
22
|
+
raise "RubyGems 2.0 or newer is required to protect against " \
|
23
|
+
"public gem pushes."
|
24
|
+
end
|
25
|
+
|
19
26
|
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
20
27
|
f.match(%r{^(test|spec|features)/})
|
21
28
|
end
|
data/lib/jenkins/builder/app.rb
CHANGED
@@ -56,9 +56,9 @@ module Jenkins
|
|
56
56
|
puts "Password: #{@secret.password}" if options[:password]
|
57
57
|
end
|
58
58
|
|
59
|
-
def create_alias(name,
|
59
|
+
def create_alias(name, command)
|
60
60
|
@config.aliases ||= {}
|
61
|
-
@config.aliases[name] =
|
61
|
+
@config.aliases[name] = command
|
62
62
|
@config.save!
|
63
63
|
end
|
64
64
|
|
@@ -72,11 +72,17 @@ module Jenkins
|
|
72
72
|
end
|
73
73
|
|
74
74
|
def list_aliases
|
75
|
-
|
75
|
+
@config.aliases.each do |k, v|
|
76
|
+
puts "`%s' is alias for `%s'" % [k, v]
|
77
|
+
end
|
76
78
|
end
|
77
79
|
|
78
80
|
def build_each(jobs)
|
79
|
-
|
81
|
+
if @options[:failfast]
|
82
|
+
jobs.find { |job| build(job).nil? }
|
83
|
+
else
|
84
|
+
jobs.each { |job| build(job) }
|
85
|
+
end
|
80
86
|
end
|
81
87
|
|
82
88
|
def build(job)
|
@@ -142,6 +148,8 @@ module Jenkins
|
|
142
148
|
else
|
143
149
|
puts pastel.red.bold(msg)
|
144
150
|
end
|
151
|
+
|
152
|
+
msg =~ /SUCCESS/
|
145
153
|
end
|
146
154
|
|
147
155
|
private
|
data/lib/jenkins/builder/cli.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'thor'
|
2
2
|
require 'io/console'
|
3
|
+
require 'shellwords'
|
3
4
|
|
4
5
|
module Jenkins
|
5
6
|
module Builder
|
@@ -7,17 +8,17 @@ module Jenkins
|
|
7
8
|
|
8
9
|
class << self
|
9
10
|
def create_alias_commands(aliases)
|
10
|
-
aliases.each do |name,
|
11
|
-
desc "#{name}", "alias for: #{
|
12
|
-
define_method name do
|
13
|
-
|
11
|
+
aliases.each do |name, command|
|
12
|
+
desc "#{name}", "alias for: #{command}"
|
13
|
+
define_method name do |*args|
|
14
|
+
self.class.start(Shellwords.split(command) + args)
|
14
15
|
end
|
15
16
|
end
|
16
17
|
end
|
17
18
|
end
|
18
19
|
|
19
20
|
desc 'setup [-e]', 'Setup URL, username and password, or open config file in an editor when -e specified.'
|
20
|
-
option :edit, type: :boolean, aliases: ['-e']
|
21
|
+
option :edit, type: :boolean, aliases: ['-e'], desc: 'open config file in an editor'
|
21
22
|
def setup
|
22
23
|
if options[:edit]
|
23
24
|
editor = ENV['VISUAL'] || ENV['EDITOR'] || "vim"
|
@@ -33,15 +34,16 @@ module Jenkins
|
|
33
34
|
end
|
34
35
|
|
35
36
|
desc 'info [-p]', 'Show saved URL, username, use -p to show password also.'
|
36
|
-
option :password, type: :boolean, aliases: ['-p']
|
37
|
+
option :password, type: :boolean, aliases: ['-p'], desc: 'show password also.'
|
37
38
|
def info
|
38
39
|
Jenkins::Builder::App.new.print_info(options)
|
39
40
|
end
|
40
41
|
|
41
|
-
desc 'build [-s] <JOB_IDENTIFIERS>', 'Build jobs'
|
42
|
-
option :silent, type: :boolean, aliases: ['-s']
|
42
|
+
desc 'build [-s] [-f] <JOB_IDENTIFIERS>', 'Build jobs'
|
43
|
+
option :silent, type: :boolean, aliases: ['-s'], desc: 'suppress console output.'
|
44
|
+
option :failfast, type: :boolean, aliases: ['-f'], desc: 'stop immediately when building fails.'
|
43
45
|
def build(*jobs)
|
44
|
-
app = Jenkins::Builder::App.new(
|
46
|
+
app = Jenkins::Builder::App.new(options)
|
45
47
|
if jobs.empty?
|
46
48
|
jobs = fzf(app.all_jobs)
|
47
49
|
exit if jobs.empty?
|
@@ -60,13 +62,13 @@ module Jenkins
|
|
60
62
|
app.build_each(jobs)
|
61
63
|
end
|
62
64
|
|
63
|
-
desc 'alias <ALIAS> <
|
64
|
-
def alias(name=nil,
|
65
|
-
if name.nil? ||
|
65
|
+
desc 'alias <ALIAS> <COMMAND>', 'Create alias or with no arguments given, it print all aliases.'
|
66
|
+
def alias(name=nil, command=nil)
|
67
|
+
if name.nil? || command.nil?
|
66
68
|
Jenkins::Builder::App.new.list_aliases
|
67
69
|
exit
|
68
70
|
end
|
69
|
-
Jenkins::Builder::App.new.create_alias(name,
|
71
|
+
Jenkins::Builder::App.new.create_alias(name, command)
|
70
72
|
end
|
71
73
|
|
72
74
|
desc 'unalias <ALIAS>', 'Delete alias'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jenkins-builder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Liu Xiang
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-11-
|
11
|
+
date: 2018-11-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -194,7 +194,8 @@ files:
|
|
194
194
|
homepage: https://github.com/lululau/jenkins-builder
|
195
195
|
licenses:
|
196
196
|
- MIT
|
197
|
-
metadata:
|
197
|
+
metadata:
|
198
|
+
allowed_push_host: https://rubygems.org
|
198
199
|
post_install_message:
|
199
200
|
rdoc_options: []
|
200
201
|
require_paths:
|