Class: Sashimi::Commands::Update
- Inherits:
-
Object
- Object
- Sashimi::Commands::Update
- Defined in:
- lib/sashimi/commands.rb
Instance Method Summary collapse
-
#initialize(base_command) ⇒ Update
constructor
A new instance of Update.
- #options ⇒ Object
- #parse!(args) ⇒ Object
- #update_plugins(plugins) ⇒ Object
Constructor Details
#initialize(base_command) ⇒ Update
Returns a new instance of Update.
134 135 136 |
# File 'lib/sashimi/commands.rb', line 134 def initialize(base_command) @base_command = base_command end |
Instance Method Details
#options ⇒ Object
138 139 140 141 142 143 144 145 146 |
# File 'lib/sashimi/commands.rb', line 138 def OptionParser.new do |o| o.set_summary_indent(' ') o. = "Usage: #{@base_command.script_name} update [OPTIONS] PLUGIN [PLUGIN2, PLUGIN3]" o.define_head "Update installed plugin(s)." o.on("-a", "--all", "Update all installed plugins.") { |@all| } o.on("-r", "--rails", "Install the plugin(s) in a Rails app.") { |@rails| } end end |
#parse!(args) ⇒ Object
148 149 150 151 152 153 154 155 156 157 158 |
# File 'lib/sashimi/commands.rb', line 148 def parse!(args) .parse!(args) raise "Can't use both --all and --rails arguments." if @all and @rails if @all update_plugins(AbstractRepository.plugins_names) elsif @rails AbstractRepository.update_rails_plugins(args) else update_plugins(args) end end |
#update_plugins(plugins) ⇒ Object
160 161 162 163 164 |
# File 'lib/sashimi/commands.rb', line 160 def update_plugins(plugins) plugins.each do |plugin| Plugin.new(plugin).update end end |