cloudfiles_cli 0.0.3 → 0.0.4
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.
data/lib/cloudfiles_cli/cli.rb
CHANGED
@@ -15,5 +15,13 @@ module CloudfilesCli
|
|
15
15
|
def upload(container, local_filename, remote_filename=nil)
|
16
16
|
Transactions.new(Config.new(options)).upload(container, local_filename, remote_filename || File.basename(local_filename))
|
17
17
|
end
|
18
|
+
|
19
|
+
desc "exists CONTAINER REMOTE_FILENAME", "Check if file exists"
|
20
|
+
option :username
|
21
|
+
option :api_key
|
22
|
+
option :auth_url
|
23
|
+
def exists(container, remote_filename)
|
24
|
+
Transactions.new(Config.new(options)).exists(container, remote_filename)
|
25
|
+
end
|
18
26
|
end
|
19
27
|
end
|
@@ -25,6 +25,12 @@ module CloudfilesCli
|
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
28
|
+
def exists(container_name, remotefile)
|
29
|
+
container(container_name).files.head(remotefile) ||
|
30
|
+
abort("#{remotefile} missing from #{container_name}")
|
31
|
+
puts("#{remotefile} found in #{container_name}")
|
32
|
+
end
|
33
|
+
|
28
34
|
def container(container_name)
|
29
35
|
connection.directories.get(container_name) ||
|
30
36
|
abort("Container #{container_name} not found on cloudfiles")
|