This project is archived and is in readonly mode.
--database option broken
-
Grzegorz Kazulak
That should solve it. Set's the default for app_path to the current dir.
-
Prem Sichanugrist (sikachu)
- State changed from new to resolved
-
Sam Ruby
- Milestone cleared.
- State changed from resolved to open
I'm still seeing this with the latest 3.0pre...
-
Prem Sichanugrist (sikachu)
- State changed from open to wontfix
optionsfor the generator in rails 3.0pre is required to be appended after application name. So it should be$ruby $RAILS/railties/bin/rails depot --database=mysql -
Prem Sichanugrist (sikachu)
- State changed from wontfix to invalid
I wish I could get it right this time ...
-
guns
options for the generator in rails 3.0pre is required to be appended after application name.
I'd like to point out that this is counterintuitive to longtime shell users. I know that Thor is being used as a replacement for OptionParser, but I feel unhappy that it doesn't support OptionParser's flexibility.
-
Ryan Bigg
- State changed from invalid to open
This has stung me a couple of times too, but there are other programs out there that accept command lines in a specific order. It should be sensible that the operator of the rails command comes after the name, followed by the options to apply to it. See commands like:
git reset --hard <commit>are not
git <commit> --hard resetfor a reason. It is conventional to have them in a certain way, and Rails IS "convention over configuration".
Perhaps the error message should be more intuitive though.
-
Prem Sichanugrist (sikachu)
As I stated, this is actually a bug of
Thor. We need to look at howThorparse those arguments, and patch it instead.I feel a bit awkward too, having to specify the argument after application name. How can people send patch to
Thorthen? Github? -
Yehuda Katz (wycats)
- Assigned user set to José Valim
-
Yehuda Katz (wycats)
- State changed from open to invalid
This should be taken up with Thor. Let's see what we can do :)
-
guns
As I stated, this is actually a bug of Thor
Well, having used rails 3 for a few months now, I take back my whining from earlier. I actually stepped through the Thor initialization back in January to patch it, but I realized it was unnecessary, as Thor is more a Rake replacement than an OptionParser replacement.
The only confusion is that years of rails tutorials have ingrained in people to create an app with
rails -d mydb myapp(even though the inverse would have worked just fine)Perhaps the error message should be more intuitive though.
I think a deprecation message for
railswould be just fine, esp. if Yehuda or José don't really want to muck up Thor's options processing -
José Valim
This is not going to be fixed. Rails 3 scaffold and generators are incredibly flexible, you can hook in template engine, ORM and test framework and it will pull all the --options available in the hooks.
This means if you have a Datamapper ORM, all the options available to generate your ORM model are pulled in and available in scaffold.
The downside of this solution is that you have less flexibility when invoking it through the command line. You need to put arguments first and just then the --switches.
-
Sam Ruby
José: I may be misreading guns' comment, but I see him as suggesting that usage of options before the app name be deprecated -- in Rails 2.3.6.
-
José Valim
- State changed from invalid to open
- Milestone set to 2.3.6
That sounds good. What needs to be changed? Where Rails 2.3.6 is telling people to do the wrong way?
-
guns
This is alot of chatter from me for a misunderstanding, but...
I meant that
railsv3.0 should still fail, but with a deprecation message when a user tries to create a new application with options preceding arguments. Unless I'm mistaken, the rails 2.3 branch will not adopt Thor, so there is no need to warn users that may have no plans to upgrade to v3.0.I think this would avoid producing large amounts of confused users when rails 3 is officially released.
-
Prem Sichanugrist (sikachu)
- Milestone cleared.
Ok, I think to 'warn' the user for that would make sense. Can somebody provide the patch for it?
-
Ravinder Rana
Attached is the patch to show message if options are given before application name.
Unfortunately, i'm not able to get the test working for this fix. Tried for an hour but not could not figure out what's wrong with the following test:
def test_options_before_application_name_raises_an_error content = capture(:stderr){ run_generator(["--skip-activerecord", destination_root]) } assert_equal "Options should be given after the application name. For details run: rails --help\n", content endCan someone help to figure out the issue?
-
Ravinder Rana
Ignore the previous patch. Attached is the patch with test.
-
Ryan Bigg
This patch (even though with the wrong extension) applies cleanly and tests pass.
+1
-
Repository
- State changed from open to resolved
(from [e9a9ef094e84abfe6a0167e9255abcf5b63412d9]) warn user if options are given before application name [#3435 state:resolved]
Signed-off-by: José Valim jose.valim@gmail.com
http://github.com/rails/rails/commit/e9a9ef094e84abfe6a0167e9255abc...
