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/cmd_config.rb,
lib/albacore/config_dsl.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/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, FpmAppSpec, InvalidAppSpecError, Package, PackageRepo, Project, SemVer, UnfilledPropertyError

Constant Summary collapse

VERSION =
"2.6.0"

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.



12
13
14
# File 'lib/albacore/albacore_module.rb', line 12

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

.define_task(*args, &block) ⇒ Object

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



40
41
42
43
44
# File 'lib/albacore/albacore_module.rb', line 40

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



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

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



22
23
24
# File 'lib/albacore/albacore_module.rb', line 22

def gemfile
  'Gemfile'
end

.log_level=(level) ⇒ Object

Set the global albacore logging level.



47
48
49
# File 'lib/albacore/albacore_module.rb', line 47

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

.publish(event, obj) ⇒ Object



66
67
68
69
70
# File 'lib/albacore/albacore_module.rb', line 66

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)



52
53
54
# File 'lib/albacore/albacore_module.rb', line 52

def puts *args
  application.puts *args
end

.rakefileObject

Name of default Rakefile, used by Cli



17
18
19
# File 'lib/albacore/albacore_module.rb', line 17

def rakefile
  'Rakefile'
end

.semver_fileObject

Name of the default .semver file, used by Cli



27
28
29
# File 'lib/albacore/albacore_module.rb', line 27

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



34
35
36
# File 'lib/albacore/albacore_module.rb', line 34

def set_application app
  @application = app
end

.subscribe(event, &block) ⇒ Object



60
61
62
63
64
# File 'lib/albacore/albacore_module.rb', line 60

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)


74
75
76
# File 'lib/albacore/albacore_module.rb', line 74

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