Skip to content

Commit

Permalink
getting executables a bit slicker and dropping the gem idea
Browse files Browse the repository at this point in the history
git-svn-id: http://cruisecontrolrb.rubyforge.org/svn/trunk@13 c04ce798-636b-4ca8-9149-0f9336831111
  • Loading branch information
stellsmi committed Jan 22, 2007
1 parent 2c8d286 commit e06fa58
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 127 deletions.
81 changes: 0 additions & 81 deletions bin/builder

This file was deleted.

31 changes: 4 additions & 27 deletions bin/cruise → cruise
@@ -1,43 +1,21 @@
#!/usr/bin/env ruby
ENV["RAILS_ENV"] = 'production'
require File.dirname(__FILE__) + '/../config/boot'
require File.dirname(__FILE__) + '/config/boot'
require 'optparse'
require 'cruisecontrol/version'

def find_builds
site_config = File.dirname(__FILE__) + "/../config/site_config.rb"
return if File.exist?(site_config)

print %{It looks like this is the first time you've run CruiseControl.rb. Where would you like your us to
build your projects? eg. c:\\cruisecontrol or ~/builds
> }

builds_dir = $stdin.gets.strip
unless File.directory? builds_dir
require 'fileutils'
FileUtils.makedirs builds_dir
unless File.directory? builds_dir
STDERR.puts "couldn't create #{builds_dir}"
exit -1
end
end

File.open(site_config, 'w') {|f| f << "Configuration.builds_directory = '#{builds_dir}'" }
end

def start
ARGV.unshift "99"
ARGV.unshift "-p"
load File.dirname(__FILE__) + "/../script/server"
load File.dirname(__FILE__) + "/script/server"
end

def add
load File.dirname(__FILE__) + "/add_project"
load File.dirname(__FILE__) + "/script/add_project"
end

def builder
load File.dirname(__FILE__) + "/builder"
load File.dirname(__FILE__) + "/script/builder"
end

def version
Expand Down Expand Up @@ -65,7 +43,6 @@ For additional information, see http://cruisecontrolrb.rubyforge.org/
EOL
end

find_builds

action = ARGV.shift
case action
Expand Down
1 change: 1 addition & 0 deletions cruise.cmd
@@ -0,0 +1 @@
@ruby cruise %*
2 changes: 1 addition & 1 deletion lib/cruisecontrol/version.rb
@@ -1,7 +1,7 @@
module CruiseControl
module VERSION #:nodoc:
MAJOR = 0
MINOR = 1
MINOR = 2

STRING = [MAJOR, MINOR].join('.')
end
Expand Down
File renamed without changes.
33 changes: 15 additions & 18 deletions script/builder
@@ -1,49 +1,46 @@
#!/usr/bin/env ruby

ENV["RAILS_ENV"] = 'builder'

ENV["RAILS_ENV"] = 'production'
require File.dirname(__FILE__) + '/../config/boot'

require 'optparse'

OPTIONS = { :verbose => false }

project_name = nil

ARGV.options do |opts|
script_name = File.basename($0)
opts.banner = "Usage: ruby #{script_name} [options]"
opts.banner = "Usage: cruise builder <project_name> []options]"

opts.separator ""

opts.on("-p", "--project=name", String,
"Project name to build. This option must be specified.") { |v| OPTIONS[:project_name] = v }
opts.on("-c", "--checkout=directory", String,
"Where the project's local copy checked out from source control is",
"Default: ccrb/builds/<project_name>/work") { |v| OPTIONS[:checkout_directory] = v }
opts.on("-v", "--verbose", "Verbose logging") { OPTIONS[:verbose] = true }

opts.separator ""

opts.on("-h", "--help",
"Show this help message.") { puts opts; exit }

opts.parse!
args = opts.parse!

unless OPTIONS[:project_name]
unless args.length == 1
STDERR.puts "Project name not specified"
STDERR.puts
puts opts
exit(-1)
end

OPTIONS[:checkout_directory] ||= File.join(RAILS_ROOT, 'builds', OPTIONS[:project_name])
OPTIONS[:checkout_directory] = File.expand_path(OPTIONS[:checkout_directory])
project_name = args[0]
end

require RAILS_ROOT + "/config/environment"

project_path = File.expand_path(File.join(Configuration.builds_directory, project_name))

unless File.exist? project_path
STDERR.puts "Project '#{project_name}' not found in '#{project_path}'"
exit(-1)
end

begin
Log.verbose = OPTIONS[:verbose]
project = Project.load_or_create(OPTIONS[:checkout_directory])
project = Project.load_or_create(project_path)

# this will create builder.pid file in project's CC directory and grab an exclusive lock on it, or else blow up saying
# that something else is already locking it
Expand Down

0 comments on commit e06fa58

Please sign in to comment.