albacore 2.8.0 → 3.0.0.pre.alpha
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/albacore/cli.rb +2 -2
- data/lib/albacore/dsl.rb +2 -42
- data/lib/albacore/nuget_model.rb +173 -67
- data/lib/albacore/paket.rb +20 -5
- data/lib/albacore/paths.rb +1 -0
- data/lib/albacore/project.rb +228 -45
- data/lib/albacore/task_types/nugets_pack.rb +73 -425
- data/lib/albacore/task_types/sql_cmd.rb +1 -1
- data/lib/albacore/tasks/release.rb +2 -2
- data/lib/albacore/version.rb +1 -1
- data/spec/dsl_spec.rb +1 -1
- data/spec/nuget_model_spec.rb +208 -79
- data/spec/nugets_pack_spec.rb +1 -353
- data/spec/paket_spec.rb +51 -2
- data/spec/project_spec.rb +118 -43
- data/spec/shared_contexts.rb +28 -14
- data/spec/testdata/Project/Project.fsproj +1 -1
- data/spec/testdata/console-core-argu/.gitignore +4 -0
- data/spec/testdata/console-core-argu/.paket/Paket.Restore.targets +239 -0
- data/spec/testdata/console-core-argu/.paket/paket.exe +0 -0
- data/spec/testdata/console-core-argu/.paket/paket.targets +72 -0
- data/spec/testdata/console-core-argu/ConsoleArgu.fsproj +12 -0
- data/spec/testdata/console-core-argu/Library.fs +31 -0
- data/spec/testdata/console-core-argu/build.sh +4 -0
- data/spec/testdata/console-core-argu/paket.dependencies +3 -0
- data/spec/testdata/console-core-argu/paket.lock +565 -0
- data/spec/testdata/console-core-argu/paket.references +2 -0
- data/spec/testdata/console-core-argu/paket.template +1 -0
- metadata +26 -16
- data/lib/albacore/app_spec.rb +0 -229
- data/lib/albacore/cpack_app_spec.rb +0 -135
- data/lib/albacore/task_types/nugets.rb +0 -8
- data/lib/albacore/task_types/nugets_restore.rb +0 -181
- data/spec/app_spec_spec.rb +0 -147
- data/spec/fpm_app_spec_spec.rb +0 -157
- data/spec/nugets_find_gem_exe_spec.rb +0 -21
- data/spec/nugets_restore_spec.rb +0 -77
@@ -1,181 +0,0 @@
|
|
1
|
-
require 'rake'
|
2
|
-
require 'nokogiri'
|
3
|
-
require 'albacore/paths'
|
4
|
-
require 'albacore/cmd_config'
|
5
|
-
require 'albacore/cross_platform_cmd'
|
6
|
-
require 'albacore/task_types/nugets'
|
7
|
-
require 'albacore/task_types/nugets_authentication'
|
8
|
-
|
9
|
-
module Albacore
|
10
|
-
module NugetsRestore
|
11
|
-
|
12
|
-
class RemoveSourceCmd
|
13
|
-
include Logging
|
14
|
-
include CrossPlatformCmd
|
15
|
-
def initialize exe, source
|
16
|
-
@executable = exe
|
17
|
-
@parameters = %W[sources remove -name #{source.name} -source #{source.uri}]
|
18
|
-
mono_command
|
19
|
-
end
|
20
|
-
def execute
|
21
|
-
system @executable, @parameters, :verbose => true do |ok, status|
|
22
|
-
ok
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
class AddSourceCmd
|
28
|
-
include Logging
|
29
|
-
include CrossPlatformCmd
|
30
|
-
def initialize exe, source, user, pass
|
31
|
-
@executable = exe
|
32
|
-
@parameters = %W[sources add -name #{source.name} -source #{source.uri} -user #{user} -password #{pass}]
|
33
|
-
mono_command
|
34
|
-
end
|
35
|
-
def execute
|
36
|
-
system @executable, @parameters, :ensure_success => true
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
class Cmd
|
41
|
-
include Logging
|
42
|
-
include CrossPlatformCmd
|
43
|
-
|
44
|
-
def initialize work_dir, executable, *args
|
45
|
-
opts = Map.options args
|
46
|
-
raise ArgumentError, 'pkgcfg is nil' if opts.getopt(:pkgcfg).nil?
|
47
|
-
raise ArgumentError, 'out is nil' if opts.getopts(:out).nil?
|
48
|
-
@work_dir = work_dir
|
49
|
-
@executable = executable
|
50
|
-
@opts = opts
|
51
|
-
|
52
|
-
pars = opts.getopt(:parameters, :default => [])
|
53
|
-
|
54
|
-
if (opts.getopt :source)
|
55
|
-
@parameters = [%W{install #{opts.getopt(:pkgcfg)} -OutputDirectory #{opts.getopt(:out)} -source #{@opts[:source][:uri]}}, pars.to_a].flatten
|
56
|
-
else
|
57
|
-
@parameters = [%W{install #{opts.getopt(:pkgcfg)} -OutputDirectory #{opts.getopt(:out)}}, pars.to_a].flatten
|
58
|
-
end
|
59
|
-
|
60
|
-
mono_command
|
61
|
-
end
|
62
|
-
|
63
|
-
def execute
|
64
|
-
system @executable, @parameters, :work_dir => @work_dir, :output => false
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
|
-
# Public: Configure 'nuget.exe install' -- nuget restore.
|
69
|
-
#
|
70
|
-
# work_dir - optional
|
71
|
-
# exe - required NuGet.exe path
|
72
|
-
# out - required location of 'packages' folder
|
73
|
-
class Config
|
74
|
-
include CmdConfig # => :exe, :work_dir, @parameters, #add_parameter
|
75
|
-
include NugetsAuthentication # => :username, :password
|
76
|
-
include Logging
|
77
|
-
|
78
|
-
OFFICIAL_REPO = 'https://nuget.org/api/v2/'
|
79
|
-
|
80
|
-
# Create a new Config object
|
81
|
-
def initialize
|
82
|
-
@include_official = false
|
83
|
-
@list_spec = File.join '**', 'packages.config'
|
84
|
-
end
|
85
|
-
|
86
|
-
# the output directory passed to nuget when restoring the nugets
|
87
|
-
attr_writer :out
|
88
|
-
|
89
|
-
# nuget source, when other than MSFT source
|
90
|
-
def source
|
91
|
-
@source
|
92
|
-
end
|
93
|
-
|
94
|
-
# set the nuget source
|
95
|
-
def source= val
|
96
|
-
if val.is_a? String
|
97
|
-
debug { 'you used a plain string as source, naming it after its md5 digest' }
|
98
|
-
md5 = Digest::MD5.hexdigest val
|
99
|
-
@source = OpenStruct.new(:name => md5, :uri => val)
|
100
|
-
else
|
101
|
-
@source = val
|
102
|
-
end
|
103
|
-
end
|
104
|
-
|
105
|
-
# specifies the list specification to load 'packages.config' files
|
106
|
-
# from.
|
107
|
-
#
|
108
|
-
# e.g. '**/packages.config' on *nix.
|
109
|
-
attr_accessor :list_spec
|
110
|
-
|
111
|
-
def packages
|
112
|
-
# it seems FileList doesn't care about the curr dir
|
113
|
-
in_work_dir do
|
114
|
-
FileList[
|
115
|
-
Dir.glob(list_spec, File::FNM_DOTMATCH).
|
116
|
-
reject { |a| a =~ /^\.{1,2}$/ }
|
117
|
-
]
|
118
|
-
end
|
119
|
-
end
|
120
|
-
|
121
|
-
# whether to include the official
|
122
|
-
# defaults to true
|
123
|
-
attr_accessor :include_official
|
124
|
-
|
125
|
-
# allows a source without credentials be added
|
126
|
-
attr_accessor :allow_insecure_source
|
127
|
-
|
128
|
-
def exclude_version
|
129
|
-
add_parameter "-ExcludeVersion"
|
130
|
-
end
|
131
|
-
|
132
|
-
def no_cache
|
133
|
-
add_parameter "-NoCache"
|
134
|
-
end
|
135
|
-
|
136
|
-
def has_credentials?
|
137
|
-
username && password && source
|
138
|
-
end
|
139
|
-
|
140
|
-
def ensure_authentication!
|
141
|
-
return unless has_credentials?
|
142
|
-
remove = RemoveSourceCmd.new exe, source
|
143
|
-
readd = AddSourceCmd.new exe, source, username, password
|
144
|
-
remove.execute
|
145
|
-
readd.execute
|
146
|
-
end
|
147
|
-
|
148
|
-
def nuget_gem_exe
|
149
|
-
@exe = Albacore::Nugets::find_nuget_gem_exe
|
150
|
-
end
|
151
|
-
|
152
|
-
def opts_for_pkgcfg pkg
|
153
|
-
pars = parameters.to_a
|
154
|
-
debug "include_official nuget repo: #{include_official}"
|
155
|
-
pars << %W[-source #{OFFICIAL_REPO}] if include_official
|
156
|
-
|
157
|
-
map = Map.new({ :pkgcfg => Albacore::Paths.normalise_slashes(pkg),
|
158
|
-
:out => @out,
|
159
|
-
:parameters => pars })
|
160
|
-
|
161
|
-
if allow_insecure_source
|
162
|
-
map.set :source, source
|
163
|
-
elsif has_credentials?
|
164
|
-
map.set :username, username
|
165
|
-
map.set :password, password
|
166
|
-
map.set :source, source
|
167
|
-
end
|
168
|
-
map
|
169
|
-
end
|
170
|
-
end
|
171
|
-
|
172
|
-
class Task
|
173
|
-
def initialize command_line
|
174
|
-
@command_line = command_line
|
175
|
-
end
|
176
|
-
def execute
|
177
|
-
@command_line.execute
|
178
|
-
end
|
179
|
-
end
|
180
|
-
end
|
181
|
-
end
|
data/spec/app_spec_spec.rb
DELETED
@@ -1,147 +0,0 @@
|
|
1
|
-
require 'xsemver'
|
2
|
-
require 'albacore/app_spec'
|
3
|
-
|
4
|
-
describe ::Albacore::AppSpec, 'public API with defaults' do
|
5
|
-
subject do
|
6
|
-
::Albacore::AppSpec.new 'missing-path', %{
|
7
|
-
---
|
8
|
-
title: superapp.now
|
9
|
-
project_path: spec/testdata/Project/Project.fsproj
|
10
|
-
}
|
11
|
-
end
|
12
|
-
|
13
|
-
%w|title description uri category version license dir_path to_s|.map { |w| :"#{w}" }.each do |s|
|
14
|
-
it "should respond to ##{s}" do
|
15
|
-
expect(subject).to respond_to s
|
16
|
-
end
|
17
|
-
|
18
|
-
it "should be possible to always call ##{s}" do
|
19
|
-
subject.method(s).call
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
def teamcity?
|
24
|
-
!!ENV['TEAMCITY_VERSION']
|
25
|
-
end
|
26
|
-
|
27
|
-
it 'should have correct title' do
|
28
|
-
expect(subject.title).to eq 'superapp.now'
|
29
|
-
end
|
30
|
-
|
31
|
-
it 'should have nil license' do
|
32
|
-
expect(subject.license).to be_nil
|
33
|
-
end
|
34
|
-
|
35
|
-
it 'should have nil description' do
|
36
|
-
expect(subject.description).to be_nil
|
37
|
-
end
|
38
|
-
|
39
|
-
it 'should never have nil uri, since we\'re in the albacore git repo and it defaults to the current repo' do
|
40
|
-
expect(subject.uri).to include 'albacore.git' unless teamcity? # teamcity doesn't keep git folder
|
41
|
-
end
|
42
|
-
|
43
|
-
it 'should have "apps" category, since it\'s not specified anywhere' do
|
44
|
-
expect(subject.category).to eq 'apps'
|
45
|
-
end
|
46
|
-
|
47
|
-
it 'should have a nil version' do
|
48
|
-
expect(subject.version).to eq('1.0.0')
|
49
|
-
end
|
50
|
-
|
51
|
-
it 'should have non-nil #bin_folder' do
|
52
|
-
expect(subject.bin_folder).to_not be_nil
|
53
|
-
end
|
54
|
-
|
55
|
-
it 'should have non-nil #conf_folder' do
|
56
|
-
expect(subject.conf_folder).to_not be_nil
|
57
|
-
end
|
58
|
-
|
59
|
-
it 'should have non-nil #contents' do
|
60
|
-
expect(subject.contents).to_not be_nil
|
61
|
-
end
|
62
|
-
|
63
|
-
it 'should have a #contents that responds to #each' do
|
64
|
-
expect(subject.contents).to respond_to :each
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
|
-
describe ::Albacore::AppSpec, 'public API with required fields' do
|
69
|
-
subject do
|
70
|
-
::Albacore::AppSpec.new 'missing-.appspec-path', %{
|
71
|
-
---
|
72
|
-
title: superapp.now
|
73
|
-
project_path: spec/testdata/Project/Project.fsproj
|
74
|
-
}
|
75
|
-
end
|
76
|
-
end
|
77
|
-
|
78
|
-
describe ::Albacore::AppSpec, 'when getting version from semver' do
|
79
|
-
subject do
|
80
|
-
::Albacore::AppSpec.new 'missing-.appspec-path', %{
|
81
|
-
---
|
82
|
-
title: zeeky
|
83
|
-
version: 4.5.6
|
84
|
-
project_path: spec/testdata/Project/Project.fsproj
|
85
|
-
}, XSemVer::SemVer.new(1,2,3)
|
86
|
-
end
|
87
|
-
|
88
|
-
it 'should take version from the semver first' do
|
89
|
-
expect(subject.version).to eq '1.2.3'
|
90
|
-
end
|
91
|
-
end
|
92
|
-
|
93
|
-
describe ::Albacore::AppSpec, 'when getting version from yaml' do
|
94
|
-
subject do
|
95
|
-
::Albacore::AppSpec.new 'missing-.appspec-path', %{
|
96
|
-
---
|
97
|
-
title: smurfs.abound
|
98
|
-
version: 4.5.6
|
99
|
-
project_path: spec/testdata/Project/Project.fsproj
|
100
|
-
}, nil
|
101
|
-
end
|
102
|
-
|
103
|
-
it 'should take version from the semver first' do
|
104
|
-
expect(subject.version).to eq '4.5.6'
|
105
|
-
end
|
106
|
-
end
|
107
|
-
|
108
|
-
describe ::Albacore::AppSpec, 'when giving invalid project path' do
|
109
|
-
it 'should raise ArgumentError when path doesn\'t exist' do
|
110
|
-
expect {
|
111
|
-
::Albacore::AppSpec.new 'missing-.appspec-path', %{---
|
112
|
-
project_path: path/not/existent/proj.fsproj}, nil
|
113
|
-
}.to raise_error(ArgumentError)
|
114
|
-
end
|
115
|
-
|
116
|
-
it 'should raise ArgumentError when no value given' do
|
117
|
-
expect {
|
118
|
-
::Albacore::AppSpec.new 'missing-.appspec-path', %{---
|
119
|
-
title: my.project}, nil
|
120
|
-
}.to raise_error(ArgumentError)
|
121
|
-
end
|
122
|
-
end
|
123
|
-
|
124
|
-
describe ::Albacore::AppSpec, 'when fetching ALL data from Project.fsproj' do
|
125
|
-
let :project_path do
|
126
|
-
'spec/testdata/Project/Project.appspec'
|
127
|
-
end
|
128
|
-
|
129
|
-
subject do
|
130
|
-
::Albacore::AppSpec.load project_path
|
131
|
-
end
|
132
|
-
|
133
|
-
it 'should find the directory of the project' do
|
134
|
-
# this also means it found a project and successfully parsed its project
|
135
|
-
# definition
|
136
|
-
expect(subject.proj.proj_path_base).to include File.dirname(project_path)
|
137
|
-
end
|
138
|
-
|
139
|
-
it 'should have the title' do
|
140
|
-
expect(subject.title).to eq 'project'
|
141
|
-
expect(subject.title_raw).to eq 'Project'
|
142
|
-
end
|
143
|
-
|
144
|
-
it 'should have no license' do
|
145
|
-
expect(subject.license).to be_nil
|
146
|
-
end
|
147
|
-
end
|
data/spec/fpm_app_spec_spec.rb
DELETED
@@ -1,157 +0,0 @@
|
|
1
|
-
require 'xsemver'
|
2
|
-
require 'albacore/app_spec'
|
3
|
-
require 'albacore/fpm_app_spec'
|
4
|
-
|
5
|
-
shared_context 'valid AppSpec' do
|
6
|
-
let :spec do
|
7
|
-
::Albacore::AppSpec.new '/a/b/c.appspec', %{
|
8
|
-
---
|
9
|
-
title: my.app
|
10
|
-
project_path: spec/testdata/Project/Project.fsproj
|
11
|
-
version: 1.2.3
|
12
|
-
license: MIT
|
13
|
-
description: my.app implements much wow
|
14
|
-
uri: https://github.com/Albacore/albacore
|
15
|
-
category: webserver
|
16
|
-
}, XSemVer::SemVer.new(5, 6, 7)
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
describe ::Albacore::FpmAppSpec, 'public API' do
|
21
|
-
include_context 'valid AppSpec'
|
22
|
-
|
23
|
-
subject do
|
24
|
-
::Albacore::FpmAppSpec.new spec
|
25
|
-
end
|
26
|
-
|
27
|
-
it { is_expected.to respond_to :filename }
|
28
|
-
|
29
|
-
it 'should know resulting filename' do
|
30
|
-
expect(subject.filename).to eq('my.app-5.6.7-1.x86_64.rpm')
|
31
|
-
end
|
32
|
-
|
33
|
-
it { is_expected.to respond_to :generate }
|
34
|
-
|
35
|
-
it { is_expected.to respond_to :generate_flags }
|
36
|
-
end
|
37
|
-
|
38
|
-
|
39
|
-
describe ::Albacore::FpmAppSpec, 'when generating command from valid AppSpec' do
|
40
|
-
include_context 'valid AppSpec'
|
41
|
-
|
42
|
-
subject do
|
43
|
-
::Albacore::FpmAppSpec.new spec
|
44
|
-
end
|
45
|
-
|
46
|
-
let :flags do
|
47
|
-
subject.generate_flags
|
48
|
-
end
|
49
|
-
|
50
|
-
it 'should generate command source' do
|
51
|
-
expect(flags['-s']).to eq 'dir'
|
52
|
-
end
|
53
|
-
|
54
|
-
it 'should generate command target' do
|
55
|
-
expect(flags['-t']).to eq 'rpm'
|
56
|
-
end
|
57
|
-
|
58
|
-
it 'should generate command name/title' do
|
59
|
-
expect(flags['--name']).to eq 'my.app'
|
60
|
-
end
|
61
|
-
|
62
|
-
it 'should generate command description' do
|
63
|
-
expect(flags['--description']).to eq 'my.app implements much wow'
|
64
|
-
end
|
65
|
-
|
66
|
-
it 'should generate command url' do
|
67
|
-
expect(flags['--url']).to eq 'https://github.com/Albacore/albacore'
|
68
|
-
end
|
69
|
-
|
70
|
-
it 'should generate command category' do
|
71
|
-
expect(flags['--category']).to eq 'webserver'
|
72
|
-
end
|
73
|
-
|
74
|
-
it 'should generate command version' do
|
75
|
-
expect(flags['--version']).to eq '5.6.7'
|
76
|
-
end
|
77
|
-
|
78
|
-
it 'should generate command epoch' do
|
79
|
-
expect(flags['--epoch']).to eq 1
|
80
|
-
end
|
81
|
-
|
82
|
-
it 'should generate command license' do
|
83
|
-
expect(flags['--license']).to eq 'MIT'
|
84
|
-
end
|
85
|
-
|
86
|
-
if ::Albacore.windows?
|
87
|
-
it 'should generate command "look in this directory" flag' do
|
88
|
-
expect(flags['-C']).to match /^.:\/a\/b$/
|
89
|
-
end
|
90
|
-
else
|
91
|
-
it 'should generate command "look in this directory" flag' do
|
92
|
-
expect(flags['-C']).to eq '/a/b'
|
93
|
-
end
|
94
|
-
end
|
95
|
-
|
96
|
-
it 'should generate command depends' do
|
97
|
-
expect(flags['--depends']).to eq 'mono'
|
98
|
-
end
|
99
|
-
|
100
|
-
it 'should generate command rpm-digest' do
|
101
|
-
expect(flags['--rpm-digest']).to eq 'sha256'
|
102
|
-
end
|
103
|
-
end
|
104
|
-
|
105
|
-
describe ::Albacore::FpmAppSpec, 'validation method' do
|
106
|
-
include_context 'valid AppSpec'
|
107
|
-
|
108
|
-
subject do
|
109
|
-
# TODO: construct
|
110
|
-
end
|
111
|
-
# TODO: to validate
|
112
|
-
end
|
113
|
-
|
114
|
-
describe ::Albacore::FpmAppSpec, 'when generating command from in-valid AppSpec' do
|
115
|
-
let :spec do
|
116
|
-
::Albacore::AppSpec.new 'missing descriptor path', %{
|
117
|
-
---
|
118
|
-
title: my.app
|
119
|
-
project_path: spec/testdata/Project/Project.fsproj
|
120
|
-
}, XSemVer::SemVer.new(5, 6, 7)
|
121
|
-
end
|
122
|
-
|
123
|
-
it 'should raise InvalidAppSpecError' do
|
124
|
-
pending 'to be done'
|
125
|
-
expect { ::Albacore::FpmAppSpec.new spec }.to raise_error ::Albacore::InvalidAppSpecError
|
126
|
-
end
|
127
|
-
end
|
128
|
-
|
129
|
-
describe ::Albacore::FpmAppSpec, 'should never generate nils' do
|
130
|
-
let :spec do
|
131
|
-
::Albacore::AppSpec.new 'missing descriptor path', %{
|
132
|
-
---
|
133
|
-
title: my.app
|
134
|
-
project_path: spec/testdata/Project/Project.fsproj
|
135
|
-
}, XSemVer::SemVer.new(5, 6, 7)
|
136
|
-
end
|
137
|
-
|
138
|
-
subject do
|
139
|
-
::Albacore::FpmAppSpec.new spec
|
140
|
-
end
|
141
|
-
|
142
|
-
it 'should not have a license' do
|
143
|
-
expect(spec.license).to be nil
|
144
|
-
end
|
145
|
-
|
146
|
-
it 'that license should never be a FPM parameter' do
|
147
|
-
expect(subject.generate_flags.has_key?('--license')).to be false
|
148
|
-
end
|
149
|
-
end
|
150
|
-
|
151
|
-
describe ::Albacore::FpmAppSpec::Config do
|
152
|
-
%w|files= out= opts no_bundler|.each do |sym|
|
153
|
-
it "should respond_to :#{sym}" do
|
154
|
-
expect(subject).to respond_to :"#{sym}"
|
155
|
-
end
|
156
|
-
end
|
157
|
-
end
|