Sha256: 28b051283b621d83e14e1a77c56d4d300420308dd28e34530af707b75427be2f
Contents?: true
Size: 1.14 KB
Versions: 2
Compression:
Stored size: 1.14 KB
Contents
module Shuttle class Generator include TerminalHelpers STRATEGIES = %w(static wordpress rails) attr_reader :strategy attr_reader :name, :git, :path def initialize(strategy='static') unless STRATEGIES.include?(strategy) raise ArgumentError, "Invalid strategy: #{strategy}" end @strategy = strategy @path = File.join(Dir.pwd, 'shuttle.yml') end def run @name = ask('Application name', :required => true) @git = ask('Git repository', :required => true) hash = send("generate_#{strategy}") File.open(path, 'w') do |f| f.write(YAML.dump(hash)) end display "New shuttle config has been generated at ./shuttle.yml" end private def generate_static { 'app' => { 'name' => name, 'git' => git }, 'target' => { 'host' => "mysite.com", 'user' => "deployer", 'password' => "password", 'deploy_to' => "/home/deployer/#{name}" } } end def generate_wordpress # TODO end def generate_rails # TODO end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
shuttle-deploy-0.2.0.beta10 | lib/shuttle/generator.rb |
shuttle-deploy-0.2.0.beta9 | lib/shuttle/generator.rb |