Wolfram Arnold, RubyFocus
2011-Aug-25 23:19 UTC
Mountable Engine/App: gems from .gemspec not available in dummy app when started with "rails console/server"
I''m building a Rails 3.1 mountable engine (3.1.0.rc6) whose sole purpose is to provides JavaScript assets (a client-side app built with backbone.js). I generated the skeleton with "rails plugin new <name> -- full" Piotr''s posts have been very helpful, as has the Railscast on the subject: http://piotrsarnacki.com/2010/09/14/mountable-engines/ http://piotrsarnacki.com/2010/12/21/mountable-apps-tutorial/ http://railscasts.com/episodes/277-mountable-engines/ I''m specifying a number of dependencies in the .gemspec file: s.add_dependency "rails", "~> 3.1.0.rc6" s.add_dependency "jquery-rails", "~> 1.0.13" s.add_dependency "backbone-rails", "~> 0.5.2" s.add_dependency "coffee-rails", "~> 3.1.0.rc6" s.add_dependency "sass-rails", "~> 3.1.0.rc6" s.add_dependency "uglifier", "~> 1.0.1" # Needed to run test suite(s) or development server (which will serve the app in spec/dummy) s.add_development_dependency "sqlite3", "~> 1.3.4" s.add_development_dependency "jasmine", "~> 1.1.0.rc3" # not getting picked up? s.add_development_dependency "rspec-rails", "~> 2.6.1" # not getting picked up? s.add_development_dependency "haml", "~> 3.1.2" # not getting picked up? The Gemfile looks like this: source "http://rubygems.org" gemspec When I run the "rails s" or "rails c" to launch the dummy app, e.g. the HAML gem is not available. If I explicitly add the HAML gem also to the engine''s Gemfile, then it is available. Same goes for the Jasmine gem (which provides rake tasks). When I check the load path $:, I do see that all the gem paths from .gemspec are listed, however they don''t seem to have been require''d. I''m wondering if this is a Rails bug. Somehow the gems listed in .gemspec only aren''t being initialized/loaded. I''m happy to dig into this more, but I''m not sure if this is broken or intended behavior. Thanks, Wolf -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
Ryan Bigg
2011-Aug-25 23:49 UTC
Re: Mountable Engine/App: gems from .gemspec not available in dummy app when started with "rails console/server"
A short guess: Something is not calling "Bundler.require(Rails.env, :default)" as what would normally happen in Rails, like in the default config/application.rb. Does putting this line in your engine.rb make it work? On Friday, 26 August 2011 at 9:19 AM, Wolfram Arnold, RubyFocus wrote:> I''m building a Rails 3.1 mountable engine (3.1.0.rc6) whose sole > purpose is to provides JavaScript assets (a client-side app built with > backbone.js). I generated the skeleton with "rails plugin new <name> -- > full" > > Piotr''s posts have been very helpful, as has the Railscast on the > subject: > http://piotrsarnacki.com/2010/09/14/mountable-engines/ > http://piotrsarnacki.com/2010/12/21/mountable-apps-tutorial/ > http://railscasts.com/episodes/277-mountable-engines/ > > I''m specifying a number of dependencies in the .gemspec file: > > s.add_dependency "rails", "~> 3.1.0.rc6" > s.add_dependency "jquery-rails", "~> 1.0.13" > s.add_dependency "backbone-rails", "~> 0.5.2" > > s.add_dependency "coffee-rails", "~> 3.1.0.rc6" > s.add_dependency "sass-rails", "~> 3.1.0.rc6" > s.add_dependency "uglifier", "~> 1.0.1" > > # Needed to run test suite(s) or development server (which will > serve the app in spec/dummy) > s.add_development_dependency "sqlite3", "~> 1.3.4" > s.add_development_dependency "jasmine", "~> 1.1.0.rc3" # not getting > picked up? > s.add_development_dependency "rspec-rails", "~> 2.6.1" # not > getting picked up? > s.add_development_dependency "haml", "~> 3.1.2" # not getting > picked up? > > The Gemfile looks like this: > > source "http://rubygems.org" > gemspec > > > When I run the "rails s" or "rails c" to launch the dummy app, e.g. > the HAML gem is not available. If I explicitly add the HAML gem also > to the engine''s Gemfile, then it is available. Same goes for the > Jasmine gem (which provides rake tasks). > > When I check the load path $:, I do see that all the gem paths > from .gemspec are listed, however they don''t seem to have been > require''d. > > I''m wondering if this is a Rails bug. Somehow the gems listed > in .gemspec only aren''t being initialized/loaded. I''m happy to dig > into this more, but I''m not sure if this is broken or intended > behavior. > > Thanks, > Wolf > > -- > You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. > To post to this group, send email to rubyonrails-core@googlegroups.com (mailto:rubyonrails-core@googlegroups.com). > To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com (mailto:rubyonrails-core+unsubscribe@googlegroups.com). > For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
Mabounassif
2011-Oct-06 18:20 UTC
Re: Mountable Engine/App: gems from .gemspec not available in dummy app when started with "rails console/server"
I''m having the same sort of problem, I have a mountable engine that provides Javascript assets, but while I try testing AJAX calls (provided by the Javascript I just mentioned) in Capybara and Spec. The database doesn''t seem to update. Because of the cluster nature of testing, I can''t have a clear understanding of what exactly is being run and loaded on the Dummy App. I was thinking about running the Dummy App as a standalone app and verify what is being rendered via the web browser (sort of manually checking things out). But that wasn''t possible because of a Gemfile not found error every time I try running ''rails s'' within the spec/dummy folder. So my question: is there another way to check why the AJAX calls are not working in my test cases(although when I run the app normally the AJAX calls are working just fine). On Aug 25, 7:49 pm, Ryan Bigg <radarliste...@gmail.com> wrote:> A short guess: Something is not calling "Bundler.require(Rails.env, :default)" as what would normally happen in Rails, like in the default config/application.rb. Does putting this line in your engine.rb make it work? > > > > > > > > On Friday, 26 August 2011 at 9:19 AM, Wolfram Arnold, RubyFocus wrote: > > I''m building a Rails 3.1 mountable engine (3.1.0.rc6) whose sole > > purpose is to provides JavaScript assets (a client-side app built with > > backbone.js). I generated the skeleton with "rails plugin new <name> -- > > full" > > > Piotr''s posts have been very helpful, as has the Railscast on the > > subject: > >http://piotrsarnacki.com/2010/09/14/mountable-engines/ > >http://piotrsarnacki.com/2010/12/21/mountable-apps-tutorial/ > >http://railscasts.com/episodes/277-mountable-engines/ > > > I''m specifying a number of dependencies in the .gemspec file: > > > s.add_dependency "rails", "~> 3.1.0.rc6" > > s.add_dependency "jquery-rails", "~> 1.0.13" > > s.add_dependency "backbone-rails", "~> 0.5.2" > > > s.add_dependency "coffee-rails", "~> 3.1.0.rc6" > > s.add_dependency "sass-rails", "~> 3.1.0.rc6" > > s.add_dependency "uglifier", "~> 1.0.1" > > > # Needed to run test suite(s) or development server (which will > > serve the app in spec/dummy) > > s.add_development_dependency "sqlite3", "~> 1.3.4" > > s.add_development_dependency "jasmine", "~> 1.1.0.rc3" # not getting > > picked up? > > s.add_development_dependency "rspec-rails", "~> 2.6.1" # not > > getting picked up? > > s.add_development_dependency "haml", "~> 3.1.2" # not getting > > picked up? > > > The Gemfile looks like this: > > > source "http://rubygems.org" > > gemspec > > > When I run the "rails s" or "rails c" to launch the dummy app, e.g. > > the HAML gem is not available. If I explicitly add the HAML gem also > > to the engine''s Gemfile, then it is available. Same goes for the > > Jasmine gem (which provides rake tasks). > > > When I check the load path $:, I do see that all the gem paths > > from .gemspec are listed, however they don''t seem to have been > > require''d. > > > I''m wondering if this is a Rails bug. Somehow the gems listed > > in .gemspec only aren''t being initialized/loaded. I''m happy to dig > > into this more, but I''m not sure if this is broken or intended > > behavior. > > > Thanks, > > Wolf > > > -- > > You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. > > To post to this group, send email to rubyonrails-core@googlegroups.com (mailto:rubyonrails-core@googlegroups.com). > > To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com (mailto:rubyonrails-core+unsubscribe@googlegroups.com). > > For more options, visit this group athttp://groups.google.com/group/rubyonrails-core?hl=en.-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
Ryan Bigg
2011-Oct-06 22:55 UTC
Re: Re: Mountable Engine/App: gems from .gemspec not available in dummy app when started with "rails console/server"
Try running `rails s` from the root of the engine, rather than from within spec/dummy itself. There''s a `script/rails` file within the root of the engine that will make this possible. I will be sure to mention this in the in-progress engines guide. https://github.com/lifo/docrails/blob/master/railties/guides/source/engines.textile On Friday, 7 October 2011 at 5:20 AM, Mabounassif wrote:> I''m having the same sort of problem, I have a mountable engine that > provides Javascript assets, but while I try testing AJAX calls > (provided by the Javascript I just mentioned) in Capybara and Spec. > The database doesn''t seem to update. > > Because of the cluster nature of testing, I can''t have a clear > understanding of what exactly is being run and loaded on the Dummy > App. I was thinking about running the Dummy App as a standalone app > and verify what is being rendered via the web browser (sort of > manually checking things out). But that wasn''t possible because of a > Gemfile not found error every time I try running ''rails s'' within the > spec/dummy folder. > > So my question: is there another way to check why the AJAX calls are > not working in my test cases(although when I run the app normally the > AJAX calls are working just fine). > > On Aug 25, 7:49 pm, Ryan Bigg <radarliste...@gmail.com (http://gmail.com)> wrote: > > A short guess: Something is not calling "Bundler.require(Rails.env, :default)" as what would normally happen in Rails, like in the default config/application.rb. Does putting this line in your engine.rb make it work? > > > > > > > > > > > > > > > > On Friday, 26 August 2011 at 9:19 AM, Wolfram Arnold, RubyFocus wrote: > > > I''m building a Rails 3.1 mountable engine (3.1.0.rc6) whose sole > > > purpose is to provides JavaScript assets (a client-side app built with > > > backbone.js). I generated the skeleton with "rails plugin new <name> -- > > > full" > > > > > Piotr''s posts have been very helpful, as has the Railscast on the > > > subject: > > > http://piotrsarnacki.com/2010/09/14/mountable-engines/ > > > http://piotrsarnacki.com/2010/12/21/mountable-apps-tutorial/ > > > http://railscasts.com/episodes/277-mountable-engines/ > > > > > I''m specifying a number of dependencies in the .gemspec file: > > > > > s.add_dependency "rails", "~> 3.1.0.rc6" > > > s.add_dependency "jquery-rails", "~> 1.0.13" > > > s.add_dependency "backbone-rails", "~> 0.5.2" > > > > > s.add_dependency "coffee-rails", "~> 3.1.0.rc6" > > > s.add_dependency "sass-rails", "~> 3.1.0.rc6" > > > s.add_dependency "uglifier", "~> 1.0.1" > > > > > # Needed to run test suite(s) or development server (which will > > > serve the app in spec/dummy) > > > s.add_development_dependency "sqlite3", "~> 1.3.4" > > > s.add_development_dependency "jasmine", "~> 1.1.0.rc3" # not getting > > > picked up? > > > s.add_development_dependency "rspec-rails", "~> 2.6.1" # not > > > getting picked up? > > > s.add_development_dependency "haml", "~> 3.1.2" # not getting > > > picked up? > > > > > The Gemfile looks like this: > > > > > source "http://rubygems.org" > > > gemspec > > > > > When I run the "rails s" or "rails c" to launch the dummy app, e.g. > > > the HAML gem is not available. If I explicitly add the HAML gem also > > > to the engine''s Gemfile, then it is available. Same goes for the > > > Jasmine gem (which provides rake tasks). > > > > > When I check the load path $:, I do see that all the gem paths > > > from .gemspec are listed, however they don''t seem to have been > > > require''d. > > > > > I''m wondering if this is a Rails bug. Somehow the gems listed > > > in .gemspec only aren''t being initialized/loaded. I''m happy to dig > > > into this more, but I''m not sure if this is broken or intended > > > behavior. > > > > > Thanks, > > > Wolf > > > > > -- > > > You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. > > > To post to this group, send email to rubyonrails-core@googlegroups.com (mailto:rubyonrails-core@googlegroups.com). > > > To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com (mailto:rubyonrails-core+unsubscribe@googlegroups.com). > > > For more options, visit this group athttp://groups.google.com/group/rubyonrails-core?hl=en. > > -- > You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. > To post to this group, send email to rubyonrails-core@googlegroups.com (mailto:rubyonrails-core@googlegroups.com). > To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com (mailto:rubyonrails-core+unsubscribe@googlegroups.com). > For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
nzifnab
2011-Oct-11 22:37 UTC
Re: Mountable Engine/App: gems from .gemspec not available in dummy app when started with "rails console/server"
I''m having a similar problem. I have an engine with these in
the .gemspec file:
s.add_dependency "rails", "~> 3.1.0"
s.add_dependency "haml-rails" # <-- Doesn''t seem to be
seen in
dummy app?
s.add_dependency "sass-rails"
s.add_dependency "jquery-rails"
s.add_development_dependency "rspec-rails", "~> 2.6.1"
s.add_development_dependency "capybara"
s.add_development_dependency "vcr", "~> 1.6.0"
s.add_development_dependency "webmock", "~> 1.6.2"
In the dummy app I tried adding this to application.html.erb:
= render :partial => ''passport/shared/topbar''
In my engine the file is located in "app/views/passport/shared/
_topbar.html.haml"
When I run rails s (from the engine root, not the dummy app root) I
get this error:
Missing partial passport/shared/topbar with
{:handlers=>[:erb, :builder], :formats=>[:html], :locale=>[:en, :en]}.
Searched in:
* "/Users/nbenes/projects/passport/spec/dummy/app/views"
* "/Users/nbenes/projects/passport/app/views"
It looks like it''s only running erb, and not haml, do you know what
I''m doing wrong? =/
On Oct 6, 4:55 pm, Ryan Bigg <radarliste...@gmail.com>
wrote:> Try running `rails s` from the root of the engine, rather than from within
spec/dummy itself. There''s a `script/rails` file within the root of the
engine that will make this possible.
>
> I will be sure to mention this in the in-progress engines
guide.https://github.com/lifo/docrails/blob/master/railties/guides/source/e...
>
>
>
>
>
>
>
> On Friday, 7 October 2011 at 5:20 AM, Mabounassif wrote:
> > I''m having the same sort of problem, I have a mountable
engine that
> > provides Javascript assets, but while I try testing AJAX calls
> > (provided by the Javascript I just mentioned) in Capybara and Spec.
> > The database doesn''t seem to update.
>
> > Because of the cluster nature of testing, I can''t have a
clear
> > understanding of what exactly is being run and loaded on the Dummy
> > App. I was thinking about running the Dummy App as a standalone app
> > and verify what is being rendered via the web browser (sort of
> > manually checking things out). But that wasn''t possible
because of a
> > Gemfile not found error every time I try running ''rails
s'' within the
> > spec/dummy folder.
>
> > So my question: is there another way to check why the AJAX calls are
> > not working in my test cases(although when I run the app normally the
> > AJAX calls are working just fine).
>
> > On Aug 25, 7:49 pm, Ryan Bigg <radarliste...@gmail.com
(http://gmail.com)> wrote:
> > > A short guess: Something is not calling
"Bundler.require(Rails.env, :default)" as what would normally happen
in Rails, like in the default config/application.rb. Does putting this line in
your engine.rb make it work?
>
> > > On Friday, 26 August 2011 at 9:19 AM, Wolfram Arnold, RubyFocus
wrote:
> > > > I''m building a Rails 3.1 mountable engine
(3.1.0.rc6) whose sole
> > > > purpose is to provides JavaScript assets (a client-side app
built with
> > > > backbone.js). I generated the skeleton with "rails
plugin new <name> --
> > > > full"
>
> > > > Piotr''s posts have been very helpful, as has the
Railscast on the
> > > > subject:
> > > >http://piotrsarnacki.com/2010/09/14/mountable-engines/
> > > >http://piotrsarnacki.com/2010/12/21/mountable-apps-tutorial/
> > > >http://railscasts.com/episodes/277-mountable-engines/
>
> > > > I''m specifying a number of dependencies in the
.gemspec file:
>
> > > > s.add_dependency "rails", "~>
3.1.0.rc6"
> > > > s.add_dependency "jquery-rails", "~>
1.0.13"
> > > > s.add_dependency "backbone-rails", "~>
0.5.2"
>
> > > > s.add_dependency "coffee-rails", "~>
3.1.0.rc6"
> > > > s.add_dependency "sass-rails", "~>
3.1.0.rc6"
> > > > s.add_dependency "uglifier", "~>
1.0.1"
>
> > > > # Needed to run test suite(s) or development server (which
will
> > > > serve the app in spec/dummy)
> > > > s.add_development_dependency "sqlite3",
"~> 1.3.4"
> > > > s.add_development_dependency "jasmine",
"~> 1.1.0.rc3" # not getting
> > > > picked up?
> > > > s.add_development_dependency "rspec-rails",
"~> 2.6.1" # not
> > > > getting picked up?
> > > > s.add_development_dependency "haml", "~>
3.1.2" # not getting
> > > > picked up?
>
> > > > The Gemfile looks like this:
>
> > > > source "http://rubygems.org"
> > > > gemspec
>
> > > > When I run the "rails s" or "rails c" to
launch the dummy app, e.g.
> > > > the HAML gem is not available. If I explicitly add the HAML
gem also
> > > > to the engine''s Gemfile, then it is available. Same
goes for the
> > > > Jasmine gem (which provides rake tasks).
>
> > > > When I check the load path $:, I do see that all the gem
paths
> > > > from .gemspec are listed, however they don''t seem
to have been
> > > > require''d.
>
> > > > I''m wondering if this is a Rails bug. Somehow the
gems listed
> > > > in .gemspec only aren''t being initialized/loaded.
I''m happy to dig
> > > > into this more, but I''m not sure if this is broken
or intended
> > > > behavior.
>
> > > > Thanks,
> > > > Wolf
>
> > > > --
> > > > You received this message because you are subscribed to the
Google Groups "Ruby on Rails: Core" group.
> > > > To post to this group, send email to
rubyonrails-core@googlegroups.com (mailto:rubyonrails-core@googlegroups.com).
> > > > To unsubscribe from this group, send email to
rubyonrails-core+unsubscribe@googlegroups.com
(mailto:rubyonrails-core+unsubscribe@googlegroups.com).
> > > > For more options, visit this group
athttp://groups.google.com/group/rubyonrails-core?hl=en.
>
> > --
> > You received this message because you are subscribed to the Google
Groups "Ruby on Rails: Core" group.
> > To post to this group, send email to rubyonrails-core@googlegroups.com
(mailto:rubyonrails-core@googlegroups.com).
> > To unsubscribe from this group, send email to
rubyonrails-core+unsubscribe@googlegroups.com
(mailto:rubyonrails-core+unsubscribe@googlegroups.com).
> > For more options, visit this group
athttp://groups.google.com/group/rubyonrails-core?hl=en.
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Core" group.
To post to this group, send email to rubyonrails-core@googlegroups.com.
To unsubscribe from this group, send email to
rubyonrails-core+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/rubyonrails-core?hl=en.
Andrey Eremin
2013-Apr-09 07:54 UTC
Re: Mountable Engine/App: gems from .gemspec not available in dummy app when started with "rails console/server"
Finally i fixed it by adding necessary require ''....'' calls to the top of my engine.rb file as it mentioned in http://edgeguides.rubyonrails.org/engines.html#other-gem-dependencies пятница, 26 августа 2011 г., 3:19:16 UTC+4 пользователь Wolfram Arnold, RubyFocus написал:> > I''m building a Rails 3.1 mountable engine (3.1.0.rc6) whose sole > purpose is to provides JavaScript assets (a client-side app built with > backbone.js). I generated the skeleton with "rails plugin new <name> -- > full" > > Piotr''s posts have been very helpful, as has the Railscast on the > subject: > http://piotrsarnacki.com/2010/09/14/mountable-engines/ > http://piotrsarnacki.com/2010/12/21/mountable-apps-tutorial/ > http://railscasts.com/episodes/277-mountable-engines/ > > I''m specifying a number of dependencies in the .gemspec file: > > s.add_dependency "rails", "~> 3.1.0.rc6" > s.add_dependency "jquery-rails", "~> 1.0.13" > s.add_dependency "backbone-rails", "~> 0.5.2" > > s.add_dependency "coffee-rails", "~> 3.1.0.rc6" > s.add_dependency "sass-rails", "~> 3.1.0.rc6" > s.add_dependency "uglifier", "~> 1.0.1" > > # Needed to run test suite(s) or development server (which will > serve the app in spec/dummy) > s.add_development_dependency "sqlite3", "~> 1.3.4" > s.add_development_dependency "jasmine", "~> 1.1.0.rc3" # not getting > picked up? > s.add_development_dependency "rspec-rails", "~> 2.6.1" # not > getting picked up? > s.add_development_dependency "haml", "~> 3.1.2" # not getting > picked up? > > The Gemfile looks like this: > > source "http://rubygems.org" > gemspec > > > When I run the "rails s" or "rails c" to launch the dummy app, e.g. > the HAML gem is not available. If I explicitly add the HAML gem also > to the engine''s Gemfile, then it is available. Same goes for the > Jasmine gem (which provides rake tasks). > > When I check the load path $:, I do see that all the gem paths > from .gemspec are listed, however they don''t seem to have been > require''d. > > I''m wondering if this is a Rails bug. Somehow the gems listed > in .gemspec only aren''t being initialized/loaded. I''m happy to dig > into this more, but I''m not sure if this is broken or intended > behavior. > > Thanks, > Wolf-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-core+unsubscribe@googlegroups.com. To post to this group, send email to rubyonrails-core@googlegroups.com. Visit this group at http://groups.google.com/group/rubyonrails-core?hl=en. For more options, visit https://groups.google.com/groups/opt_out.