aptly_cli 0.2.7 → 0.2.8

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,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZWM3OGM4ZGE3MTY0NGZkMzRkMzliNDk5MjE3ZjFhOTUyZjcxMmY2Mw==
4
+ ZmFmYjZhZjI1NzkxYjg5YTRlYjI3MjZhZTcyYzgxZWVkYjk3M2JlNQ==
5
5
  data.tar.gz: !binary |-
6
- N2QyYWZlNjdiMmMxMGUzODZjMjZkOTNmYTVjMTAxNTEzMTMwMDBlYQ==
6
+ YjZhMjRjYjcyNmNhYjhiYTgyNzRhZGI4ODRhOGI1YWJjYTE4NjdhOQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- NGEwZmI1MTMxNDg4ZDJhNWYwMjI3MDY1MjM3MjJkOTZkYjJhM2Y3YmQ4ZGY5
10
- MDNmZDlhNTI4OTY0NDQzMGVkYjA0Y2YyMDI5ZTUxYzBmMDFlZTVmMGY3ZGUz
11
- OTgyYmJkNGEyNTdkYTAyNGQ5ZDBjNWNjODJlYjc2ZmZiNzZmMWI=
9
+ MjYzOWYyOWY2OWRjOTg2MGVkNzM0ZGJiM2VmNmE3ZDA0NTRjYTc5ODZjYzBl
10
+ NmU0OGYzN2ZiYjA4NTc0NTdiM2JkNDAwMTFkYTUxYTA2N2I3OTZjMGNiY2Y2
11
+ YTY3YzQwOGZjZjJjYjBhNmM4Y2Q3NjBmNjgxZjM4OGFkODEyZWM=
12
12
  data.tar.gz: !binary |-
13
- NzgxN2JlMGY4N2EzYTBiNDExMTAxYTcyMDkwZWMxNjQ5OWRmMzY1ODJmY2Uy
14
- YzYxMWU1ZDQ2MTc1ZDhlNWVkMThkZDMzNWUwY2FhNzAzNTVjNjEwNWJjNzk4
15
- NDM2MDlkYWFkZmQwYjAxOWZiOWM4MjcxNjFlODQwMDc3NDFiNTE=
13
+ YTEyNjU1MDc2ZTljZTA1OTFiMjIyMzBjNDYwZjJlMTYzNjFkZjg2NjIwYWYy
14
+ MzIwN2Y5ZjU5NDI0ODBmYWE2NTY0ZGNiZjJkZjExOGE0ODU2ZDdkMWE4ZDZi
15
+ NGM0MTU5NjcyMjhmYzY2YmI5MmY2YTZiM2Q4ZDdlN2EyZjg2N2E=
data/.rubocop_todo.yml CHANGED
@@ -1,21 +1,18 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2016-03-20 13:34:32 -0700 using RuboCop version 0.38.0.
3
+ # on 2016-04-09 19:20:20 -0700 using RuboCop version 0.38.0.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
7
7
  # versions of RuboCop, may require this file to be generated again.
8
8
 
9
- # Offense count: 20
9
+ # Offense count: 2
10
10
  # Cop supports --auto-correct.
11
11
  # Configuration parameters: AlignWith, SupportedStyles.
12
12
  # SupportedStyles: either, start_of_block, start_of_line
13
13
  Lint/BlockAlignment:
14
14
  Exclude:
15
15
  - 'test/test_aptly_misc.rb'
16
- - 'test/test_aptly_package.rb'
17
- - 'test/test_aptly_repo.rb'
18
- - 'test/test_aptly_snapshot.rb'
19
16
 
20
17
  # Offense count: 26
21
18
  # Cop supports --auto-correct.
@@ -24,22 +21,17 @@ Lint/UnusedBlockArgument:
24
21
  Exclude:
25
22
  - 'bin/aptly-cli'
26
23
 
27
- # Offense count: 62
24
+ # Offense count: 4
28
25
  Lint/UselessAssignment:
29
26
  Exclude:
30
27
  - 'test/test_aptly_cli_configure.rb'
31
- - 'test/test_aptly_file.rb'
32
28
  - 'test/test_aptly_misc.rb'
33
- - 'test/test_aptly_package.rb'
34
- - 'test/test_aptly_publish.rb'
35
- - 'test/test_aptly_repo.rb'
36
- - 'test/test_aptly_snapshot.rb'
37
29
 
38
- # Offense count: 2
30
+ # Offense count: 5
39
31
  Metrics/AbcSize:
40
32
  Max: 31
41
33
 
42
- # Offense count: 1
34
+ # Offense count: 2
43
35
  # Configuration parameters: CountComments.
44
36
  Metrics/ClassLength:
45
37
  Max: 108
@@ -48,13 +40,13 @@ Metrics/ClassLength:
48
40
  Metrics/CyclomaticComplexity:
49
41
  Max: 9
50
42
 
51
- # Offense count: 147
43
+ # Offense count: 122
52
44
  # Configuration parameters: AllowHeredoc, AllowURI, URISchemes.
53
45
  # URISchemes: http, https
54
46
  Metrics/LineLength:
55
- Max: 524
47
+ Max: 253
56
48
 
57
- # Offense count: 9
49
+ # Offense count: 17
58
50
  # Configuration parameters: CountComments.
59
51
  Metrics/MethodLength:
60
52
  Max: 34
@@ -74,14 +66,26 @@ Style/AlignArray:
74
66
  Exclude:
75
67
  - 'lib/aptly_publish.rb'
76
68
 
77
- # Offense count: 8
69
+ # Offense count: 14
78
70
  # Cop supports --auto-correct.
79
71
  # Configuration parameters: EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle, SupportedLastArgumentHashStyles.
80
72
  # SupportedLastArgumentHashStyles: always_inspect, always_ignore, ignore_implicit, ignore_explicit
81
73
  Style/AlignHash:
82
74
  Exclude:
83
75
  - 'bin/aptly-cli'
76
+ - 'test/test_aptly_file.rb'
84
77
  - 'test/test_aptly_publish.rb'
78
+ - 'test/test_aptly_repo.rb'
79
+
80
+ # Offense count: 10
81
+ # Cop supports --auto-correct.
82
+ # Configuration parameters: EnforcedStyle, SupportedStyles.
83
+ # SupportedStyles: with_first_parameter, with_fixed_indentation
84
+ Style/AlignParameters:
85
+ Exclude:
86
+ - 'test/test_aptly_cli_configure.rb'
87
+ - 'test/test_aptly_file.rb'
88
+ - 'test/test_aptly_repo.rb'
85
89
 
86
90
  # Offense count: 2
87
91
  # Cop supports --auto-correct.
@@ -91,15 +95,34 @@ Style/AndOr:
91
95
  Exclude:
92
96
  - 'bin/aptly-cli'
93
97
 
94
- # Offense count: 20
98
+ # Offense count: 4
99
+ # Cop supports --auto-correct.
100
+ # Configuration parameters: EnforcedStyle, SupportedStyles, ProceduralMethods, FunctionalMethods, IgnoredMethods.
101
+ # SupportedStyles: line_count_based, semantic, braces_for_chaining
102
+ # ProceduralMethods: benchmark, bm, bmbm, create, each_with_object, measure, new, realtime, tap, with_object
103
+ # FunctionalMethods: let, let!, subject, watch
104
+ # IgnoredMethods: lambda, proc, it
105
+ Style/BlockDelimiters:
106
+ Exclude:
107
+ - 'test/test_aptly_file.rb'
108
+ - 'test/test_aptly_repo.rb'
109
+
110
+ # Offense count: 4
111
+ # Cop supports --auto-correct.
112
+ Style/BlockEndNewline:
113
+ Exclude:
114
+ - 'test/test_aptly_file.rb'
115
+ - 'test/test_aptly_repo.rb'
116
+
117
+ # Offense count: 7
95
118
  # Cop supports --auto-correct.
96
119
  # Configuration parameters: EnforcedStyle, SupportedStyles.
97
120
  # SupportedStyles: braces, no_braces, context_dependent
98
121
  Style/BracesAroundHashParameters:
99
122
  Exclude:
100
123
  - 'bin/aptly-cli'
124
+ - 'test/test_aptly_cli_configure.rb'
101
125
  - 'test/test_aptly_repo.rb'
102
- - 'test/test_aptly_snapshot.rb'
103
126
 
104
127
  # Offense count: 3
105
128
  Style/ClassVars:
@@ -108,113 +131,56 @@ Style/ClassVars:
108
131
 
109
132
  # Offense count: 1
110
133
  # Cop supports --auto-correct.
111
- # Configuration parameters: SingleLineConditionsOnly.
112
- Style/ConditionalAssignment:
113
- Exclude:
114
- - 'lib/aptly_snapshot.rb'
115
-
116
- # Offense count: 2
117
- # Cop supports --auto-correct.
118
- Style/DeprecatedHashMethods:
119
- Exclude:
120
- - 'lib/aptly_snapshot.rb'
121
-
122
- # Offense count: 1
123
- Style/Documentation:
124
- Exclude:
125
- - 'spec/**/*'
126
- - 'test/**/*'
127
- - 'lib/aptly_snapshot.rb'
128
-
129
- # Offense count: 2
130
- # Cop supports --auto-correct.
131
134
  Style/EmptyLines:
132
135
  Exclude:
133
136
  - 'test/test_aptly_file.rb'
134
- - 'test/test_aptly_repo.rb'
135
137
 
136
- # Offense count: 45
138
+ # Offense count: 1
137
139
  # Cop supports --auto-correct.
138
140
  # Configuration parameters: EnforcedStyle, SupportedStyles.
139
141
  # SupportedStyles: empty_lines, no_empty_lines
140
142
  Style/EmptyLinesAroundBlockBody:
141
143
  Exclude:
142
- - 'test/test_aptly_file.rb'
143
- - 'test/test_aptly_misc.rb'
144
- - 'test/test_aptly_package.rb'
145
- - 'test/test_aptly_publish.rb'
146
144
  - 'test/test_aptly_repo.rb'
147
- - 'test/test_aptly_snapshot.rb'
148
145
 
149
- # Offense count: 2
150
- # Cop supports --auto-correct.
151
- # Configuration parameters: EnforcedStyle, SupportedStyles.
152
- # SupportedStyles: empty_lines, no_empty_lines
153
- Style/EmptyLinesAroundClassBody:
154
- Exclude:
155
- - 'lib/aptly_snapshot.rb'
156
- - 'test/test_aptly_cli_configure.rb'
157
-
158
- # Offense count: 3
159
- # Cop supports --auto-correct.
160
- Style/EmptyLinesAroundMethodBody:
161
- Exclude:
162
- - 'lib/aptly_snapshot.rb'
163
-
164
- # Offense count: 130
146
+ # Offense count: 56
165
147
  # Cop supports --auto-correct.
166
148
  # Configuration parameters: EnforcedStyle, SupportedStyles, UseHashRocketsWithSymbolValues.
167
149
  # SupportedStyles: ruby19, ruby19_no_mixed_keys, hash_rockets
168
150
  Style/HashSyntax:
169
151
  Enabled: false
170
152
 
171
- # Offense count: 7
153
+ # Offense count: 2
172
154
  # Cop supports --auto-correct.
173
155
  # Configuration parameters: MaxLineLength.
174
156
  Style/IfUnlessModifier:
175
157
  Exclude:
176
158
  - 'bin/aptly-cli'
177
159
  - 'lib/aptly_publish.rb'
178
- - 'lib/aptly_snapshot.rb'
179
160
 
180
- # Offense count: 30
161
+ # Offense count: 5
181
162
  # Cop supports --auto-correct.
182
163
  # Configuration parameters: EnforcedStyle, SupportedStyles.
183
164
  # SupportedStyles: normal, rails
184
165
  Style/IndentationConsistency:
185
166
  Exclude:
167
+ - 'test/test_aptly_file.rb'
186
168
  - 'test/test_aptly_misc.rb'
187
- - 'test/test_aptly_package.rb'
188
- - 'test/test_aptly_publish.rb'
189
- - 'test/test_aptly_repo.rb'
190
- - 'test/test_aptly_snapshot.rb'
191
169
 
192
- # Offense count: 24
170
+ # Offense count: 3
193
171
  # Cop supports --auto-correct.
194
172
  # Configuration parameters: Width.
195
173
  Style/IndentationWidth:
196
174
  Exclude:
197
- - 'test/test_aptly_file.rb'
175
+ - 'lib/aptly_publish.rb'
198
176
  - 'test/test_aptly_misc.rb'
199
- - 'test/test_aptly_package.rb'
200
- - 'test/test_aptly_publish.rb'
201
- - 'test/test_aptly_repo.rb'
202
- - 'test/test_aptly_snapshot.rb'
203
177
 
204
- # Offense count: 1
205
- # Cop supports --auto-correct.
206
- Style/LeadingCommentSpace:
207
- Exclude:
208
- - 'test/minitest_helper.rb'
209
-
210
- # Offense count: 8
178
+ # Offense count: 5
211
179
  # Cop supports --auto-correct.
212
180
  Style/MethodCallParentheses:
213
181
  Exclude:
214
182
  - 'bin/aptly-cli'
215
- - 'test/test_aptly_file.rb'
216
183
  - 'test/test_aptly_misc.rb'
217
- - 'test/test_aptly_repo.rb'
218
184
 
219
185
  # Offense count: 2
220
186
  # Configuration parameters: EnforcedStyle, SupportedStyles.
@@ -222,11 +188,19 @@ Style/MethodCallParentheses:
222
188
  Style/MethodName:
223
189
  Enabled: false
224
190
 
225
- # Offense count: 2
191
+ # Offense count: 4
192
+ # Cop supports --auto-correct.
193
+ Style/MultilineBlockLayout:
194
+ Exclude:
195
+ - 'test/test_aptly_file.rb'
196
+ - 'test/test_aptly_repo.rb'
197
+
198
+ # Offense count: 5
226
199
  # Cop supports --auto-correct.
227
200
  # Configuration parameters: PreferredDelimiters.
228
201
  Style/PercentLiteralDelimiters:
229
202
  Exclude:
203
+ - 'Rakefile'
230
204
  - 'aptly_cli.gemspec'
231
205
 
232
206
  # Offense count: 1
@@ -235,16 +209,16 @@ Style/PercentLiteralDelimiters:
235
209
  Style/RaiseArgs:
236
210
  EnforcedStyle: compact
237
211
 
238
- # Offense count: 15
212
+ # Offense count: 6
239
213
  # Cop supports --auto-correct.
240
214
  Style/RedundantParentheses:
241
215
  Exclude:
216
+ - 'test/test_aptly_cli_configure.rb'
242
217
  - 'test/test_aptly_file.rb'
243
218
  - 'test/test_aptly_misc.rb'
244
219
  - 'test/test_aptly_publish.rb'
245
- - 'test/test_aptly_snapshot.rb'
246
220
 
247
- # Offense count: 2
221
+ # Offense count: 4
248
222
  # Cop supports --auto-correct.
249
223
  # Configuration parameters: AllowMultipleReturnValues.
250
224
  Style/RedundantReturn:
@@ -252,35 +226,14 @@ Style/RedundantReturn:
252
226
  - 'lib/aptly_publish.rb'
253
227
  - 'lib/aptly_repo.rb'
254
228
 
255
- # Offense count: 7
256
- # Cop supports --auto-correct.
257
- Style/SpaceAfterComma:
258
- Exclude:
259
- - 'test/test_aptly_snapshot.rb'
260
-
261
- # Offense count: 6
262
- # Cop supports --auto-correct.
263
- # Configuration parameters: AllowForAlignment.
264
- Style/SpaceAroundOperators:
265
- Exclude:
266
- - 'lib/aptly_snapshot.rb'
267
- - 'test/test_aptly_snapshot.rb'
268
-
269
229
  # Offense count: 1
270
230
  # Cop supports --auto-correct.
271
- # Configuration parameters: EnforcedStyle, SupportedStyles, EnforcedStyleForEmptyBraces, SpaceBeforeBlockParameters.
272
- # SupportedStyles: space, no_space
273
- Style/SpaceInsideBlockBraces:
274
- Enabled: false
275
-
276
- # Offense count: 51
277
- # Cop supports --auto-correct.
278
231
  # Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces, SupportedStyles.
279
232
  # SupportedStyles: space, no_space
280
233
  Style/SpaceInsideHashLiteralBraces:
281
234
  Enabled: false
282
235
 
283
- # Offense count: 189
236
+ # Offense count: 40
284
237
  # Cop supports --auto-correct.
285
238
  # Configuration parameters: EnforcedStyle, SupportedStyles, ConsistentQuotesInMultiline.
286
239
  # SupportedStyles: single_quotes, double_quotes
@@ -296,20 +249,16 @@ Style/TrailingBlankLines:
296
249
  - 'bin/aptly-cli'
297
250
  - 'test/test_aptly_file.rb'
298
251
 
299
- # Offense count: 66
252
+ # Offense count: 25
300
253
  # Cop supports --auto-correct.
301
254
  Style/TrailingWhitespace:
302
255
  Exclude:
303
- - 'aptly_cli.gemspec'
304
256
  - 'bin/aptly-cli'
305
- - 'lib/aptly_snapshot.rb'
257
+ - 'lib/aptly_publish.rb'
306
258
  - 'test/test_aptly_cli_configure.rb'
307
259
  - 'test/test_aptly_file.rb'
308
260
  - 'test/test_aptly_misc.rb'
309
- - 'test/test_aptly_package.rb'
310
- - 'test/test_aptly_publish.rb'
311
261
  - 'test/test_aptly_repo.rb'
312
- - 'test/test_aptly_snapshot.rb'
313
262
 
314
263
  # Offense count: 1
315
264
  # Cop supports --auto-correct.
@@ -319,27 +268,8 @@ Style/TrivialAccessors:
319
268
  Exclude:
320
269
  - 'lib/aptly_load.rb'
321
270
 
322
- # Offense count: 1
323
- # Cop supports --auto-correct.
324
- Style/UnlessElse:
325
- Exclude:
326
- - 'lib/aptly_snapshot.rb'
327
-
328
- # Offense count: 3
329
- # Cop supports --auto-correct.
330
- Style/UnneededInterpolation:
331
- Exclude:
332
- - 'lib/aptly_snapshot.rb'
333
-
334
271
  # Offense count: 2
335
272
  # Cop supports --auto-correct.
336
273
  Style/UnneededPercentQ:
337
274
  Exclude:
338
275
  - 'aptly_cli.gemspec'
339
-
340
- # Offense count: 1
341
- # Cop supports --auto-correct.
342
- # Configuration parameters: SupportedStyles, MinSize, WordRegex.
343
- # SupportedStyles: percent, brackets
344
- Style/WordArray:
345
- EnforcedStyle: brackets
data/README.md CHANGED
@@ -1,9 +1,8 @@
1
1
  # AptlyCli
2
2
 
3
- [![Join the chat at https://gitter.im/sepulworld/aptly_cli](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/sepulworld/aptly_cli?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
4
-
5
3
  [![Build Status](https://travis-ci.org/sepulworld/aptly_cli.svg)](https://travis-ci.org/sepulworld/aptly_cli)
6
4
  [![Gem Version](https://badge.fury.io/rb/aptly_cli.svg)](http://badge.fury.io/rb/aptly_cli)
5
+ [![Coverage Status](https://coveralls.io/repos/github/sepulworld/aptly_cli/badge.svg?branch=master)](https://coveralls.io/github/sepulworld/aptly_cli?branch=master)
7
6
 
8
7
  A command line interace to execute [Aptly](http://aptly.info) commands againts remote Aptly API servers. Aptly-cli will allow you to interact with the file, repo, snapshot, publish, packages, graph and version API endpoints of your Aptly server.
9
8
 
data/aptly_cli.gemspec CHANGED
@@ -26,10 +26,9 @@ Gem::Specification.new do |spec|
26
26
 
27
27
  spec.add_development_dependency "bundler"
28
28
  spec.add_development_dependency "rake", "~> 10.0"
29
- spec.add_development_dependency "webmock", "~> 1.20"
30
- spec.add_development_dependency "vcr", "~> 2.9"
31
29
  spec.add_development_dependency "minitest"
32
-
30
+ spec.add_development_dependency "coveralls"
31
+
33
32
  spec.add_dependency "httmultiparty", "~> 0.3.16"
34
33
  spec.add_dependency "commander", "~> 4.3"
35
34
  end
@@ -1,3 +1,3 @@
1
1
  module AptlyCli
2
- VERSION = '0.2.7'.freeze
2
+ VERSION = '0.2.8'.freeze
3
3
  end
data/lib/aptly_file.rb CHANGED
@@ -9,16 +9,16 @@ module AptlyCli
9
9
  attr_accessor :file_uri, :package, :local_file_path
10
10
 
11
11
  # Load aptly-cli.conf and establish base_uri
12
- config = AptlyCli::AptlyLoad.new.configure_with('/etc/aptly-cli.conf')
13
- base_uri "http://#{config[:server]}:#{config[:port]}/api"
12
+ @config = AptlyCli::AptlyLoad.new.configure_with('/etc/aptly-cli.conf')
13
+ base_uri "http://#{@config[:server]}:#{@config[:port]}/api"
14
14
 
15
- if config[:username]
16
- if config[:password]
17
- basic_auth config[:username].to_s, config[:password].to_s
15
+ if @config[:username]
16
+ if @config[:password]
17
+ basic_auth @config[:username].to_s, @config[:password].to_s
18
18
  end
19
19
  end
20
20
 
21
- debug_output $stdout if config[:debug] == true
21
+ debug_output $stdout if @config[:debug] == true
22
22
 
23
23
  def initialize(file_uri=nil, package=nil, local_file_path=nil)
24
24
  end
data/lib/aptly_misc.rb CHANGED
@@ -9,16 +9,16 @@ module AptlyCli
9
9
  include HTTMultiParty
10
10
 
11
11
  # Load aptly-cli.conf and establish base_uri
12
- config = AptlyCli::AptlyLoad.new.configure_with('/etc/aptly-cli.conf')
13
- base_uri "http://#{config[:server]}:#{config[:port]}/api"
12
+ @config = AptlyCli::AptlyLoad.new.configure_with('/etc/aptly-cli.conf')
13
+ base_uri "http://#{@config[:server]}:#{@config[:port]}/api"
14
14
 
15
- if config[:username]
16
- if config[:password]
17
- basic_auth config[:username].to_s, config[:password].to_s
15
+ if @config[:username]
16
+ if @config[:password]
17
+ basic_auth @config[:username].to_s, @config[:password].to_s
18
18
  end
19
19
  end
20
20
 
21
- debug_output $stdout if config[:debug] == true
21
+ debug_output $stdout if @config[:debug] == true
22
22
 
23
23
  def get_graph(extension)
24
24
  uri = "/graph.#{extension}"
data/lib/aptly_package.rb CHANGED
@@ -9,16 +9,16 @@ module AptlyCli
9
9
  include HTTMultiParty
10
10
 
11
11
  # Load aptly-cli.conf and establish base_uri
12
- config = AptlyCli::AptlyLoad.new.configure_with('/etc/aptly-cli.conf')
13
- base_uri "http://#{config[:server]}:#{config[:port]}/api"
12
+ @config = AptlyCli::AptlyLoad.new.configure_with('/etc/aptly-cli.conf')
13
+ base_uri "http://#{@config[:server]}:#{@config[:port]}/api"
14
14
 
15
- if config[:username]
16
- if config[:password]
17
- basic_auth config[:username].to_s, config[:password].to_s
15
+ if @config[:username]
16
+ if @config[:password]
17
+ basic_auth @config[:username].to_s, @config[:password].to_s
18
18
  end
19
19
  end
20
20
 
21
- debug_output $stdout if config[:debug] == true
21
+ debug_output $stdout if @config[:debug] == true
22
22
 
23
23
  def package_show(package_key)
24
24
  uri = "/packages/#{package_key}"
data/lib/aptly_publish.rb CHANGED
@@ -9,16 +9,16 @@ module AptlyCli
9
9
  include HTTMultiParty
10
10
 
11
11
  # Load aptly-cli.conf and establish base_uri
12
- config = AptlyCli::AptlyLoad.new.configure_with('/etc/aptly-cli.conf')
13
- base_uri "http://#{config[:server]}:#{config[:port]}/api"
12
+ @config = AptlyCli::AptlyLoad.new.configure_with('/etc/aptly-cli.conf')
13
+ base_uri "http://#{@config[:server]}:#{@config[:port]}/api"
14
14
 
15
- if config[:username]
16
- if config[:password]
17
- basic_auth config[:username].to_s, config[:password].to_s
15
+ if @config[:username]
16
+ if @config[:password]
17
+ basic_auth @config[:username].to_s, @config[:password].to_s
18
18
  end
19
19
  end
20
20
 
21
- debug_output $stdout if config[:debug] == true
21
+ debug_output $stdout if @config[:debug] == true
22
22
 
23
23
  @@available_gpg_options = [:skip, :batch, :gpgKey, :keyring, :secretKeyring,
24
24
  :passphrase, :passphraseFile]
data/lib/aptly_repo.rb CHANGED
@@ -8,15 +8,15 @@ module AptlyCli
8
8
  class AptlyRepo
9
9
  include HTTMultiParty
10
10
  # Load aptly-cli.conf and establish base_uri
11
- config = AptlyCli::AptlyLoad.new.configure_with('/etc/aptly-cli.conf')
12
- base_uri "http://#{config[:server]}:#{config[:port]}/api"
11
+ @config = AptlyCli::AptlyLoad.new.configure_with('/etc/aptly-cli.conf')
12
+ base_uri "http://#{@config[:server]}:#{@config[:port]}/api"
13
13
 
14
- if config[:username]
15
- if config[:password]
16
- basic_auth config[:username].to_s, config[:password].to_s
14
+ if @config[:username]
15
+ if @config[:password]
16
+ basic_auth @config[:username].to_s, @config[:password].to_s
17
17
  end
18
18
  end
19
- debug_output $stdout if config[:debug] == true
19
+ debug_output $stdout if @config[:debug] == true
20
20
 
21
21
  def repo_create(repo_options = { name: nil,
22
22
  comment: nil,
@@ -1,67 +1,59 @@
1
- require "aptly_cli/version"
2
- require "aptly_load"
3
- require "httmultiparty"
4
- require "json"
1
+ require 'aptly_cli/version'
2
+ require 'aptly_load'
3
+ require 'httmultiparty'
4
+ require 'json'
5
5
 
6
6
  module AptlyCli
7
+ # Aplty class to work with Snapshot API
7
8
  class AptlySnapshot
8
-
9
9
  include HTTMultiParty
10
10
 
11
11
  # Load aptly-cli.conf and establish base_uri
12
- config = AptlyCli::AptlyLoad.new.configure_with("/etc/aptly-cli.conf")
13
- base_uri "http://#{config[:server]}:#{config[:port]}/api"
12
+ @config = AptlyCli::AptlyLoad.new.configure_with('/etc/aptly-cli.conf')
13
+ base_uri "http://#{@config[:server]}:#{@config[:port]}/api"
14
14
 
15
- if config[:username]
16
- if config[:password]
17
- basic_auth "#{config[:username]}", "#{config[:password]}"
15
+ if @config[:username]
16
+ if @config[:password]
17
+ basic_auth @config[:username].to_s, @config[:password].to_s
18
18
  end
19
19
  end
20
20
 
21
- if config[:debug] == true
22
- debug_output $stdout
23
- end
21
+ debug_output $stdout if @config[:debug] == true
24
22
 
25
23
  def snapshot_delete(name, force=nil)
26
24
  uri = "/snapshots/#{name}"
27
-
28
- if force == true
29
- uri += "?force=1"
30
- end
31
-
25
+ uri += '?force=1' if force == true
32
26
  self.class.delete(uri)
33
27
  end
34
28
 
35
29
  def snapshot_list(sort=nil)
36
- uri = "/snapshots"
37
-
38
- if sort
39
- uri += "?sort=#{sort}"
40
- end
41
-
30
+ uri = '/snapshots'
31
+ uri += "?sort=#{sort}" if sort
42
32
  self.class.get(uri)
43
33
  end
44
34
 
45
35
  def snapshot_create(name, repo, description=nil)
46
- # Build uri to create snapshot, requires name of snap and name of repo
47
- uri = "/repos/#{repo}/" + "snapshots"
48
-
49
- self.class.post(uri, :query => { 'Name' => name, 'Description' => description }.to_json, :headers => {'Content-Type'=>'application/json'})
50
- end
36
+ # Build uri to create snapshot, requires name of snap and name of repo
37
+ uri = "/repos/#{repo}/" + 'snapshots'
51
38
 
52
- def snapshot_create_ref(name, description=nil, sourcesnapshots=[], packagerefs=[])
53
- uri = "/snapshots"
39
+ self.class.post(uri, query:
40
+ { 'Name' => name,
41
+ 'Description' => description }.to_json,
42
+ headers: { 'Content-Type' => 'application/json' })
43
+ end
54
44
 
45
+ def snapshot_create_ref(name, description=nil,
46
+ sourcesnapshots=[], packagerefs=[])
47
+ uri = '/snapshots'
55
48
  begin
56
- self.class.post(uri, :query => { 'Name' => name,
57
- 'Description' => description,
58
- 'SourceSnapshots' => sourcesnapshots,
59
- 'PackageRefs' => packagerefs }.to_json,
60
- :headers => {'Content-Type'=>'application/json'})
49
+ self.class.post(uri,
50
+ query: { 'Name' => name, 'Description' => description,
51
+ 'SourceSnapshots' => sourcesnapshots,
52
+ 'PackageRefs' => packagerefs }.to_json,
53
+ headers: { 'Content-Type' => 'application/json' })
61
54
  rescue HTTParty::Error => e
62
55
  return e
63
56
  end
64
-
65
57
  end
66
58
 
67
59
  def snapshot_diff(name, with_snapshot)
@@ -71,22 +63,18 @@ module AptlyCli
71
63
 
72
64
  def snapshot_search(name, search_options={})
73
65
  uri = "/snapshots/#{name}/packages"
74
- @options = { query: {} }
66
+ @options = { query: {} }
75
67
 
76
- if search_options.has_key?(:format)
77
- @options[:query] = {format: "#{search_options[:format]}" }
68
+ if search_options.key?(:format)
69
+ @options[:query] = { format: search_options[:format].to_s }
78
70
  end
79
71
 
80
- if search_options.has_key?(:q)
81
- @options[:query] = {q: "Name (~ #{search_options[:q]})" }
82
- end
83
-
84
- if search_options[:withDeps] == true
85
- @options[:query] = {withDeps: "1" }
72
+ if search_options.key?(:q)
73
+ @options[:query] = { q: "Name (~ #{search_options[:q]})" }
86
74
  end
87
75
 
76
+ @options[:query] = { withDeps: '1' } if search_options[:withDeps] == true
88
77
  self.class.get(uri, @options)
89
-
90
78
  end
91
79
 
92
80
  def snapshot_show(name)
@@ -96,27 +84,21 @@ module AptlyCli
96
84
 
97
85
  def snapshot_update(name, new_name, description=nil)
98
86
  uri = "/snapshots/#{name}"
99
-
100
- if new_name.nil?
101
- snap_name = name
102
- else
103
- snap_name = new_name
104
- end
105
-
87
+ snap_name = if new_name.nil?
88
+ name
89
+ else
90
+ new_name
91
+ end
106
92
  @query = {}
107
- @query[:Name] = snap_name
108
-
109
- unless description.nil?
110
- @query[:Description] = description
111
- end
93
+ @query[:Name] = snap_name
94
+ @query[:Description] = description unless description.nil?
112
95
  @query_json = @query.to_json
113
-
114
96
  begin
115
- self.class.put(uri, :query => @query_json, :headers => {'Content-Type'=>'application/json'})
97
+ self.class.put(uri, query: @query_json, headers:
98
+ { 'Content-Type' => 'application/json' })
116
99
  rescue HTTPary::Error => e
117
- puts e
100
+ puts e
118
101
  end
119
-
120
102
  end
121
103
  end
122
104
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aptly_cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.7
4
+ version: 0.2.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zane
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-06 00:00:00.000000000 Z
11
+ date: 2016-04-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -39,35 +39,21 @@ dependencies:
39
39
  - !ruby/object:Gem::Version
40
40
  version: '10.0'
41
41
  - !ruby/object:Gem::Dependency
42
- name: webmock
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - ~>
46
- - !ruby/object:Gem::Version
47
- version: '1.20'
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - ~>
53
- - !ruby/object:Gem::Version
54
- version: '1.20'
55
- - !ruby/object:Gem::Dependency
56
- name: vcr
42
+ name: minitest
57
43
  requirement: !ruby/object:Gem::Requirement
58
44
  requirements:
59
- - - ~>
45
+ - - ! '>='
60
46
  - !ruby/object:Gem::Version
61
- version: '2.9'
47
+ version: '0'
62
48
  type: :development
63
49
  prerelease: false
64
50
  version_requirements: !ruby/object:Gem::Requirement
65
51
  requirements:
66
- - - ~>
52
+ - - ! '>='
67
53
  - !ruby/object:Gem::Version
68
- version: '2.9'
54
+ version: '0'
69
55
  - !ruby/object:Gem::Dependency
70
- name: minitest
56
+ name: coveralls
71
57
  requirement: !ruby/object:Gem::Requirement
72
58
  requirements:
73
59
  - - ! '>='