rubiojr-iorb 0.5.2 → 0.5.3
Sign up to get free protection for your applications and to get access to all the features.
- data/iorb.gemspec +1 -1
- data/lib/iorb.rb +4 -1
- data/lib/iorb/commands/info.rb +34 -5
- data/lib/iorb/commands/update.rb +1 -1
- metadata +1 -1
data/iorb.gemspec
CHANGED
data/lib/iorb.rb
CHANGED
@@ -15,7 +15,7 @@ class Dropio::Asset
|
|
15
15
|
end
|
16
16
|
end
|
17
17
|
module IORB
|
18
|
-
VERSION = "0.5.
|
18
|
+
VERSION = "0.5.3"
|
19
19
|
module Util
|
20
20
|
# Code stolen from:
|
21
21
|
# http://evan.tiggerpalace.com/2008/04/26/pastie-from-the-mac-clipboard/
|
@@ -79,6 +79,9 @@ module IORB
|
|
79
79
|
class DropDetails < Hash
|
80
80
|
|
81
81
|
def method_missing(id, *args)
|
82
|
+
if id.eql?(:admin_token) and self[id.to_s.gsub('_', '-')].nil?
|
83
|
+
return nil
|
84
|
+
end
|
82
85
|
self[id.to_s.gsub('_', '-')] || super
|
83
86
|
end
|
84
87
|
|
data/lib/iorb/commands/info.rb
CHANGED
@@ -1,18 +1,47 @@
|
|
1
1
|
command :info do |c|
|
2
2
|
c.description = 'display drop/asset info'
|
3
|
+
c.syntax = 'iorb info <drop_name>[:asset_name]'
|
3
4
|
c.when_called do |args, options|
|
4
5
|
if args.empty?
|
5
6
|
$stderr.puts 'Needs drop name as an argument.'
|
7
|
+
$stderr.puts c.syntax
|
6
8
|
else
|
7
9
|
begin
|
8
10
|
drop_name = args.first
|
11
|
+
if drop_name =~ /^\w+:.*/
|
12
|
+
drop_name, asset = drop_name.split(':')
|
13
|
+
end
|
9
14
|
details = IORB::DropManager.find(drop_name)
|
10
15
|
admin_token = nil
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
+
if details
|
17
|
+
admin_token = details.admin_token
|
18
|
+
end
|
19
|
+
drop = Drop.find(drop_name, admin_token)
|
20
|
+
if asset
|
21
|
+
assets = drop.assets
|
22
|
+
found = false
|
23
|
+
if assets.empty?
|
24
|
+
$stderr.puts "No assets in #{drop_name}"
|
25
|
+
abort
|
26
|
+
else
|
27
|
+
drop.assets.each do |a|
|
28
|
+
if a.name.eql? asset
|
29
|
+
found = true
|
30
|
+
puts a.class
|
31
|
+
puts "Name: #{a.name}"
|
32
|
+
puts "Hidden URL: #{a.hidden_url}"
|
33
|
+
puts "Type: #{a.type}"
|
34
|
+
puts "File size: #{a.filesize}"
|
35
|
+
puts "Created at: #{a.created_at}"
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
$stderr.puts "Asset #{asset} not found in #{drop_name}" if not found
|
40
|
+
else
|
41
|
+
details = IORB::DropDetails.build_from(drop)
|
42
|
+
details.save
|
43
|
+
details.print
|
44
|
+
end
|
16
45
|
rescue Dropio::MissingResourceError
|
17
46
|
$stderr.puts "Drop/Asset does not exist"
|
18
47
|
rescue Dropio::AuthorizationError
|
data/lib/iorb/commands/update.rb
CHANGED
@@ -8,7 +8,7 @@ command :update do |c|
|
|
8
8
|
c.option '--admin-password PASSWORD', String, 'Admin password to manage this drop (defaut: none)'
|
9
9
|
c.option '--password PASSWORD', String, 'Password to access this drop (defaut: none)'
|
10
10
|
c.option '--premium-code CODE', String, 'Premium code to apply to the drop (defaut: none)'
|
11
|
-
c.syntax = '
|
11
|
+
c.syntax = 'iorb update <drop_name> [options]'
|
12
12
|
c.when_called do |args, drop_options|
|
13
13
|
drop_name = args.first
|
14
14
|
if drop_name.nil?
|