loft-harmony 1.2.2 → 1.3.0

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/bin/harmony +44 -0
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: df76af79bda66a3cc2b48282f7d0c31586e143b3
4
- data.tar.gz: 174090be91e9ccedc3e4566792586bbf6265c95b
3
+ metadata.gz: a787fc1aa34315a42462695d17d3a0acb1a52fe1
4
+ data.tar.gz: 41a7edff4216a52c3818a61df9d34b15bad31698
5
5
  SHA512:
6
- metadata.gz: 266bf609aed5a29318bc686a262cebff45d8baf6bdf6eed09cc4a5b2279ad4d11278e7221f1c6fcf072d14545c08552aeb18066ae373eec9c443bd06414c1a4c
7
- data.tar.gz: af25de5487c71f06c76d4b057f9db51e248675f5d563ba44545b7e186fc213b9df75413b808fc9a5af8bcdd80bd3867272463fa522951068a928c2caddf1c134
6
+ metadata.gz: c7274be884f2c6f0f87a525300560dd8869796e7527ce4366d2d03b17537346692f77a892d2d2c4b3f96c1f12ff4e6c7359ba2a6ec795c2c00f8144a4bbac6c8
7
+ data.tar.gz: 3f804e9eab4c49689d7a5c9a5a0c0b19e56f176c88dcc5ed7262175d04c26ce75057beff2c72f69d53164f8ce427287befae60c6d7bccc62734833c7682c829e
data/bin/harmony CHANGED
@@ -2,6 +2,7 @@
2
2
  require 'net/ftp'
3
3
  require 'terrun'
4
4
  require 'timeout'
5
+ require 'fileutils'
5
6
 
6
7
  class Harmony < TerminalRunner
7
8
  name "Harmony"
@@ -19,6 +20,7 @@ class Harmony < TerminalRunner
19
20
  option "--auto", 0, "", "Start up auto mode automatically."
20
21
  option "--passive", 0, "", "Use FTP in passive mode."
21
22
  option "--vanilla_ftp", 0, "", "Use Vanilla ruby Net::FTP. Disables automatica directory creation."
23
+ option "--local", 0, "", "Use a local copy instead of an FTP transfer."
22
24
 
23
25
  help ""
24
26
 
@@ -40,6 +42,7 @@ class Harmony < TerminalRunner
40
42
  @compile_coffeescript = @@options.include?("--coffee") ? @@options["--coffee"][0] : nil
41
43
  @passive_mode = @@options.include?("--passive")
42
44
  @use_vanilla_ftp = @@options.include?("--vanilla_ftp")
45
+ @use_local = @@options.include?("--local")
43
46
  @ignored = []
44
47
 
45
48
  @compile_eco = nil
@@ -242,6 +245,9 @@ class Harmony < TerminalRunner
242
245
  if @use_vanilla_ftp
243
246
  puts "(Using Vanilla FTP)".pink
244
247
  @ftp = Net::FTP.new(@server, @user, @password)
248
+ elsif @use_local
249
+ puts "(Using Local non-FTP)".pink
250
+ @ftp = LocalCopyFTP.new
245
251
  else
246
252
  @ftp = BetterFTP.new(@server, @user, @password)
247
253
  end
@@ -293,6 +299,44 @@ class String
293
299
  end
294
300
  end
295
301
 
302
+ # Only performs a local copy, instead of using an FTP connection
303
+ class LocalCopyFTP
304
+ @dir = '/'
305
+
306
+ def mkdir_p(path)
307
+ FileUtils.mkdir_p path
308
+ end
309
+
310
+ def chdir(path)
311
+ @dir = path
312
+ end
313
+
314
+ def puttextfile(file)
315
+ FileUtils.cp file, @dir
316
+ end
317
+
318
+ def putbinaryfile(file)
319
+ puttextfile(file)
320
+ end
321
+
322
+ def connect(_host, _port=nil)
323
+ end
324
+
325
+ def passive=(_val)
326
+ end
327
+
328
+ def list
329
+ []
330
+ end
331
+
332
+ def closed?
333
+ false
334
+ end
335
+
336
+ def close
337
+ end
338
+ end
339
+
296
340
  require 'net/ftp'
297
341
 
298
342
  class BetterFTP < Net::FTP
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: loft-harmony
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.2
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Caleb Simpson