Sha256: cf785db3b86d82d87178f85572b78ea10685f993f4913b237588cc1ebd603bb3

Contents?: true

Size: 1.21 KB

Versions: 1

Compression:

Stored size: 1.21 KB

Contents

require "thor"
module Dogids
  class Cli < Thor
    desc "reload", "Reloads the specified machine. Defaults to development"

    # Reload the specified environment
    # TODO add environments
    # @param [string] app_name
    def reload(app_name = nil)
      if yes?("-----> Reload development? [no]")
        reload_development_machine
      else
        update_vagrant_box if yes?("-----> Update Vagrant Box? (NOT RECOMMENDED) [no]")
      end
    end

    no_commands do

      # Upgrade local vagrant box (default is ubuntu/trusty64)
      def update_vagrant_box
        say("-----> Updating the vagrant box...","\e[32m")
        system("cd ~/dogids-vagrant && vagrant box update")
        system("cd ~/dogids-vagrant && vagrant box list")
        if yes?("-----> Remove old boxes? (NOT RECOMMENDED) [no]")
          system("cd ~/dogids-vagrant && vagrant box remove --all")
          system("cd ~/dogids-vagrant && vagrant box add ubuntu/trusty64")
        end
        reload_development_machine
      end

      # Reloads development machine
      def reload_development_machine
        say("-----> Reloading the development machine...","\e[32m")
        system("cd ~/dogids-vagrant && vagrant reload")
      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dogids-cli-0.0.20 lib/dogids/reload.rb