Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

"rails {app} -g" doesn't work

#2313

In 3-0-unstable branch, rails command with -g/--git option doesn't work because of invalid paths.

A patch is attached to fix the issue.

Reported by ujihisa · March 23rd, 2009 @ 04:30 PM

State: invalid
Milestone: 3.0.2
Assigned to: Jeremy Kemper Jeremy Kemper
Importance: none

Activity

  1. David Trasbo
    David Trasbo

    Your patch no longer applies. I've made a new one that does a git init unless the --skip-git option is specified.

    April 10th, 2010 @ 08:25 PM

  2. Ryan Bigg
    Ryan Bigg

    Patch does not apply cleanly:

    /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.0.0.beta3/lib/rails/generators/actions.rb:134:in `git': undefined method `each' for "init":String (NoMethodError)
      from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.0.0.beta3/lib/rails/generators/rails/app/app_generator.rb:189:in `initialize_git'
      from /usr/local/lib/ruby/gems/1.9.1/gems/thor-0.13.4/lib/thor/task.rb:33:in `run'
      from /usr/local/lib/ruby/gems/1.9.1/gems/thor-0.13.4/lib/thor/invocation.rb:109:in `block in invoke'
      from /usr/local/lib/ruby/gems/1.9.1/gems/thor-0.13.4/lib/thor/invocation.rb:118:in `each'
      from /usr/local/lib/ruby/gems/1.9.1/gems/thor-0.13.4/lib/thor/invocation.rb:118:in `map'
      from /usr/local/lib/ruby/gems/1.9.1/gems/thor-0.13.4/lib/thor/invocation.rb:118:in `invoke'
      from /usr/local/lib/ruby/gems/1.9.1/gems/thor-0.13.4/lib/thor/group.rb:36:in `block in start'
      from /usr/local/lib/ruby/gems/1.9.1/gems/thor-0.13.4/lib/thor/base.rb:378:in `start'
      from /usr/local/lib/ruby/gems/1.9.1/gems/thor-0.13.4/lib/thor/group.rb:29:in `start'
      from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.0.0.beta3/lib/rails/commands/application.rb:13:in `<top (required)>'
      from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.0.0.beta3/bin/rails:30:in `require'
      from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.0.0.beta3/bin/rails:30:in `<top (required)>'
      from /usr/local/bin/rails:19:in `load'
      from /usr/local/bin/rails:19:in `<main>'
    

    I am investigating a resolution now.

    April 10th, 2010 @ 11:38 PM

  3. Ryan Bigg
    Ryan Bigg

    Quite simple, just need to array-ify the argument passed to git.

    This patch applies cleanly and works as expected beside an unrelated bug of double generation of application.html.erb.

    April 10th, 2010 @ 11:47 PM

  4. Ryan Bigg
    Ryan Bigg
    • State changed from new to open

    April 10th, 2010 @ 11:49 PM

  5. Ryan Bigg
  6. David Trasbo
    David Trasbo

    It's another case of "works on my machine" but my theory is that it's because I'm running Ruby 1.8.7 and you're running 1.9.1, as far as I can tell from the stack trace. Might want to look into causing it inside that git method.

    April 11th, 2010 @ 12:40 PM

  7. Ryan Bigg
    Ryan Bigg

    Well, quite simply:

      def git(command={})
        if command.is_a?(Symbol)
          run "git #{command}"
        else
          command.each do |command, options|
            run "git #{command} #{options}"
          end
        end
      end
    

    It should be passed a symbol and not a string.

    Attached is a patch to this effect.

    April 11th, 2010 @ 12:46 PM

  8. Rohit Arondekar
    Rohit Arondekar

    Not reproducible on Rails 3.0.0.beta3 since -g option is not available AFAIK. rails --help does not list -g as an option.

    May 10th, 2010 @ 02:26 AM

  9. Ryan Bigg
    Ryan Bigg
    • State changed from open to invalid

    There is no more -g option as far as I can tell, only a -G option which skips git.

    In a default Rails application, there is a .gitignore file automatically included.

    Marking as invalid.

    May 10th, 2010 @ 02:27 AM

  10. Jeremy Kemper
    Jeremy Kemper
    • Milestone set to 3.0.2
    • Importance changed from to

    October 15th, 2010 @ 11:01 PM