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.
@@ -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")
@@ -1,3 +1,3 @@
1
1
  module CloudfilesCli
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cloudfiles_cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: