Sha256: 76ddfcd5a291fa128defce18f659eeb6496d9858aad40799479105788b32e338

Contents?: true

Size: 1.55 KB

Versions: 10

Compression:

Stored size: 1.55 KB

Contents

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

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
physique-0.3.10 lib/physique/solution.rb
physique-0.3.9 lib/physique/solution.rb
physique-0.3.8 lib/physique/solution.rb
physique-0.3.7 lib/physique/solution.rb
physique-0.3.6 lib/physique/solution.rb
physique-0.3.5 lib/physique/solution.rb
physique-0.3.4 lib/physique/solution.rb
physique-0.3.3 lib/physique/solution.rb
physique-0.3.2 lib/physique/solution.rb
physique-0.3.1 lib/physique/solution.rb