voog-kit 0.4.0 → 0.5.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
  SHA1:
3
- metadata.gz: 5c7ac235dd563c5bfebdf3a3c1153c9898da4810
4
- data.tar.gz: e3d3d75ae208a8af22c2198fb8882656dc4b6051
3
+ metadata.gz: cd2594260b0fbf7e26ad8e55a7eacfbef664fc69
4
+ data.tar.gz: 4cac4348a4f3ec4c8b2332fb6bcb38a95034f44f
5
5
  SHA512:
6
- metadata.gz: 9787c777adc1df1fd0d42f396677195af1a2c8766a780735f8a13f7428cea44abc0635fc78d882cb8495fc934700b413123897a8ad058dd1332992fbe68f7a5b
7
- data.tar.gz: 04e62394e467681c2013a9683f919ee2fc93e560360bff2a3b579c7105c22f99d194ddf0e214c51111b920415ef2986832f7232326e8c2817ca24bbbfea1deaa
6
+ metadata.gz: c14a1298aaa6c57458ac15a5667b403bea6fc3ef03d55ab798b1eeff62731a46a5d8c926fe09453467b113f855284bc1c72e22eabc340c08f6a164b53f9ead19
7
+ data.tar.gz: 2cc2504593c300e8b6122b83095b14d4f3a7639fbd8731f52f6ca203dbb89cc5e1b1b67b3ff56eb2f0b98a55d6fd8a9ceee3a978607b6e09485305e923984a6a
data/bin/kit CHANGED
@@ -24,10 +24,12 @@ hostname_args = [:h, :host, :hostname, { desc: 'Provide a hostname', arg_name: :
24
24
  api_token_args = [:t, :token, :api_token, { desc: 'Provide an API token', arg_name: :API_TOKEN }]
25
25
  site_args = [:s, :site, { arg_name: :SITE, default_value: nil, desc: 'Specify which site block to use when parsing the .voog file' }]
26
26
  overwrite_args = [:overwrite, { negatable: true, default_value: false, desc: 'Enable overwriting asset files that cannot be normally updated.' }]
27
+ protocol_args = [:protocol, { negatable: false, default_value: '', desc: 'Set protocol to use (HTTP or HTTPS)' }]
27
28
 
28
29
  flag *hostname_args
29
30
  flag *api_token_args
30
31
  flag *site_args
32
+ flag *protocol_args
31
33
 
32
34
  switch *debug_args
33
35
  switch *verbose_args
@@ -52,6 +54,7 @@ command :init do |c|
52
54
  c.flag *hostname_args
53
55
  c.flag *api_token_args
54
56
  c.flag *site_args
57
+ c.flag *protocol_args
55
58
 
56
59
  c.desc 'Initializes the local project folder with remote layout files'
57
60
  c.action do |global_options, options, args|
@@ -88,6 +91,7 @@ command :check do |c|
88
91
  c.flag *hostname_args
89
92
  c.flag *api_token_args
90
93
  c.flag *site_args
94
+ c.flag *protocol_args
91
95
  c.action do |global_options, options, args|
92
96
  @filemanager.check
93
97
  end
@@ -111,6 +115,7 @@ command :pull do |c|
111
115
  c.flag *hostname_args
112
116
  c.flag *api_token_args
113
117
  c.flag *site_args
118
+ c.flag *protocol_args
114
119
  c.action do |global_options, options, args|
115
120
  unless args.empty? # if filenames are given, pull specified files and generate new manifest
116
121
  @filemanager.pull_files(args)
@@ -135,6 +140,7 @@ command :push do |c|
135
140
  c.flag *hostname_args
136
141
  c.flag *api_token_args
137
142
  c.flag *site_args
143
+ c.flag *protocol_args
138
144
  c.action do |global_options, options, args|
139
145
  @filemanager.upload_files args
140
146
  end
@@ -150,6 +156,7 @@ command :remove do |c|
150
156
  c.flag *hostname_args
151
157
  c.flag *api_token_args
152
158
  c.flag *site_args
159
+ c.flag *protocol_args
153
160
  c.action do |global_options, options, args|
154
161
  @filemanager.remove_files args
155
162
  end
@@ -165,6 +172,7 @@ command :add do |c|
165
172
  c.flag *hostname_args
166
173
  c.flag *api_token_args
167
174
  c.flag *site_args
175
+ c.flag *protocol_args
168
176
  c.action do |global_options, options, args|
169
177
  @filemanager.add_files args
170
178
  end
@@ -186,6 +194,7 @@ command :manifest do |c|
186
194
  c.flag *hostname_args
187
195
  c.flag *api_token_args
188
196
  c.flag *site_args
197
+ c.flag *protocol_args
189
198
  c.switch(
190
199
  [:r, :remote],
191
200
  default_value: false,
@@ -213,6 +222,7 @@ command :sites do |c|
213
222
  c.flag *hostname_args
214
223
  c.flag *api_token_args
215
224
  c.flag *site_args
225
+ c.flag *protocol_args
216
226
  c.action do |global_options, options, args|
217
227
  @filemanager.display_sites(Voog::Dtk.read_config(:all))
218
228
  end
@@ -232,6 +242,7 @@ command :watch do |c|
232
242
  c.flag *hostname_args
233
243
  c.flag *api_token_args
234
244
  c.flag *site_args
245
+ c.flag *protocol_args
235
246
  c.action do |global_options, options, args|
236
247
  @notifier.info "Watching #{Dir.pwd}/ for changes..."
237
248
  @notifier.newline
@@ -253,12 +264,32 @@ pre do |global, command, options, args|
253
264
  host = global.fetch(:host, nil) || options.fetch(:host, nil)
254
265
  api_token = global.fetch(:token, nil) || options.fetch(:token, nil)
255
266
 
267
+ # check if protocol is provided with the host URL
268
+ if host
269
+ matched_protocol = host.match(/^https?:\/\//)
270
+ if (matched_protocol)
271
+ protocol_string = matched_protocol[0].slice(0, matched_protocol[0].length-3)
272
+ if options.fetch(:protocol, '').empty?
273
+ protocol = protocol_string
274
+ else
275
+ protocol = options.fetch(:protocol)
276
+ end
277
+ protocol = protocol.empty? ? protocol_string : protocol
278
+ host = host.slice(matched_protocol[0].length, host.length)
279
+ else
280
+ protocol = options.fetch(:protocol, '').empty? ? 'http' : options.fetch(:protocol)
281
+ end
282
+ else
283
+ protocol = options.fetch(:protocol, '').empty? ? 'http' : options.fetch(:protocol)
284
+ end
285
+
256
286
  if host && api_token
257
287
  Voog::Dtk.write_config({
258
288
  host: host,
259
289
  api_token: api_token,
260
290
  block: @config_block || host,
261
- overwrite: overwrite
291
+ overwrite: overwrite,
292
+ protocol: protocol
262
293
  })
263
294
  end
264
295
 
@@ -277,12 +308,14 @@ pre do |global, command, options, args|
277
308
 
278
309
  host ||= @config[:host]
279
310
  api_token ||= @config[:api_token]
311
+ overwrite ||= @config[:overwrite]
280
312
 
281
- client = Voog::Client.new(host, api_token)
313
+ client = Voog::Client.new(host, api_token, protocol: protocol, raise_on_error: true)
282
314
  @filemanager = Voog::Dtk::FileManager.new(client, {
283
315
  silent: silent,
284
316
  verbose: verbose,
285
- overwrite: overwrite
317
+ overwrite: overwrite,
318
+ protocol: protocol
286
319
  })
287
320
  end
288
321
 
data/lib/voog/dtk.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  require 'voog/dtk/version'
2
2
  require 'parseconfig'
3
- require 'prettyprint'
3
+ require 'pp'
4
4
 
5
5
  module Voog
6
6
  module Dtk
@@ -20,7 +20,8 @@ module Voog
20
20
  config = {
21
21
  :host => nil,
22
22
  :api_token => nil,
23
- :overwrite => false
23
+ :overwrite => nil,
24
+ :protocol => 'http'
24
25
  }
25
26
  local_config = config_exists?(file) ? ParseConfig.new(File.expand_path(file)).params : {}
26
27
  global_config = global_config_exists?(file) ? ParseConfig.new(File.expand_path([ENV['HOME'], file].join('/'))).params : {}
@@ -47,13 +48,16 @@ module Voog
47
48
  config << {
48
49
  name: site,
49
50
  host: options[site].fetch('host'),
50
- api_token: options[site].fetch('api_token')
51
+ api_token: options[site].fetch('api_token'),
52
+ overwrite: options[site].fetch('overwrite'),
53
+ protocol: options[site].fetch('protocol')
51
54
  }
52
55
  end
53
56
  else
54
57
  config[:host] = options[@block].fetch("host")
55
58
  config[:api_token] = options[@block].fetch("api_token")
56
59
  config[:overwrite] = options[@block].fetch("overwrite", false) == 'true' ? true : false
60
+ config[:protocol] = options[@block].fetch("protocol", 'http') == "https" ? "https" : "http"
57
61
  end
58
62
  end
59
63
  config
@@ -64,7 +68,8 @@ module Voog
64
68
  host = opts.fetch(:host, '')
65
69
  api_token = opts.fetch(:api_token, '')
66
70
  silent = opts.fetch(:silent, false)
67
- overwrite = opts.fetch(:overwrite, false)
71
+ overwrite = opts.fetch(:overwrite, '')
72
+ protocol = opts.fetch(:protocol, '')
68
73
 
69
74
  @file = if config_exists?
70
75
  CONFIG_FILENAME
@@ -81,13 +86,15 @@ module Voog
81
86
  puts "Writing new configuration options to existing config block.".white unless silent
82
87
  options.params[block]['host'] = host unless host.empty?
83
88
  options.params[block]['api_token'] = api_token unless api_token.empty?
84
- options.params[block]['overwrite'] = overwrite unless overwrite.empty?
89
+ options.params[block]['overwrite'] = overwrite if (overwrite == true || overwrite == false)
90
+ options.params[block]['protocol'] = (protocol == 'https' ? 'https' : 'http') unless protocol.empty?
85
91
  else
86
92
  puts "Writing configuration options to new config block.".white unless silent
87
93
  options.params[block] = {
88
94
  'host' => host,
89
95
  'api_token' => api_token,
90
- 'overwrite' => overwrite
96
+ 'overwrite' => (overwrite == true ? true : false),
97
+ 'protocol' => (protocol == 'https' ? 'https' : 'http')
91
98
  }
92
99
  end
93
100
 
@@ -1,5 +1,5 @@
1
1
  module Voog
2
2
  module Dtk
3
- VERSION = '0.4.0'
3
+ VERSION = '0.5.1'
4
4
  end
5
5
  end
data/voog-kit.gemspec CHANGED
@@ -25,13 +25,13 @@ Gem::Specification.new do |spec|
25
25
  spec.add_development_dependency 'rake'
26
26
  spec.add_development_dependency 'rspec'
27
27
  spec.add_development_dependency 'guard-rspec'
28
-
29
28
  spec.add_runtime_dependency 'gli', '2.10.0'
29
+
30
30
  spec.add_runtime_dependency 'pry'
31
31
  spec.add_runtime_dependency 'listen', '~> 3.0'
32
32
  spec.add_runtime_dependency 'git'
33
33
  spec.add_runtime_dependency 'parseconfig'
34
- spec.add_runtime_dependency 'voog_api', '~> 0.0.7'
34
+ spec.add_runtime_dependency 'voog_api', '~> 0.0.9'
35
35
  spec.add_runtime_dependency 'colorize'
36
36
  spec.add_runtime_dependency 'mime-types', '>= 1.25.1', '< 3.0'
37
37
  spec.add_runtime_dependency 'rb-readline'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: voog-kit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mikk Pristavka
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-12-22 00:00:00.000000000 Z
12
+ date: 2016-02-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -143,14 +143,14 @@ dependencies:
143
143
  requirements:
144
144
  - - "~>"
145
145
  - !ruby/object:Gem::Version
146
- version: 0.0.7
146
+ version: 0.0.9
147
147
  type: :runtime
148
148
  prerelease: false
149
149
  version_requirements: !ruby/object:Gem::Requirement
150
150
  requirements:
151
151
  - - "~>"
152
152
  - !ruby/object:Gem::Version
153
- version: 0.0.7
153
+ version: 0.0.9
154
154
  - !ruby/object:Gem::Dependency
155
155
  name: colorize
156
156
  requirement: !ruby/object:Gem::Requirement