jacquescrocker / jammit-s3

Extensions so you can use jammit with s3/cloudfront for your Rails app
http://documentcloud.github.com/jammit/
MIT License
124 stars 31 forks source link

will jammit-s3 help to set the ActionController::Base.asset_host to s3 or cloudfront? #24

Open wizztjh opened 13 years ago

wizztjh commented 13 years ago

It seems to be not working in my rails app.

kmamykin commented 13 years ago

post your assets.yml

wizztjh commented 13 years ago

<% asset_version = ["1.0","1.2","1.2_general","2.0","2.04","2.05","2.06","2.07","2.08","2.1","2.11","2.2"] CURRENT_VERSION = 2.2 %> package_assets: on javascript_compressor: closure compilation_level: "WHITESPACE_ONLY" gzip_assets: on s3_access_key_id: xxx s3_secret_access_key:xxx s3_bucket: xxx embed_assets: datauri;

use_cloudfront: on cloudfront_dist_id:xxx cloudfront_domain: xxx

s3_upload_files:

javascripts: user_session:

stylesheets: main:

kmamykin commented 13 years ago

The option use_cloudfront should be set to either of the two values: invalidate or version. Try: use_cloudfront: version or use_cloudfront: invalidate

wizztjh commented 13 years ago

i looked inside my ~/.rvm/gems/ruby-1.8.7-p352@rails238/gems/jammit-s3-0.6.0.2/lib/jammit-s3.rb

require 'jammit/command_line'
require 'jammit/s3_command_line'
require 'jammit/s3_uploader'

module Jammit
  def self.upload_to_s3!(options = {})
    S3Uploader.new(options).upload
  end
end

the code above is not same with github. the code below that set the asset host is still missing even i have set my gemfile to https://github.com/railsjedi/jammit-s3.git

if defined?(Rails)
  module Jammit
    class JammitRailtie < Rails::Railtie

i try to binding.pry within the ~/.rvm/gems/ruby-1.8.7-p352@rails238/gems/jammit-s3-0.6.0.2/lib/jammit-s3.rb to check whether it will run when rvmsudo bundle exec jammit-s3 , and it runs into pry.

So , i think the problem is happening when i bundle install for rails 2.3.8. Do you have any idea what cause this?

Thanks for the quick reply kmamykin!

wizztjh commented 13 years ago

but somehow when pushed to heroku , it will load the missing code and it prompt this error uninitialized constant Rails::Railtie (NameError)

2011-09-01T09:37:22+00:00 app[web.1]: /app/.bundle/gems/ruby/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:440:in `load_missing_constant': uninitialized constant Rails::Railtie (NameError)
2011-09-01T09:37:22+00:00 app[web.1]:   from /app/.bundle/gems/ruby/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:80:in `const_missing'
2011-09-01T09:37:22+00:00 app[web.1]:   from /app/.bundle/gems/ruby/1.8/bundler/gems/jammit-s3-e8aaa4074ab1/lib/jammit-s3.rb:13
2011-09-01T09:37:22+00:00 app[web.1]:   from /usr/ruby1.8.7/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/runtime.rb:64:in `require'
2011-09-01T09:37:22+00:00 app[web.1]:   from /usr/ruby1.8.7/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/runtime.rb:64:in `require'
2011-09-01T09:37:22+00:00 app[web.1]:   from /usr/ruby1.8.7/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/runtime.rb:62:in `each'
wizztjh commented 13 years ago

after done some research ... rails 2 dont have Rails::Railtie i suggest to put

if defined?(Rails) && Rails.version =~ /^3\./

end

around it

kmamykin commented 13 years ago

Thank you for digging into this issue. I have only used the gem with Rails 3, dont have rails 2 apps using it.

Since you are already in the midst of things, may be you can test out a patch and submit a pull request?

Much appreciated.

wizztjh commented 13 years ago

sure!

On Sat, Sep 3, 2011 at 2:52 AM, kmamykin < reply@reply.github.com>wrote:

Thank you for digging into this issue. I have only used the gem with Rails 3, dont have rails 2 apps using it.

Since you are already in the midst of things, may be you can test out a patch and submit a pull request?

Much appreciated.

Reply to this email directly or view it on GitHub: https://github.com/railsjedi/jammit-s3/issues/24#issuecomment-1982012

PratheepV commented 11 years ago

any updates in this...