albacore 2.0.16 → 2.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +36 -15
- data/albacore.gemspec +2 -2
- data/bin/albacore +11 -0
- data/lib/albacore/albacore_module.rb +75 -65
- data/lib/albacore/cli.rb +105 -0
- data/lib/albacore/cli_dsl.rb +43 -0
- data/lib/albacore/version.rb +1 -1
- data/spec/cli_spec.rb +53 -0
- metadata +10 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8459e2ab287d35aab39714362dd1a67c00e3a1b6
|
4
|
+
data.tar.gz: de71fc5144cbb5bdd60994ac7ada639b41c26fe4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 027a22bdb053bf94a9df10572e2982613b985b3d9cc69c3bea14337cdff0967af26ca372726da06dadc28017b83bac65750d7da8d1df8d8ec0a16e5475ed62ed
|
7
|
+
data.tar.gz: bcb602717b386994bd383d0599608436fd4bbecf4e3409a98995cab06545891bee8a02de6c8c22344f0fe48be1c5670a210a6196ae5fa5a123e452fe2608686c
|
data/README.md
CHANGED
@@ -51,7 +51,7 @@ Ruby' first. Albacore works on both Ruby 1.9.3 and 2.x.
|
|
51
51
|
First create `Gemfile` with these contents:
|
52
52
|
|
53
53
|
source 'https://rubygems.org'
|
54
|
-
gem 'albacore', '2.0.0'
|
54
|
+
gem 'albacore', '~> 2.0.0'
|
55
55
|
|
56
56
|
When setting up your build you need to ensure it is reproducible. Bundler
|
57
57
|
allows you to lock down the few gems that Albacore depend on to their specific
|
@@ -61,31 +61,46 @@ built and that it works well on your continous integration server.
|
|
61
61
|
Now you can bundle the dependencies, effectively freezing all gem dependencies
|
62
62
|
that your build depends on.
|
63
63
|
|
64
|
-
bundle
|
65
|
-
git add Gemfile
|
66
|
-
git add Gemfile.lock
|
64
|
+
bundle
|
65
|
+
git add Gemfile*
|
67
66
|
git commit -m 'Installed Albacore'
|
68
67
|
|
69
68
|
Now you are ready to continue reading below for your first Rakefile.
|
70
69
|
|
71
70
|
### Installing Ruby on Windows
|
72
71
|
|
73
|
-
|
72
|
+
First install Ruby from http://rubyinstaller.org/downloads/ - e.g. [v2.1.3
|
73
|
+
32-bits](http://dl.bintray.com/oneclick/rubyinstaller/rubyinstaller-2.1.3.exe?direct)
|
74
|
+
which is the latest version, at time of writing.
|
74
75
|
|
75
|
-
|
76
|
+
Second, install Ruby DevKit, or you won't be able to install nokogiri. Download
|
77
|
+
it [lower down on the same
|
78
|
+
page](http://cdn.rubyinstaller.org/archives/devkits/DevKit-mingw64-32-4.7.2-20130224-1151-sfx.exe),
|
79
|
+
open a console:
|
76
80
|
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
+
``` bash
|
82
|
+
cd \DevKit
|
83
|
+
ruby dk.rb init
|
84
|
+
ruby dk.rb install
|
85
|
+
```
|
81
86
|
|
82
|
-
Now
|
83
|
-
installed. Now you can install Albacore, the collection of tasktypes, tasks and
|
84
|
-
extension points aimed to make your life as a .Net developer easier:
|
87
|
+
Now close that console and open a new console, and run:
|
85
88
|
|
86
89
|
gem install bundler
|
87
90
|
|
88
|
-
Continue below with your first
|
91
|
+
This gives you a working ruby installation. Continue below with your first
|
92
|
+
Rakefile.
|
93
|
+
|
94
|
+
### Installing Ruby on OS X
|
95
|
+
|
96
|
+
``` bash
|
97
|
+
brew install rbenv ruby-build
|
98
|
+
rbenv install 2.1.3
|
99
|
+
gem install bundler
|
100
|
+
```
|
101
|
+
|
102
|
+
Done. Ensure `brew doctor` is clean enough and that `ruby --version` outputs the
|
103
|
+
expected version.
|
89
104
|
|
90
105
|
## Creating Your First Rakefile
|
91
106
|
|
@@ -126,7 +141,7 @@ nugets_pack :create_nugets => ['build/pkg', :versioning, :build] do |p|
|
|
126
141
|
p.files = FileList['src/**/*.{csproj,fsproj,nuspec}'].
|
127
142
|
exclude(/Tests/)
|
128
143
|
p.out = 'build/pkg'
|
129
|
-
p.exe = '
|
144
|
+
p.exe = 'tools/NuGet.exe'
|
130
145
|
p.with_metadata do |m|
|
131
146
|
m.description = 'A cool nuget'
|
132
147
|
m.authors = 'Henrik'
|
@@ -144,6 +159,10 @@ You can now run:
|
|
144
159
|
|
145
160
|
bundle exec rake
|
146
161
|
|
162
|
+
You can continue reading about the available task-types in [the wiki][wiki].
|
163
|
+
|
164
|
+
If you're upgrading from v1.0, there's an article [there for you][upgrade-v1.0]
|
165
|
+
|
147
166
|
## Contributing
|
148
167
|
|
149
168
|
1. Create a feature branch with your change:
|
@@ -166,3 +185,5 @@ Document your code with
|
|
166
185
|
writing it: it's much easier to write the documentation together with the code
|
167
186
|
than afterwards.
|
168
187
|
|
188
|
+
[wiki]: https://github.com/Albacore/albacore/wiki
|
189
|
+
[upgrade-v1.0]: https://github.com/Albacore/albacore/wiki/Upgrading-from-v1.0
|
data/albacore.gemspec
CHANGED
@@ -31,6 +31,6 @@ EOF
|
|
31
31
|
|
32
32
|
s.files = `git ls-files`.split("\n").concat(Dir.glob('./resources/**'))
|
33
33
|
s.test_files = `git ls-files -- spec/*`.split("\n")
|
34
|
-
|
35
|
-
s.require_paths =
|
34
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename f }
|
35
|
+
s.require_paths = %w|bin lib|
|
36
36
|
end
|
data/bin/albacore
ADDED
@@ -1,65 +1,75 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
|
-
|
3
|
-
require 'albacore/application'
|
4
|
-
require 'albacore/logging'
|
5
|
-
|
6
|
-
# The albacore module instance methods.
|
7
|
-
module Albacore
|
8
|
-
class << self
|
9
|
-
# Accessor for the Albacore application. Configuration
|
10
|
-
# and similar singleton values will be stored in this
|
11
|
-
# instance. Multiple calls will yield the same instance.
|
12
|
-
def application
|
13
|
-
@application ||= Albacore::Application.new
|
14
|
-
end
|
15
|
-
|
16
|
-
#
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
application.
|
39
|
-
end
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
end
|
50
|
-
|
51
|
-
def
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
end
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
require 'albacore/application'
|
4
|
+
require 'albacore/logging'
|
5
|
+
|
6
|
+
# The albacore module instance methods.
|
7
|
+
module Albacore
|
8
|
+
class << self
|
9
|
+
# Accessor for the Albacore application. Configuration
|
10
|
+
# and similar singleton values will be stored in this
|
11
|
+
# instance. Multiple calls will yield the same instance.
|
12
|
+
def application
|
13
|
+
@application ||= Albacore::Application.new
|
14
|
+
end
|
15
|
+
|
16
|
+
# Name of default Rakefile, used by Cli
|
17
|
+
def rakefile
|
18
|
+
'Rakefile'
|
19
|
+
end
|
20
|
+
|
21
|
+
# Name of the default Gemfile, used by Cli
|
22
|
+
def gemfile
|
23
|
+
'Gemfile'
|
24
|
+
end
|
25
|
+
|
26
|
+
# set the application -- good for testing
|
27
|
+
# the infrastructure of albacore by resetting the
|
28
|
+
# state after each test
|
29
|
+
def set_application app
|
30
|
+
@application = app
|
31
|
+
end
|
32
|
+
|
33
|
+
# Defines a new task with all of what that entails:
|
34
|
+
# will call application.define_task.
|
35
|
+
def define_task *args, &block
|
36
|
+
args = [caller[0][/`.*'/][1..-2]] if args.nil? or args.empty?
|
37
|
+
# delegate to the application singleton
|
38
|
+
application.define_task *args, &block
|
39
|
+
end
|
40
|
+
|
41
|
+
# Set the global albacore logging level.
|
42
|
+
def log_level= level
|
43
|
+
application.logger.level = level
|
44
|
+
end
|
45
|
+
|
46
|
+
# Use to write to STDOUT (by default)
|
47
|
+
def puts *args
|
48
|
+
application.puts *args
|
49
|
+
end
|
50
|
+
|
51
|
+
def events
|
52
|
+
@events ||= {}
|
53
|
+
end
|
54
|
+
|
55
|
+
def subscribe event, &block
|
56
|
+
event = event.to_sym unless event.is_a? Symbol
|
57
|
+
events[event] ||= Set.new
|
58
|
+
events[event].add block
|
59
|
+
end
|
60
|
+
|
61
|
+
def publish event, obj
|
62
|
+
if events.member? event
|
63
|
+
events[event].each { |m| m.call(obj) }
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
# Gets whether we're running under Windows.
|
68
|
+
#
|
69
|
+
def windows?
|
70
|
+
!!::Rake::Win32.windows?
|
71
|
+
end
|
72
|
+
|
73
|
+
Albacore.log_level = Logger::DEBUG if ENV["DEBUG"]
|
74
|
+
end
|
75
|
+
end
|
data/lib/albacore/cli.rb
ADDED
@@ -0,0 +1,105 @@
|
|
1
|
+
require 'albacore/version'
|
2
|
+
require 'albacore/cross_platform_cmd'
|
3
|
+
require 'albacore/cli_dsl'
|
4
|
+
|
5
|
+
module Albacore
|
6
|
+
class Cli
|
7
|
+
include Albacore::CliDSL
|
8
|
+
|
9
|
+
def initialize args
|
10
|
+
# Run a semver command. Raise a CommandError if the command does not exist.
|
11
|
+
# Expects an array of commands, such as ARGV.
|
12
|
+
@args = args
|
13
|
+
run_command(@args.shift || :help)
|
14
|
+
end
|
15
|
+
|
16
|
+
private
|
17
|
+
|
18
|
+
def next_param_or_error(error_message)
|
19
|
+
@args.shift || raise(CommandError, error_message)
|
20
|
+
end
|
21
|
+
|
22
|
+
# Gets the help text if the command line is used in the wrong way
|
23
|
+
def help_text
|
24
|
+
<<-HELP
|
25
|
+
albacore commands
|
26
|
+
-----------------
|
27
|
+
|
28
|
+
init[ialze] # initialize a new Rakefile with defaults
|
29
|
+
help # display this help
|
30
|
+
|
31
|
+
PLEASE READ https://github.com/Albacore/albacore/wiki/Albacore-binary
|
32
|
+
HELP
|
33
|
+
end
|
34
|
+
|
35
|
+
# Create a new Rakefile file if the file does not exist.
|
36
|
+
command :initialize, :init do
|
37
|
+
files = [Albacore.rakefile, Albacore.gemfile]
|
38
|
+
if files.any? { |file| File.exist? file }
|
39
|
+
puts "One of #{files.inspect} already exists"
|
40
|
+
else
|
41
|
+
File.open Albacore.gemfile, 'w+' do |io|
|
42
|
+
io.puts <<-DATA
|
43
|
+
source 'https://rubygems.org'
|
44
|
+
gem 'albacore', '~> #{Albacore::VERSION}'
|
45
|
+
DATA
|
46
|
+
end
|
47
|
+
Albacore::CrossPlatformCmd.system 'bundle'
|
48
|
+
File.open Albacore.rakefile, 'w+' do |io|
|
49
|
+
io.puts <<-DATA
|
50
|
+
require 'bundler/setup'
|
51
|
+
|
52
|
+
require 'albacore'
|
53
|
+
require 'albacore/tasks/versionizer'
|
54
|
+
require 'albacore/ext/teamcity'
|
55
|
+
|
56
|
+
Albacore::Tasks::Versionizer.new :versioning
|
57
|
+
|
58
|
+
desc 'Perform fast build (warn: doesn\\'t d/l deps)'
|
59
|
+
build :quick_build do |b|
|
60
|
+
b.logging = 'detailed'
|
61
|
+
b.sln = 'src/MyProj.sln'
|
62
|
+
end
|
63
|
+
|
64
|
+
desc 'restore all nugets as per the packages.config files'
|
65
|
+
nugets_restore :restore do |p|
|
66
|
+
p.out = 'src/packages'
|
67
|
+
p.exe = 'tools/NuGet.exe'
|
68
|
+
end
|
69
|
+
|
70
|
+
desc 'Perform full build'
|
71
|
+
build :build => [:versioning, :restore] do |b|
|
72
|
+
b.sln = 'src/MyProj.sln'
|
73
|
+
# alt: b.file = 'src/MyProj.sln'
|
74
|
+
end
|
75
|
+
|
76
|
+
directory 'build/pkg'
|
77
|
+
|
78
|
+
desc 'package nugets - finds all projects and package them'
|
79
|
+
nugets_pack :create_nugets => ['build/pkg', :versioning, :build] do |p|
|
80
|
+
p.files = FileList['src/**/*.{csproj,fsproj,nuspec}'].
|
81
|
+
exclude(/Tests/)
|
82
|
+
p.out = 'build/pkg'
|
83
|
+
p.exe = 'tools/NuGet.exe'
|
84
|
+
p.with_metadata do |m|
|
85
|
+
m.description = 'A cool nuget'
|
86
|
+
m.authors = 'Henrik'
|
87
|
+
m.version = ENV['NUGET_VERSION']
|
88
|
+
end
|
89
|
+
p.with_package do |p|
|
90
|
+
p.add_file 'file/relative/to/proj', 'lib/net40'
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
task :default => :create_nugets
|
95
|
+
DATA
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
# Output instructions for using the semvar command.
|
101
|
+
command :help do
|
102
|
+
puts help_text
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
module Albacore
|
2
|
+
module CliDSL
|
3
|
+
|
4
|
+
def self.included klass
|
5
|
+
klass.extend ClassMethods
|
6
|
+
klass.send :include, InstanceMethods
|
7
|
+
end
|
8
|
+
|
9
|
+
class CommandError < StandardError
|
10
|
+
end
|
11
|
+
|
12
|
+
module InstanceMethods
|
13
|
+
# Calls an instance method defined via the ::command class method.
|
14
|
+
# Raises CommandError if the command does not exist.
|
15
|
+
def run_command(command)
|
16
|
+
method_name = "#{self.class.command_prefix}#{command}"
|
17
|
+
if self.class.method_defined?(method_name)
|
18
|
+
send method_name
|
19
|
+
else
|
20
|
+
raise CommandError, "invalid command #{command}"
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
module ClassMethods
|
26
|
+
# Defines an instance method based on the first command name.
|
27
|
+
# The method executes the code of the given block.
|
28
|
+
# Aliases methods for any subsequent command names.
|
29
|
+
def command(*command_names, &block)
|
30
|
+
method_name = "#{command_prefix}#{command_names.shift}"
|
31
|
+
define_method method_name, &block
|
32
|
+
command_names.each do |c|
|
33
|
+
alias_method "#{command_prefix}#{c}", method_name
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
# The prefix for any instance method defined by the ::command method.
|
38
|
+
def command_prefix
|
39
|
+
:_run_
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
data/lib/albacore/version.rb
CHANGED
data/spec/cli_spec.rb
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
require 'albacore/cli'
|
2
|
+
|
3
|
+
describe Albacore::Cli do
|
4
|
+
|
5
|
+
before :each do
|
6
|
+
# Output to a file that doesn't conflict with the project's Rakefile file.
|
7
|
+
@test_rake = 'Test_Rakefile'
|
8
|
+
@test_gem = 'Test_Gemfile'
|
9
|
+
Albacore.stub(:rakefile).and_return @test_rake
|
10
|
+
Albacore.stub(:gemfile).and_return @test_gem
|
11
|
+
|
12
|
+
# Capture the output that would typically appear in the console.
|
13
|
+
@original_stdout = $stdout
|
14
|
+
@output = StringIO.new
|
15
|
+
$stdout = @output
|
16
|
+
end
|
17
|
+
|
18
|
+
after :each do
|
19
|
+
# Delete the Test_Rakefile if one was created.
|
20
|
+
FileUtils.rm @test_rake
|
21
|
+
FileUtils.rm @test_gem
|
22
|
+
|
23
|
+
# Return output to its original value.
|
24
|
+
$stdout = @original_stdout
|
25
|
+
end
|
26
|
+
|
27
|
+
%w( init initialize ).each do |command|
|
28
|
+
describe command do
|
29
|
+
describe 'when no Rakefile file exists' do
|
30
|
+
it 'creates a new Rakefile and Gemfile' do
|
31
|
+
expect {
|
32
|
+
described_class.new [command]
|
33
|
+
}.to change{ File.exist?(@test_rake) }.from(false).to(true)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
describe 'when a Rakefile file already exists' do
|
37
|
+
before :each do
|
38
|
+
FileUtils.touch @test_rake
|
39
|
+
FileUtils.touch @test_gem
|
40
|
+
end
|
41
|
+
it 'outputs a warning message' do
|
42
|
+
described_class.new [command]
|
43
|
+
@output.string.should match /One of \[.*\] already exists\n/
|
44
|
+
end
|
45
|
+
it "does not overwrite the existing file" do
|
46
|
+
expect {
|
47
|
+
described_class.new [command]
|
48
|
+
}.to_not change{ File.mtime(@test_rake) }
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: albacore
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Henrik Feldt
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-10-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
@@ -101,7 +101,8 @@ description: |2
|
|
101
101
|
handling the .Net compilers while making it very easy to integrate your ruby-code
|
102
102
|
with existing dev-ops tools, such as Puppet, Chef, Capistrano or Vagrant/VirtualBox.
|
103
103
|
email: henrik@haf.se
|
104
|
-
executables:
|
104
|
+
executables:
|
105
|
+
- albacore
|
105
106
|
extensions: []
|
106
107
|
extra_rdoc_files: []
|
107
108
|
files:
|
@@ -115,6 +116,7 @@ files:
|
|
115
116
|
- README.md
|
116
117
|
- Rakefile
|
117
118
|
- albacore.gemspec
|
119
|
+
- bin/albacore
|
118
120
|
- lib/albacore.rb
|
119
121
|
- lib/albacore/albacore_module.rb
|
120
122
|
- lib/albacore/app_spec.rb
|
@@ -122,6 +124,8 @@ files:
|
|
122
124
|
- lib/albacore/app_spec/defaults.rb
|
123
125
|
- lib/albacore/app_spec/iis_site.rb
|
124
126
|
- lib/albacore/application.rb
|
127
|
+
- lib/albacore/cli.rb
|
128
|
+
- lib/albacore/cli_dsl.rb
|
125
129
|
- lib/albacore/cmd_config.rb
|
126
130
|
- lib/albacore/config_dsl.rb
|
127
131
|
- lib/albacore/cpack_app_spec.rb
|
@@ -172,6 +176,7 @@ files:
|
|
172
176
|
- spec/asmver_spec.rb
|
173
177
|
- spec/asmver_task_spec.rb
|
174
178
|
- spec/build_spec.rb
|
179
|
+
- spec/cli_spec.rb
|
175
180
|
- spec/config_dsl_spec.rb
|
176
181
|
- spec/cross_platform_cmd_spec.rb
|
177
182
|
- spec/dsl_spec.rb
|
@@ -368,6 +373,7 @@ metadata: {}
|
|
368
373
|
post_install_message:
|
369
374
|
rdoc_options: []
|
370
375
|
require_paths:
|
376
|
+
- bin
|
371
377
|
- lib
|
372
378
|
required_ruby_version: !ruby/object:Gem::Requirement
|
373
379
|
requirements:
|
@@ -392,6 +398,7 @@ test_files:
|
|
392
398
|
- spec/asmver_spec.rb
|
393
399
|
- spec/asmver_task_spec.rb
|
394
400
|
- spec/build_spec.rb
|
401
|
+
- spec/cli_spec.rb
|
395
402
|
- spec/config_dsl_spec.rb
|
396
403
|
- spec/cross_platform_cmd_spec.rb
|
397
404
|
- spec/dsl_spec.rb
|