Closed selectport closed 14 years ago
What error do you get specifically when trying to start the application using padrino-dev?
let me know if you need more info or transcript of irc session with arthur.
Ok so error is:
/Users/sre/.rvm/rubies/ruby-1.8.7-p249/lib/ruby/site_ruby/1.8/rubygems.rb:777:in `report_activate_error': Could not find RubyGem padrino-core (>= 0) (Gem::LoadError)
from /Users/sre/.rvm/rubies/ruby-1.8.7-p249/lib/ruby/site_ruby/1.8/rubygems.rb:211:in `activate'
from /Users/sre/.rvm/rubies/ruby-1.8.7-p249/lib/ruby/site_ruby/1.8/rubygems.rb:1056:in `gem'
from /users/sre/work/padre/vendor/bin/padrino:18
Odd that the padrino binary seems to be having trouble locating padrino-core gem in these instances? DAddYE, any idea why this might be happening?
Hello!
Installing from git per the Bleeding Edge guide appears to work properly, however padrino-dev start does fails (randomly?)
Mmm, Im using only padrino-dev in my env from the git checkout without any problem, can you paste me an error that occur?
Then for other problem related to bundle install
you can't use "padrino-dev" because is intended to work from a git checkout. In your case you need only to invoke bin with vendor/bin/padrino start
this due to fact that bundler need their own env.
This is my working session:
$ gem install bundler padrino Successfully installed bundler-0.9.24 Successfully installed padrino-core-0.9.10 Successfully installed padrino-helpers-0.9.10 Successfully installed padrino-mailer-0.9.10 Successfully installed padrino-gen-0.9.10 Successfully installed padrino-admin-0.9.10 Successfully installed padrino-0.9.10 $ padrino g project foo $ cd foo $ bundle install vendor --disable-shared-gems ... Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed. $ vendor/bin/padrino start => Located unlocked Gemfile for development => Padrino/0.9.10 has taken the stage development on port 3000 >> Thin web server (v1.2.7 codename No Hup) >> Maximum connections set to 1024 >> Listening on localhost:3000, CTRL+C to stop
Does this work also for you?
No. Here's the setup : on a machine with just these gems installed :
* LOCAL GEMS *
passenger (2.2.11) rack (1.1.0) rack-test (0.5.3) rake (0.8.7) rdoc (2.5) rjb (1.2.0) rspec (1.3.0) rubygems-update (1.3.6) sequel (3.10.0) shotgun (0.6) sinatra (1.0) sqlite3-ruby (1.2.5)
I want to run a padrino app without requiring "external" gems; to simulate this i did the following :
$ gem install padrino $ padrino-gen project app -d sequel $ cd app $ bundle install vendor --disable-shared-gems $ bundle lock $ bundle show padrino # to confirm everything is in vendor/* and app is using this $ gem uninstall padrino # (and all the gems that got installed beyond my base set)
so at this point, in theory, i should be able to run the app via your suggestion :
$ cd app $ vendor/bin/padrino start
which fails as before with :
/Users/sre/.rvm/rubies/ruby-1.8.7-p249/lib/ruby/site_ruby/1.8/rubygems.rb:777:in report_activate_error': Could not find RubyGem padrino-core (>= 0) (Gem::LoadError) from /Users/sre/.rvm/rubies/ruby-1.8.7-p249/lib/ruby/site_ruby/1.8/rubygems.rb:211:in
activate'
from /Users/sre/.rvm/rubies/ruby-1.8.7-p249/lib/ruby/site_ruby/1.8/rubygems.rb:1056:in `gem'
from vendor/bin/padrino:18
it also fails if i $ alias padrino-dev="users/sre/work/app/vendor/bin/padrino"
BUT : as per Arthur's suggestion, if I $ shotgun config.ru
everything cranks up and runs as expected.
So my diagnosis is that it works ok if you have the gems installed at o/s level (since if i do all the above but do NOT delete the gems and instead leave both the gems at o/s and the gems in locked vendor/* - everything works ok.
I did basically the same thing 2 days ago using git install on edge and had pretty much exactly the same experience (except for the locked bundle piece) - ie if the gems were installed AND i did edge install, it worked; but if i didn't have the gems installed and only had the edge installed, it failed with the same error.
Let me know if you need more from me ...
Thanks Scott Eckenrode
Additional information -
padrino rake test and padrino rake spec are failing also !
/Users/sre/Work/psim/vendor/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in require': no such file to load -- action_controller (MissingSourceFile) from /Users/sre/Work/psim/vendor/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in
require'
from /Users/sre/Work/psim/vendor/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:521:in new_constants_in' from /Users/sre/Work/psim/vendor/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in
require'
from ./vendor/gems/haml-2.2.23/test/haml/../linked_rails.rb:10
from /Users/sre/Work/psim/vendor/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in require' from /Users/sre/Work/psim/vendor/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in
require'
from /Users/sre/Work/psim/vendor/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:521:in new_constants_in' from /Users/sre/Work/psim/vendor/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in
require'
from ./vendor/gems/haml-2.2.23/test/haml/../test_helper.rb:2
from /Users/sre/Work/psim/vendor/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in require' from /Users/sre/Work/psim/vendor/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in
require'
from /Users/sre/Work/psim/vendor/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:521:in new_constants_in' from /Users/sre/Work/psim/vendor/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in
require'
from ./vendor/gems/haml-2.2.23/test/haml/engine_test.rb:3
from /Users/sre/Work/psim/vendor/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:145:in load_without_new_constant_marking' from /Users/sre/Work/psim/vendor/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:145:in
load'
from /Users/sre/Work/psim/vendor/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:521:in new_constants_in' from /Users/sre/Work/psim/vendor/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:145:in
load'
from /Users/sre/Work/psim/vendor/gems/rake-0.8.7/lib/rake/rake_test_loader.rb:5
from /Users/sre/Work/psim/vendor/gems/rake-0.8.7/lib/rake/rake_test_loader.rb:5:in each' from /Users/sre/Work/psim/vendor/gems/rake-0.8.7/lib/rake/rake_test_loader.rb:5 rake aborted! Command failed with status (1): [/Users/sre/.rvm/rubies/ruby-1.8.7-p249/bin...] /Users/sre/Work/psim/vendor/gems/padrino-core-0.9.10/lib/padrino-core/cli/rake.rb:9:in
init'
To see if this was because of the locked gems issue, on my dev machine with full gem install of padrino, i created a new project, gen'd the admin, did NOT bundle install --disable-shared-gems and did not lock, ran padrino rake spec and it worked; i then bundle install --disable-shared-gems and bundle lock and now when running padrino rake spec i get a similar issue .... so it looks like locking to local bundle even with gems installed causes issues ....
Yep in this case you need to use bundle exec
like:
bundle exec vendor/bin/padrino start
This works ?
Yeah, I was going to say once you have locked everything into your bundler environment and you want to bypass the system, you should probably use bundle exec binary
as described on the bundler website
Run a script provided by a bundled gem
$ bundle exec padrino start
This should load the environment properly and allow start to run.
Yep also for rake tasks you need to use:
$ bundle exec vendor/bin/padrino rake -T => Executing Rake -T ... rake routes[query] # Displays a listing of the named routes within a project rake seed # Load the seed data from db/seeds.rb rake spec # Run specs
Yea thanks Nathan I see now that you can simply use:
bundle exec padrino start bundle exec padrino rake -T ...
Yeah, that makes a lot of sense and follows with what I would expect from bundler. If this fixes the issues then this ticket can probably be closed?
well... bundle exec padrino start and bundle exec padrino rake -T work - so that's solved; but on plain install with admin gen'd in, padrino rake spec works; but after locking gems into vendor, bundle exec padrino rake spec fails, now with same kind of error but on fuzzy_hash
$ bundle exec padrino rake spec
=> Executing Rake spec ...
=> Located locked Gemfile for test
./vendor/gems/fuzzyhash-0.0.11/spec/fuzzy_hash_spec.rb:1:in require': no such file to load -- lib/fuzzy_hash (LoadError) from ./vendor/gems/fuzzyhash-0.0.11/spec/fuzzy_hash_spec.rb:1 from /Users/sre/Work/pscott/vendor/gems/rspec-1.3.0/lib/spec/runner/example_group_runner.rb:15:in
load'
from /Users/sre/Work/pscott/vendor/gems/rspec-1.3.0/lib/spec/runner/example_group_runner.rb:15:in load_files' from /Users/sre/Work/pscott/vendor/gems/rspec-1.3.0/lib/spec/runner/example_group_runner.rb:14:in
each'
from /Users/sre/Work/pscott/vendor/gems/rspec-1.3.0/lib/spec/runner/example_group_runner.rb:14:in load_files' from /Users/sre/Work/pscott/vendor/gems/rspec-1.3.0/lib/spec/runner/options.rb:133:in
run_examples'
from /Users/sre/Work/pscott/vendor/gems/rspec-1.3.0/lib/spec/runner/command_line.rb:9:in `run'
from /Users/sre/Work/pscott/vendor/gems/rspec-1.3.0/bin/spec:5
rake aborted!
(last line of stack dump was cutoff : /Users/sre/Work/pscott/vendor/gems/padrino-core-0.9.10/lib/padrino-core/cli/rake.rb:9:in `init'
And note, this is on a machine with both gems loaded at o/s and locked to vendor ... am i pushing locking gems too far ?
Can you try to add to your Gemfile this: gem 'fuzzy_hash'
adding gem 'fuzzy_hash' to Gemfile fails when i try to bundle lock again; fails saying it can't find gem fuzzy_hash; i confirmed that fuzzyhash gem was in vendor; changed line in Gemfile to : gem 'fuzzyhash' and this time bundle lock worked, but then the bundle exec padrino rake spec fails still looking for fuzzy_hash (note underscore); also testing bundle show fuzzyhash works; bundle show fuzzy_hash does not ...
Damn! Found a little bug ... but the fix is super simpler.
Edit your_app/spec/spec.rake
and change this:
t.spec_files = Dir['**/*_spec.rb']
into
t.spec_files = Dir['spec/**/*_spec.rb']
and should work super well!
Also looks like it should be:
gem 'fuzzyhash', :require => 'fuzzy_hash'
since the gem is called fuzzyhash and the file is fuzzy_hash.rb
Damn! Found a little bug ... but the fix is super simpler.
Ah that explains the problem anyways, that change should help alot. We def need to patch that in padrino too.
changing the spec.rake file worked; then i removed the gem fuzzyhash line for Gemfile and that still worked - so i'm assuming we don't need that line in there afterall
Yeah, fuzzyhash line is not needed, the error was due to that typo which I fixed here: be36be8e8b653c0d4be6218cfde97b7d18be705f
Does that mean that using bundle exec
everything seems to work for you now as expected? Can we close this?
so i guess with these 2 notes : 1) if you bundle lock, you have to prefix bundle exec to all the padrino commands (or alias them to do that) in order for it to work; and 2) bugfix on test/spec rake commands ....
i think this can be closed ! thanks !
i think if you're in agreement, i'll add the note to the google note on locking gems about using the bundle exec ... unless you have a more elegant solution in mind ! as a side note, having used rake for so long, having to do padrino rake was hurting my muscle memory ... having to do bundle exec padrino rake will hurt more so ! i'll just have to alias something like prake="bundle exec padrino rake" and get used to it ... i tried the trick you have in the rakefile guide to invoke rake directly, but for some reason (probably thor, which i'm not familiar with) it doubled my rake tasks .... and i don't want to alias the rake command in general (since i rake other non padrino stuff) ... not an issue, just feedback. thanks guys for both the framework and your help on this ! scott
Thanks Scott for this feedback I will try to build a short alias for do what you need.
Btw remember that also if you build a RakeFile you need always:
bundle exec rake some
The main issue now is fixed.
Installing from git per the Bleeding Edge guide appears to work properly, however padrino-dev start does fails (randomly?); a similar issue was discovered using bundle install and bundle lock to pull the gems into the directory tree; then aliasing padrino-dev to point to the .bundle/bin padrino command fails on padrino-dev start. Starting the app from rack directly (eg. shotgun config.ru) works fine - so problem appears to be in invoking the start command from a non-gem install. Problem worked around via IRC chat of 4/22 with achiu and eckenrode ...