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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 35e2e3b4886655a6ffc8278233940424cc21586d711aa04565407d4d32ec98c9
4
- data.tar.gz: 2a03de504c5b28ce27b15abb4a8c8a8ec64e4fdfd21fedfaa2b9c3bd61bc3c95
3
+ metadata.gz: b39898848784b84c87559eb63675f51dc4a03823ee35fe2da7dd749edd5d621c
4
+ data.tar.gz: 39212caecea142e17c80df6d37f94d4494bb30d0694059a983b17e50939c6181
5
5
  SHA512:
6
- metadata.gz: 3beecf48e5b8b318b8c71137e5c2e6059ebd758aed7c9bf52b0a2a0568b22434194ad5519e323326619cbd9339df6773a15dab525de9307fed614870d95d31bf
7
- data.tar.gz: ddb3a55e68e071d62f8f74715ef0953a3c3d897161b06de5dc615f705d3b24840f8dfd3c4d9cee4c33fd969289b84625d457129b1f4432b58fb7daeb5ce6721e
6
+ metadata.gz: 8cd027c6c46a93b6478e2fa9aed14f5032843a4d9661ed86ee9332c11acf6ad1af083a0aed72ac52c271989213a3fc14820a9f093f02740554a656e83e0cfc36
7
+ data.tar.gz: c8edb12b96dfdf9ec8e74e445632175c75316bb98113d4b0a74bbb4078d1fa30f6a663a92ff0b56bfec6d1d481009747c8875a28f72c3c41e92202323c221706
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- jenkins-builder (0.1.0)
4
+ jenkins-builder (0.1.1)
5
5
  jenkins_api_client (~> 1.5.3)
6
6
  pastel (~> 0.7.2)
7
7
  security (~> 0.1.3)
@@ -79,4 +79,4 @@ DEPENDENCIES
79
79
  rspec (~> 3.0)
80
80
 
81
81
  BUNDLED WITH
82
- 1.16.1
82
+ 1.16.2
@@ -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
@@ -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, job)
59
+ def create_alias(name, command)
60
60
  @config.aliases ||= {}
61
- @config.aliases[name] = job
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
- p @config.aliases
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
- jobs.each { |job| build(job) }
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
@@ -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, job|
11
- desc "#{name}", "alias for: #{job}"
12
- define_method name do
13
- Jenkins::Builder::App.new.build(job)
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(silent: options[:silent])
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> <JOB_IDENTIFIER>', 'Create job alias'
64
- def alias(name=nil, job=nil)
65
- if name.nil? || job.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, job)
71
+ Jenkins::Builder::App.new.create_alias(name, command)
70
72
  end
71
73
 
72
74
  desc 'unalias <ALIAS>', 'Delete alias'
@@ -1,5 +1,5 @@
1
1
  module Jenkins
2
2
  module Builder
3
- VERSION = "0.1.0"
3
+ VERSION = "0.1.1"
4
4
  end
5
5
  end
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.0
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-05 00:00:00.000000000 Z
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: