Sha256: 7c3386dae21307ca92b2f547ccd2893a03e88434f6660acfb8844ebce2832eb7

Contents?: true

Size: 1.33 KB

Versions: 13

Compression:

Stored size: 1.33 KB

Contents

#!/usr/bin/env ruby


require 'tempfile'
require 'rubygems'
require 'fileutils'
require "aws/s3"
require 'yaml'

#require 'ruby-debug'
#$:.unshift File.join(File.dirname(__FILE__), "..", "lib")

require 'astrails/safe'
include Astrails::Safe

def die(msg)
  puts "ERROR: #{msg}"
  exit 1
end

def usage
  puts <<-END
Usage: astrails-safe [OPTIONS] CONFIG_FILE
Options:
  -h, --help           This help screen
  -v, --verbose        be verbose, duh!
  -n, --dry-run        just pretend, don't do anything.
  -L, --local          skip S3

Note: config file will be created from template if missing
END
  exit 1
end

def process_options
  usage if ARGV.delete("-h") || ARGV.delete("--help")
  $_VERBOSE = ARGV.delete("-v") || ARGV.delete("--verbose")
  $DRY_RUN = ARGV.delete("-n") || ARGV.delete("--dry-run")
  $LOCAL   = ARGV.delete("-L") || ARGV.delete("--local")
  usage unless ARGV.first
  $CONFIG_FILE_NAME = File.expand_path(ARGV.first)
end

def main
  process_options

  unless File.exists?($CONFIG_FILE_NAME)
    die "Missing configuration file. NOT CREATED! Rerun w/o the -n argument to create a template configuration file." if $DRY_RUN

    FileUtils.cp File.join(Astrails::Safe::ROOT, "templates", "script.rb"), $CONFIG_FILE_NAME

    die "Created default #{$CONFIG_FILE_NAME}. Please edit and run again."
  end


  load($CONFIG_FILE_NAME)
end

main

Version data entries

13 entries across 13 versions & 4 rubygems

Version Path
astrails-safe-0.0.6 bin/astrails-safe
astrails-safe-0.0.7 bin/astrails-safe
astrails-safe-0.0.8 bin/astrails-safe
astrails-safe-0.0.9 bin/astrails-safe
astrails-safe-0.1.0 bin/astrails-safe
astrails-safe-0.1.1 bin/astrails-safe
astrails-safe-0.1.2 bin/astrails-safe
astrails-safe-0.1.3 bin/astrails-safe
astrails-safe-0.1.4 bin/astrails-safe
astrails-safe-0.1.6 bin/astrails-safe
colin-safe-0.1.6 bin/astrails-safe
markmansour-safe-0.1.7 bin/astrails-safe
ralph-safe-0.1.7 bin/astrails-safe