module Albacore
The albacore module instance methods.
note: this is a Windows provider
Constants
- VERSION
Public Class Methods
application()
click to toggle source
Accessor for the Albacore
application. Configuration and similar singleton values will be stored in this instance. Multiple calls will yield the same instance.
# File lib/albacore/albacore_module.rb, line 14 def application @application ||= Albacore::Application.new end
create_project(project)
click to toggle source
# File lib/albacore/albacore_module.rb, line 80 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)
click to toggle source
Defines a new task with all of what that entails: will call application.define_task.
# File lib/albacore/albacore_module.rb, line 42 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
events()
click to toggle source
# File lib/albacore/albacore_module.rb, line 58 def events @events ||= {} end
find_msbuild_versions()
click to toggle source
# File lib/albacore/task_types/find_msbuild_versions.rb, line 7 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 # MSBuild 15, assume default installation path vs2017_dir = Dir[File.join(ENV['ProgramFiles(x86)'].gsub('\\', '/'), 'Microsoft Visual Studio', '2017', '*')].first retval[15] = File.join(vs2017_dir, 'MSBuild', '15.0', 'Bin', 'msbuild.exe') unless vs2017_dir.nil? return retval end
gemfile()
click to toggle source
Name of the default Gemfile, used by Cli
# File lib/albacore/albacore_module.rb, line 24 def gemfile 'Gemfile' end
log_level=(level)
click to toggle source
Set the global albacore logging level.
# File lib/albacore/albacore_module.rb, line 49 def log_level= level application.logger.level = level end
publish(event, obj)
click to toggle source
# File lib/albacore/albacore_module.rb, line 68 def publish event, obj if events.member? event events[event].each { |m| m.call(obj) } end end
puts(*args)
click to toggle source
Use to write to STDOUT (by default)
# File lib/albacore/albacore_module.rb, line 54 def puts *args application.puts *args end
rakefile()
click to toggle source
Name of default Rakefile, used by Cli
# File lib/albacore/albacore_module.rb, line 19 def rakefile 'Rakefile' end
semver_file()
click to toggle source
Name of the default .semver file, used by Cli
# File lib/albacore/albacore_module.rb, line 29 def semver_file '.semver' end
set_application(app)
click to toggle source
set the application – good for testing the infrastructure of albacore by resetting the state after each test
# File lib/albacore/albacore_module.rb, line 36 def set_application app @application = app end
subscribe(event, &block)
click to toggle source
# File lib/albacore/albacore_module.rb, line 62 def subscribe event, &block event = event.to_sym unless event.is_a? Symbol events[event] ||= Set.new events[event].add block end
windows?()
click to toggle source
Gets whether we're running under Windows.
# File lib/albacore/albacore_module.rb, line 76 def windows? !!::Rake::Win32.windows? end