class Middleman::Cli::Deploy
This class provides a “deploy” command for the middleman CLI.
Public Class Methods
exit_on_failure?()
click to toggle source
Tell Thor to exit with a nonzero exit code on failure
# File lib/middleman-bitballoon/commands.rb, line 17 def self.exit_on_failure? true end
Public Instance Methods
deploy()
click to toggle source
# File lib/middleman-bitballoon/commands.rb, line 26 def deploy build_before(options) process end
Protected Instance Methods
build_before(options={})
click to toggle source
# File lib/middleman-bitballoon/commands.rb, line 33 def build_before(options={}) build_enabled = options.fetch('build_before', self.deploy_options.build_before) if build_enabled # http://forum.middlemanapp.com/t/problem-with-the-build-task-in-an-extension run('middleman build') || exit(1) end end
deploy_options()
click to toggle source
# File lib/middleman-bitballoon/commands.rb, line 68 def deploy_options options = nil begin options = ::Middleman::Application.server.inst.options rescue NoMethodError print_usage_and_die "You need to activate the bitballoon extension in config.rb." end unless options.token print_usage_and_die "The bitballoon extension requires you to set a token." end unless options.site print_usage_and_die "The bitballoon extension requires you to set a site." end options end
print_usage_and_die(message)
click to toggle source
# File lib/middleman-bitballoon/commands.rb, line 42 def print_usage_and_die(message) raise Error, <<-MSG ERROR: #{message} Configure the bitballoon extension in config.rb: activate :bitballoon do |bitballoon| bitballoon.token = ENV['BB_TOKEN'] bitballoon.site = "mysite.bitballoon.com" end MSG end
process()
click to toggle source
# File lib/middleman-bitballoon/commands.rb, line 55 def process puts "Deploying to BitBalloon site #{deploy_options.site}" server_instance = ::Middleman::Application.server.inst client = ::BitBalloon::Client.new(:access_token => deploy_options.token) client.sites.get(deploy_options.site).tap do |site| site.update(:dir => server_instance.build_dir) puts "Waiting for BitBalloon to Process the deploy" site.wait_for_ready puts "Deploy ready at #{site.url}" end end