This repository was archived by the owner on Nov 7, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathbuilder.rb
More file actions
executable file
·46 lines (42 loc) · 1.47 KB
/
builder.rb
File metadata and controls
executable file
·46 lines (42 loc) · 1.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/usr/bin/env ruby -KU
# encoding: UTF-8
__F__ = if File.symlink? __FILE__ then File.readlink(__FILE__) else File.expand_path(__FILE__) end
BUILDER_DIR = File.expand_path(File.dirname(__F__)) + '/'
$:.unshift "#{BUILDER_DIR}lib/"
require "constants"
require "helpers"
require "runner"
require "settings"
require 'commander/import'
program :name, 'builder'
program :version, '1.0.0'
program :description, 'Build System'
command :install do |c|
c.syntax = ' builder install'
c.description = 'Install builder in system'
c.option '-f', '--force', 'Force install'
c.action do |args, options|
if File.exist?(BIN_PATH) && !options.force
fail "builder is already installed or its default name '#{BIN_PATH}' is already taken by another app\nyou can overwrite it by passing --force option"
elsif options.force
begin
File.delete BIN_PATH
rescue Exception => e
fail "failed while deleting old file/link at #{BIN_PATH}..."
end
end
puts 'Installing...'
puts "...creating [#{BIN_PATH}] symlink..."
File.symlink __F__, BIN_PATH
puts "...creating global configuration file [#{GLOBAL_CONFIG_FILE}]..."
open(GLOBAL_CONFIG_FILE, "w") { |io| io << ''} unless File.exist? GLOBAL_CONFIG_FILE
puts 'Done.'
end
end
command :build do |c|
c.syntax = '[WORKSPACE=/path/to/project] [CONFIGURATION=configuration_name] builder build [build_config_file]'
c.description = 'Run build'
c.action do |args, options|
Runner::run args
end
end