This project is archived and is in readonly mode.

#2313 ✓invalid
ujihisa

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

Reported by ujihisa | March 23rd, 2009 @ 04:30 PM | in 3.0.2

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.

Comments and changes to this ticket

  • David Trasbo

    David Trasbo April 10th, 2010 @ 08:25 PM

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

  • Ryan Bigg

    Ryan Bigg April 10th, 2010 @ 11:38 PM

    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.

  • Ryan Bigg

    Ryan Bigg April 10th, 2010 @ 11:47 PM

    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.

  • Ryan Bigg

    Ryan Bigg April 10th, 2010 @ 11:49 PM

    • State changed from “new” to “open”
  • Ryan Bigg
  • David Trasbo

    David Trasbo April 11th, 2010 @ 12:40 PM

    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.

  • Ryan Bigg

    Ryan Bigg April 11th, 2010 @ 12:46 PM

    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.

  • Rohit Arondekar

    Rohit Arondekar May 10th, 2010 @ 02:26 AM

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

  • Ryan Bigg

    Ryan Bigg May 10th, 2010 @ 02:27 AM

    • 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.

  • Jeremy Kemper

    Jeremy Kemper October 15th, 2010 @ 11:01 PM

    • Milestone set to 3.0.2
    • Importance changed from “” to “”

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

People watching this ticket

Pages