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

Rake tasks #1109

Closed
dariocravero opened this issue Mar 11, 2013 · 9 comments
Closed

Rake tasks #1109

dariocravero opened this issue Mar 11, 2013 · 9 comments
Milestone

Comments

@dariocravero
Copy link

With the separation of rake tasks and the need to require them explicity, I find it a bit confusing that the following commands don't do the same:

bundle exec padrino rake ar:migrate

vs

bundle exec rake ar:migrate

If I don't bundle exec the call rake ar:migrate it fails because I'm it wouldn't load the rest of the requirements but I reckon that's fine.

Now, my question is: shouldn't the two above at least be the same?

@skade
Copy link
Contributor

skade commented Mar 11, 2013

Could you please show be the error that it is throwing? ar:migrate depends on enviroment, so it should actually load it.

@dariocravero
Copy link
Author

@daris.local➜  haml-app  bundle exec padrino rake ar:migrate
=> Executing Rake ar:migrate ...
Loading activerecord tasks automatically.
This functionality will be disabled in future versions. Please put

   PadrinoTasks.use(:activerecord)
   PadrinoTasks.init

and remove

   require File.expand_path('../config/boot.rb', __FILE__)

in you Rakefile instead.
Loading database tasks automatically.
This functionality will be disabled in future versions. Please put

   PadrinoTasks.use(:database)
   PadrinoTasks.init

and remove

   require File.expand_path('../config/boot.rb', __FILE__)

in you Rakefile instead.
  DEBUG -   (0.1ms)  SELECT "schema_migrations"."version" FROM "schema_migrations"
   INFO -  Migrating to CreateAccounts (1)
   INFO -  Migrating to CreateTests (2)
   INFO -  Migrating to CreateTestdas (3)
  DEBUG -   (0.1ms)  select sqlite_version(*)
  DEBUG -   (0.1ms)  SELECT "schema_migrations"."version" FROM "schema_migrations"
@daris.local➜  haml-app  bundle exec rake ar:migrate
  DEBUG -   (0.1ms)  SELECT "schema_migrations"."version" FROM "schema_migrations"
   INFO -  Migrating to CreateAccounts (1)
   INFO -  Migrating to CreateTests (2)
   INFO -  Migrating to CreateTestdas (3)
  DEBUG -   (0.1ms)  select sqlite_version(*)
  DEBUG -   (0.1ms)  SELECT "schema_migrations"."version" FROM "schema_migrations"
@daris.local➜  haml-app  rake ar:migrate
rake aborted!
undefined method `use' for PadrinoTasks:Module
/Users/daris/Documents/uxtemple/opensource/admins/haml-app/Rakefile:3:in `<top (required)>'
(See full trace by running task with --trace)
@daris.local➜  haml-app

@dariocravero
Copy link
Author

@daris.local➜  haml-app  cat Rakefile
require 'padrino-core/cli/rake'

PadrinoTasks.use(:activerecord)
PadrinoTasks.use(:database)
PadrinoTasks.init

@dariocravero
Copy link
Author

On padrino rake .... it's not really an error but a warning

@skade
Copy link
Contributor

skade commented Mar 11, 2013

Seems like padrino-core/cli/rake doesn't load PadrinoTasks fully :(. This is definitely a bug.

@dariocravero
Copy link
Author

I reckon we should look into it to release 0.11.0?

@skade
Copy link
Contributor

skade commented Mar 11, 2013

Yes.

@skade
Copy link
Contributor

skade commented Mar 12, 2013

The first bug (bare rake) is due to rake picking up the external "padrino" that you installed as gem. Try the following:

bundle install --binstubs
bin/rake -T

Works. This will go a away in the release version.

What bothers me is that padrino rake -T warns because of autoloading.

@skade skade closed this as completed in 2dbcc2d Mar 12, 2013
@nesquena
Copy link
Member

Nice!

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

No branches or pull requests

3 participants