albacore 2.1.2 → 2.2.0.pre.beta
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +9 -0
- data/lib/albacore.rb +7 -7
- data/lib/albacore/application.rb +45 -45
- data/lib/albacore/cmd_config.rb +66 -66
- data/lib/albacore/dsl.rb +119 -119
- data/lib/albacore/errors/unfilled_property_error.rb +13 -13
- data/lib/albacore/ext/teamcity.rb +13 -0
- data/lib/albacore/facts.rb +24 -25
- data/lib/albacore/logging.rb +33 -33
- data/lib/albacore/paths.rb +114 -114
- data/lib/albacore/project.rb +2 -2
- data/lib/albacore/task_types/nugets_restore.rb +18 -4
- data/lib/albacore/task_types/test_runner.rb +143 -143
- data/lib/albacore/tasks/albasemver.rb +49 -49
- data/lib/albacore/tasks/release.rb +150 -0
- data/lib/albacore/tools/restore_hint_paths.rb +82 -82
- data/lib/albacore/tools/zippy.rb +61 -61
- data/lib/albacore/version.rb +1 -1
- data/spec/nugets_restore_spec.rb +19 -5
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7e854836b52f89c28e1f486c0d9f89042ecb15a4
|
4
|
+
data.tar.gz: cf2d48cf0215692536f625e87c6edb729e5a243e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 11da68eb2c56c77891f892b369e82866c0ffc0f089977e9841336d894a05d995cdaafdcc3b7b10e379d1d6250f7e60a8eb5b79245e644586ebd4f27774597e23
|
7
|
+
data.tar.gz: 85b35c45c35a650bdb00a294993232940c1a5f34235757358abb4d1529d42ec804eb49a237595d9296529ebd24f416d64abecb3ed04b77155817d0fb66aea3a1
|
data/README.md
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
# Albacore v2.0
|
2
|
+
[![Gitter](https://badges.gitter.im/Join Chat.svg)](https://gitter.im/Albacore/albacore?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
2
3
|
|
3
4
|
[![Version ](https://img.shields.io/gem/v/albacore.svg?style=flat)](https://rubygems.org/gems/albacore)
|
4
5
|
[![Build Status](http://img.shields.io/travis/Albacore/albacore/master.svg?style=flat)](http://travis-ci.org/Albacore/albacore)
|
@@ -43,6 +44,14 @@ the above task types, but there's also [very
|
|
43
44
|
extensive](http://rubydoc.info/gems/albacore/2.0.0/frames) documentation in the
|
44
45
|
code, as well as hundreds of unit tests written in a easy-to-read rspec syntax.
|
45
46
|
|
47
|
+
## Quickstart TLDR; SHOW ME THE CODE!
|
48
|
+
|
49
|
+
gem install albacore
|
50
|
+
albacore init
|
51
|
+
|
52
|
+
Now you have the initial setup and can run `bundle exec rake`. But please read
|
53
|
+
below:
|
54
|
+
|
46
55
|
## Getting Started
|
47
56
|
|
48
57
|
Follow along for a quick intro, but if on Windows, see the section 'Installing
|
data/lib/albacore.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
require 'albacore/version'
|
2
|
-
require 'albacore/albacore_module'
|
3
|
-
require 'albacore/rake_overrides'
|
4
|
-
require 'albacore/dsl'
|
5
|
-
|
6
|
-
module Albacore
|
7
|
-
end
|
1
|
+
require 'albacore/version'
|
2
|
+
require 'albacore/albacore_module'
|
3
|
+
require 'albacore/rake_overrides'
|
4
|
+
require 'albacore/dsl'
|
5
|
+
|
6
|
+
module Albacore
|
7
|
+
end
|
data/lib/albacore/application.rb
CHANGED
@@ -1,45 +1,45 @@
|
|
1
|
-
require 'rake'
|
2
|
-
require 'time'
|
3
|
-
|
4
|
-
module Albacore
|
5
|
-
class Application
|
6
|
-
|
7
|
-
# the logger instance for this application
|
8
|
-
attr_reader :logger
|
9
|
-
|
10
|
-
# the output IO for this application, defaults to
|
11
|
-
# STDOUT
|
12
|
-
attr_reader :output
|
13
|
-
|
14
|
-
# the standard IO error output
|
15
|
-
attr_reader :output_err
|
16
|
-
|
17
|
-
# initialize a new albacore application with a given log IO object
|
18
|
-
def initialize log = STDOUT, output = STDOUT, output_err = STDERR
|
19
|
-
raise ArgumentError, "log must not be nil" unless log
|
20
|
-
raise ArgumentError, "output must not be nil" unless output
|
21
|
-
raise ArgumentError, "out_err must not be nil" unless output_err
|
22
|
-
@logger = Logger.new log
|
23
|
-
@logger.level = Logger::INFO
|
24
|
-
@logger.formatter = proc do |severity, datetime, progname, msg|
|
25
|
-
"#{severity[0]} #{datetime.to_datetime.iso8601(6)}: #{msg}\n"
|
26
|
-
end
|
27
|
-
@output = output
|
28
|
-
@output_err = output_err
|
29
|
-
end
|
30
|
-
|
31
|
-
def define_task *args, &block
|
32
|
-
Rake::Task.define_task *args, &block
|
33
|
-
end
|
34
|
-
|
35
|
-
# wite a line to stdout
|
36
|
-
def puts *args
|
37
|
-
@output.puts *args
|
38
|
-
end
|
39
|
-
|
40
|
-
# write a line to stderr
|
41
|
-
def err *args
|
42
|
-
@output_err.puts *args
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
1
|
+
require 'rake'
|
2
|
+
require 'time'
|
3
|
+
|
4
|
+
module Albacore
|
5
|
+
class Application
|
6
|
+
|
7
|
+
# the logger instance for this application
|
8
|
+
attr_reader :logger
|
9
|
+
|
10
|
+
# the output IO for this application, defaults to
|
11
|
+
# STDOUT
|
12
|
+
attr_reader :output
|
13
|
+
|
14
|
+
# the standard IO error output
|
15
|
+
attr_reader :output_err
|
16
|
+
|
17
|
+
# initialize a new albacore application with a given log IO object
|
18
|
+
def initialize log = STDOUT, output = STDOUT, output_err = STDERR
|
19
|
+
raise ArgumentError, "log must not be nil" unless log
|
20
|
+
raise ArgumentError, "output must not be nil" unless output
|
21
|
+
raise ArgumentError, "out_err must not be nil" unless output_err
|
22
|
+
@logger = Logger.new log
|
23
|
+
@logger.level = Logger::INFO
|
24
|
+
@logger.formatter = proc do |severity, datetime, progname, msg|
|
25
|
+
"#{severity[0]} #{datetime.to_datetime.iso8601(6)}: #{msg}\n"
|
26
|
+
end
|
27
|
+
@output = output
|
28
|
+
@output_err = output_err
|
29
|
+
end
|
30
|
+
|
31
|
+
def define_task *args, &block
|
32
|
+
Rake::Task.define_task *args, &block
|
33
|
+
end
|
34
|
+
|
35
|
+
# wite a line to stdout
|
36
|
+
def puts *args
|
37
|
+
@output.puts *args
|
38
|
+
end
|
39
|
+
|
40
|
+
# write a line to stderr
|
41
|
+
def err *args
|
42
|
+
@output_err.puts *args
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
data/lib/albacore/cmd_config.rb
CHANGED
@@ -1,66 +1,66 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
|
-
|
3
|
-
require 'set'
|
4
|
-
require 'albacore/config_dsl'
|
5
|
-
|
6
|
-
module Albacore
|
7
|
-
|
8
|
-
# Use on **configuration** objects that are command-oriented.
|
9
|
-
#
|
10
|
-
# a mixin that adds a couple of field writers and readers.
|
11
|
-
# specifically, allows the configuration to have a work_dir and exe field
|
12
|
-
# and defined a method that joins paths relative to the work_dir
|
13
|
-
module CmdConfig
|
14
|
-
include Logging
|
15
|
-
self.extend ConfigDSL
|
16
|
-
|
17
|
-
# TODO: move towards opts for all task types rather than
|
18
|
-
# reading these public properties.
|
19
|
-
|
20
|
-
# the working directory for this command
|
21
|
-
attr_path_accessor :work_dir
|
22
|
-
|
23
|
-
# TODO: move towards opts for all task types rather than
|
24
|
-
# reading these public properties.
|
25
|
-
|
26
|
-
# field field denoting the path of the executable that should be on the path
|
27
|
-
# specified in the work_dir parameter.
|
28
|
-
attr_path_accessor :exe
|
29
|
-
|
30
|
-
# TODO: move towards opts for all task types rather than
|
31
|
-
# reading these public properties.
|
32
|
-
|
33
|
-
# returns a Set with parameters
|
34
|
-
def parameters
|
35
|
-
@parameters ||= Set.new
|
36
|
-
end
|
37
|
-
|
38
|
-
# add a parameter to the list of parameters to pass to the executable
|
39
|
-
def add_parameter param
|
40
|
-
parameters.add param
|
41
|
-
end
|
42
|
-
|
43
|
-
# helper method that joins the path segments with
|
44
|
-
# respect to the work_dir.
|
45
|
-
private
|
46
|
-
def join *segments
|
47
|
-
segments ||= []
|
48
|
-
segments.unshift work_dir
|
49
|
-
File.join segments
|
50
|
-
end
|
51
|
-
|
52
|
-
# helper method that changes directory to the work directory
|
53
|
-
# and then yields to the block
|
54
|
-
def in_work_dir
|
55
|
-
unless @work_dir.nil?
|
56
|
-
Dir.chdir @work_dir do
|
57
|
-
trace "in work dir '#{@work_dir}'"
|
58
|
-
yield
|
59
|
-
end
|
60
|
-
else
|
61
|
-
trace "not in work dir, because it is nil."
|
62
|
-
yield
|
63
|
-
end
|
64
|
-
end
|
65
|
-
end
|
66
|
-
end
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
require 'set'
|
4
|
+
require 'albacore/config_dsl'
|
5
|
+
|
6
|
+
module Albacore
|
7
|
+
|
8
|
+
# Use on **configuration** objects that are command-oriented.
|
9
|
+
#
|
10
|
+
# a mixin that adds a couple of field writers and readers.
|
11
|
+
# specifically, allows the configuration to have a work_dir and exe field
|
12
|
+
# and defined a method that joins paths relative to the work_dir
|
13
|
+
module CmdConfig
|
14
|
+
include Logging
|
15
|
+
self.extend ConfigDSL
|
16
|
+
|
17
|
+
# TODO: move towards opts for all task types rather than
|
18
|
+
# reading these public properties.
|
19
|
+
|
20
|
+
# the working directory for this command
|
21
|
+
attr_path_accessor :work_dir
|
22
|
+
|
23
|
+
# TODO: move towards opts for all task types rather than
|
24
|
+
# reading these public properties.
|
25
|
+
|
26
|
+
# field field denoting the path of the executable that should be on the path
|
27
|
+
# specified in the work_dir parameter.
|
28
|
+
attr_path_accessor :exe
|
29
|
+
|
30
|
+
# TODO: move towards opts for all task types rather than
|
31
|
+
# reading these public properties.
|
32
|
+
|
33
|
+
# returns a Set with parameters
|
34
|
+
def parameters
|
35
|
+
@parameters ||= Set.new
|
36
|
+
end
|
37
|
+
|
38
|
+
# add a parameter to the list of parameters to pass to the executable
|
39
|
+
def add_parameter param
|
40
|
+
parameters.add param
|
41
|
+
end
|
42
|
+
|
43
|
+
# helper method that joins the path segments with
|
44
|
+
# respect to the work_dir.
|
45
|
+
private
|
46
|
+
def join *segments
|
47
|
+
segments ||= []
|
48
|
+
segments.unshift work_dir
|
49
|
+
File.join segments
|
50
|
+
end
|
51
|
+
|
52
|
+
# helper method that changes directory to the work directory
|
53
|
+
# and then yields to the block
|
54
|
+
def in_work_dir
|
55
|
+
unless @work_dir.nil?
|
56
|
+
Dir.chdir @work_dir do
|
57
|
+
trace "in work dir '#{@work_dir}'"
|
58
|
+
yield
|
59
|
+
end
|
60
|
+
else
|
61
|
+
trace "not in work dir, because it is nil."
|
62
|
+
yield
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
data/lib/albacore/dsl.rb
CHANGED
@@ -1,119 +1,119 @@
|
|
1
|
-
require 'albacore/cross_platform_cmd'
|
2
|
-
require 'albacore/paths'
|
3
|
-
|
4
|
-
module Albacore
|
5
|
-
module DSL
|
6
|
-
# this means that you can use all things available in the cross platform
|
7
|
-
# cmd from within albacore
|
8
|
-
include Albacore::CrossPlatformCmd
|
9
|
-
|
10
|
-
private
|
11
|
-
|
12
|
-
# a rake task type for outputting assembly versions
|
13
|
-
def asmver *args, &block
|
14
|
-
require 'albacore/task_types/asmver'
|
15
|
-
Albacore.define_task *args do
|
16
|
-
c = Albacore::Asmver::Config.new
|
17
|
-
yield c
|
18
|
-
Albacore::Asmver::Task.new(c.opts).execute
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
def asmver_files *args, &block
|
23
|
-
require 'albacore/task_types/asmver'
|
24
|
-
Albacore.define_task *args do
|
25
|
-
c = Albacore::Asmver::MultipleFilesConfig.new
|
26
|
-
yield c
|
27
|
-
|
28
|
-
c.configurations.each do |conf|
|
29
|
-
trace { "generating asmver for #{conf}" }
|
30
|
-
Albacore::Asmver::Task.new(conf.opts).execute
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
# a task for building sln or proj files - or just invoking something
|
36
|
-
# with MsBuild
|
37
|
-
def build *args, &block
|
38
|
-
require 'albacore/task_types/build'
|
39
|
-
Albacore.define_task *args do
|
40
|
-
c = Albacore::Build::Config.new
|
41
|
-
yield c
|
42
|
-
|
43
|
-
fail "unable to find MsBuild or XBuild" unless c.exe
|
44
|
-
command = Albacore::Build::Cmd.new(c.work_dir, c.exe, c.parameters)
|
45
|
-
Albacore::Build::Task.new(command).execute
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
# restore the nugets to the solution
|
50
|
-
def nugets_restore *args, &block
|
51
|
-
require 'albacore/task_types/nugets_restore'
|
52
|
-
Albacore.define_task *args do
|
53
|
-
c = Albacore::NugetsRestore::Config.new
|
54
|
-
yield c
|
55
|
-
|
56
|
-
c.ensure_authentication!
|
57
|
-
|
58
|
-
c.packages.each do |p|
|
59
|
-
command = Albacore::NugetsRestore::Cmd.new(c.work_dir, c.exe, c.opts_for_pkgcfg(p))
|
60
|
-
Albacore::NugetsRestore::Task.new(command).execute
|
61
|
-
end
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
# pack nugets
|
66
|
-
def nugets_pack *args, &block
|
67
|
-
require 'albacore/task_types/nugets_pack'
|
68
|
-
Albacore.define_task *args do
|
69
|
-
c = Albacore::NugetsPack::Config.new
|
70
|
-
yield c
|
71
|
-
Albacore::NugetsPack::ProjectTask.new(c.opts).execute
|
72
|
-
end
|
73
|
-
end
|
74
|
-
|
75
|
-
# basically a command with some parameters; allows you to execute your
|
76
|
-
# tests with albacore
|
77
|
-
def test_runner *args, &block
|
78
|
-
require 'albacore/task_types/test_runner'
|
79
|
-
Albacore.define_task *args do
|
80
|
-
c = Albacore::TestRunner::Config.new
|
81
|
-
yield c
|
82
|
-
Albacore::TestRunner::Task.new(c.opts).execute
|
83
|
-
end
|
84
|
-
end
|
85
|
-
|
86
|
-
# Restore hint paths to registered nugets
|
87
|
-
def restore_hint_paths *args, &block
|
88
|
-
require 'albacore/tools/restore_hint_paths'
|
89
|
-
Albacore.define_task *args do
|
90
|
-
c = Albacore::RestoreHintPaths::Config.new
|
91
|
-
yield c
|
92
|
-
|
93
|
-
t = Albacore::RestoreHintPaths::Task.new c
|
94
|
-
t.execute
|
95
|
-
end
|
96
|
-
end
|
97
|
-
|
98
|
-
# Generate .rpm or .deb files from .appspec files
|
99
|
-
def appspecs *args, &block
|
100
|
-
if Albacore.windows?
|
101
|
-
require 'albacore/cpack_app_spec'
|
102
|
-
Albacore.define_task *args do
|
103
|
-
c = ::Albacore::CpackAppSpec::Config.new
|
104
|
-
yield c
|
105
|
-
::Albacore::CpackAppSpec::Task.new(c.opts).execute
|
106
|
-
end
|
107
|
-
else
|
108
|
-
require 'albacore/fpm_app_spec'
|
109
|
-
Albacore.define_task *args do
|
110
|
-
c = ::Albacore::FpmAppSpec::Config.new
|
111
|
-
yield c
|
112
|
-
::Albacore::FpmAppSpec::Task.new(c.opts).execute
|
113
|
-
end
|
114
|
-
end
|
115
|
-
end
|
116
|
-
end
|
117
|
-
end
|
118
|
-
|
119
|
-
self.extend Albacore::DSL
|
1
|
+
require 'albacore/cross_platform_cmd'
|
2
|
+
require 'albacore/paths'
|
3
|
+
|
4
|
+
module Albacore
|
5
|
+
module DSL
|
6
|
+
# this means that you can use all things available in the cross platform
|
7
|
+
# cmd from within albacore
|
8
|
+
include Albacore::CrossPlatformCmd
|
9
|
+
|
10
|
+
private
|
11
|
+
|
12
|
+
# a rake task type for outputting assembly versions
|
13
|
+
def asmver *args, &block
|
14
|
+
require 'albacore/task_types/asmver'
|
15
|
+
Albacore.define_task *args do
|
16
|
+
c = Albacore::Asmver::Config.new
|
17
|
+
yield c
|
18
|
+
Albacore::Asmver::Task.new(c.opts).execute
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def asmver_files *args, &block
|
23
|
+
require 'albacore/task_types/asmver'
|
24
|
+
Albacore.define_task *args do
|
25
|
+
c = Albacore::Asmver::MultipleFilesConfig.new
|
26
|
+
yield c
|
27
|
+
|
28
|
+
c.configurations.each do |conf|
|
29
|
+
trace { "generating asmver for #{conf}" }
|
30
|
+
Albacore::Asmver::Task.new(conf.opts).execute
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
# a task for building sln or proj files - or just invoking something
|
36
|
+
# with MsBuild
|
37
|
+
def build *args, &block
|
38
|
+
require 'albacore/task_types/build'
|
39
|
+
Albacore.define_task *args do
|
40
|
+
c = Albacore::Build::Config.new
|
41
|
+
yield c
|
42
|
+
|
43
|
+
fail "unable to find MsBuild or XBuild" unless c.exe
|
44
|
+
command = Albacore::Build::Cmd.new(c.work_dir, c.exe, c.parameters)
|
45
|
+
Albacore::Build::Task.new(command).execute
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
# restore the nugets to the solution
|
50
|
+
def nugets_restore *args, &block
|
51
|
+
require 'albacore/task_types/nugets_restore'
|
52
|
+
Albacore.define_task *args do
|
53
|
+
c = Albacore::NugetsRestore::Config.new
|
54
|
+
yield c
|
55
|
+
|
56
|
+
c.ensure_authentication!
|
57
|
+
|
58
|
+
c.packages.each do |p|
|
59
|
+
command = Albacore::NugetsRestore::Cmd.new(c.work_dir, c.exe, c.opts_for_pkgcfg(p))
|
60
|
+
Albacore::NugetsRestore::Task.new(command).execute
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
# pack nugets
|
66
|
+
def nugets_pack *args, &block
|
67
|
+
require 'albacore/task_types/nugets_pack'
|
68
|
+
Albacore.define_task *args do
|
69
|
+
c = Albacore::NugetsPack::Config.new
|
70
|
+
yield c
|
71
|
+
Albacore::NugetsPack::ProjectTask.new(c.opts).execute
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
# basically a command with some parameters; allows you to execute your
|
76
|
+
# tests with albacore
|
77
|
+
def test_runner *args, &block
|
78
|
+
require 'albacore/task_types/test_runner'
|
79
|
+
Albacore.define_task *args do
|
80
|
+
c = Albacore::TestRunner::Config.new
|
81
|
+
yield c
|
82
|
+
Albacore::TestRunner::Task.new(c.opts).execute
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
# Restore hint paths to registered nugets
|
87
|
+
def restore_hint_paths *args, &block
|
88
|
+
require 'albacore/tools/restore_hint_paths'
|
89
|
+
Albacore.define_task *args do
|
90
|
+
c = Albacore::RestoreHintPaths::Config.new
|
91
|
+
yield c
|
92
|
+
|
93
|
+
t = Albacore::RestoreHintPaths::Task.new c
|
94
|
+
t.execute
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
# Generate .rpm or .deb files from .appspec files
|
99
|
+
def appspecs *args, &block
|
100
|
+
if Albacore.windows?
|
101
|
+
require 'albacore/cpack_app_spec'
|
102
|
+
Albacore.define_task *args do
|
103
|
+
c = ::Albacore::CpackAppSpec::Config.new
|
104
|
+
yield c
|
105
|
+
::Albacore::CpackAppSpec::Task.new(c.opts).execute
|
106
|
+
end
|
107
|
+
else
|
108
|
+
require 'albacore/fpm_app_spec'
|
109
|
+
Albacore.define_task *args do
|
110
|
+
c = ::Albacore::FpmAppSpec::Config.new
|
111
|
+
yield c
|
112
|
+
::Albacore::FpmAppSpec::Task.new(c.opts).execute
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
self.extend Albacore::DSL
|