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

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

Open
wizztjh opened this issue Aug 25, 2011 · 9 comments

Comments

@wizztjh
Copy link

wizztjh commented Aug 25, 2011

It seems to be not working in my rails app.

@kmamykin
Copy link
Collaborator

post your assets.yml

@wizztjh
Copy link
Author

wizztjh commented Aug 26, 2011

<%
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:

  • public/pro_images/**

javascripts:
user_session:
- public/javascripts/show_status_bar.js
- public/javascripts/userLogin.js
user_session_signup:
- public/javascripts/show_status_bar.js
- public/javascripts/userLogin.js
- public/javascripts/browserDetection.js
campaign:
- public/javascripts/share_scripts.js
- public/javascripts/jquery-ui.min.js
- public/javascripts/show_status_bar.js
- public/javascripts/pageListDisplayer.js
- public/javascripts/events-prototype.js
- public/javascripts/mColorPicker.js
- public/javascripts/publish.js
- public/javascripts/iAd/iAd.js
builder-<%= CURRENT_VERSION %>:
- public/javascripts/<%=CURRENT_VERSION%>/1_jquery.js
- public/javascripts/jquery-ui.min.js
- public/javascripts/jquery.jeegoocontext.js
- public/javascripts/jquery.simplyscroll-1.0.4.js
- public/javascripts/<%=CURRENT_VERSION%>/processingScreen.js
- public/javascripts/show_status_bar.js
- public/javascripts/share_scripts.js
- public/javascripts/pageDesignDisplayer.js
- public/javascripts/<%=CURRENT_VERSION%>/2_animation-css-obj.js
- public/javascripts/functions.js
- public/javascripts/initialization.js
- public/javascripts/image.js
- public/javascripts/video.js
- public/javascripts/text-edit.js
- public/javascripts/html_edit.js
- public/javascripts/mColorPicker.js
- public/javascripts/events-prototype.js
- public/javascripts/undo.js
- public/javascripts/<%= CURRENT_VERSION %>/widgetAPI.js
- public/javascripts/<%= CURRENT_VERSION %>/coverflow.js
- public/javascripts/<%=CURRENT_VERSION%>/coverflowRSS.js
- public/javascripts/<%=CURRENT_VERSION%>/rssNews.js
- public/javascripts/<%=CURRENT_VERSION%>/carousel.js
- public/javascripts/<%=CURRENT_VERSION%>/carouselRSS.js
- public/javascripts/<%=CURRENT_VERSION%>/gallery.js
- public/javascripts/<%=CURRENT_VERSION%>/galleryRSS.js
- public/javascripts/<%=CURRENT_VERSION%>/wipeClear.js
- public/javascripts/<%=CURRENT_VERSION%>/formWidget.js
- public/javascripts/<%=CURRENT_VERSION%>/youtube.js
- public/javascripts/<%=CURRENT_VERSION%>/twitter.js
- public/javascripts/<%=CURRENT_VERSION%>/fb.js
- public/javascripts/<%=CURRENT_VERSION%>/pageinpage.js
- public/javascripts/<%=CURRENT_VERSION%>/iAd/iAd.js
- public/javascripts/json/json2.js

jq-<%=CURRENT_VERSION%>:
- public/javascripts/<%=CURRENT_VERSION%>/1_jquery.js

campaign-<%=CURRENT_VERSION%>:
- public/javascripts/<%=CURRENT_VERSION%>/1_jquery.js
- public/javascripts/<%=CURRENT_VERSION%>/2_animation-css-obj.js
- public/javascripts/<%=CURRENT_VERSION%>/processingScreen.js
- public/javascripts/<%=CURRENT_VERSION%>/widgetAPI.js
- public/javascripts/<%=CURRENT_VERSION%>/coverflow.js
- public/javascripts/<%=CURRENT_VERSION%>/coverflowRSS.js
- public/javascripts/<%=CURRENT_VERSION%>/rssNews.js
- public/javascripts/<%=CURRENT_VERSION%>/map.js
- public/javascripts/<%=CURRENT_VERSION%>/carousel.js
- public/javascripts/<%=CURRENT_VERSION%>/youtube.js
- public/javascripts/<%=CURRENT_VERSION%>/carouselRSS.js
- public/javascripts/<%=CURRENT_VERSION%>/gallery.js
- public/javascripts/<%=CURRENT_VERSION%>/galleryRSS.js
- public/javascripts/<%=CURRENT_VERSION%>/wipeClear.js
- public/javascripts/<%=CURRENT_VERSION%>/formWidget.js
- public/javascripts/<%=CURRENT_VERSION%>/youtube.js
- public/javascripts/<%=CURRENT_VERSION%>/twitter.js
- public/javascripts/<%=CURRENT_VERSION%>/fb.js
- public/javascripts/<%=CURRENT_VERSION%>/pageinpage.js
<% for ver in asset_version %>
<% end %>

stylesheets:
main:
- public/stylesheets/main_2.css

builder:
- public/stylesheets/jquery-ui.css
- public/stylesheets/builder.css
- public/stylesheets/MobDisHeader.css
- public/stylesheets/event-effect-prototype.css

campaign:
- public/stylesheets/MobDisHeader.css
- public/stylesheets/general.css
- public/stylesheets/pageStyles.css
- public/stylesheets/publish.css

builder-<%=CURRENT_VERSION%>:
- public/stylesheets/<%=CURRENT_VERSION%>/iAd.css
- public/stylesheets/<%=CURRENT_VERSION%>/tempCSS.css
- public/stylesheets/<%=CURRENT_VERSION%>/textstyle.css

campaign-<%=CURRENT_VERSION%>:
- public/stylesheets/<%=CURRENT_VERSION%>/iAd.css
- public/stylesheets/<%=CURRENT_VERSION%>/widget.css
- public/stylesheets/<%=CURRENT_VERSION%>/textstyle.css
- public/stylesheets/<%=CURRENT_VERSION%>/jquery-ui-1.8.14.custom.css

<% for ver in asset_version %>
<% end %>

@kmamykin
Copy link
Collaborator

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
Copy link
Author

wizztjh commented Sep 1, 2011

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 wizztjh closed this as completed Sep 1, 2011
@wizztjh wizztjh reopened this Sep 1, 2011
@wizztjh
Copy link
Author

wizztjh commented Sep 1, 2011

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
Copy link
Author

wizztjh commented Sep 1, 2011

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

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

end

around it

@kmamykin
Copy link
Collaborator

kmamykin commented Sep 2, 2011

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
Copy link
Author

wizztjh commented Sep 3, 2011

sure!

On Sat, Sep 3, 2011 at 2:52 AM, kmamykin <
[email protected]>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:
#24 (comment)

@PratheepV
Copy link

any updates in this...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants