lib/physique/solution.rb in physique-0.3.10 vs lib/physique/solution.rb in physique-0.4.0

- old
+ new

@@ -1,73 +1,73 @@ -require 'rake' -require 'albacore' -require 'physique/tasks_builder' - -module Physique - class SolutionConfig - self.extend Albacore::ConfigDSL - include Albacore::Logging - - # Path to the solution file - attr_path_accessor :file - - def initialize - @file = nil - @compilation = CompileConfig.new - @nuget = NugetConfig.new - @tests = TestConfig.new - end - - def use_nuget - yield @nuget - end - - def compile - yield @compilation - end - - def run_tests - yield @tests - end - - def fluently_migrate - @dbs_to_migrate = @dbs_to_migrate || [] - - migrator = FluentMigratorConfig.new - yield migrator - - @dbs_to_migrate << migrator - end - - alias_method :database, :fluently_migrate - - def octopus_deploy - @octopus = OctopusDeployConfig.new - yield @octopus - end - - def publish_nugets - @publish_nugets = PublishNugetsConfig.new - yield @publish_nugets - end - - def opts - Map.new({ - file: @file, - nuget: @nuget && @nuget.opts, - compile: @compilation && @compilation.opts, - test: @tests && @tests.opts, - fluent_migrator_dbs: @dbs_to_migrate && @dbs_to_migrate.map {|db| db.opts }, - octopus: @octopus && @octopus.opts, - publish_nugets: @publish_nugets && @publish_nugets.opts - }) - end - end - - class Solution - def initialize(&block) - config = SolutionConfig.new - block.call config - TasksBuilder.build_tasks_for config.opts - end - end +require 'rake' +require 'albacore' +require 'physique/tasks_builder' + +module Physique + class SolutionConfig + self.extend Albacore::ConfigDSL + include Albacore::Logging + + # Path to the solution file + attr_path_accessor :file + + def initialize + @file = nil + @compilation = CompileConfig.new + @nuget = NugetConfig.new + @tests = TestConfig.new + end + + def use_nuget + yield @nuget + end + + def compile + yield @compilation + end + + def run_tests + yield @tests + end + + def fluently_migrate + @dbs_to_migrate = @dbs_to_migrate || [] + + migrator = FluentMigratorConfig.new + yield migrator + + @dbs_to_migrate << migrator + end + + alias_method :database, :fluently_migrate + + def octopus_deploy + @octopus = OctopusDeployConfig.new + yield @octopus + end + + def publish_nugets + @publish_nugets = PublishNugetsConfig.new + yield @publish_nugets + end + + def opts + Map.new({ + file: @file, + nuget: @nuget && @nuget.opts, + compile: @compilation && @compilation.opts, + test: @tests && @tests.opts, + fluent_migrator_dbs: @dbs_to_migrate && @dbs_to_migrate.map {|db| db.opts }, + octopus: @octopus && @octopus.opts, + publish_nugets: @publish_nugets && @publish_nugets.opts + }) + end + end + + class Solution + def initialize(&block) + config = SolutionConfig.new + block.call config + TasksBuilder.build_tasks_for config.opts + end + end end \ No newline at end of file