backup_jenkins 0.0.12 → 0.0.13

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -4,13 +4,9 @@ source :rubygems
4
4
  gemspec
5
5
 
6
6
  group :development do
7
- gem "guard"
8
- gem "guard-bundler"
9
- gem "guard-rspec"
10
7
  gem "rb-fchange", :require => false
11
8
  gem "rb-fsevent", :require => false
12
9
  gem "rb-inotify", :require => false
13
- gem "terminal-notifier-guard"
14
10
  end
15
11
 
16
12
  group :test do
@@ -17,6 +17,11 @@ Gem::Specification.new do |gem|
17
17
 
18
18
  gem.add_dependency("aws-sdk")
19
19
  gem.add_dependency("hashie")
20
+ gem.add_dependency("command_line_helper")
20
21
 
21
22
  gem.add_development_dependency("rake")
23
+ gem.add_development_dependency("guard")
24
+ gem.add_development_dependency("guard-bundler")
25
+ gem.add_development_dependency("guard-rspec")
26
+ gem.add_development_dependency("terminal-notifier-guard")
22
27
  end
@@ -1,7 +1,12 @@
1
+ require 'command_line_helper'
2
+
1
3
  module BackupJenkins
2
4
  class CLI
5
+ include CommandLineHelper::HelpText
6
+
3
7
  class << self
4
8
  def run
9
+ change_program_name
5
10
  cli = self.new
6
11
  cli.parse_options
7
12
  cli.check_config
@@ -58,6 +63,10 @@ module BackupJenkins
58
63
 
59
64
  private
60
65
 
66
+ def self.change_program_name
67
+ $0 = File.basename($0) << " (#{VERSION})"
68
+ end
69
+
61
70
  def options_possible
62
71
  [
63
72
  [
@@ -160,35 +169,6 @@ module BackupJenkins
160
169
  File.expand_path("../../../LICENSE", __FILE__)
161
170
  end
162
171
 
163
- def help_info
164
- <<-EOH
165
- Usage: #{File.basename($0)} [options]
166
- #{short_hand_options}
167
-
168
- Options:
169
- #{option_details}
170
- #{version_info}
171
- EOH
172
- end
173
-
174
- def short_hand_options
175
- "[#{options_possible.map{ |o| short_hand_option(o)}.join('], [')}]"
176
- end
177
-
178
- def short_hand_option(option)
179
- if option[2] == GetoptLong::REQUIRED_ARGUMENT
180
- [option[0], option[1]].join('|') << " argument"
181
- else
182
- [option[0], option[1]].join('|')
183
- end
184
- end
185
-
186
- def option_details
187
- <<-EOO
188
- #{options_possible.map{ |o| expand_option(o) }.join("\n")}
189
- EOO
190
- end
191
-
192
172
  def version_info
193
173
  <<-EOV
194
174
  backup_jenkins (#{version_number})
@@ -202,12 +182,5 @@ Work on this has been proudly backed by ChallengePost, Inc.
202
182
  VERSION
203
183
  end
204
184
 
205
- def longest_width
206
- @max_width ||= options_possible.map{ |o| o[0] }.max{ |a, b| a.length <=> b.length }.length
207
- end
208
-
209
- def expand_option(option)
210
- sprintf(" %-#{longest_width + 6}s %s", option.first(2).join(', '), option[3])
211
- end
212
185
  end
213
186
  end
@@ -1,3 +1,3 @@
1
1
  module BackupJenkins
2
- VERSION = "0.0.12"
2
+ VERSION = "0.0.13"
3
3
  end
@@ -274,31 +274,6 @@ Work on this has been proudly backed by ChallengePost, Inc.
274
274
  end
275
275
  end
276
276
 
277
- describe "#option_details" do
278
- it "should return nice things" do
279
- subject.stub(:options_possible).and_return(
280
- [
281
- ['--foo', '-f', 1, 'Fooism'],
282
- ['--bar', '-b', 2, 'Bark']
283
- ]
284
- )
285
- subject.send(:option_details).should ==
286
- " --foo, -f Fooism\n --bar, -b Bark\n"
287
- end
288
- end
289
-
290
- describe "#short_hand_option" do
291
- it "should return '--foo|-f argument'" do
292
- option = ["--foo", "-f", GetoptLong::REQUIRED_ARGUMENT]
293
- subject.send(:short_hand_option, option).should == "--foo|-f argument"
294
- end
295
-
296
- it "should return '--bar|-b'" do
297
- option = ["--bar", "-b", nil]
298
- subject.send(:short_hand_option, option).should == "--bar|-b"
299
- end
300
- end
301
-
302
277
  describe "#version_number" do
303
278
  it "returns version" do
304
279
  BackupJenkins::VERSION = "foo"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: backup_jenkins
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.12
4
+ version: 0.0.13
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -43,6 +43,22 @@ dependencies:
43
43
  - - ! '>='
44
44
  - !ruby/object:Gem::Version
45
45
  version: '0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: command_line_helper
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :runtime
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
46
62
  - !ruby/object:Gem::Dependency
47
63
  name: rake
48
64
  requirement: !ruby/object:Gem::Requirement
@@ -59,6 +75,70 @@ dependencies:
59
75
  - - ! '>='
60
76
  - !ruby/object:Gem::Version
61
77
  version: '0'
78
+ - !ruby/object:Gem::Dependency
79
+ name: guard
80
+ requirement: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ! '>='
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
86
+ type: :development
87
+ prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
+ - !ruby/object:Gem::Dependency
95
+ name: guard-bundler
96
+ requirement: !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ! '>='
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
+ type: :development
103
+ prerelease: false
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
110
+ - !ruby/object:Gem::Dependency
111
+ name: guard-rspec
112
+ requirement: !ruby/object:Gem::Requirement
113
+ none: false
114
+ requirements:
115
+ - - ! '>='
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ! '>='
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
126
+ - !ruby/object:Gem::Dependency
127
+ name: terminal-notifier-guard
128
+ requirement: !ruby/object:Gem::Requirement
129
+ none: false
130
+ requirements:
131
+ - - ! '>='
132
+ - !ruby/object:Gem::Version
133
+ version: '0'
134
+ type: :development
135
+ prerelease: false
136
+ version_requirements: !ruby/object:Gem::Requirement
137
+ none: false
138
+ requirements:
139
+ - - ! '>='
140
+ - !ruby/object:Gem::Version
141
+ version: '0'
62
142
  description: Simple Jenkins config and plugin backup to S3
63
143
  email:
64
144
  - jcmuller@gmail.com