Class: BundleMate::Application::Controller

Inherits:
SimpleConsole::Controller
  • Object
show all
Defined in:
lib/bundle_mate/application.rb

Instance Method Summary collapse

Instance Method Details

#defaultObject



20
21
22
# File 'lib/bundle_mate/application.rb', line 20

def default
  render :action => :help
end

#infoObject



28
29
30
31
# File 'lib/bundle_mate/application.rb', line 28

def info
  @bundle = Bundle.from_macromates(params[:id])
  @description = @bundle.('description').sanitize_html
end

#installObject



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/bundle_mate/application.rb', line 33

def install
  if params[:url] 
    @bundle = Bundle.new(params[:url])
  else
    @bundle = Bundle.from_macromates(params[:id])
  end
  
  if @bundle.installed?
    puts "\n** #{@bundle.name} bundle is already installed. Use 'update' command instead. **\n\n"
  else
    revision = params[:revision] || 'HEAD'
    puts "\n** Installing #{@bundle.name} (revision: #{revision}) **\n\n"
    @result = @bundle.install(revision)
  end
end

#listObject



24
25
26
# File 'lib/bundle_mate/application.rb', line 24

def list
  @bundle_list = Bundle.remote_bundle_list
end

#uninstallObject



61
62
63
64
65
66
67
68
69
70
# File 'lib/bundle_mate/application.rb', line 61

def uninstall
  @bundle = Bundle.from_macromates(params[:id])
  uninstall_method = params[:noprompt] ? :uninstall : :uninstall_with_confirmation
  
  unless @bundle.installed?
    @already_uninstalled = true
  else
    @result = @bundle.send(uninstall_method)
  end
end

#updateObject



49
50
51
52
# File 'lib/bundle_mate/application.rb', line 49

def update
  @bundle = Bundle.from_macromates(params[:id])
  @result = @bundle.update
end

#update_allObject



54
55
56
57
58
59
# File 'lib/bundle_mate/application.rb', line 54

def update_all
  Bundle.installed_bundles.each do |bundle|
    puts "\n** Updating #{bundle.name} bundle. **"
    bundle.update
  end
end