Methods
A
D
E
F
I
L
N
R
S
Included Modules
Class Public methods
each(&block)
# File railties/lib/commands/plugin.rb, line 397
def self.each(&block)
  self.instance.each(&block)
end
instance()
# File railties/lib/commands/plugin.rb, line 393
def self.instance
  @instance ||= Repositories.new
end
new(cache_file = File.join(find_home, ".rails-plugin-sources"))
# File railties/lib/commands/plugin.rb, line 316
def initialize(cache_file = File.join(find_home, ".rails-plugin-sources"))
  @cache_file = File.expand_path(cache_file)
  load!
end
Instance Public methods
add(uri)
# File railties/lib/commands/plugin.rb, line 325
def add(uri)
  unless find{|repo| repo.uri == uri }
    @repositories.push(Repository.new(uri)).last
  end
end
all()
# File railties/lib/commands/plugin.rb, line 339
def all
  @repositories
end
defaults()
# File railties/lib/commands/plugin.rb, line 369
def defaults
  <<-DEFAULTS
  http://dev.rubyonrails.com/svn/rails/plugins/
  DEFAULTS
end
each(&block)
# File railties/lib/commands/plugin.rb, line 321
def each(&block)
  @repositories.each(&block)
end
exist?(uri)
# File railties/lib/commands/plugin.rb, line 335
def exist?(uri)
  @repositories.detect{|repo| repo.uri == uri }
end
find_home()
# File railties/lib/commands/plugin.rb, line 375
def find_home
  ['HOME', 'USERPROFILE'].each do |homekey|
    return ENV[homekey] if ENV[homekey]
  end
  if ENV['HOMEDRIVE'] && ENV['HOMEPATH']
    return "#{ENV['HOMEDRIVE']}:#{ENV['HOMEPATH']}"
  end
  begin
    File.expand_path("~")
  rescue StandardError => ex
    if File::ALT_SEPARATOR
      "C:/"
    else
      "/"
    end
  end
end
find_plugin(name)
# File railties/lib/commands/plugin.rb, line 343
def find_plugin(name)
  @repositories.each do |repo|
    repo.each do |plugin|
      return plugin if plugin.name == name
    end
  end
  return nil
end
load!()
# File railties/lib/commands/plugin.rb, line 352
def load!
  contents = File.exist?(@cache_file) ? File.read(@cache_file) : defaults
  contents = defaults if contents.empty?
  @repositories = contents.split(/\n/).reject do |line|
    line =~ /^\s*#/ or line =~ /^\s*$/
  end.map { |source| Repository.new(source.strip) }
end
remove(uri)
# File railties/lib/commands/plugin.rb, line 331
def remove(uri)
  @repositories.reject!{|repo| repo.uri == uri}
end
save()
# File railties/lib/commands/plugin.rb, line 360
def save
  File.open(@cache_file, 'w') do |f|
    each do |repo|
      f.write(repo.uri)
      f.write("\n")
    end
  end
end