droxi 0.4.0 → 0.4.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: ad346e735c5106bff58480298a50a5c296e15542
4
- data.tar.gz: f565510a170c8ad38066048d4cf7fe10bf09d51e
3
+ metadata.gz: e18e4d87aac63a2329521ad3914056e04e0050b4
4
+ data.tar.gz: da3104c02ce7a5c2ea86d68f4800563e7acc5d37
5
5
  SHA512:
6
- metadata.gz: d14ddec3bd6d7cb7bbd3ad82ece43f7f9cb3811868fa1ef82525fb3dcbf853aaecf30365c960ded970be82fbf26455d454a334e34c27a6b599b7eca50f56cbda
7
- data.tar.gz: 337b45f2741a59ac04422264ce0452abcd69e62eea9e2ee38dea7a97dca309fc56e14d4c90b62e2244c7ce11a4e36c82ed9b4541e2505e5ce8a8e5a49a54dcc1
6
+ metadata.gz: cbf92717523c05adac49d3b7f925bdfea903543697325d6b6468da7ca419e4bf59ee7fb575ab6c27c6fec593ccc711b9567f2eac3b503e2237e1d27292f748b5
7
+ data.tar.gz: 3442fecd04eb87b3c3afe40086ce4096f459fec58b3b7902426ea9d5c901e998f99998fe67054d32741edbd09c318d39cd2077f2a6fba5b7ead48de50d9adc9e
data/droxi.gemspec CHANGED
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'droxi'
3
3
  s.version = IO.read('lib/droxi.rb')[/VERSION = '(.+)'/, 1]
4
- s.date = '2015-05-31'
4
+ s.date = '2015-06-04'
5
5
  s.summary = 'An ftp-like command-line interface to Dropbox'
6
6
  s.description = "A command-line Dropbox interface based on GNU coreutils, \
7
7
  GNU ftp, and lftp. Features include smart tab completion, \
@@ -9,7 +9,7 @@ Gem::Specification.new do |s|
9
9
  s.authors = ['Brandon Mulcahy']
10
10
  s.email = 'brandon@jangler.info'
11
11
  s.files = `git ls-files`.split
12
- s.homepage = 'https://github.com/jangler/droxi'
12
+ s.homepage = 'http://jangler.info/code/droxi'
13
13
  s.license = 'MIT'
14
14
 
15
15
  s.executables << 'droxi'
@@ -415,7 +415,7 @@ module Commands
415
415
  warn "put: #{arg}: no such file or directory" if array.empty?
416
416
  array.map { |path| path.sub(File.dirname(path), File.dirname(arg)) }
417
417
  end
418
- args = args.reduce(:+)
418
+ args = args.reduce(:+) unless args.empty? # avoid making args nil
419
419
 
420
420
  args.each do |arg|
421
421
  to_path = state.resolve_path(File.basename(arg))
data/lib/droxi.rb CHANGED
@@ -17,7 +17,7 @@ require_relative 'droxi/text'
17
17
  # Command-line Dropbox client module.
18
18
  module Droxi
19
19
  # Version number of the program.
20
- VERSION = '0.4.0'
20
+ VERSION = '0.4.1'
21
21
 
22
22
  # Message to display when invoked with the --help option.
23
23
  HELP_TEXT = [
@@ -33,17 +33,17 @@ module Droxi
33
33
  reenter = ARGV[0] == 'REENTER'
34
34
  ARGV.delete_if { |arg| arg == 'REENTER' }
35
35
  original_argv = ARGV.dup
36
- options = handle_options
36
+ options, args = handle_options
37
37
  Settings.init
38
38
 
39
39
  client = DropboxClient.new(access_token)
40
- state = State.new(client, ARGV.empty?, original_argv)
40
+ state = State.new(client, args.empty?, original_argv)
41
41
  state.debug_enabled = options[:debug]
42
42
 
43
- if ARGV.empty?
43
+ if args.empty?
44
44
  run_interactive(client, state, reenter)
45
45
  else
46
- invoke(ARGV, client, state)
46
+ invoke(args, client, state)
47
47
  end
48
48
  rescue DropboxAuthError => error
49
49
  warn error
@@ -54,7 +54,8 @@ module Droxi
54
54
 
55
55
  private
56
56
 
57
- # Handles command-line options and returns a +Hash+ of the extracted options.
57
+ # Handles command-line options and returns a +Hash+ of the extracted options,
58
+ # and an +Array+ of the remaining arguments.
58
59
  def self.handle_options
59
60
  options = { debug: false }
60
61
 
@@ -87,13 +88,15 @@ module Droxi
87
88
  end
88
89
 
89
90
  begin
90
- parser.parse!
91
+ global_opts = ARGV.take_while { |arg| !Commands::NAMES.include?(arg) }
92
+ num_opts = global_opts.size
93
+ parser.parse!(global_opts)
91
94
  rescue OptionParser::ParseError => err
92
95
  warn(err)
93
96
  exit(1)
94
97
  end
95
98
 
96
- options
99
+ [options, global_opts + ARGV.drop(num_opts)]
97
100
  end
98
101
 
99
102
  # Invokes a single command formed by joining an +Array+ of +String+ args.
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: droxi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brandon Mulcahy
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-31 00:00:00.000000000 Z
11
+ date: 2015-06-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dropbox-sdk
@@ -58,7 +58,7 @@ files:
58
58
  - spec/state_spec.rb
59
59
  - spec/testutils.rb
60
60
  - spec/text_spec.rb
61
- homepage: https://github.com/jangler/droxi
61
+ homepage: http://jangler.info/code/droxi
62
62
  licenses:
63
63
  - MIT
64
64
  metadata: {}