fog-local 0.1.0 → 0.2.0

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: 7aa87f144c0161b011bf8b98de92dc71384bd116
4
- data.tar.gz: 2c12c547029f47e8f05b4e142c436da8baa557f9
3
+ metadata.gz: a95da8ab33a335e4bb68e9c3fdf3715a6aec3305
4
+ data.tar.gz: 4d93eee4372f1c7110dcfc6014a61c7cb08bb28b
5
5
  SHA512:
6
- metadata.gz: 5191d18d28bfaff0193029a1d098f1481369e0fedd2a8e103770d5c341070383887d4858a8c36b7218bd8f060f372dbf680745d96ca157522a049c28dc4591af
7
- data.tar.gz: 4396615bc48dac3976ffbcd26a85588868e7cb0d982befcbcc602f7707cd85e11e476faa772c45b440e31d07407f88e79a1fb91d917faff256364540cc098283
6
+ metadata.gz: e4d85e10b6ebe75cf458ccf0bda70b9f76e697d0befbe08f748d75ae4b561cf95d3163fa4b1231adbb0cf9acf73f05e7be0e95bf8534c309abd399cb05395e48
7
+ data.tar.gz: 6f7da030400de9f2de428e34ce487d1c79fa6bafdc3bbb9dc4bf588f21572ce62917d750f8252d7aa43146d6754604412166b89ec4f5cfc10c56674329763618
data/.travis.yml CHANGED
@@ -7,3 +7,6 @@ rvm:
7
7
  - 2.1.5
8
8
  - 2.2.0
9
9
  - jruby-19mode
10
+ env:
11
+ - FOG_MOCK=true
12
+ - FOG_MOCK=false
data/Rakefile CHANGED
@@ -2,7 +2,7 @@ require "bundler/gem_tasks"
2
2
 
3
3
  task :default => :test
4
4
 
5
- mock = ENV['FOG_MOCK'] || 'true'
5
+ mock = ENV['FOG_MOCK'] || 'false'
6
6
  task :test do
7
7
  sh("export FOG_MOCK=#{mock} && bundle exec shindont")
8
8
  end
data/lib/fog/local.rb CHANGED
@@ -1 +1,15 @@
1
- require 'fog/local/storage'
1
+ require 'fog/core'
2
+ require 'fileutils'
3
+ require File.expand_path('../local/version', __FILE__)
4
+
5
+ module Fog
6
+ module Storage
7
+ autoload :Local, File.expand_path('../storage/local', __FILE__)
8
+ end
9
+
10
+ module Local
11
+ extend Fog::Provider
12
+
13
+ service(:storage, 'Storage')
14
+ end
15
+ end
@@ -1,5 +1,5 @@
1
1
  module Fog
2
2
  module Local
3
- VERSION = '0.1.0'
3
+ VERSION = '0.2.0'
4
4
  end
5
5
  end
@@ -1,12 +1,15 @@
1
- require 'fog/local/core'
2
-
3
1
  module Fog
4
2
  module Storage
5
3
  class Local < Fog::Service
4
+ autoload :Directories, ::File.expand_path('../local/models/directories', __FILE__)
5
+ autoload :Directory, ::File.expand_path('../local/models/directory', __FILE__)
6
+ autoload :File, ::File.expand_path('../local/models/file', __FILE__)
7
+ autoload :Files, ::File.expand_path('../local/models/files', __FILE__)
8
+
6
9
  requires :local_root
7
10
  recognizes :endpoint, :scheme, :host, :port, :path
8
11
 
9
- model_path 'fog/local/models/storage'
12
+ model_path 'fog/storage/local/models'
10
13
  collection :directories
11
14
  model :directory
12
15
  model :file
@@ -77,7 +80,6 @@ module Fog
77
80
  end
78
81
 
79
82
  def copy_object(source_directory_name, source_object_name, target_directory_name, target_object_name, options={})
80
- require 'fileutils'
81
83
  source_path = path_to(::File.join(source_directory_name, source_object_name))
82
84
  target_path = path_to(::File.join(target_directory_name, target_object_name))
83
85
  ::FileUtils.mkdir_p(::File.dirname(target_path))
@@ -1,6 +1,3 @@
1
- require 'fog/core/collection'
2
- require 'fog/local/models/storage/directory'
3
-
4
1
  module Fog
5
2
  module Storage
6
3
  class Local
@@ -1,6 +1,3 @@
1
- require 'fog/core/model'
2
- require 'fog/local/models/storage/files'
3
-
4
1
  module Fog
5
2
  module Storage
6
3
  class Local
@@ -1,6 +1,3 @@
1
- require 'fileutils'
2
- require 'fog/core/model'
3
-
4
1
  module Fog
5
2
  module Storage
6
3
  class Local
@@ -1,6 +1,3 @@
1
- require 'fog/core/collection'
2
- require 'fog/local/models/storage/file'
3
-
4
1
  module Fog
5
2
  module Storage
6
3
  class Local
data/tests/helper.rb CHANGED
@@ -8,6 +8,7 @@ end
8
8
  require File.expand_path('../../lib/fog/local', __FILE__)
9
9
 
10
10
  Bundler.require(:test)
11
+ require 'tmpdir'
11
12
 
12
13
  Excon.defaults.merge!(:debug_request => true, :debug_response => true)
13
14
 
@@ -2,16 +2,17 @@ Shindo.tests('Storage[:local] | directories', ["local"]) do
2
2
 
3
3
  pending if Fog.mocking?
4
4
 
5
- @options = { :local_root => "/tmp/fogtests" }
5
+ @options = { :local_root => Dir.mktmpdir('fog-tests') }
6
6
  @collection = Fog::Storage::Local.new(@options).directories
7
7
 
8
8
  collection_tests(@collection, {:key => "fogdirtests"}, true)
9
9
 
10
10
  tests("#all") do
11
11
  tests("succeeds when :local_root does not exist").succeeds do
12
- FileUtils.rm_rf(@options[:local_root])
12
+ FileUtils.remove_entry_secure(@options[:local_root])
13
13
  @collection.all
14
14
  end
15
15
  end
16
16
 
17
+ FileUtils.remove_entry_secure(@options[:local_root]) if File.directory?(@options[:local_root])
17
18
  end
@@ -3,14 +3,18 @@ Shindo.tests('Storage[:local] | directory', ["local"]) do
3
3
  pending if Fog.mocking?
4
4
 
5
5
  before do
6
- @options = { :local_root => '~/.fog' }
6
+ @options = { :local_root => Dir.mktmpdir('fog-tests') }
7
+ end
8
+
9
+ after do
10
+ FileUtils.remove_entry_secure @options[:local_root]
7
11
  end
8
12
 
9
13
  tests('save') do
10
- returns(true) do
14
+ returns('directory') do
11
15
  connection = Fog::Storage::Local.new(@options)
12
16
  connection.directories.create(:key => 'directory')
13
- connection.directories.create(:key => 'directory')
17
+ connection.directories.create(:key => 'directory').key
14
18
  end
15
19
  end
16
20
  end
@@ -3,7 +3,11 @@ Shindo.tests('Storage[:local] | file', ["local"]) do
3
3
  pending if Fog.mocking?
4
4
 
5
5
  before do
6
- @options = { :local_root => '~/.fog' }
6
+ @options = { :local_root => Dir.mktmpdir('fog-tests') }
7
+ end
8
+
9
+ after do
10
+ FileUtils.remove_entry_secure @options[:local_root]
7
11
  end
8
12
 
9
13
  tests('#public_url') do
@@ -3,7 +3,11 @@ Shindo.tests('Local | storage') do
3
3
  pending if Fog.mocking?
4
4
 
5
5
  before do
6
- @options = { :local_root => "~/.fog" }
6
+ @options = { :local_root => Dir.mktmpdir('fog-tests') }
7
+ end
8
+
9
+ after do
10
+ FileUtils.remove_entry_secure @options[:local_root]
7
11
  end
8
12
 
9
13
  tests('#endpoint') do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fog-local
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Wesley Beary
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-02-19 00:00:00.000000000 Z
12
+ date: 2015-04-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -86,16 +86,14 @@ files:
86
86
  - README.md
87
87
  - Rakefile
88
88
  - fog-local.gemspec
89
- - lib/fog-local.rb
90
89
  - lib/fog/bin/local.rb
91
90
  - lib/fog/local.rb
92
- - lib/fog/local/core.rb
93
- - lib/fog/local/models/storage/directories.rb
94
- - lib/fog/local/models/storage/directory.rb
95
- - lib/fog/local/models/storage/file.rb
96
- - lib/fog/local/models/storage/files.rb
97
- - lib/fog/local/storage.rb
98
91
  - lib/fog/local/version.rb
92
+ - lib/fog/storage/local.rb
93
+ - lib/fog/storage/local/models/directories.rb
94
+ - lib/fog/storage/local/models/directory.rb
95
+ - lib/fog/storage/local/models/file.rb
96
+ - lib/fog/storage/local/models/files.rb
99
97
  - tests/helper.rb
100
98
  - tests/helpers/collection_helper.rb
101
99
  - tests/helpers/formats_helper.rb
data/lib/fog-local.rb DELETED
@@ -1 +0,0 @@
1
- require 'fog/local'
@@ -1,9 +0,0 @@
1
- require 'fog/core'
2
-
3
- module Fog
4
- module Local
5
- extend Fog::Provider
6
-
7
- service(:storage, 'Storage')
8
- end
9
- end