lib/distrib_builder.rb in distrib_builder-0.0.1 vs lib/distrib_builder.rb in distrib_builder-0.0.2

- old
+ new

@@ -1,11 +1,44 @@ -## -# Distrib Builder -## +require 'optparse' +require 'yaml' +require 'mustache' +require 'distrib_builder/builder' +require 'distrib_builder/versioner' +require 'distrib_builder/version' + module DistribBuilder + DISTRIB_TYPES = ['build', 'version'] + WORK_DIR = Dir.pwd + CONFIG_FILE = "DistribBuilder.yml" + CMAKELIST_FILE = "CMakeLists.txt" + VERSION_PATTERN = Regexp.new('_VERSION \"\d+\.\d+\.\d+\"') + BUILD_PATTERN = Regexp.new('_BUILD \"\d+\"') + class Main def self.run - puts ARGV + args = duplicate_argv + type = args.shift + + if type == '--version' + puts VERSION + return + elsif !DISTRIB_TYPES.include?(type) && args.empty? + puts "Use 'distrib_builder version --help' or 'distrib_builder build --help' for more information" + puts "Exit" + return + end + + if type == 'build' + Builder::Main.new(args).run + else + Versioner::Main.new(args).run + end + end + + private + + def self.duplicate_argv + ARGV.dup end end end