jweslley / rails_completion

Bash completion support for Ruby on Rails.
Other
105 stars 16 forks source link

Doesn't automatically create .rails_generators~ #1

Closed madhusudancs closed 13 years ago

madhusudancs commented 13 years ago

I have copied the rails.bash script from this repo to /etc/bash_completion.d/. I am using Ubuntu 10.10 and I always get the following error.

~/blog$ rails generate scainternal:lib/rubygems/custom_require:29:in require': no such file to load -- config/application (LoadError) from <internal:lib/rubygems/custom_require>:29:inrequire' from -:4:in `

' cat: .rails_generators~: No such file or directory

I tried creating the .rails_generators~ file in $HOME, /etc/bash_completion.d/ and rails_app/config but with no luck. I also tried to modify RAILSCOMP_FILE=".rails_generators~" to RAILSCOMP_FILE="$HOME/.rails_generators~" still with no luck. Can you please fix this issue?

jweslley commented 13 years ago

Hi Madhusudan,

What Rails version are you using? This completion requires Rails 3.

madhusudancs commented 13 years ago

Hi Jweslley, I am using rails 3.0.5. In fact, I have no clue what Rails 2.x is. When I started with Rails, the rails world had already moved to 3.x :)

jweslley commented 13 years ago

Hi Madhusudan, could you check if the "config/application.rb" file exists in your application? The only way I found to reproduce this error, was (re)moving this file.

madhusudancs commented 13 years ago

Hi Jweslley, I have application.rb in my config directory :( :

madhu@madhu:~/blog/config$ ls
application.rb  database.yml    environments  locales
boot.rb         environment.rb  initializers  routes.rb

Also this is the content of application.rb:

madhu@madhu:~/blog/config$ cat application.rb 
require File.expand_path('../boot', __FILE__)

require 'rails/all'

# If you have a Gemfile, require the gems listed there, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(:default, Rails.env) if defined?(Bundler)

module Blog
  class Application < Rails::Application
    # Settings in config/environments/* take precedence over those specified here.
    # Application configuration should go into files in config/initializers
    # -- all .rb files in that directory are automatically loaded.

    # Custom directories with classes and modules you want to be autoloadable.
    # config.autoload_paths += %W(#{config.root}/extras)

    # Only load the plugins named here, in the order given (default is alphabetical).
    # :all can be used as a placeholder for all plugins not explicitly named.
    # config.plugins = [ :exception_notification, :ssl_requirement, :all ]

    # Activate observers that should always be running.
    # config.active_record.observers = :cacher, :garbage_collector, :forum_observer

    # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
    # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
    # config.time_zone = 'Central Time (US & Canada)'

    # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
    # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
    # config.i18n.default_locale = :de

    # JavaScript files you want as :defaults (application.js is always included).
    # config.action_view.javascript_expansions[:defaults] = %w(jquery rails)

    # Configure the default encoding used in templates for Ruby 1.9.
    config.encoding = "utf-8"

    # Configure sensitive parameters which will be filtered from the log file.
    config.filter_parameters += [:password]
  end
end

If that helps at all.

jweslley commented 13 years ago

hum... What is your ruby's version? I'm using Ubuntu 10.10, ruby 1.8.7, ruby gems 1.8.7 and Rails 3.0.5; and it's works fine. :(

madhusudancs commented 13 years ago

Hi Jweslley, I am using Ruby 1.9.2 (madhu@madhu:~$ ruby --version ruby 1.9.2p180 (2011-02-18 revision 30909) [x86_64-linux]) I have source compiled ruby. My gem version is 1.5.2. Is that the problem then? Also what is ruby gems 1.8.7. How to know that revision number?

eskatos commented 13 years ago

I see the very same error using rvm with

jweslley commented 13 years ago

Bugfix for error when loading 'config/application' on ruby 1.9.2. Closed by 477cab3e42b95ffe74c17879c27b6e623e554785.

madhusudancs commented 13 years ago

Hi Jweslley, Thank you very much for fixing this issue. I updated my completion script and it works fine now.