Sha256: 88b7c2150c369b7f44dd96f7384ee486bb61b6e637f70b290790d442c10aacd2

Contents?: true

Size: 1.71 KB

Versions: 6

Compression:

Stored size: 1.71 KB

Contents

require 'thor/group'

module Engineyard
  module Hudson
    class Install < Thor::Group
      include Thor::Actions
      
      argument :project_path
      
      def self.source_root
        File.join(File.dirname(__FILE__), "install", "templates")
      end
      
      def install_cookbooks
        file       = "cookbooks/main/recipes/default.rb"
        unless File.exists?(File.join(destination_root, "cookbooks/main/recipes/default.rb"))
          directory "cookbooks"
        end
      end
      
      def attributes
        template "attributes.rb.tt", "cookbooks/hudson_slave/attributes/default.rb"
      end
      
      def recipe
        copy_file "recipes.rb", "cookbooks/hudson_slave/recipes/default.rb"
      end
      
      def enable_recipe
        file       = "cookbooks/main/recipes/default.rb"
        enable_cmd = "\nrequire_recipe 'hudson_slave'"
        if File.exists?(file_path = File.join(destination_root, file))
          append_file file, enable_cmd
        else
          create_file file, enable_cmd
        end
      end
      
      def readme
        say ""
        say "Finally:"
        say "* edit "; say "cookbooks/hudson_slave/attributes/default.rb ", :yellow; say "as necessary."
        say "* run: "; say "ey recipes upload ", :green; say "# use --environment(-e) & --account(-c)"
        say "* run: "; say "ey recipes apply  ", :green; say "#   to select environment"
        say "* "; say "Boot your environment ", :yellow; say "if not already booted."
        say "When the recipe completes, your project will commence its first build on Hudson CI."
      end
      
      private
      def say(msg, color = nil)
        color ? shell.say(msg, color) : shell.say(msg)
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
engineyard-hudson-0.3.2 lib/engineyard-hudson/cli/install.rb
engineyard-hudson-0.3.1 lib/engineyard-hudson/cli/install.rb
engineyard-hudson-0.3.0 lib/engineyard-hudson/cli/install.rb
engineyard-hudson-0.2.2 lib/engineyard-hudson/cli/install.rb
engineyard-hudson-0.2.1 lib/engineyard-hudson/cli/install.rb
engineyard-hudson-0.2.0 lib/engineyard-hudson/cli/install.rb