Class: FubuRake::Solution
- Inherits:
-
Object
- Object
- FubuRake::Solution
- Defined in:
- lib/fuburake.rb
Instance Attribute Summary collapse
-
#build_number ⇒ Object
Returns the value of attribute build_number.
-
#compilemode ⇒ Object
Returns the value of attribute compilemode.
-
#options ⇒ Object
Returns the value of attribute options.
Instance Method Summary collapse
- #add_dependency(from, to) ⇒ Object
- #create_task(name, description) ⇒ Object
- #enable_docs(tasks) ⇒ Object
-
#initialize(&block) ⇒ Solution
constructor
A new instance of Solution.
- #make_clean(tasks) ⇒ Object
Constructor Details
#initialize(&block) ⇒ Solution
Returns a new instance of Solution.
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 |
# File 'lib/fuburake.rb', line 46 def initialize(&block) tasks = SolutionTasks.new block.call(tasks) if Platform.is_nix tasks.fubudocs_enabled = false end @defaultTask = create_task(:default, "**Default**, compiles and runs tests") @ciTask = create_task(:ci, "Target used for the CI server") @ciTask.enhance [:default] = tasks. ||= {} tc_build_number = ENV["BUILD_NUMBER"] build_revision = tc_build_number || Time.new.strftime('5%H%M') asm_version = BUILD_VERSION + ".0" @build_number = "#{BUILD_VERSION}.#{build_revision}" # SAMPLE: fuburake-options @options = { :compilemode => ENV['config'].nil? ? "Debug" : ENV['config'], :clrversion => 'v4.0.30319', :platform => 'x86', :unit_test_list_file => 'TESTS.txt', :unit_test_projects => [], :build_number => @build_number, :asm_version => asm_version, :tc_build_number => tc_build_number, :build_revision => build_revision, :source => 'src'}.merge() # ENDSAMPLE @compilemode = @options[:compilemode] tasks.clean ||= [] tasks.defaults ||= [] tasks.ci_steps ||= [] tasks.precompile ||= [] enable_docs tasks FubuRake::AssemblyInfo.create tasks, @options FubuRake::Ripple.create tasks, @options make_clean tasks FubuRake::MSBuild.create_task tasks, @options FubuRake::NUnit.create_task tasks, @options add_dependency :compile, [:clean, :version, 'ripple:restore', 'docs:bottle'] Rake::Task[:compile].enhance(tasks.precompile) add_dependency :unit_test, :compile add_dependency :default, [:compile, :unit_test] add_dependency :default, :unit_test Rake::Task[:default].enhance tasks.defaults Rake::Task[:ci].enhance tasks.ci_steps add_dependency :ci, tasks.ci_steps add_dependency :ci, ["ripple:history", "ripple:package"] tasks.compilations ||= [] tasks.compilations.each do |c| c.create @options end end |
Instance Attribute Details
#build_number ⇒ Object
Returns the value of attribute build_number.
44 45 46 |
# File 'lib/fuburake.rb', line 44 def build_number @build_number end |
#compilemode ⇒ Object
Returns the value of attribute compilemode.
44 45 46 |
# File 'lib/fuburake.rb', line 44 def compilemode @compilemode end |
#options ⇒ Object
Returns the value of attribute options.
44 45 46 |
# File 'lib/fuburake.rb', line 44 def @options end |
Instance Method Details
#add_dependency(from, to) ⇒ Object
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 |
# File 'lib/fuburake.rb', line 112 def add_dependency(from, to) if to.kind_of?(Array) to.each do |dep| add_dependency from, dep end end if !Rake::Task.task_defined?(from) return end if !Rake::Task.task_defined?(to) return end Rake::Task[from].enhance [to] end |
#create_task(name, description) ⇒ Object
130 131 132 133 134 135 136 137 |
# File 'lib/fuburake.rb', line 130 def create_task(name, description) task = Rake::Task.define_task name do end task.add_description description return task end |
#enable_docs(tasks) ⇒ Object
152 153 154 155 156 |
# File 'lib/fuburake.rb', line 152 def enable_docs(tasks) if tasks.fubudocs_enabled require_relative 'fubudocs' end end |
#make_clean(tasks) ⇒ Object
139 140 141 142 143 144 145 146 147 148 149 |
# File 'lib/fuburake.rb', line 139 def make_clean(tasks) if tasks.clean.any? @cleanTask = Rake::Task.define_task :clean do tasks.clean.each do |dir| cleanDirectory dir end end @cleanTask.add_description "Prepares the working directory for a new build" end end |