Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Limit number of runtime dependencies for fog. #325

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 3 additions & 6 deletions README.md
Expand Up @@ -24,13 +24,10 @@ gem 'asset_sync'

### Optimized Fog loading

Since AssetSync doesn't know which parts of Fog you intend to use, it will just load the entire library.
If you prefer to load fewer classes into your application, which will reduce load time and memory use,
you need to load those parts of Fog yourself *before* loading AssetSync:

In your Gemfile:
Since AssetSync doesn't know which parts of Fog you intend to use, it will just load the fog-core library.
In order to use aws or other providers, add those in your Gemfile accordingly, like:
```ruby
gem "fog", "~>1.20", require: "fog/aws/storage"
gem "fog-aws"
gem "asset_sync"
```

Expand Down
3 changes: 2 additions & 1 deletion asset_sync.gemspec
Expand Up @@ -18,11 +18,12 @@ Gem::Specification.new do |s|

s.rubyforge_project = "asset_sync"

s.add_dependency('fog', ">= 1.8.0")
s.add_dependency('fog-core', ">= 1.8.0")
s.add_dependency('unf')
s.add_dependency('activemodel')

s.add_development_dependency "rspec"
s.add_development_dependency "fog-aws"
s.add_development_dependency "bundler"
s.add_development_dependency "jeweler"

Expand Down
8 changes: 5 additions & 3 deletions lib/asset_sync.rb
@@ -1,4 +1,4 @@
require 'fog' unless defined?(::Fog)
require 'fog/core'
require 'active_model'
require 'erb'
require "asset_sync/asset_sync"
Expand All @@ -7,5 +7,7 @@
require 'asset_sync/multi_mime'


require 'asset_sync/railtie' if defined?(Rails)
require 'asset_sync/engine' if defined?(Rails)
if defined?(Rails)
require 'asset_sync/railtie'
require 'asset_sync/engine'
end
10 changes: 6 additions & 4 deletions spec/integration/aws_integration_spec.rb
@@ -1,5 +1,7 @@
require File.dirname(__FILE__) + '/../spec_helper'

require "fog/aws"

def bucket(name)
options = {
:provider => 'AWS',
Expand All @@ -23,12 +25,12 @@ def execute(command)
@prefix = SecureRandom.hex(6)
end

let(:app_js_regex){
/#{@prefix}\/application-[a-zA-Z0-9]*.js$/
let(:app_js_regex){
/#{@prefix}\/application-[a-zA-Z0-9]*.js$/
}

let(:app_js_gz_regex){
/#{@prefix}\/application-[a-zA-Z0-9]*.js.gz$/
let(:app_js_gz_regex){
/#{@prefix}\/application-[a-zA-Z0-9]*.js.gz$/
}

let(:files){ bucket(@prefix).files }
Expand Down