fog 0.3.15 → 0.3.16

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. data/Gemfile.lock +1 -1
  2. data/fog.gemspec +21 -11
  3. data/lib/fog.rb +1 -1
  4. data/lib/fog/core/collection.rb +1 -1
  5. data/lib/fog/rackspace/models/storage/files.rb +8 -8
  6. data/lib/fog/rackspace/requests/storage/get_object.rb +1 -1
  7. data/tests/aws/models/storage/directories_tests.rb +5 -0
  8. data/tests/aws/models/storage/directory_tests.rb +2 -6
  9. data/tests/aws/models/storage/file_tests.rb +5 -0
  10. data/tests/aws/models/storage/files_tests.rb +5 -0
  11. data/tests/google/models/storage/directories_tests.rb +5 -0
  12. data/tests/google/models/storage/directory_tests.rb +5 -0
  13. data/tests/google/models/storage/file_tests.rb +5 -0
  14. data/tests/google/models/storage/files_tests.rb +5 -0
  15. data/tests/helper.rb +10 -1
  16. data/tests/helpers/storage/directories_tests.rb +39 -0
  17. data/tests/helpers/storage/directory_tests.rb +24 -0
  18. data/tests/helpers/storage/file_tests.rb +32 -0
  19. data/tests/helpers/storage/files_tests.rb +47 -0
  20. data/tests/local/models/storage/directories_tests.rb +5 -0
  21. data/tests/local/models/storage/directory_tests.rb +5 -0
  22. data/tests/local/models/storage/file_tests.rb +5 -0
  23. data/tests/local/models/storage/files_tests.rb +5 -0
  24. data/tests/rackspace/models/storage/directories_tests.rb +5 -0
  25. data/tests/rackspace/models/storage/directory_tests.rb +5 -0
  26. data/tests/rackspace/models/storage/file_tests.rb +5 -0
  27. data/tests/rackspace/models/storage/files_tests.rb +5 -0
  28. metadata +22 -12
  29. data/spec/aws/models/storage/directories_spec.rb +0 -49
  30. data/spec/aws/models/storage/directory_spec.rb +0 -113
  31. data/spec/aws/models/storage/file_spec.rb +0 -121
  32. data/spec/aws/models/storage/files_spec.rb +0 -139
  33. data/spec/google/models/storage/directories_spec.rb +0 -49
  34. data/spec/google/models/storage/directory_spec.rb +0 -83
  35. data/spec/google/models/storage/file_spec.rb +0 -121
  36. data/spec/google/models/storage/files_spec.rb +0 -140
  37. data/tests/helpers/model_helper.rb +0 -72
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- fog (0.3.15)
4
+ fog (0.3.16)
5
5
  builder
6
6
  excon (>= 0.2.4)
7
7
  formatador (>= 0.0.15)
@@ -7,8 +7,8 @@ Gem::Specification.new do |s|
7
7
  ## If your rubyforge_project name is different, then edit it and comment out
8
8
  ## the sub! line in the Rakefile
9
9
  s.name = 'fog'
10
- s.version = '0.3.15'
11
- s.date = '2010-11-03'
10
+ s.version = '0.3.16'
11
+ s.date = '2010-11-04'
12
12
  s.rubyforge_project = 'fog'
13
13
 
14
14
  ## Make sure your summary is short. The description may be as long
@@ -579,10 +579,6 @@ Gem::Specification.new do |s|
579
579
  spec/aws/models/compute/snapshots_spec.rb
580
580
  spec/aws/models/compute/volume_spec.rb
581
581
  spec/aws/models/compute/volumes_spec.rb
582
- spec/aws/models/storage/directories_spec.rb
583
- spec/aws/models/storage/directory_spec.rb
584
- spec/aws/models/storage/file_spec.rb
585
- spec/aws/models/storage/files_spec.rb
586
582
  spec/aws/requests/simpledb/batch_put_attributes_spec.rb
587
583
  spec/aws/requests/simpledb/create_domain_spec.rb
588
584
  spec/aws/requests/simpledb/delete_attributes_spec.rb
@@ -596,10 +592,6 @@ Gem::Specification.new do |s|
596
592
  spec/bluebox/models/compute/server_spec.rb
597
593
  spec/bluebox/models/compute/servers_spec.rb
598
594
  spec/compact_progress_bar_formatter.rb
599
- spec/google/models/storage/directories_spec.rb
600
- spec/google/models/storage/directory_spec.rb
601
- spec/google/models/storage/file_spec.rb
602
- spec/google/models/storage/files_spec.rb
603
595
  spec/google/requests/storage/copy_object_spec.rb
604
596
  spec/google/requests/storage/delete_bucket_spec.rb
605
597
  spec/google/requests/storage/delete_object_spec.rb
@@ -665,7 +657,10 @@ Gem::Specification.new do |s|
665
657
  spec/vcloud/terremark/ecloud/requests/power_on_spec.rb
666
658
  spec/vcloud/vcloud_spec.rb
667
659
  tests/aws/helper.rb
660
+ tests/aws/models/storage/directories_tests.rb
668
661
  tests/aws/models/storage/directory_tests.rb
662
+ tests/aws/models/storage/file_tests.rb
663
+ tests/aws/models/storage/files_tests.rb
669
664
  tests/aws/requests/compute/address_tests.rb
670
665
  tests/aws/requests/compute/availability_zone_tests.rb
671
666
  tests/aws/requests/compute/image_tests.rb
@@ -684,16 +679,31 @@ Gem::Specification.new do |s|
684
679
  tests/bluebox/requests/compute/template_tests.rb
685
680
  tests/go_grid/helper.rb
686
681
  tests/go_grid/requests/compute/image_tests.rb
682
+ tests/google/models/storage/directories_tests.rb
683
+ tests/google/models/storage/directory_tests.rb
684
+ tests/google/models/storage/file_tests.rb
685
+ tests/google/models/storage/files_tests.rb
687
686
  tests/helper.rb
688
687
  tests/helper_tests.rb
689
- tests/helpers/model_helper.rb
688
+ tests/helpers/storage/directories_tests.rb
689
+ tests/helpers/storage/directory_tests.rb
690
+ tests/helpers/storage/file_tests.rb
691
+ tests/helpers/storage/files_tests.rb
690
692
  tests/linode/helper.rb
691
693
  tests/linode/requests/compute/datacenter_tests.rb
692
694
  tests/linode/requests/compute/distribution_tests.rb
693
695
  tests/linode/requests/compute/linode_tests.rb
694
696
  tests/linode/requests/compute/linodeplans_tests.rb
697
+ tests/local/models/storage/directories_tests.rb
698
+ tests/local/models/storage/directory_tests.rb
699
+ tests/local/models/storage/file_tests.rb
700
+ tests/local/models/storage/files_tests.rb
695
701
  tests/lorem.txt
696
702
  tests/rackspace/helper.rb
703
+ tests/rackspace/models/storage/directories_tests.rb
704
+ tests/rackspace/models/storage/directory_tests.rb
705
+ tests/rackspace/models/storage/file_tests.rb
706
+ tests/rackspace/models/storage/files_tests.rb
697
707
  tests/rackspace/requests/compute/address_tests.rb
698
708
  tests/rackspace/requests/compute/flavor_tests.rb
699
709
  tests/rackspace/requests/compute/image_tests.rb
data/lib/fog.rb CHANGED
@@ -18,7 +18,7 @@ module Fog
18
18
  @mocking = false
19
19
 
20
20
  unless const_defined?(:VERSION)
21
- VERSION = '0.3.15'
21
+ VERSION = '0.3.16'
22
22
  end
23
23
 
24
24
  module Mock
@@ -17,7 +17,7 @@ module Fog
17
17
 
18
18
  %w[reject select].each do |method|
19
19
  class_eval <<-RUBY
20
- remove_method :#{method}
20
+ # remove_method :#{method}
21
21
  def #{method}(*args)
22
22
  unless @loaded
23
23
  lazy_load
@@ -17,6 +17,12 @@ module Fog
17
17
 
18
18
  def all(options = {})
19
19
  requires :directory
20
+ options = {
21
+ 'limit' => @limit,
22
+ 'marker' => @marker,
23
+ 'path' => @path,
24
+ 'prefix' => @prefix
25
+ }.merge!(options)
20
26
  merge_attributes(options)
21
27
  parent = directory.collection.get(
22
28
  directory.key,
@@ -29,15 +35,9 @@ module Fog
29
35
  end
30
36
  end
31
37
 
32
- def get(key, options = {}, &block)
38
+ def get(key, &block)
33
39
  requires :directory
34
- options = {
35
- 'limit' => @limit,
36
- 'marker' => @marker,
37
- 'path' => @path,
38
- 'prefix' => @prefix
39
- }.merge!(options)
40
- data = connection.get_object(directory.name, key, options, &block)
40
+ data = connection.get_object(directory.key, key, &block)
41
41
  file_data = {
42
42
  :body => data.body,
43
43
  :key => key
@@ -23,7 +23,7 @@ module Fog
23
23
 
24
24
  class Mock
25
25
 
26
- def get_object(container, object)
26
+ def get_object(container, object, &block)
27
27
  Fog::Mock.not_implemented
28
28
  end
29
29
 
@@ -0,0 +1,5 @@
1
+ Shindo.tests('AWS::Storage | directories collection', ['aws']) do
2
+
3
+ directories_tests(AWS[:storage])
4
+
5
+ end
@@ -1,9 +1,5 @@
1
- Shindo.tests('AWS::Storage | directory models', ['aws']) do
1
+ Shindo.tests('AWS::Storage | directory model', ['aws']) do
2
2
 
3
- @collection = AWS[:storage].directories
4
- @model = @collection.new(:key => Time.now.to_f.to_s)
5
- @non_id = 'not_a_directory'
6
-
7
- tests_model
3
+ directory_tests(AWS[:storage])
8
4
 
9
5
  end
@@ -0,0 +1,5 @@
1
+ Shindo.tests('AWS::Storage | file model', ['aws']) do
2
+
3
+ file_tests(AWS[:storage])
4
+
5
+ end
@@ -0,0 +1,5 @@
1
+ Shindo.tests('AWS::Storage | files collection', ['aws']) do
2
+
3
+ files_tests(AWS[:storage])
4
+
5
+ end
@@ -0,0 +1,5 @@
1
+ Shindo.tests('Google::Storage | directories collection', ['google']) do
2
+
3
+ directories_tests(Google[:storage])
4
+
5
+ end
@@ -0,0 +1,5 @@
1
+ Shindo.tests('Google::Storage | directory model', ['google']) do
2
+
3
+ directory_tests(Google[:storage])
4
+
5
+ end
@@ -0,0 +1,5 @@
1
+ Shindo.tests('Google::Storage | file model', ['google']) do
2
+
3
+ file_tests(Google[:storage])
4
+
5
+ end
@@ -0,0 +1,5 @@
1
+ Shindo.tests('Google::Storage | files collection', ['google']) do
2
+
3
+ files_tests(Google[:storage])
4
+
5
+ end
@@ -2,7 +2,16 @@ require 'fog'
2
2
  require 'fog/core/bin'
3
3
  Fog.bin = true
4
4
 
5
- require File.expand_path(File.join(File.dirname(__FILE__), 'helpers', 'model_helper'))
5
+ __DIR__ = File.dirname(__FILE__)
6
+
7
+ $LOAD_PATH.unshift __DIR__ unless
8
+ $LOAD_PATH.include?(__DIR__) ||
9
+ $LOAD_PATH.include?(File.expand_path(__DIR__))
10
+
11
+ require 'tests/helpers/storage/directory_tests'
12
+ require 'tests/helpers/storage/directories_tests'
13
+ require 'tests/helpers/storage/file_tests'
14
+ require 'tests/helpers/storage/files_tests'
6
15
 
7
16
  if ENV["FOG_MOCK"] == "true"
8
17
  Fog.mock!
@@ -0,0 +1,39 @@
1
+ def directories_tests(connection, mocks_implemented = true)
2
+
3
+ tests('success') do
4
+
5
+ tests("#new(:key => 'fogdirectoriestests')").succeeds do
6
+ pending if Fog.mocking? && !mocks_implemented
7
+ @directory = connection.directories.new(:key => 'fogdirectoriestests')
8
+ end
9
+
10
+ tests("#create(:key => 'fogdirectoriestests')").succeeds do
11
+ pending if Fog.mocking? && !mocks_implemented
12
+ @directory = connection.directories.create(:key => 'fogdirectoriestests')
13
+ end
14
+
15
+ tests("#all").succeeds do
16
+ pending if Fog.mocking? && !mocks_implemented
17
+ connection.directories.all
18
+ end
19
+
20
+ tests("#get('fogdirectoriestests')").succeeds do
21
+ pending if Fog.mocking? && !mocks_implemented
22
+ connection.directories.get('fogdirectoriestests')
23
+ end
24
+
25
+ if !Fog.mocking? || mocks_implemented
26
+ @directory.destroy
27
+ end
28
+ end
29
+
30
+ tests('failure') do
31
+
32
+ tests("#get('fognondirectory')").returns(nil) do
33
+ pending if Fog.mocking? && !mocks_implemented
34
+ connection.directories.get('fognondirectory')
35
+ end
36
+
37
+ end
38
+
39
+ end
@@ -0,0 +1,24 @@
1
+ def directory_tests(connection, mocks_implemented = true)
2
+
3
+ tests('success') do
4
+
5
+ if !Fog.mocking? || mocks_implemented
6
+ @directory = connection.directories.new(:key => 'fogdirectorytests')
7
+ end
8
+
9
+ tests("#save").succeeds do
10
+ pending if Fog.mocking? && !mocks_implemented
11
+ @directory.save
12
+ end
13
+
14
+ tests("#destroy").succeeds do
15
+ pending if Fog.mocking? && !mocks_implemented
16
+ @directory.destroy
17
+ end
18
+
19
+ end
20
+
21
+ tests('failure') do
22
+ end
23
+
24
+ end
@@ -0,0 +1,32 @@
1
+ def file_tests(connection, mocks_implemented = true)
2
+
3
+ if !Fog.mocking? || mocks_implemented
4
+ @directory = connection.directories.create(:key => 'fogfilestests')
5
+ end
6
+
7
+ tests('success') do
8
+
9
+ if !Fog.mocking? || mocks_implemented
10
+ @file = @directory.files.new(:key => 'fog_file_tests', :body => lorem_file)
11
+ end
12
+
13
+ tests("#save").succeeds do
14
+ pending if Fog.mocking? && !mocks_implemented
15
+ @file.save
16
+ end
17
+
18
+ tests("#destroy").succeeds do
19
+ pending if Fog.mocking? && !mocks_implemented
20
+ @file.destroy
21
+ end
22
+
23
+ end
24
+
25
+ tests('failure') do
26
+ end
27
+
28
+ if !Fog.mocking? || mocks_implemented
29
+ @directory.destroy
30
+ end
31
+
32
+ end
@@ -0,0 +1,47 @@
1
+ def files_tests(connection, mocks_implemented = true)
2
+
3
+ if !Fog.mocking? || mocks_implemented
4
+ @directory = connection.directories.create(:key => 'fogfilestests')
5
+ end
6
+
7
+ tests('success') do
8
+
9
+ tests("#new(:key => 'fog_files_tests', :body => lorem_file)").succeeds do
10
+ pending if Fog.mocking? && !mocks_implemented
11
+ @directory.files.new(:key => 'fog_files_tests', :body => lorem_file)
12
+ end
13
+
14
+ tests("#create(:key => 'fog_files_tests', :body => lorem_file)").succeeds do
15
+ pending if Fog.mocking? && !mocks_implemented
16
+ @file = @directory.files.create(:key => 'fog_files_tests', :body => lorem_file)
17
+ end
18
+
19
+ tests("#all").succeeds do
20
+ pending if Fog.mocking? && !mocks_implemented
21
+ @directory.files.all
22
+ end
23
+
24
+ tests("#get('fog_files_tests')").succeeds do
25
+ pending if Fog.mocking? && !mocks_implemented
26
+ @directory.files.get('fog_files_tests')
27
+ end
28
+
29
+ if !Fog.mocking? || mocks_implemented
30
+ @file.destroy
31
+ end
32
+ end
33
+
34
+ tests('failure') do
35
+
36
+ tests("#get('fog_non_file')").returns(nil) do
37
+ pending if Fog.mocking? && !mocks_implemented
38
+ @directory.files.get('fog_non_file')
39
+ end
40
+
41
+ end
42
+
43
+ if !Fog.mocking? || mocks_implemented
44
+ @directory.destroy
45
+ end
46
+
47
+ end
@@ -0,0 +1,5 @@
1
+ Shindo.tests('Local::Storage | directories collection', ['local']) do
2
+
3
+ directories_tests(Local[:storage], false)
4
+
5
+ end
@@ -0,0 +1,5 @@
1
+ Shindo.tests('Local::Storage | directory model', ['local']) do
2
+
3
+ directory_tests(Local[:storage], false)
4
+
5
+ end
@@ -0,0 +1,5 @@
1
+ Shindo.tests('Local::Storage | file model', ['local']) do
2
+
3
+ file_tests(Local[:storage], false)
4
+
5
+ end
@@ -0,0 +1,5 @@
1
+ Shindo.tests('Local::Storage | files collection', ['local']) do
2
+
3
+ files_tests(Local[:storage], false)
4
+
5
+ end
@@ -0,0 +1,5 @@
1
+ Shindo.tests('Rackspace::Storage | directories collection', ['rackspace']) do
2
+
3
+ directories_tests(Rackspace[:storage], false)
4
+
5
+ end
@@ -0,0 +1,5 @@
1
+ Shindo.tests('Rackspace::Storage | directory model', ['rackspace']) do
2
+
3
+ directory_tests(Rackspace[:storage], false)
4
+
5
+ end
@@ -0,0 +1,5 @@
1
+ Shindo.tests('Rackspace::Storage | file model', ['rackspace']) do
2
+
3
+ file_tests(Rackspace[:storage], false)
4
+
5
+ end
@@ -0,0 +1,5 @@
1
+ Shindo.tests('Rackspace::Storage | files collection', ['rackspace']) do
2
+
3
+ files_tests(Rackspace[:storage], false)
4
+
5
+ end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 3
8
- - 15
9
- version: 0.3.15
8
+ - 16
9
+ version: 0.3.16
10
10
  platform: ruby
11
11
  authors:
12
12
  - geemus (Wesley Beary)
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-11-03 00:00:00 -07:00
17
+ date: 2010-11-04 00:00:00 -07:00
18
18
  default_executable: fog
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -686,10 +686,6 @@ files:
686
686
  - spec/aws/models/compute/snapshots_spec.rb
687
687
  - spec/aws/models/compute/volume_spec.rb
688
688
  - spec/aws/models/compute/volumes_spec.rb
689
- - spec/aws/models/storage/directories_spec.rb
690
- - spec/aws/models/storage/directory_spec.rb
691
- - spec/aws/models/storage/file_spec.rb
692
- - spec/aws/models/storage/files_spec.rb
693
689
  - spec/aws/requests/simpledb/batch_put_attributes_spec.rb
694
690
  - spec/aws/requests/simpledb/create_domain_spec.rb
695
691
  - spec/aws/requests/simpledb/delete_attributes_spec.rb
@@ -703,10 +699,6 @@ files:
703
699
  - spec/bluebox/models/compute/server_spec.rb
704
700
  - spec/bluebox/models/compute/servers_spec.rb
705
701
  - spec/compact_progress_bar_formatter.rb
706
- - spec/google/models/storage/directories_spec.rb
707
- - spec/google/models/storage/directory_spec.rb
708
- - spec/google/models/storage/file_spec.rb
709
- - spec/google/models/storage/files_spec.rb
710
702
  - spec/google/requests/storage/copy_object_spec.rb
711
703
  - spec/google/requests/storage/delete_bucket_spec.rb
712
704
  - spec/google/requests/storage/delete_object_spec.rb
@@ -772,7 +764,10 @@ files:
772
764
  - spec/vcloud/terremark/ecloud/requests/power_on_spec.rb
773
765
  - spec/vcloud/vcloud_spec.rb
774
766
  - tests/aws/helper.rb
767
+ - tests/aws/models/storage/directories_tests.rb
775
768
  - tests/aws/models/storage/directory_tests.rb
769
+ - tests/aws/models/storage/file_tests.rb
770
+ - tests/aws/models/storage/files_tests.rb
776
771
  - tests/aws/requests/compute/address_tests.rb
777
772
  - tests/aws/requests/compute/availability_zone_tests.rb
778
773
  - tests/aws/requests/compute/image_tests.rb
@@ -791,16 +786,31 @@ files:
791
786
  - tests/bluebox/requests/compute/template_tests.rb
792
787
  - tests/go_grid/helper.rb
793
788
  - tests/go_grid/requests/compute/image_tests.rb
789
+ - tests/google/models/storage/directories_tests.rb
790
+ - tests/google/models/storage/directory_tests.rb
791
+ - tests/google/models/storage/file_tests.rb
792
+ - tests/google/models/storage/files_tests.rb
794
793
  - tests/helper.rb
795
794
  - tests/helper_tests.rb
796
- - tests/helpers/model_helper.rb
795
+ - tests/helpers/storage/directories_tests.rb
796
+ - tests/helpers/storage/directory_tests.rb
797
+ - tests/helpers/storage/file_tests.rb
798
+ - tests/helpers/storage/files_tests.rb
797
799
  - tests/linode/helper.rb
798
800
  - tests/linode/requests/compute/datacenter_tests.rb
799
801
  - tests/linode/requests/compute/distribution_tests.rb
800
802
  - tests/linode/requests/compute/linode_tests.rb
801
803
  - tests/linode/requests/compute/linodeplans_tests.rb
804
+ - tests/local/models/storage/directories_tests.rb
805
+ - tests/local/models/storage/directory_tests.rb
806
+ - tests/local/models/storage/file_tests.rb
807
+ - tests/local/models/storage/files_tests.rb
802
808
  - tests/lorem.txt
803
809
  - tests/rackspace/helper.rb
810
+ - tests/rackspace/models/storage/directories_tests.rb
811
+ - tests/rackspace/models/storage/directory_tests.rb
812
+ - tests/rackspace/models/storage/file_tests.rb
813
+ - tests/rackspace/models/storage/files_tests.rb
804
814
  - tests/rackspace/requests/compute/address_tests.rb
805
815
  - tests/rackspace/requests/compute/flavor_tests.rb
806
816
  - tests/rackspace/requests/compute/image_tests.rb