Sha256: 1644b433752f5a6d00795d93058e797ee0baf0d12c4e50043baf0311b6621eea

Contents?: true

Size: 1.85 KB

Versions: 9

Compression:

Stored size: 1.85 KB

Contents

#!/usr/bin/env ruby

require File.dirname(__FILE__) + '/../lib/s3_website'

class Cfg < Thor
  desc 'create', 'Create a config file with placeholder values'
  def create
    S3Website::Tasks.config_create Dir.pwd
  end

  desc 'apply', 'Apply the configuration on the AWS services'
  long_desc <<-LONGDESC
    `s3_website cfg apply` will apply the configuration the S3 bucket.

    In addition, if you CloudFront related settings, this command will apply them on the CloudFront distribution.

    If the S3 bucket does not exist, this command will create it
    and configure it to function as a website.
  LONGDESC
  def apply
    puts 'Applying the configurations in s3_website.yml on the AWS services ...'
    system('configure-s3-website --config-file s3_website.yml')
  end
end

class Cli < Thor
  option(
    :site,
    :type => :string,
    :default => 'infer automatically',
    :desc => "The directory where your website files are. When not defined, s3_website will look for the site in #{S3Website::Paths.site_paths.join(' or ')}."
  )
  option(
    :headless,
    :type => :boolean,
    :desc =>
      'When headless, s3_website will not require human interaction at any point'
  )
  option(
    :config_dir,
    :type => :string,
    :default => Dir.pwd,
    :desc => "The directory where your config file is. When not defined, s3_website will look in the current working directory."
  )
  desc 'push', 'Push local files with the S3 website'
  long_desc <<-LONGDESC
    `s3_website push` will upload new and changes files to S3. It will
    also delete from S3 the files that you no longer have locally.
  LONGDESC
  def push
    site_path = S3Website::Paths.infer_site_path options[:site]
    S3Website::Tasks.push(options[:config_dir], site_path, options[:headless])
  end

  desc 'cfg SUBCOMMAND ...ARGS', 'Operate on the config file'
  subcommand 'cfg', Cfg
end

Cli.start(ARGV)

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
s3_website-1.6.3 bin/s3_website
s3_website-1.6.2 bin/s3_website
s3_website-1.6.1 bin/s3_website
s3_website-1.6.0 bin/s3_website
s3_website-1.5.0 bin/s3_website
s3_website-1.4.5 bin/s3_website
s3_website-1.4.4 bin/s3_website
s3_website-1.4.3 bin/s3_website
s3_website-1.4.2 bin/s3_website