fog-local-0.8.0/0000755000004100000410000000000014173204373013416 5ustar www-datawww-datafog-local-0.8.0/README.md0000644000004100000410000000206514173204373014700 0ustar www-datawww-data# Fog::Local ![Gem Version](https://badge.fury.io/rb/fog-local.svg) [![Build Status](https://travis-ci.org/fog/fog-local.svg?branch=master)](https://travis-ci.org/fog/fog-local) [![Dependency Status](https://gemnasium.com/fog/fog-local.svg)](https://gemnasium.com/fog/fog-local) ## Installation Add this line to your application's Gemfile: ```ruby gem 'fog-local' ``` And then execute: $ bundle Or install it yourself as: $ gem install fog-local ## Usage Initialise a `Fog::Local::Storage` object: ```ruby storage = Fog::Local::Storage.new(local_root: '~/fog') ``` This can then be used like any other [Fog storage](http://fog.io/storage/). ```ruby directory = storage.directories.create(key: 'data') directory.files.create(body: 'Hello World!', key: 'hello_world.txt') ``` ## Contributing 1. Fork it ( https://github.com/fog/fog-local/fork) 2. Create your feature branch (`git checkout -b my-new-feature`) 3. Commit your changes (`git commit -am 'Add some feature'`) 4. Push to the branch (`git push origin my-new-feature`) 5. Create a new Pull Request fog-local-0.8.0/tests/0000755000004100000410000000000014173204373014560 5ustar www-datawww-datafog-local-0.8.0/tests/helper.rb0000644000004100000410000000147214173204373016370 0ustar www-datawww-databegin require "codeclimate-test-reporter" CodeClimate::TestReporter.start rescue LoadError => e $stderr.puts "not recording test coverage: #{e.inspect}" end $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__) require 'fog/local' Bundler.require(:test) require 'tmpdir' Excon.defaults.merge!(:debug_request => true, :debug_response => true) require File.expand_path(File.join(File.dirname(__FILE__), 'helpers', 'mock_helper')) # This overrides the default 600 seconds timeout during live test runs if Fog.mocking? Fog.timeout = ENV['FOG_TEST_TIMEOUT'] || 2000 Fog::Logger.warning "Setting default fog timeout to #{Fog.timeout} seconds" end def lorem_file File.open(File.dirname(__FILE__) + '/lorem.txt', 'r') end def array_differences(array_a, array_b) (array_a - array_b) | (array_b - array_a) end fog-local-0.8.0/tests/helpers/0000755000004100000410000000000014173204373016222 5ustar www-datawww-datafog-local-0.8.0/tests/helpers/collection_helper.rb0000644000004100000410000000502714173204373022245 0ustar www-datawww-datadef collection_tests(collection, params = {}, mocks_implemented = true) tests('success') do tests("#new(#{params.inspect})").succeeds do pending if Fog.mocking? && !mocks_implemented collection.new(params) end tests("#create(#{params.inspect})").succeeds do pending if Fog.mocking? && !mocks_implemented @instance = collection.create(params) end # FIXME: work around for timing issue on AWS describe_instances mocks if Fog.mocking? && @instance.respond_to?(:ready?) @instance.wait_for { ready? } end tests("#all").succeeds do pending if Fog.mocking? && !mocks_implemented collection.all end if !Fog.mocking? || mocks_implemented @identity = @instance.identity end tests("#get(#{@identity})").succeeds do pending if Fog.mocking? && !mocks_implemented collection.get(@identity) end tests('Enumerable') do pending if Fog.mocking? && !mocks_implemented methods = [ 'all?', 'any?', 'find', 'detect', 'collect', 'map', 'find_index', 'flat_map', 'collect_concat', 'group_by', 'none?', 'one?' ] # JRuby 1.7.5+ issue causes a SystemStackError: stack level too deep # https://github.com/jruby/jruby/issues/1265 if RUBY_PLATFORM == "java" and JRUBY_VERSION =~ /1\.7\.[5-8]/ methods.delete('all?') end methods.each do |enum_method| if collection.respond_to?(enum_method) tests("##{enum_method}").succeeds do block_called = false collection.send(enum_method) {|x| block_called = true } block_called end end end [ 'max_by','min_by' ].each do |enum_method| if collection.respond_to?(enum_method) tests("##{enum_method}").succeeds do block_called = false collection.send(enum_method) {|x| block_called = true; 0 } block_called end end end end if block_given? yield(@instance) end if !Fog.mocking? || mocks_implemented @instance.destroy end end tests('failure') do if !Fog.mocking? || mocks_implemented @identity = @identity.to_s @identity = @identity.gsub(/[a-zA-Z]/) { Fog::Mock.random_letters(1) } @identity = @identity.gsub(/\d/) { Fog::Mock.random_numbers(1) } @identity end tests("#get('#{@identity}')").returns(nil) do pending if Fog.mocking? && !mocks_implemented collection.get(@identity) end end end fog-local-0.8.0/tests/helpers/mock_helper.rb0000644000004100000410000000017414173204373021041 0ustar www-datawww-data# Use so you can run in mock mode from the command line # # FOG_MOCK=true fog if ENV["FOG_MOCK"] == "true" Fog.mock! end fog-local-0.8.0/tests/helpers/model_helper.rb0000644000004100000410000000141414173204373021206 0ustar www-datawww-datadef model_tests(collection, params = {}, mocks_implemented = true) tests('success') do @instance = collection.new(params) tests("#save").succeeds do pending if Fog.mocking? && !mocks_implemented @instance.save end if block_given? yield(@instance) end tests("#destroy").succeeds do pending if Fog.mocking? && !mocks_implemented @instance.destroy end end end # Generates a unique identifier with a random differentiator. # Useful when rapidly re-running tests, so we don't have to wait # serveral minutes for deleted objects to disappear from the API # E.g. 'fog-test-1234' def uniq_id(base_name = 'fog-test') # random_differentiator suffix = rand(65536).to_s(16).rjust(4, '0') [base_name, suffix] * '-' end fog-local-0.8.0/tests/helpers/succeeds_helper.rb0000644000004100000410000000021314173204373021700 0ustar www-datawww-datamodule Shindo class Tests def succeeds(&block) test('succeeds') do !!instance_eval(&block) end end end end fog-local-0.8.0/tests/local/0000755000004100000410000000000014173204373015652 5ustar www-datawww-datafog-local-0.8.0/tests/local/storage_tests.rb0000644000004100000410000000206214173204373021065 0ustar www-datawww-dataShindo.tests('Local | storage') do pending if Fog.mocking? before do @options = { :local_root => Dir.mktmpdir('fog-tests') } end after do FileUtils.remove_entry_secure @options[:local_root] end tests('#endpoint') do tests('when no endpoint is provided'). returns(nil) do Fog::Local::Storage.new(@options).endpoint end tests('when no host is provided'). returns(nil) do @options[:scheme] = 'http' @options[:path] = '/files' @options[:port] = 80 Fog::Local::Storage.new(@options).endpoint end tests('when endpoint is provided'). returns('http://example.com/files') do @options[:endpoint] = 'http://example.com/files' Fog::Local::Storage.new(@options).endpoint end tests('when at least host option is provided'). returns('http://example.com/files') do @options[:scheme] = 'http' @options[:host] = 'example.com' @options[:path] = '/files' Fog::Local::Storage.new(@options).endpoint end end end fog-local-0.8.0/tests/local/models/0000755000004100000410000000000014173204373017135 5ustar www-datawww-datafog-local-0.8.0/tests/local/models/file_tests.rb0000644000004100000410000001116714173204373021631 0ustar www-datawww-dataShindo.tests('Storage[:local] | file', ["local"]) do pending if Fog.mocking? before do @options = { :local_root => Dir.mktmpdir('fog-tests') } end after do FileUtils.remove_entry_secure @options[:local_root] end tests('#public_url') do tests('when connection has an endpoint'). returns('http://example.com/files/directory/file.txt') do @options[:endpoint] = 'http://example.com/files' connection = Fog::Local::Storage.new(@options) directory = connection.directories.new(:key => 'directory') file = directory.files.new(:key => 'file.txt') file.public_url end tests('when connection has no endpoint'). returns(nil) do @options[:endpoint] = nil connection = Fog::Local::Storage.new(@options) directory = connection.directories.new(:key => 'directory') file = directory.files.new(:key => 'file.txt') file.public_url end tests('when file path has escapable characters'). returns('http://example.com/files/my%20directory/my%20file.txt') do @options[:endpoint] = 'http://example.com/files' connection = Fog::Local::Storage.new(@options) directory = connection.directories.new(:key => 'my directory') file = directory.files.new(:key => 'my file.txt') file.public_url end tests('when key has safe characters'). returns('http://example.com/files/my/directory/my/file.txt') do @options[:endpoint] = 'http://example.com/files' connection = Fog::Local::Storage.new(@options) directory = connection.directories.new(:key => 'my/directory') file = directory.files.new(:key => 'my/file.txt') file.public_url end end tests('#save') do tests('creates non-existent subdirs') do returns(true) do connection = Fog::Local::Storage.new(@options) directory = connection.directories.new(:key => 'path1') file = directory.files.new(:key => 'path2/file.rb', :body => "my contents") file.save File.exists?(@options[:local_root] + "/path1/path2/file.rb") end end tests('with tempfile').returns('tempfile') do connection = Fog::Local::Storage.new(@options) directory = connection.directories.create(:key => 'directory') tempfile = Tempfile.new(['file', '.txt']) tempfile.write('tempfile') tempfile.rewind tempfile.instance_eval do def read raise 'must not be read' end end file = directory.files.new(:key => 'tempfile.txt', :body => tempfile) file.save tempfile.close tempfile.unlink directory.files.get('tempfile.txt').body end end tests('#destroy') do # - removes dir if it contains no files # - keeps dir if it contains non-hidden files # - keeps dir if it contains hidden files # - stays in the same directory tests('removes enclosing dir if it is empty') do returns(false) do connection = Fog::Local::Storage.new(@options) directory = connection.directories.new(:key => 'path1') file = directory.files.new(:key => 'path2/file.rb', :body => "my contents") file.save file.destroy File.exists?(@options[:local_root] + "/path1/path2") end end tests('keeps enclosing dir if it is not empty') do returns(true) do connection = Fog::Local::Storage.new(@options) directory = connection.directories.new(:key => 'path1') file = directory.files.new(:key => 'path2/file.rb', :body => "my contents") file.save file = directory.files.new(:key => 'path2/file2.rb', :body => "my contents") file.save file.destroy File.exists?(@options[:local_root] + "/path1/path2") end end tests('keeps enclosing dir if contains only hidden files') do returns(true) do connection = Fog::Local::Storage.new(@options) directory = connection.directories.new(:key => 'path1') file = directory.files.new(:key => 'path2/.file.rb', :body => "my contents") file.save file = directory.files.new(:key => 'path2/.file2.rb', :body => "my contents") file.save file.destroy File.exists?(@options[:local_root] + "/path1/path2") end end tests('it stays in the same directory') do returns(Dir.pwd) do connection = Fog::Local::Storage.new(@options) directory = connection.directories.new(:key => 'path1') file = directory.files.new(:key => 'path2/file2.rb', :body => "my contents") file.save file.destroy Dir.pwd end end end end fog-local-0.8.0/tests/local/models/directories_tests.rb0000644000004100000410000000105314173204373023217 0ustar www-datawww-dataShindo.tests('Storage[:local] | directories', ["local"]) do pending if Fog.mocking? @options = { :local_root => Dir.mktmpdir('fog-tests') } @collection = Fog::Local::Storage.new(@options).directories collection_tests(@collection, {:key => "fogdirtests"}, true) tests("#all") do tests("succeeds when :local_root does not exist").succeeds do FileUtils.remove_entry_secure(@options[:local_root]) @collection.all end end FileUtils.remove_entry_secure(@options[:local_root]) if File.directory?(@options[:local_root]) end fog-local-0.8.0/tests/local/models/files_tests.rb0000644000004100000410000000102514173204373022004 0ustar www-datawww-dataShindo.tests('Storage[:local] | files', ["local"]) do pending if Fog.mocking? before do @options = { :local_root => Dir.mktmpdir('fog-tests') } end after do FileUtils.remove_entry_secure(@options[:local_root]) if File.directory?(@options[:local_root]) end tests("#is_truncated") do returns(false) do connection = Fog::Local::Storage.new(@options) directory = connection.directories.create(:key => 'directory') collection = directory.files collection.is_truncated end end end fog-local-0.8.0/tests/local/models/directory_tests.rb0000644000004100000410000000073314173204373022713 0ustar www-datawww-dataShindo.tests('Storage[:local] | directory', ["local"]) do pending if Fog.mocking? before do @options = { :local_root => Dir.mktmpdir('fog-tests') } end after do FileUtils.remove_entry_secure @options[:local_root] end tests('save') do returns('directory') do connection = Fog::Local::Storage.new(@options) connection.directories.create(:key => 'directory') connection.directories.create(:key => 'directory').key end end end fog-local-0.8.0/tests/watchr.rb0000644000004100000410000000070714173204373016401 0ustar www-datawww-dataENV['FOG_MOCK'] ||= 'true' ENV['AUTOTEST'] = 'true' ENV['WATCHR'] = '1' def file2shindo(file) result = file.sub('lib/fog/', 'tests/').gsub(/\.rb$/, '_tests.rb') end def run_shindo_test(file) if File.exist? file system("shindont #{file}") else puts "FIXME: No test #{file} [#{Time.now}]" end end watch( 'tests/.*_tests\.rb' ) do |md| run_shindo_test(md[0]) end watch( 'lib/.*\.rb' ) do |md| run_shindo_test(file2shindo(md[0])) end fog-local-0.8.0/LICENSE.md0000644000004100000410000000216414173204373015025 0ustar www-datawww-dataThe MIT License (MIT) Copyright (c) 2015 [CONTRIBUTORS.md](https://github.com/fog/fog/blob/master/CONTRIBUTORS.md) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. fog-local-0.8.0/CONTRIBUTORS.md0000644000004100000410000000131214173204373015672 0ustar www-datawww-data* geemus * Lance Ivy * Paul Thornthwaite * Benjamin Manns * Sjoerd Andringa * Juris Galang * Paul Thornthwaite * Jamie Paton * Thomas Wright * Wesley Beary * Karl Freeman * Andy Lindeman * Athir Nuaimi * Brian D. Burns * Jade Tucker * James Herdman * Adam Tanner * Mark Yen * Kevin Deisz fog-local-0.8.0/.gitignore0000644000004100000410000000020114173204373015377 0ustar www-datawww-data/.bundle/ /.yardoc /Gemfile.lock /_yardoc/ /coverage/ /doc/ /pkg/ /spec/reports/ /tmp/ *.bundle *.so *.o *.a mkmf.log tests/.fog fog-local-0.8.0/Rakefile0000644000004100000410000000026314173204373015064 0ustar www-datawww-datarequire "bundler/gem_tasks" task :default => :test mock = ENV['FOG_MOCK'] || 'false' desc "Run tests" task :test do sh("export FOG_MOCK=#{mock} && bundle exec shindont") end fog-local-0.8.0/lib/0000755000004100000410000000000014173204373014164 5ustar www-datawww-datafog-local-0.8.0/lib/fog/0000755000004100000410000000000014173204373014737 5ustar www-datawww-datafog-local-0.8.0/lib/fog/bin/0000755000004100000410000000000014173204373015507 5ustar www-datawww-datafog-local-0.8.0/lib/fog/bin/local.rb0000644000004100000410000000125414173204373017130 0ustar www-datawww-dataclass Local < Fog::Bin class << self def class_for(key) case key when :storage Fog::Local::Storage else raise ArgumentError, "Unsupported #{self} service: #{key}" end end def [](service) @@connections ||= Hash.new do |hash, key| hash[key] = case key when :storage Fog::Logger.warning("Local[:storage] is not recommended, use Storage[:local] for portability") Fog::Local::Storage.new else raise ArgumentError, "Unrecognized service: #{key.inspect}" end end @@connections[service] end def services Fog::Local.services end end end fog-local-0.8.0/lib/fog/local/0000755000004100000410000000000014173204373016031 5ustar www-datawww-datafog-local-0.8.0/lib/fog/local/version.rb0000644000004100000410000000007214173204373020042 0ustar www-datawww-datamodule Fog module Local VERSION = '0.8.0' end end fog-local-0.8.0/lib/fog/local/models/0000755000004100000410000000000014173204373017314 5ustar www-datawww-datafog-local-0.8.0/lib/fog/local/models/directories.rb0000644000004100000410000000142314173204373022155 0ustar www-datawww-datamodule Fog module Local class Storage class Directories < Fog::Collection model Directory def all data = if ::File.directory?(service.local_root) Dir.entries(service.local_root).select do |entry| entry[0...1] != '.' && ::File.directory?(service.path_to(entry)) end.map do |entry| {:key => entry} end else [] end load(data) end def get(key, options = {}) create_directory(key, options) if ::File.directory?(service.path_to(key)) end private def create_directory(key, options) options[:path] ? new(key: key + options[:path]) : new(key: key) end end end end end fog-local-0.8.0/lib/fog/local/models/files.rb0000644000004100000410000000413214173204373020743 0ustar www-datawww-datamodule Fog module Local class Storage class Files < Fog::Collection attribute :directory model File def all requires :directory if directory.collection.get(directory.key) data = [] Dir.chdir(service.path_to(directory.key)) { data = Dir.glob('**/*').reject do |file| ::File.directory?(file) end.map do |key| path = file_path(key) { :content_length => ::File.size(path), :key => key, :last_modified => ::File.mtime(path) } end } load(data) else nil end end def get(key, &block) requires :directory path = file_path(key) if ::File.exist?(path) data = { :content_length => ::File.size(path), :key => key, :last_modified => ::File.mtime(path) } body = "" ::File.open(path) do |file| while (chunk = file.read(Excon::CHUNK_SIZE)) && (!block_given? || (block_given? && yield(chunk))) body << chunk end end data.merge!(:body => body) if !block_given? new(data) else nil end end def head(key) requires :directory path = file_path(key) if ::File.exist?(path) new({ :content_length => ::File.size(path), :key => key, :last_modified => ::File.mtime(path) }) else nil end end def new(attributes = {}) requires :directory super({ :directory => directory }.merge!(attributes)) end def is_truncated false end private def file_path(key) service.path_to(::File.join(directory.key, key)) end end end end end fog-local-0.8.0/lib/fog/local/models/file.rb0000644000004100000410000001014614173204373020562 0ustar www-datawww-datamodule Fog module Local class Storage class File < Fog::Model identity :key, :aliases => 'Key' attribute :content_length, :aliases => 'Content-Length', :type => :integer # attribute :content_type, :aliases => 'Content-Type' attribute :last_modified, :aliases => 'Last-Modified' require 'uri' def body attributes[:body] ||= if last_modified collection.get(identity).body else '' end end def body=(new_body) attributes[:body] = new_body end def content_type @content_type ||= begin unless (mime_types = ::MIME::Types.of(key)).empty? mime_types.first.content_type end end end def directory @directory end def copy(target_directory_key, target_file_key, options={}) requires :directory, :key service.copy_object(directory.key, key, target_directory_key, target_file_key) target_directory = service.directories.new(:key => target_directory_key) target_directory.files.get(target_file_key) end def destroy requires :directory, :key ::File.delete(path) if ::File.exist?(path) dirs = path.split(::File::SEPARATOR)[0...-1] dirs.length.times do |index| dir_path = dirs[0..-index].join(::File::SEPARATOR) if dir_path.empty? # path starts with ::File::SEPARATOR next end # don't delete the containing directory or higher if dir_path == service.path_to(directory.key) break end rm_if_empty_dir(dir_path) end true end def public=(new_public) new_public end def public_url requires :directory, :key if service.endpoint escaped_directory = uri_escape(directory.key) escaped_key = uri_escape(key) ::File.join(service.endpoint, escaped_directory, escaped_key) else nil end end def save(options = {}) requires :body, :directory, :key # Once 1.9.3 support is dropped, the following two lines # can be replaced with `File.dirname(path)` dirs = path.split(::File::SEPARATOR)[0...-1] dir_path = dirs.join(::File::SEPARATOR) # Create all directories in file path that do not yet exist FileUtils.mkdir_p(dir_path) if (body.is_a?(::File) || body.is_a?(Tempfile)) && ::File.exist?(body.path) FileUtils.cp(body.path, path) else write_file(path, body) end merge_attributes( :content_length => Fog::Storage.get_body_size(body), :last_modified => ::File.mtime(path) ) true end private def directory=(new_directory) @directory = new_directory end def uri_escape(string) string.b.gsub(URI::DEFAULT_PARSER.regexp[:UNSAFE]) do |m| '%' + m.unpack('H2' * m.bytesize).join('%').upcase end end def path service.path_to(::File.join(directory.key, key)) end def write_file(path, content) input_io = StringIO.new(content) if content.is_a?(String) input_io ||= content ::File.open(path, 'wb') do |file| IO.copy_stream(input_io, file) end end def rm_if_empty_dir(dir_path) if ::File.directory?(dir_path) Dir.rmdir(dir_path) if dir_empty?(dir_path) end end def dir_empty?(dir_path) # NOTE: There’s Dir.empty?, but it is only available on Ruby 2.4+ # NOTE: `entries` will be empty on Windows, and contain . and .. on # unix-like systems (macOS, Linux, BSD, …) entries = Dir.entries(dir_path) entries.empty? || entries.all? { |e| ['.', '..'].include?(e) } end end end end end fog-local-0.8.0/lib/fog/local/models/directory.rb0000644000004100000410000000130714173204373021646 0ustar www-datawww-datamodule Fog module Local class Storage class Directory < Fog::Model identity :key def destroy requires :key if ::File.directory?(path) Dir.rmdir(path) true else false end end def files @files ||= Files.new(directory: self, service: service) end def public=(new_public) new_public end def public_url nil end def save requires :key FileUtils.mkpath(path) true end private def path service.path_to(key) end end end end end fog-local-0.8.0/lib/fog/local/storage.rb0000644000004100000410000000462114173204373020025 0ustar www-datawww-datamodule Fog module Local class Storage < Fog::Service autoload :Directories, 'fog/local/models/directories' autoload :Directory, 'fog/local/models/directory' autoload :File, 'fog/local/models/file' autoload :Files, 'fog/local/models/files' requires :local_root recognizes :endpoint, :scheme, :host, :port, :path model_path 'fog/local/models' collection :directories model :directory model :file collection :files require 'uri' class Mock attr_reader :endpoint def self.data @data ||= Hash.new do |hash, key| hash[key] = {} end end def self.reset @data = nil end def initialize(options={}) Fog::Mock.not_implemented @local_root = ::File.expand_path(options[:local_root]) @endpoint = options[:endpoint] || build_endpoint_from_options(options) end def data self.class.data[@local_root] end def local_root @local_root end def path_to(partial) ::File.join(@local_root, partial) end def reset_data self.class.data.delete(@local_root) end private def build_endpoint_from_options(options) return unless options[:host] URI::Generic.build(options).to_s end end class Real attr_reader :endpoint def initialize(options={}) @local_root = ::File.expand_path(options[:local_root]) @endpoint = options[:endpoint] || build_endpoint_from_options(options) end def local_root @local_root end def path_to(partial) ::File.join(@local_root, partial) end def copy_object(source_directory_name, source_object_name, target_directory_name, target_object_name, options={}) source_path = path_to(::File.join(source_directory_name, source_object_name)) target_path = path_to(::File.join(target_directory_name, target_object_name)) ::FileUtils.mkdir_p(::File.dirname(target_path)) ::FileUtils.copy_file(source_path, target_path) end private def build_endpoint_from_options(options) return unless options[:host] URI::Generic.build(options).to_s end end end end end fog-local-0.8.0/lib/fog/local.rb0000644000004100000410000000042614173204373016360 0ustar www-datawww-datarequire 'fog/core' require 'fileutils' require 'tempfile' require 'fog/local/version' module Fog module Local extend Provider autoload :Storage, 'fog/local/storage' service :storage, :Storage end end Fog::Storage::Local = Fog::Local::Storage # legacy compat fog-local-0.8.0/CONTRIBUTING.md0000644000004100000410000000147114173204373015652 0ustar www-datawww-data## Getting Involved New contributors are always welcome, when it doubt please ask questions. We strive to be an open and welcoming community. Please be nice to one another. ### Coding * Pick a task: * Offer feedback on open [pull requests](https://github.com/fog/fog/pulls). * Review open [issues](https://github.com/fog/fog/issues) for things to help on. * [Create an issue](https://github.com/fog/fog/issues/new) to start a discussion on additions or features. * Fork the project, add your changes and tests to cover them in a topic branch. * Commit your changes and rebase against `fog/fog` to ensure everything is up to date. * [Submit a pull request](https://github.com/fog/fog/compare/). ### Non-Coding * Offer feedback on open [issues](https://github.com/fog/fog/issues). * Organize or volunteer at events. fog-local-0.8.0/.ruby-gemset0000644000004100000410000000001214173204373015653 0ustar www-datawww-datafog-local fog-local-0.8.0/Gemfile0000644000004100000410000000013614173204373014711 0ustar www-datawww-datasource 'https://rubygems.org' # Specify your gem's dependencies in fog-local.gemspec gemspec fog-local-0.8.0/.github/0000755000004100000410000000000014173204373014756 5ustar www-datawww-datafog-local-0.8.0/.github/dependabot.yml0000644000004100000410000000031714173204373017607 0ustar www-datawww-dataversion: 2 updates: - package-ecosystem: "bundler" directory: "/" schedule: interval: "daily" - package-ecosystem: "github-actions" directory: "/" schedule: interval: "daily" fog-local-0.8.0/.github/workflows/0000755000004100000410000000000014173204373017013 5ustar www-datawww-datafog-local-0.8.0/.github/workflows/stale.yml0000644000004100000410000000126514173204373020652 0ustar www-datawww-dataname: Mark stale issues and pull requests on: schedule: - cron: "30 1 * * *" jobs: stale: runs-on: ubuntu-latest steps: - uses: actions/stale@v3 with: repo-token: ${{ secrets.GITHUB_TOKEN }} days-before-stale: 60 days-before-close: 7 exempt-issue-labels: 'pinned,security' exempt-pr-labels: 'pinned,security' stale-issue-message: 'This issue has been marked inactive and will be closed if no further activity occurs.' stale-pr-message: 'This pr has been marked inactive and will be closed if no further activity occurs.' stale-issue-label: 'no-issue-activity' stale-pr-label: 'no-pr-activity' fog-local-0.8.0/.github/workflows/ruby.yml0000644000004100000410000000172014173204373020517 0ustar www-datawww-data# This workflow uses actions that are not certified by GitHub. # They are provided by a third-party and are governed by # separate terms of service, privacy policy, and support # documentation. # This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake # For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby name: Ruby on: push: branches: [ master ] pull_request: branches: [ master ] jobs: test: runs-on: ubuntu-latest strategy: matrix: ruby-version: ['2.5', '2.6', '2.7', '3.0', 'head'] steps: - uses: actions/checkout@v2 - name: Set up Ruby uses: ruby/setup-ruby@v1 with: ruby-version: ${{ matrix.ruby-version }} bundler-cache: true # runs 'bundle install' and caches installed gems automatically - name: Install dependencies run: bundle install - name: Run tests run: bundle exec rake fog-local-0.8.0/fog-local.gemspec0000644000004100000410000000215714173204373016633 0ustar www-datawww-data# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'fog/local/version' Gem::Specification.new do |spec| spec.name = "fog-local" spec.version = Fog::Local::VERSION spec.authors = ["Wesley Beary", "Ville Lautanala"] spec.email = ["geemus@gmail.com", "lautis@gmail.com"] spec.summary = %q{Module for the 'fog' gem to support local filesystem storage.} spec.description = %q{This library can be used as a module for `fog` or as standalone provider to use local filesystem storage.} spec.homepage = "https://github.com/fog/fog-local" spec.license = "MIT" spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) } spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) } spec.require_paths = ["lib"] spec.add_development_dependency 'bundler' spec.add_development_dependency 'rake', '>= 12.3.3' spec.add_development_dependency 'shindo', '~> 0.3' spec.add_dependency 'fog-core', '>= 1.27', '< 3.0' end