fog-local 0.4.0 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 2f8d4c17d2d000539b8dad9be95d8495556d6868
4
- data.tar.gz: 22616d1b9f12d284cdd10e396ce87596c14082e1
2
+ SHA256:
3
+ metadata.gz: e7569fa5ae2ee41c45358a28ddb0400a7b9f3224ecda75e03493bd7db059f308
4
+ data.tar.gz: 37b5d624939ad7da579bef36f4751ecb74fb829aeade62f6b41b2fdc12f20ced
5
5
  SHA512:
6
- metadata.gz: e18eadc38367b13c82ce00b4fac8b8619d877417f8f976f9a2ff755eb33bf30e15c27f2327ba408532ed73acf700aa2dda6012de7cf0dfd9fee8b025f2b52f1c
7
- data.tar.gz: f89a42302dc3b2806d9e0f773f62a6bd64219d3df4e728ed7fc451590734e4bd8a31b9e9c8f9d671b0ea0c903093138c43db4e5f363f70db51642e705fbe83ec
6
+ metadata.gz: 2d15633fba2df0006079c9e6e1c51eb72862561b29d57f051045996b754e8378ad24e1d2f100132dcd2063b5bc18baceffafb68162638894584fc2dbfb47c619
7
+ data.tar.gz: ed7462cf6ce37d131afa6406bfbb87db8394c573a1fb45dc496420cdbcf2dacc6aee01cc10f54e10ad819ee71a9d63a1f69a82960c5b55b42ab40ae50c073b12
@@ -0,0 +1,10 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: "bundler"
4
+ directory: "/"
5
+ schedule:
6
+ interval: "daily"
7
+ - package-ecosystem: "github-actions"
8
+ directory: "/"
9
+ schedule:
10
+ interval: "daily"
@@ -0,0 +1,34 @@
1
+ # This workflow uses actions that are not certified by GitHub.
2
+ # They are provided by a third-party and are governed by
3
+ # separate terms of service, privacy policy, and support
4
+ # documentation.
5
+ # This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
6
+ # For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
7
+
8
+ name: Ruby
9
+
10
+ on:
11
+ push:
12
+ branches: [ master ]
13
+ pull_request:
14
+ branches: [ master ]
15
+
16
+ jobs:
17
+ test:
18
+
19
+ runs-on: ubuntu-latest
20
+ strategy:
21
+ matrix:
22
+ ruby-version: ['2.5', '2.6', '2.7', '3.0', 'head']
23
+
24
+ steps:
25
+ - uses: actions/checkout@v2
26
+ - name: Set up Ruby
27
+ uses: ruby/setup-ruby@v1
28
+ with:
29
+ ruby-version: ${{ matrix.ruby-version }}
30
+ bundler-cache: true # runs 'bundle install' and caches installed gems automatically
31
+ - name: Install dependencies
32
+ run: bundle install
33
+ - name: Run tests
34
+ run: bundle exec rake
@@ -0,0 +1,23 @@
1
+ name: Mark stale issues and pull requests
2
+
3
+ on:
4
+ schedule:
5
+ - cron: "30 1 * * *"
6
+
7
+ jobs:
8
+ stale:
9
+
10
+ runs-on: ubuntu-latest
11
+
12
+ steps:
13
+ - uses: actions/stale@v3
14
+ with:
15
+ repo-token: ${{ secrets.GITHUB_TOKEN }}
16
+ days-before-stale: 60
17
+ days-before-close: 7
18
+ exempt-issue-labels: 'pinned,security'
19
+ exempt-pr-labels: 'pinned,security'
20
+ stale-issue-message: 'This issue has been marked inactive and will be closed if no further activity occurs.'
21
+ stale-pr-message: 'This pr has been marked inactive and will be closed if no further activity occurs.'
22
+ stale-issue-label: 'no-issue-activity'
23
+ stale-pr-label: 'no-pr-activity'
data/CONTRIBUTORS.md CHANGED
@@ -16,3 +16,4 @@
16
16
  * James Herdman <james.herdman@me.com>
17
17
  * Adam Tanner <adam@adamtanner.org>
18
18
  * Mark Yen <marky@activestate.com>
19
+ * Kevin Deisz <kevin.deisz@gmail.com>
data/README.md CHANGED
@@ -22,27 +22,22 @@ Or install it yourself as:
22
22
 
23
23
  ## Usage
24
24
 
25
- Initialise a `Fog::Storage` object using local provider
25
+ Initialise a `Fog::Local::Storage` object:
26
26
 
27
27
  ```ruby
28
-
29
- storage = Fog::Storage.new({
30
- :local_root => '~/fog',
31
- :provider => 'Local'
32
- })
33
-
28
+ storage = Fog::Local::Storage.new(local_root: '~/fog')
34
29
  ```
35
30
 
36
31
  This can then be used like any other [Fog storage](http://fog.io/storage/).
37
32
 
38
33
  ```ruby
39
- directory = storage.directories.create(:key => 'data')
40
- directory.files.create(:body => 'Hello World!', :key => 'hello_world.txt')
34
+ directory = storage.directories.create(key: 'data')
35
+ directory.files.create(body: 'Hello World!', key: 'hello_world.txt')
41
36
  ```
42
37
 
43
38
  ## Contributing
44
39
 
45
- 1. Fork it ( https://github.com/fog/fog-local/fork )
40
+ 1. Fork it ( https://github.com/fog/fog-local/fork)
46
41
  2. Create your feature branch (`git checkout -b my-new-feature`)
47
42
  3. Commit your changes (`git commit -am 'Add some feature'`)
48
43
  4. Push to the branch (`git push origin my-new-feature`)
data/fog-local.gemspec CHANGED
@@ -19,9 +19,9 @@ Gem::Specification.new do |spec|
19
19
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
20
  spec.require_paths = ["lib"]
21
21
 
22
- spec.add_development_dependency 'bundler', '~> 1.7'
23
- spec.add_development_dependency 'rake', '~> 10.0'
22
+ spec.add_development_dependency 'bundler'
23
+ spec.add_development_dependency 'rake', '>= 12.3.3'
24
24
  spec.add_development_dependency 'shindo', '~> 0.3'
25
25
 
26
- spec.add_dependency 'fog-core', '~> 1.27'
26
+ spec.add_dependency 'fog-core', '>= 1.27', '< 3.0'
27
27
  end
data/lib/fog/bin/local.rb CHANGED
@@ -3,7 +3,7 @@ class Local < Fog::Bin
3
3
  def class_for(key)
4
4
  case key
5
5
  when :storage
6
- Fog::Storage::Local
6
+ Fog::Local::Storage
7
7
  else
8
8
  raise ArgumentError, "Unsupported #{self} service: #{key}"
9
9
  end
@@ -14,7 +14,7 @@ class Local < Fog::Bin
14
14
  hash[key] = case key
15
15
  when :storage
16
16
  Fog::Logger.warning("Local[:storage] is not recommended, use Storage[:local] for portability")
17
- Fog::Storage.new(:provider => 'Local')
17
+ Fog::Local::Storage.new
18
18
  else
19
19
  raise ArgumentError, "Unrecognized service: #{key.inspect}"
20
20
  end
@@ -1,8 +1,8 @@
1
1
  module Fog
2
- module Storage
3
- class Local
2
+ module Local
3
+ class Storage
4
4
  class Directories < Fog::Collection
5
- model Fog::Storage::Local::Directory
5
+ model Directory
6
6
 
7
7
  def all
8
8
  data = if ::File.directory?(service.local_root)
@@ -22,6 +22,7 @@ module Fog
22
22
  end
23
23
 
24
24
  private
25
+
25
26
  def create_directory(key, options)
26
27
  options[:path] ? new(key: key + options[:path]) : new(key: key)
27
28
  end
@@ -1,6 +1,6 @@
1
1
  module Fog
2
- module Storage
3
- class Local
2
+ module Local
3
+ class Storage
4
4
  class Directory < Fog::Model
5
5
  identity :key
6
6
 
@@ -16,12 +16,7 @@ module Fog
16
16
  end
17
17
 
18
18
  def files
19
- @files ||= begin
20
- Fog::Storage::Local::Files.new(
21
- :directory => self,
22
- :service => service
23
- )
24
- end
19
+ @files ||= Files.new(directory: self, service: service)
25
20
  end
26
21
 
27
22
  def public=(new_public)
@@ -1,6 +1,6 @@
1
1
  module Fog
2
- module Storage
3
- class Local
2
+ module Local
3
+ class Storage
4
4
  class File < Fog::Model
5
5
  identity :key, :aliases => 'Key'
6
6
 
@@ -54,14 +54,7 @@ module Fog
54
54
  if dir_path == service.path_to(directory.key)
55
55
  break
56
56
  end
57
- pwd = Dir.pwd
58
- if ::File.directory?(dir_path)
59
- Dir.chdir(dir_path)
60
- if Dir.glob('*').empty?
61
- Dir.rmdir(dir_path)
62
- end
63
- Dir.chdir(pwd)
64
- end
57
+ rm_if_empty_dir(dir_path)
65
58
  end
66
59
  true
67
60
  end
@@ -74,8 +67,8 @@ module Fog
74
67
  requires :directory, :key
75
68
 
76
69
  if service.endpoint
77
- escaped_directory = URI.escape(directory.key)
78
- escaped_key = URI.escape(key)
70
+ escaped_directory = uri_escape(directory.key)
71
+ escaped_key = uri_escape(key)
79
72
 
80
73
  ::File.join(service.endpoint, escaped_directory, escaped_key)
81
74
  else
@@ -113,6 +106,12 @@ module Fog
113
106
  @directory = new_directory
114
107
  end
115
108
 
109
+ def uri_escape(string)
110
+ string.b.gsub(URI::DEFAULT_PARSER.regexp[:UNSAFE]) do |m|
111
+ '%' + m.unpack('H2' * m.bytesize).join('%').upcase
112
+ end
113
+ end
114
+
116
115
  def path
117
116
  service.path_to(::File.join(directory.key, key))
118
117
  end
@@ -125,6 +124,22 @@ module Fog
125
124
  IO.copy_stream(input_io, file)
126
125
  end
127
126
  end
127
+
128
+ def rm_if_empty_dir(dir_path)
129
+ if ::File.directory?(dir_path)
130
+ Dir.rmdir(dir_path) if dir_empty?(dir_path)
131
+ end
132
+ end
133
+
134
+ def dir_empty?(dir_path)
135
+ # NOTE: There’s Dir.empty?, but it is only available on Ruby 2.4+
136
+
137
+ # NOTE: `entries` will be empty on Windows, and contain . and .. on
138
+ # unix-like systems (macOS, Linux, BSD, …)
139
+
140
+ entries = Dir.entries(dir_path)
141
+ entries.empty? || entries.all? { |e| ['.', '..'].include?(e) }
142
+ end
128
143
  end
129
144
  end
130
145
  end
@@ -1,10 +1,10 @@
1
1
  module Fog
2
- module Storage
3
- class Local
2
+ module Local
3
+ class Storage
4
4
  class Files < Fog::Collection
5
5
  attribute :directory
6
6
 
7
- model Fog::Storage::Local::File
7
+ model File
8
8
 
9
9
  def all
10
10
  requires :directory
@@ -71,6 +71,10 @@ module Fog
71
71
  super({ :directory => directory }.merge!(attributes))
72
72
  end
73
73
 
74
+ def is_truncated
75
+ false
76
+ end
77
+
74
78
  private
75
79
 
76
80
  def file_path(key)
@@ -1 +1,98 @@
1
- # This file was intentionally left blank
1
+ module Fog
2
+ module Local
3
+ class Storage < Fog::Service
4
+ autoload :Directories, 'fog/local/models/directories'
5
+ autoload :Directory, 'fog/local/models/directory'
6
+ autoload :File, 'fog/local/models/file'
7
+ autoload :Files, 'fog/local/models/files'
8
+
9
+ requires :local_root
10
+ recognizes :endpoint, :scheme, :host, :port, :path
11
+
12
+ model_path 'fog/local/models'
13
+ collection :directories
14
+ model :directory
15
+ model :file
16
+ collection :files
17
+
18
+ require 'uri'
19
+
20
+ class Mock
21
+ attr_reader :endpoint
22
+
23
+ def self.data
24
+ @data ||= Hash.new do |hash, key|
25
+ hash[key] = {}
26
+ end
27
+ end
28
+
29
+ def self.reset
30
+ @data = nil
31
+ end
32
+
33
+ def initialize(options={})
34
+ Fog::Mock.not_implemented
35
+
36
+ @local_root = ::File.expand_path(options[:local_root])
37
+
38
+ @endpoint = options[:endpoint] || build_endpoint_from_options(options)
39
+ end
40
+
41
+ def data
42
+ self.class.data[@local_root]
43
+ end
44
+
45
+ def local_root
46
+ @local_root
47
+ end
48
+
49
+ def path_to(partial)
50
+ ::File.join(@local_root, partial)
51
+ end
52
+
53
+ def reset_data
54
+ self.class.data.delete(@local_root)
55
+ end
56
+
57
+ private
58
+ def build_endpoint_from_options(options)
59
+ return unless options[:host]
60
+
61
+ URI::Generic.build(options).to_s
62
+ end
63
+ end
64
+
65
+ class Real
66
+ attr_reader :endpoint
67
+
68
+ def initialize(options={})
69
+ @local_root = ::File.expand_path(options[:local_root])
70
+
71
+ @endpoint = options[:endpoint] || build_endpoint_from_options(options)
72
+ end
73
+
74
+ def local_root
75
+ @local_root
76
+ end
77
+
78
+ def path_to(partial)
79
+ ::File.join(@local_root, partial)
80
+ end
81
+
82
+ def copy_object(source_directory_name, source_object_name, target_directory_name, target_object_name, options={})
83
+ source_path = path_to(::File.join(source_directory_name, source_object_name))
84
+ target_path = path_to(::File.join(target_directory_name, target_object_name))
85
+ ::FileUtils.mkdir_p(::File.dirname(target_path))
86
+ ::FileUtils.copy_file(source_path, target_path)
87
+ end
88
+
89
+ private
90
+ def build_endpoint_from_options(options)
91
+ return unless options[:host]
92
+
93
+ URI::Generic.build(options).to_s
94
+ end
95
+ end
96
+ end
97
+ end
98
+ end
@@ -1,5 +1,5 @@
1
1
  module Fog
2
2
  module Local
3
- VERSION = '0.4.0'
3
+ VERSION = '0.8.0'
4
4
  end
5
5
  end
data/lib/fog/local.rb CHANGED
@@ -1,16 +1,16 @@
1
1
  require 'fog/core'
2
2
  require 'fileutils'
3
3
  require 'tempfile'
4
- require File.expand_path('../local/version', __FILE__)
5
4
 
6
- module Fog
7
- module Storage
8
- autoload :Local, File.expand_path('../storage/local', __FILE__)
9
- end
5
+ require 'fog/local/version'
10
6
 
7
+ module Fog
11
8
  module Local
12
- extend Fog::Provider
9
+ extend Provider
13
10
 
14
- service(:storage, 'Storage')
11
+ autoload :Storage, 'fog/local/storage'
12
+ service :storage, :Storage
15
13
  end
16
14
  end
15
+
16
+ Fog::Storage::Local = Fog::Local::Storage # legacy compat
data/tests/helper.rb CHANGED
@@ -5,7 +5,8 @@ rescue LoadError => e
5
5
  $stderr.puts "not recording test coverage: #{e.inspect}"
6
6
  end
7
7
 
8
- require File.expand_path('../../lib/fog/local', __FILE__)
8
+ $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
9
+ require 'fog/local'
9
10
 
10
11
  Bundler.require(:test)
11
12
  require 'tmpdir'
@@ -1,8 +1,8 @@
1
1
  module Shindo
2
2
  class Tests
3
- def succeeds
3
+ def succeeds(&block)
4
4
  test('succeeds') do
5
- !!instance_eval(&Proc.new)
5
+ !!instance_eval(&block)
6
6
  end
7
7
  end
8
8
  end
@@ -3,7 +3,7 @@ Shindo.tests('Storage[:local] | directories', ["local"]) do
3
3
  pending if Fog.mocking?
4
4
 
5
5
  @options = { :local_root => Dir.mktmpdir('fog-tests') }
6
- @collection = Fog::Storage::Local.new(@options).directories
6
+ @collection = Fog::Local::Storage.new(@options).directories
7
7
 
8
8
  collection_tests(@collection, {:key => "fogdirtests"}, true)
9
9
 
@@ -12,7 +12,7 @@ Shindo.tests('Storage[:local] | directory', ["local"]) do
12
12
 
13
13
  tests('save') do
14
14
  returns('directory') do
15
- connection = Fog::Storage::Local.new(@options)
15
+ connection = Fog::Local::Storage.new(@options)
16
16
  connection.directories.create(:key => 'directory')
17
17
  connection.directories.create(:key => 'directory').key
18
18
  end
@@ -15,7 +15,7 @@ Shindo.tests('Storage[:local] | file', ["local"]) do
15
15
  returns('http://example.com/files/directory/file.txt') do
16
16
  @options[:endpoint] = 'http://example.com/files'
17
17
 
18
- connection = Fog::Storage::Local.new(@options)
18
+ connection = Fog::Local::Storage.new(@options)
19
19
  directory = connection.directories.new(:key => 'directory')
20
20
  file = directory.files.new(:key => 'file.txt')
21
21
 
@@ -26,7 +26,7 @@ Shindo.tests('Storage[:local] | file', ["local"]) do
26
26
  returns(nil) do
27
27
  @options[:endpoint] = nil
28
28
 
29
- connection = Fog::Storage::Local.new(@options)
29
+ connection = Fog::Local::Storage.new(@options)
30
30
  directory = connection.directories.new(:key => 'directory')
31
31
  file = directory.files.new(:key => 'file.txt')
32
32
 
@@ -37,10 +37,21 @@ Shindo.tests('Storage[:local] | file', ["local"]) do
37
37
  returns('http://example.com/files/my%20directory/my%20file.txt') do
38
38
  @options[:endpoint] = 'http://example.com/files'
39
39
 
40
- connection = Fog::Storage::Local.new(@options)
40
+ connection = Fog::Local::Storage.new(@options)
41
41
  directory = connection.directories.new(:key => 'my directory')
42
42
  file = directory.files.new(:key => 'my file.txt')
43
43
 
44
+ file.public_url
45
+ end
46
+
47
+ tests('when key has safe characters').
48
+ returns('http://example.com/files/my/directory/my/file.txt') do
49
+ @options[:endpoint] = 'http://example.com/files'
50
+
51
+ connection = Fog::Local::Storage.new(@options)
52
+ directory = connection.directories.new(:key => 'my/directory')
53
+ file = directory.files.new(:key => 'my/file.txt')
54
+
44
55
  file.public_url
45
56
  end
46
57
  end
@@ -48,7 +59,7 @@ Shindo.tests('Storage[:local] | file', ["local"]) do
48
59
  tests('#save') do
49
60
  tests('creates non-existent subdirs') do
50
61
  returns(true) do
51
- connection = Fog::Storage::Local.new(@options)
62
+ connection = Fog::Local::Storage.new(@options)
52
63
  directory = connection.directories.new(:key => 'path1')
53
64
  file = directory.files.new(:key => 'path2/file.rb', :body => "my contents")
54
65
  file.save
@@ -57,7 +68,7 @@ Shindo.tests('Storage[:local] | file', ["local"]) do
57
68
  end
58
69
 
59
70
  tests('with tempfile').returns('tempfile') do
60
- connection = Fog::Storage::Local.new(@options)
71
+ connection = Fog::Local::Storage.new(@options)
61
72
  directory = connection.directories.create(:key => 'directory')
62
73
 
63
74
  tempfile = Tempfile.new(['file', '.txt'])
@@ -76,4 +87,69 @@ Shindo.tests('Storage[:local] | file', ["local"]) do
76
87
  directory.files.get('tempfile.txt').body
77
88
  end
78
89
  end
90
+
91
+ tests('#destroy') do
92
+ # - removes dir if it contains no files
93
+ # - keeps dir if it contains non-hidden files
94
+ # - keeps dir if it contains hidden files
95
+ # - stays in the same directory
96
+
97
+ tests('removes enclosing dir if it is empty') do
98
+ returns(false) do
99
+ connection = Fog::Local::Storage.new(@options)
100
+ directory = connection.directories.new(:key => 'path1')
101
+
102
+ file = directory.files.new(:key => 'path2/file.rb', :body => "my contents")
103
+ file.save
104
+ file.destroy
105
+
106
+ File.exists?(@options[:local_root] + "/path1/path2")
107
+ end
108
+ end
109
+
110
+ tests('keeps enclosing dir if it is not empty') do
111
+ returns(true) do
112
+ connection = Fog::Local::Storage.new(@options)
113
+ directory = connection.directories.new(:key => 'path1')
114
+
115
+ file = directory.files.new(:key => 'path2/file.rb', :body => "my contents")
116
+ file.save
117
+
118
+ file = directory.files.new(:key => 'path2/file2.rb', :body => "my contents")
119
+ file.save
120
+ file.destroy
121
+
122
+ File.exists?(@options[:local_root] + "/path1/path2")
123
+ end
124
+ end
125
+
126
+ tests('keeps enclosing dir if contains only hidden files') do
127
+ returns(true) do
128
+ connection = Fog::Local::Storage.new(@options)
129
+ directory = connection.directories.new(:key => 'path1')
130
+
131
+ file = directory.files.new(:key => 'path2/.file.rb', :body => "my contents")
132
+ file.save
133
+
134
+ file = directory.files.new(:key => 'path2/.file2.rb', :body => "my contents")
135
+ file.save
136
+ file.destroy
137
+
138
+ File.exists?(@options[:local_root] + "/path1/path2")
139
+ end
140
+ end
141
+
142
+ tests('it stays in the same directory') do
143
+ returns(Dir.pwd) do
144
+ connection = Fog::Local::Storage.new(@options)
145
+ directory = connection.directories.new(:key => 'path1')
146
+
147
+ file = directory.files.new(:key => 'path2/file2.rb', :body => "my contents")
148
+ file.save
149
+ file.destroy
150
+
151
+ Dir.pwd
152
+ end
153
+ end
154
+ end
79
155
  end
@@ -0,0 +1,21 @@
1
+ Shindo.tests('Storage[:local] | files', ["local"]) do
2
+
3
+ pending if Fog.mocking?
4
+
5
+ before do
6
+ @options = { :local_root => Dir.mktmpdir('fog-tests') }
7
+ end
8
+
9
+ after do
10
+ FileUtils.remove_entry_secure(@options[:local_root]) if File.directory?(@options[:local_root])
11
+ end
12
+
13
+ tests("#is_truncated") do
14
+ returns(false) do
15
+ connection = Fog::Local::Storage.new(@options)
16
+ directory = connection.directories.create(:key => 'directory')
17
+ collection = directory.files
18
+ collection.is_truncated
19
+ end
20
+ end
21
+ end
@@ -13,7 +13,7 @@ Shindo.tests('Local | storage') do
13
13
  tests('#endpoint') do
14
14
  tests('when no endpoint is provided').
15
15
  returns(nil) do
16
- Fog::Storage::Local.new(@options).endpoint
16
+ Fog::Local::Storage.new(@options).endpoint
17
17
  end
18
18
 
19
19
  tests('when no host is provided').
@@ -22,14 +22,14 @@ Shindo.tests('Local | storage') do
22
22
  @options[:path] = '/files'
23
23
  @options[:port] = 80
24
24
 
25
- Fog::Storage::Local.new(@options).endpoint
25
+ Fog::Local::Storage.new(@options).endpoint
26
26
  end
27
27
 
28
28
  tests('when endpoint is provided').
29
29
  returns('http://example.com/files') do
30
30
  @options[:endpoint] = 'http://example.com/files'
31
31
 
32
- Fog::Storage::Local.new(@options).endpoint
32
+ Fog::Local::Storage.new(@options).endpoint
33
33
  end
34
34
 
35
35
  tests('when at least host option is provided').
@@ -38,7 +38,7 @@ Shindo.tests('Local | storage') do
38
38
  @options[:host] = 'example.com'
39
39
  @options[:path] = '/files'
40
40
 
41
- Fog::Storage::Local.new(@options).endpoint
41
+ Fog::Local::Storage.new(@options).endpoint
42
42
  end
43
43
  end
44
44
  end
metadata CHANGED
@@ -1,44 +1,44 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fog-local
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Wesley Beary
8
8
  - Ville Lautanala
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-09-04 00:00:00.000000000 Z
12
+ date: 2022-01-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - "~>"
18
+ - - ">="
19
19
  - !ruby/object:Gem::Version
20
- version: '1.7'
20
+ version: '0'
21
21
  type: :development
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
- - - "~>"
25
+ - - ">="
26
26
  - !ruby/object:Gem::Version
27
- version: '1.7'
27
+ version: '0'
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: rake
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
- - - "~>"
32
+ - - ">="
33
33
  - !ruby/object:Gem::Version
34
- version: '10.0'
34
+ version: 12.3.3
35
35
  type: :development
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
- - - "~>"
39
+ - - ">="
40
40
  - !ruby/object:Gem::Version
41
- version: '10.0'
41
+ version: 12.3.3
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: shindo
44
44
  requirement: !ruby/object:Gem::Requirement
@@ -57,16 +57,22 @@ dependencies:
57
57
  name: fog-core
58
58
  requirement: !ruby/object:Gem::Requirement
59
59
  requirements:
60
- - - "~>"
60
+ - - ">="
61
61
  - !ruby/object:Gem::Version
62
62
  version: '1.27'
63
+ - - "<"
64
+ - !ruby/object:Gem::Version
65
+ version: '3.0'
63
66
  type: :runtime
64
67
  prerelease: false
65
68
  version_requirements: !ruby/object:Gem::Requirement
66
69
  requirements:
67
- - - "~>"
70
+ - - ">="
68
71
  - !ruby/object:Gem::Version
69
72
  version: '1.27'
73
+ - - "<"
74
+ - !ruby/object:Gem::Version
75
+ version: '3.0'
70
76
  description: |-
71
77
  This library can be used as a module for `fog` or as standalone provider
72
78
  to use local filesystem storage.
@@ -77,10 +83,11 @@ executables: []
77
83
  extensions: []
78
84
  extra_rdoc_files: []
79
85
  files:
86
+ - ".github/dependabot.yml"
87
+ - ".github/workflows/ruby.yml"
88
+ - ".github/workflows/stale.yml"
80
89
  - ".gitignore"
81
90
  - ".ruby-gemset"
82
- - ".ruby-version"
83
- - ".travis.yml"
84
91
  - CONTRIBUTING.md
85
92
  - CONTRIBUTORS.md
86
93
  - Gemfile
@@ -90,13 +97,12 @@ files:
90
97
  - fog-local.gemspec
91
98
  - lib/fog/bin/local.rb
92
99
  - lib/fog/local.rb
100
+ - lib/fog/local/models/directories.rb
101
+ - lib/fog/local/models/directory.rb
102
+ - lib/fog/local/models/file.rb
103
+ - lib/fog/local/models/files.rb
93
104
  - lib/fog/local/storage.rb
94
105
  - lib/fog/local/version.rb
95
- - lib/fog/storage/local.rb
96
- - lib/fog/storage/local/models/directories.rb
97
- - lib/fog/storage/local/models/directory.rb
98
- - lib/fog/storage/local/models/file.rb
99
- - lib/fog/storage/local/models/files.rb
100
106
  - tests/helper.rb
101
107
  - tests/helpers/collection_helper.rb
102
108
  - tests/helpers/mock_helper.rb
@@ -105,13 +111,14 @@ files:
105
111
  - tests/local/models/directories_tests.rb
106
112
  - tests/local/models/directory_tests.rb
107
113
  - tests/local/models/file_tests.rb
114
+ - tests/local/models/files_tests.rb
108
115
  - tests/local/storage_tests.rb
109
116
  - tests/watchr.rb
110
117
  homepage: https://github.com/fog/fog-local
111
118
  licenses:
112
119
  - MIT
113
120
  metadata: {}
114
- post_install_message:
121
+ post_install_message:
115
122
  rdoc_options: []
116
123
  require_paths:
117
124
  - lib
@@ -126,9 +133,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
126
133
  - !ruby/object:Gem::Version
127
134
  version: '0'
128
135
  requirements: []
129
- rubyforge_project:
130
- rubygems_version: 2.6.12
131
- signing_key:
136
+ rubygems_version: 3.2.15
137
+ signing_key:
132
138
  specification_version: 4
133
139
  summary: Module for the 'fog' gem to support local filesystem storage.
134
140
  test_files: []
data/.ruby-version DELETED
@@ -1 +0,0 @@
1
- 2.2.0
data/.travis.yml DELETED
@@ -1,15 +0,0 @@
1
- language: ruby
2
- sudo: false
3
- script: bundle exec rake test
4
- rvm:
5
- - 1.9.3
6
- - 2.0.0
7
- - 2.1.10
8
- - 2.2.6
9
- - 2.3.3
10
- - 2.4.0
11
- - jruby-19mode
12
- - jruby-9.1.7.0
13
- env:
14
- - FOG_MOCK=true
15
- - FOG_MOCK=false
@@ -1,98 +0,0 @@
1
- module Fog
2
- module Storage
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
-
9
- requires :local_root
10
- recognizes :endpoint, :scheme, :host, :port, :path
11
-
12
- model_path 'fog/storage/local/models'
13
- collection :directories
14
- model :directory
15
- model :file
16
- collection :files
17
-
18
- require 'uri'
19
-
20
- class Mock
21
- attr_reader :endpoint
22
-
23
- def self.data
24
- @data ||= Hash.new do |hash, key|
25
- hash[key] = {}
26
- end
27
- end
28
-
29
- def self.reset
30
- @data = nil
31
- end
32
-
33
- def initialize(options={})
34
- Fog::Mock.not_implemented
35
-
36
- @local_root = ::File.expand_path(options[:local_root])
37
-
38
- @endpoint = options[:endpoint] || build_endpoint_from_options(options)
39
- end
40
-
41
- def data
42
- self.class.data[@local_root]
43
- end
44
-
45
- def local_root
46
- @local_root
47
- end
48
-
49
- def path_to(partial)
50
- ::File.join(@local_root, partial)
51
- end
52
-
53
- def reset_data
54
- self.class.data.delete(@local_root)
55
- end
56
-
57
- private
58
- def build_endpoint_from_options(options)
59
- return unless options[:host]
60
-
61
- URI::Generic.build(options).to_s
62
- end
63
- end
64
-
65
- class Real
66
- attr_reader :endpoint
67
-
68
- def initialize(options={})
69
- @local_root = ::File.expand_path(options[:local_root])
70
-
71
- @endpoint = options[:endpoint] || build_endpoint_from_options(options)
72
- end
73
-
74
- def local_root
75
- @local_root
76
- end
77
-
78
- def path_to(partial)
79
- ::File.join(@local_root, partial)
80
- end
81
-
82
- def copy_object(source_directory_name, source_object_name, target_directory_name, target_object_name, options={})
83
- source_path = path_to(::File.join(source_directory_name, source_object_name))
84
- target_path = path_to(::File.join(target_directory_name, target_object_name))
85
- ::FileUtils.mkdir_p(::File.dirname(target_path))
86
- ::FileUtils.copy_file(source_path, target_path)
87
- end
88
-
89
- private
90
- def build_endpoint_from_options(options)
91
- return unless options[:host]
92
-
93
- URI::Generic.build(options).to_s
94
- end
95
- end
96
- end
97
- end
98
- end