albacore 0.3.2 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/albacore/nugetinstall.rb +57 -0
- data/lib/version.rb +1 -1
- data/spec/nugetinstall_spec.rb +47 -0
- metadata +8 -6
@@ -0,0 +1,57 @@
|
|
1
|
+
require 'albacore/albacoretask'
|
2
|
+
require 'albacore/support/supportlinux'
|
3
|
+
|
4
|
+
class NuGetInstall
|
5
|
+
include Albacore::Task
|
6
|
+
include Albacore::RunCommand
|
7
|
+
include SupportsLinuxEnvironment
|
8
|
+
|
9
|
+
attr_accessor :command,
|
10
|
+
:package,
|
11
|
+
:output_directory,
|
12
|
+
:version,
|
13
|
+
:exclude_version,
|
14
|
+
:prerelease,
|
15
|
+
:no_cache
|
16
|
+
|
17
|
+
attr_array :sources
|
18
|
+
|
19
|
+
def initialize(command='NuGet.exe')
|
20
|
+
super()
|
21
|
+
@sources = []
|
22
|
+
@command = command
|
23
|
+
@no_cache = false
|
24
|
+
@prerelease = false
|
25
|
+
@exclude_version = false
|
26
|
+
end
|
27
|
+
|
28
|
+
def execute
|
29
|
+
params = generate_params
|
30
|
+
|
31
|
+
@logger.debug "Build NuGet Install Command Line: #{params}"
|
32
|
+
result = run_command "NuGet", params
|
33
|
+
|
34
|
+
failure_message = "Nuget Install for package #{@package} failed. See Build log for details."
|
35
|
+
fail_with_message failure_message unless result
|
36
|
+
end
|
37
|
+
|
38
|
+
def generate_params
|
39
|
+
fail_with_message 'A NuGet package must be specified.' unless @package
|
40
|
+
|
41
|
+
params = []
|
42
|
+
params << 'install'
|
43
|
+
params << package
|
44
|
+
params << "-Version #{version}" if @version
|
45
|
+
params << "-OutputDirectory #{output_directory}" if @output_directory
|
46
|
+
params << "-ExcludeVersion" if @exclude_version
|
47
|
+
params << "-NoCache" if @no_cache
|
48
|
+
params << "-Prerelease" if @prerelease
|
49
|
+
params << "-Source #{build_package_sources}" if @sources unless @sources.empty?
|
50
|
+
|
51
|
+
merged_params = params.join(' ')
|
52
|
+
end
|
53
|
+
|
54
|
+
def build_package_sources
|
55
|
+
"\"#{@sources.join(';')}\""
|
56
|
+
end
|
57
|
+
end
|
data/lib/version.rb
CHANGED
@@ -0,0 +1,47 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'albacore/nugetinstall'
|
3
|
+
|
4
|
+
describe NuGetInstall do
|
5
|
+
before :each do
|
6
|
+
@nugetinstall = NuGetInstall.new
|
7
|
+
@strio = StringIO.new
|
8
|
+
@nugetinstall.log_device = @strio
|
9
|
+
@nugetinstall.log_level = :diagnostic
|
10
|
+
end
|
11
|
+
|
12
|
+
context "when no path to NuGet is specified" do
|
13
|
+
it "assumes NuGet is in the path" do
|
14
|
+
@nugetinstall.command.should == "NuGet.exe"
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
it "generates the correct command-line parameters" do
|
19
|
+
@nugetinstall.package = "Hircine"
|
20
|
+
@nugetinstall.sources = "source1", "source2"
|
21
|
+
@nugetinstall.version = "0.1.1-pre"
|
22
|
+
@nugetinstall.no_cache = false
|
23
|
+
@nugetinstall.prerelease = true
|
24
|
+
@nugetinstall.exclude_version = true
|
25
|
+
@nugetinstall.output_directory = "customdir"
|
26
|
+
|
27
|
+
params = @nugetinstall.generate_params
|
28
|
+
params.should include("install")
|
29
|
+
params.should include(@nugetinstall.package)
|
30
|
+
params.should include("-Version 0.1.1-pre")
|
31
|
+
params.should include("-Source \"source1;source2\"")
|
32
|
+
params.should include("-OutputDirectory customdir")
|
33
|
+
params.should include("-ExcludeVersion")
|
34
|
+
params.should include("-Prerelease")
|
35
|
+
params.should_not include("-NoCache")
|
36
|
+
|
37
|
+
@nugetinstall.no_cache = true
|
38
|
+
params = @nugetinstall.generate_params
|
39
|
+
params.should include("-NoCache")
|
40
|
+
end
|
41
|
+
|
42
|
+
it "fails if no package is specified" do
|
43
|
+
@nugetinstall.extend(FailPatch)
|
44
|
+
@nugetinstall.generate_params
|
45
|
+
@strio.string.should include('A NuGet package must be specified.')
|
46
|
+
end
|
47
|
+
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: 0.3.
|
4
|
+
version: 0.3.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,11 +10,11 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2012-09-
|
13
|
+
date: 2012-09-13 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rubyzip
|
17
|
-
requirement: &
|
17
|
+
requirement: &3508284 !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
20
20
|
- - ! '>='
|
@@ -22,7 +22,7 @@ dependencies:
|
|
22
22
|
version: '0'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
|
-
version_requirements: *
|
25
|
+
version_requirements: *3508284
|
26
26
|
description: Easily build your .Net or Mono project using this collection of Rake
|
27
27
|
tasks.
|
28
28
|
email: henrik@haf.se
|
@@ -105,6 +105,7 @@ files:
|
|
105
105
|
- lib/albacore/ncoverreports/summaryreport.rb
|
106
106
|
- lib/albacore/ncoverreports/symbolcoverage.rb
|
107
107
|
- lib/albacore/ndepend.rb
|
108
|
+
- lib/albacore/nugetinstall.rb
|
108
109
|
- lib/albacore/nugetpack.rb
|
109
110
|
- lib/albacore/nugetpublish.rb
|
110
111
|
- lib/albacore/nugetpush.rb
|
@@ -152,6 +153,7 @@ files:
|
|
152
153
|
- spec/ncoverconsole_spec.rb
|
153
154
|
- spec/ncoverreport_spec.rb
|
154
155
|
- spec/ndepend_spec.rb
|
156
|
+
- spec/nugetinstall_spec.rb
|
155
157
|
- spec/nugetupdate_spec.rb
|
156
158
|
- spec/nunittestrunner_spec.rb
|
157
159
|
- spec/nuspec_spec.rb
|
@@ -692,7 +694,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
692
694
|
version: '0'
|
693
695
|
segments:
|
694
696
|
- 0
|
695
|
-
hash:
|
697
|
+
hash: 897375565
|
696
698
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
697
699
|
none: false
|
698
700
|
requirements:
|
@@ -701,7 +703,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
701
703
|
version: '0'
|
702
704
|
segments:
|
703
705
|
- 0
|
704
|
-
hash:
|
706
|
+
hash: 897375565
|
705
707
|
requirements: []
|
706
708
|
rubyforge_project: albacore
|
707
709
|
rubygems_version: 1.8.16
|