Module: Albacore

Defined in:
lib/albacore/albacore_module.rb,
lib/albacore.rb,
lib/albacore/cli.rb,
lib/albacore/dsl.rb,
lib/albacore/facts.rb,
lib/albacore/paket.rb,
lib/albacore/semver.rb,
lib/albacore/cli_dsl.rb,
lib/albacore/logging.rb,
lib/albacore/package.rb,
lib/albacore/project.rb,
lib/albacore/version.rb,
lib/albacore/app_spec.rb,
lib/albacore/solution.rb,
lib/albacore/cmd_config.rb,
lib/albacore/config_dsl.rb,
lib/albacore/vb_project.rb,
lib/albacore/application.rb,
lib/albacore/nuget_model.rb,
lib/albacore/ext/teamcity.rb,
lib/albacore/fpm_app_spec.rb,
lib/albacore/package_repo.rb,
lib/albacore/tasks/release.rb,
lib/albacore/cpack_app_spec.rb,
lib/albacore/csharp_project.rb,
lib/albacore/fsharp_project.rb,
lib/albacore/task_types/build.rb,
lib/albacore/tasks/albasemver.rb,
lib/albacore/app_spec/defaults.rb,
lib/albacore/app_spec/iis_site.rb,
lib/albacore/task_types/asmver.rb,
lib/albacore/task_types/nugets.rb,
lib/albacore/tasks/projectlint.rb,
lib/albacore/tasks/versionizer.rb,
lib/albacore/cross_platform_cmd.rb,
lib/albacore/task_types/sql_cmd.rb,
lib/albacore/task_types/is_package.rb,
lib/albacore/task_types/nugets_pack.rb,
lib/albacore/task_types/sql_package.rb,
lib/albacore/task_types/test_runner.rb,
lib/albacore/task_types/nugets_restore.rb,
lib/albacore/errors/command_failed_error.rb,
lib/albacore/errors/invalid_app_spec_error.rb,
lib/albacore/errors/command_not_found_error.rb,
lib/albacore/errors/unfilled_property_error.rb,
lib/albacore/task_types/find_msbuild_versions.rb,
lib/albacore/task_types/nugets_authentication.rb

Overview

note: this is a Windows provider

Defined Under Namespace

Modules: AlbaSemVer, Asmver, Build, CliDSL, CmdConfig, ConfigDSL, CrossPlatformCmd, DSL, Ext, Facts, IsPackage, Logging, NugetModel, Nugets, NugetsAuthentication, NugetsPack, NugetsRestore, Paket, Paths, Sql, SqlPackage, Tasks, TestRunner, Tools Classes: AppSpec, Application, Cli, CommandFailedError, CommandNotFoundError, ConfigurationNotFoundError, CpackAppSpec, CsharpProject, FpmAppSpec, FsharpProject, InvalidAppSpecError, Package, PackageRepo, Project, SemVer, Solution, UnfilledPropertyError, VbProject

Constant Summary collapse

VERSION =
"2.6.3"

Class Method Summary collapse

Class Method Details

.applicationObject

Accessor for the Albacore application. Configuration and similar singleton values will be stored in this instance. Multiple calls will yield the same instance.



15
16
17
# File 'lib/albacore/albacore_module.rb', line 15

def application
  @application ||= Albacore::Application.new
end

.create_project(project) ⇒ Object



81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# File 'lib/albacore/albacore_module.rb', line 81

def create_project(project)
  path=if project.is_a? String
         Pathname.new(project)
       else
         project
       end
  case path.extname
    when ".fsproj"
      FsharpProject.new(path)
    when ".csproj"
      CsharpProject.new(path)
    when ".vbproj"
      VbProject.new(path)
  end
end

.define_task(*args, &block) ⇒ Object

Defines a new task with all of what that entails: will call application.define_task.



43
44
45
46
47
# File 'lib/albacore/albacore_module.rb', line 43

def define_task *args, &block
  args = [caller[0][/`.*'/][1..-2]] if args.nil? or args.empty?
  # delegate to the application singleton
  application.define_task *args, &block
end

.eventsObject



59
60
61
# File 'lib/albacore/albacore_module.rb', line 59

def events
  @events ||= {}
end

.find_msbuild_versionsObject



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/albacore/task_types/find_msbuild_versions.rb', line 3

def self.find_msbuild_versions
  return nil unless ::Rake::Win32.windows?
  require 'win32/registry'
  retval = Hash.new
  begin
    Win32::Registry::HKEY_LOCAL_MACHINE.open('SOFTWARE\Microsoft\MSBuild\ToolsVersions') do |toolsVersion|
      toolsVersion.each_key do |key|
        begin
          versionKey = toolsVersion.open(key)
          version = key.to_i
          msb = File.join(versionKey['MSBuildToolsPath'],'msbuild.exe')
          retval[version] = msb
        rescue
          error "failed to open #{key}"
        end
      end
    end
  rescue
    error "failed to open HKLM\\SOFTWARE\\Microsoft\\MSBuild\\ToolsVersions"
  end
  return retval
end

.gemfileObject

Name of the default Gemfile, used by Cli



25
26
27
# File 'lib/albacore/albacore_module.rb', line 25

def gemfile
  'Gemfile'
end

.log_level=(level) ⇒ Object

Set the global albacore logging level.



50
51
52
# File 'lib/albacore/albacore_module.rb', line 50

def log_level= level
  application.logger.level = level
end

.publish(event, obj) ⇒ Object



69
70
71
72
73
# File 'lib/albacore/albacore_module.rb', line 69

def publish event, obj
  if events.member? event
    events[event].each { |m| m.call(obj) }
  end
end

.puts(*args) ⇒ Object

Use to write to STDOUT (by default)



55
56
57
# File 'lib/albacore/albacore_module.rb', line 55

def puts *args
  application.puts *args
end

.rakefileObject

Name of default Rakefile, used by Cli



20
21
22
# File 'lib/albacore/albacore_module.rb', line 20

def rakefile
  'Rakefile'
end

.semver_fileObject

Name of the default .semver file, used by Cli



30
31
32
# File 'lib/albacore/albacore_module.rb', line 30

def semver_file
  '.semver'
end

.set_application(app) ⇒ Object

set the application – good for testing the infrastructure of albacore by resetting the state after each test



37
38
39
# File 'lib/albacore/albacore_module.rb', line 37

def set_application app
  @application = app
end

.subscribe(event, &block) ⇒ Object



63
64
65
66
67
# File 'lib/albacore/albacore_module.rb', line 63

def subscribe event, &block
  event = event.to_sym unless event.is_a? Symbol
  events[event] ||= Set.new
  events[event].add block
end

.windows?Boolean

Gets whether we’re running under Windows.

Returns:

  • (Boolean)


77
78
79
# File 'lib/albacore/albacore_module.rb', line 77

def windows?
  !!::Rake::Win32.windows?
end