albacore 2.0.0.rc.4 → 2.0.0.rc.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.md CHANGED
@@ -31,8 +31,14 @@ build will use. Create a new file, named `Gemfile`. This file should look like
31
31
  this:
32
32
 
33
33
  source 'http://rubygems.org'
34
- gem 'albacore', '2.0.0.rc.2'
34
+ gem 'albacore', '2.0.0.rc.5'
35
35
 
36
+ When setting up your build you need to ensure it is reproducible. Bundler
37
+ allows you to lock down all gems that albacore depend on to their specific
38
+ versions, ensuring that your peers can re-run the same rake script you just
39
+ built and that it works well on your continous integration server.
40
+
41
+ The first step after installing `bundler` is to create a `Gemfile` next to your
36
42
  Now, install albacore from this repository by running:
37
43
 
38
44
  bundle
@@ -90,7 +96,7 @@ task :default => :create_nugets
90
96
 
91
97
  You can now run:
92
98
 
93
- rake
99
+ bundle exec rake
94
100
 
95
101
  ## Contributing
96
102
 
@@ -101,6 +107,49 @@ You can now run:
101
107
  a. Make sure TravisCI is OK with it
102
108
  b. Describe your PR in English.
103
109
 
110
+ ## DSL
111
+
112
+ When you `require 'albacore'` you will get a few methods added and available for
113
+ use within your Rakefile, these are specified in CrossPlatformCmd, and are as
114
+ follows:
115
+
116
+ - `#system`
117
+ - `#sh`
118
+ - `#shie`
119
+ - `#system_control`
120
+ - `#which`
121
+ - `#normalise_slashes`
122
+ - `#chdir (work_dir : ?string) (block : Block<unit, x>) : x` - takes a string work dir to be
123
+ in and a block of ruby to execute in that work dir and returns the return
124
+ value of block.
125
+
126
+
127
+ ## Debugging Albacore scripts
128
+
129
+ You can call the rakefile as such:
130
+
131
+ ```
132
+ DEBUG=true rake
133
+ ```
134
+
135
+ This changes the behaviour of the logging to output debug verbosity. It also
136
+ changes some tasks to override Rakefile settings for verbosity and prints more
137
+ debug information. I've tried to keep the information structured.
138
+
139
+ If you're reporting a bug or need crash information to file a bug report, you
140
+ can append the `--trace` flag to the invocation.
141
+
142
+ ```
143
+ DEBUG=true rake --trace
144
+ ```
145
+
146
+ ## Tips and Tricks
147
+
148
+ rake script:
149
+
150
+ ```
151
+ source "https://rubygems.org"
152
+
104
153
  ## Task Types
105
154
 
106
155
  Task types are the pre-built factories for rake tasks. They often take care of
@@ -60,6 +60,9 @@ module Albacore
60
60
  # output: whether to supress the command's output (default false)
61
61
  # out: output pipe
62
62
  # err: error pipe
63
+ # clr_command:
64
+ # whether to include 'mono' in front of the things to run
65
+ # if the command is a clr command
63
66
  #
64
67
  def system *cmd, &block
65
68
  raise ArgumentError, "cmd is nil" if cmd.nil? # don't allow nothing to be passed
@@ -69,9 +72,10 @@ module Albacore
69
72
  output: true,
70
73
  work_dir: FileUtils.pwd,
71
74
  out: Albacore.application.output,
72
- err: Albacore.application.output_err)
75
+ err: Albacore.application.output_err,
76
+ clr_command: false)
73
77
 
74
- exe, pars, printable, block = prepare_command cmd, &block
78
+ exe, pars, printable, block = prepare_command cmd, (opts.get('clr_command')), &block
75
79
 
76
80
  # TODO: figure out how to interleave output and error streams
77
81
  out, _, inmem = opts.get(:out), opts.get(:err), StringIO.new
@@ -231,10 +235,10 @@ module Albacore
231
235
 
232
236
  private
233
237
 
234
- def prepare_command cmd, &block
238
+ def prepare_command cmd, clr_command = false, &block
239
+ cmd = cmd.unshift 'mono' if clr_command && ! ::Albacore.windows?
235
240
  pars = cmd[1..-1].flatten
236
241
  raise ArgumentError, "arguments 1..-1 must be an array" unless pars.is_a? Array
237
-
238
242
  exe, pars = ::Albacore::Paths.normalise cmd[0], pars
239
243
  printable = %Q{#{exe} #{pars.join(' ')}}
240
244
  handler = block_given? ? block : handler_with_message(printable)
@@ -91,6 +91,11 @@ end})
91
91
  # gets the framework assemblies for this package
92
92
  nuspec_field :framework_assemblies
93
93
 
94
+ # (v2.5 or above) Specifies the minimum version of the NuGet client that
95
+ # can install this package. This requirement is enforced by both the
96
+ # NuGet Visual Studio extension and nuget.exe program.
97
+ nuspec_field :min_client_version
98
+
94
99
  # gets the field symbols that have been set
95
100
  attr_reader :set_fields
96
101
 
@@ -127,6 +127,7 @@ module Albacore
127
127
  @target = 'net40'
128
128
  @symbols = false
129
129
  @project_dependencies = true
130
+ @leave_nuspec = false
130
131
  fill_required
131
132
  end
132
133
 
@@ -145,6 +146,12 @@ module Albacore
145
146
  @symbols = true
146
147
  end
147
148
 
149
+ # leave the nuspec behind, don't delete it after generating it
150
+ #
151
+ def leave_nuspec
152
+ @leave_nuspec = true
153
+ end
154
+
148
155
  # call this if you want to cancel 'smart' scanning of the *proj
149
156
  # file for its dependencies
150
157
  def no_project_dependencies
@@ -168,7 +175,8 @@ module Albacore
168
175
  :files => @files,
169
176
  :configuration => @configuration,
170
177
  :project_dependencies => @project_dependencies,
171
- :original_path => FileUtils.pwd
178
+ :original_path => FileUtils.pwd,
179
+ :leave_nuspec => @leave_nuspec
172
180
  })
173
181
  end
174
182
 
@@ -331,6 +339,7 @@ module Albacore
331
339
 
332
340
  def cleanup_nuspec nuspec
333
341
  return if nuspec.nil? or not File.exists? nuspec
342
+ return if @opts.get :leave_nuspec, false
334
343
  File.delete nuspec
335
344
  end
336
345
 
@@ -73,6 +73,7 @@ module Albacore
73
73
 
74
74
  def initialize
75
75
  @include_official = false
76
+ @list_spec = File.join '**', 'packages.config'
76
77
  end
77
78
 
78
79
  # the output directory passed to nuget when restoring the nugets
@@ -81,8 +82,13 @@ module Albacore
81
82
  # nuget source, when other than MSFT source
82
83
  attr_accessor :source
83
84
 
85
+ # specifies the list specification to load 'packages.config' files
86
+ # from.
87
+ #
88
+ # e.g. '**/packages.config' on *nix.
89
+ attr_accessor :list_spec
90
+
84
91
  def packages
85
- list_spec = File.join '**', 'packages.config'
86
92
  # it seems FileList doesn't care about the curr dir
87
93
  in_work_dir do
88
94
  FileList[
@@ -1,4 +1,4 @@
1
- require 'semver'
1
+ require 'xsemver'
2
2
  require 'albacore/logging'
3
3
 
4
4
  module Albacore
@@ -21,9 +21,9 @@ module Albacore
21
21
  # code if you want something of your own.
22
22
  #
23
23
  def self.new *sym
24
- ver = SemVer.find
24
+ ver = XSemVer::SemVer.find
25
25
  revision = (ENV['BUILD_NUMBER'] || ver.patch).to_i
26
- ver = SemVer.new(ver.major, ver.minor, revision, ver.special)
26
+ ver = XSemVer::SemVer.new(ver.major, ver.minor, revision, ver.special)
27
27
 
28
28
  # extensible number w/ git hash
29
29
  ENV['BUILD_VERSION'] = ver.format("%M.%m.%p%s") + ".#{commit_data()[0]}"
@@ -32,7 +32,7 @@ module Albacore
32
32
  ENV['NUGET_VERSION'] = ver.format("%M.%m.%p%s")
33
33
 
34
34
  # purely M.m.p format
35
- ENV['FORMAL_VERSION'] = "#{ SemVer.new(ver.major, ver.minor, revision).format "%M.%m.%p"}"
35
+ ENV['FORMAL_VERSION'] = "#{ XSemVer::SemVer.new(ver.major, ver.minor, revision).format "%M.%m.%p"}"
36
36
 
37
37
  body = proc {
38
38
  Albacore.publish :build_version, OpenStruct.new(
@@ -1,3 +1,3 @@
1
1
  module Albacore
2
- VERSION = "2.0.0.rc.4"
2
+ VERSION = "2.0.0.rc.5"
3
3
  end
@@ -15,6 +15,56 @@ describe Albacore::CrossPlatformCmd.method(:which), "what happens when calling #
15
15
  end
16
16
  end
17
17
 
18
+ describe Albacore::CrossPlatformCmd.method(:prepare_command) do
19
+ it 'should be callable' do
20
+ subject.should respond_to(:call)
21
+ end
22
+ before :all do
23
+ # noteworthy: escape spaces with backslash!
24
+ @exe, @pars, @printable, @handler = subject.call %w[echo Hello World Goodbye\ World], true
25
+ end
26
+ it "should not return nil for anything" do
27
+ { exe: @exe,
28
+ pars: @pars,
29
+ printable: @printable,
30
+ handler: @handler
31
+ }.each do |kv|
32
+ kv[1].should_not be_nil
33
+ end
34
+ end
35
+ if Albacore.windows? then
36
+ it 'should not include mono' do
37
+ @exe.should_not include('mono')
38
+ end
39
+
40
+ it 'should return first param correctly' do
41
+ @pars[0].should eq('Hello')
42
+ end
43
+ it 'should return second param correctly' do
44
+ @pars[1].should eq('World')
45
+ end
46
+ it 'should return third param correctly' do
47
+ @pars[2].should eq('Goodbye World')
48
+ end
49
+ else
50
+ it 'should include mono' do
51
+ @exe.should include('mono')
52
+ end
53
+ it 'should return first param as "echo"' do
54
+ @pars[0].should eq('echo')
55
+ end
56
+ it 'should return second param as "Hello"' do
57
+ @pars[1].should eq('Hello')
58
+ end
59
+ it 'should return third param as "World"' do
60
+ @pars[2].should eq('World')
61
+ end
62
+ it 'should return fourth param as "Goodbye World"' do
63
+ @pars[3].should eq('Goodbye World')
64
+ end
65
+ end
66
+ end
67
+
18
68
  [:system, :sh, :shie].each do |method|
19
69
  describe Albacore::CrossPlatformCmd.method(method), "##{method}" do
20
70
  describe 'its positive modes' do
@@ -0,0 +1,17 @@
1
+ require 'albacore'
2
+ require 'albacore/tasks/versionizer'
3
+
4
+ describe 'adding versionizer to a class' do
5
+ class VersioniserUsage
6
+ def initialize
7
+ ::Albacore::Tasks::Versionizer.new :v
8
+ end
9
+ end
10
+
11
+ it 'can create a new class instance' do
12
+ begin
13
+ VersioniserUsage.new
14
+ rescue SemVerMissingError
15
+ end
16
+ end
17
+ 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.0.0.rc.4
4
+ version: 2.0.0.rc.5
5
5
  prerelease: 6
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-12-17 00:00:00.000000000 Z
13
+ date: 2014-01-12 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rake
@@ -270,6 +270,7 @@ files:
270
270
  - spec/support/returnstatus/returnstatus.exe.config
271
271
  - spec/support/returnstatus/returnstatus.pdb
272
272
  - spec/support/sh_interceptor.rb
273
+ - spec/tasks/versionizer_spec.rb
273
274
  - spec/testdata/.gitignore
274
275
  - spec/testdata/DebugProject/.gitignore
275
276
  - spec/testdata/DebugProject/Degbu.fsproj
@@ -322,7 +323,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
322
323
  version: '0'
323
324
  segments:
324
325
  - 0
325
- hash: -205228917217279465
326
+ hash: 3795329884422946093
326
327
  required_rubygems_version: !ruby/object:Gem::Requirement
327
328
  none: false
328
329
  requirements:
@@ -378,6 +379,7 @@ test_files:
378
379
  - spec/support/returnstatus/returnstatus.exe.config
379
380
  - spec/support/returnstatus/returnstatus.pdb
380
381
  - spec/support/sh_interceptor.rb
382
+ - spec/tasks/versionizer_spec.rb
381
383
  - spec/testdata/.gitignore
382
384
  - spec/testdata/DebugProject/.gitignore
383
385
  - spec/testdata/DebugProject/Degbu.fsproj