Object
# File lib/heroku/plugin.rb, line 83 def self.check_for_deprecation(plugin) return unless STDIN.isatty if DEPRECATED_PLUGINS.include?(plugin) if confirm "The plugin #{plugin} has been deprecated. Would you like to remove it? (y/N)" remove_plugin(plugin) end end end
# File lib/heroku/plugin.rb, line 36 def self.directory File.expand_path("#{home_directory}/.heroku/plugins") end
# File lib/heroku/plugin.rb, line 40 def self.list Dir["#{directory}/*"].sort.map do |folder| File.basename(folder) end end
# File lib/heroku/plugin.rb, line 46 def self.load! list.each do |plugin| check_for_deprecation(plugin) next if skip_plugins.include?(plugin) load_plugin(plugin) end # check to see if we are using ddollar/heroku-accounts if list.include?('heroku-accounts') && Heroku::Auth.methods.include?(:fetch_from_account) # setup netrc to match the default, if one exists if default_account = %{ git config heroku.account }.chomp account = Heroku::Auth.extract_account rescue nil if account && Heroku::Auth.read_credentials != [Heroku::Auth.user, Heroku::Auth.password] Heroku::Auth.credentials = [Heroku::Auth.user, Heroku::Auth.password] Heroku::Auth.write_credentials load("#{File.dirname(__FILE__)}/command/accounts.rb") # kill memoization in case '--account' was passed Heroku::Auth.instance_variable_set(:@account, nil) end end end end
# File lib/heroku/plugin.rb, line 68 def self.load_plugin(plugin) begin folder = "#{self.directory}/#{plugin}" $: << "#{folder}/lib" if File.directory? "#{folder}/lib" load "#{folder}/init.rb" if File.exists? "#{folder}/init.rb" rescue ScriptError, StandardError => error styled_error(error, "Unable to load plugin #{plugin}.") false end end
# File lib/heroku/plugin.rb, line 97 def initialize(uri) @uri = uri guess_name(uri) end
# File lib/heroku/plugin.rb, line 110 def install if File.directory?(path) uninstall end FileUtils.mkdir_p(self.class.directory) Dir.chdir(self.class.directory) do git("clone #{uri}") unless $?.success? FileUtils.rm_rf path return false end end true end
# File lib/heroku/plugin.rb, line 106 def path "#{self.class.directory}/#{name}" end
# File lib/heroku/plugin.rb, line 125 def uninstall ensure_plugin_exists FileUtils.rm_r(path) end
# File lib/heroku/plugin.rb, line 130 def update ensure_plugin_exists if File.symlink?(path) raise Heroku::Plugin::ErrorUpdatingSymlinkPlugin else Dir.chdir(path) do unless git('config --get branch.master.remote').empty? message = git("pull") unless $?.success? error("Unable to update #{name}.\n" + message) end else error(#{name} is a legacy plugin installation.Enable updating by reinstalling with `heroku plugins:install`.) end end end end
Generated with the Darkfish Rdoc Generator 2.