class Envirobly::Cli::Main
def deploy(environ_name = nil)
def deploy(environ_name = nil) commit = Envirobly::Git::Commit.new options.commit unless commit.exists? say_error "Commit '#{commit.ref}' doesn't exist in this repository. Aborting." exit 1 end Envirobly::AccessToken.new(shell:).require! environ_name = environ_name.presence || commit.current_branch project_name = nil project_id = nil if options.project.present? if options.project =~ Envirobly::Defaults::Project.regexp project_id = $1.to_i else project_name = options.project end end deployment = Envirobly::Deployment.new( account_id: options.account_id, region: options.region, project_name:, environ_name:, project_id:, commit:, shell: ) deployment.perform(dry_run: options.dry_run) end
def pull(region, bucket, ref, path)
def pull(region, bucket, ref, path) Envirobly::Duration.measure("Build context download took %s") do s3 = Envirobly::Aws::S3.new(region:, bucket:) s3.pull ref, path end end
def set_default_account
def set_default_account Envirobly::Defaults::Account.new(shell:).require_id end
def set_default_region
def set_default_region Envirobly::Defaults::Region.new(shell:).require_id end
def signin
def signin access_token = Envirobly::AccessToken.new(shell:) access_token.set end
def signout
def signout Envirobly::AccessToken.destroy say "You've signed out." say "This didn't delete the access token itself." say "You can sign in again with `envirobly signin`." end
def validate
def validate Envirobly::AccessToken.new(shell:).require! configs = Envirobly::Config.new api = Envirobly::Api.new params = { validation: configs.to_params } response = api.validate_shape params if response.object.fetch("valid") puts "Config is valid #{green_check}" else display_config_errors response.object.fetch("errors") exit 1 end end
def version
def version if options.pure puts Envirobly::VERSION else puts "envirobly CLI v#{Envirobly::VERSION}" end end