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.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/lib/albacore/cli.rb +2 -2
  3. data/lib/albacore/dsl.rb +2 -42
  4. data/lib/albacore/nuget_model.rb +173 -67
  5. data/lib/albacore/paket.rb +20 -5
  6. data/lib/albacore/paths.rb +1 -0
  7. data/lib/albacore/project.rb +228 -45
  8. data/lib/albacore/task_types/nugets_pack.rb +73 -425
  9. data/lib/albacore/task_types/sql_cmd.rb +1 -1
  10. data/lib/albacore/tasks/release.rb +2 -2
  11. data/lib/albacore/version.rb +1 -1
  12. data/spec/dsl_spec.rb +1 -1
  13. data/spec/nuget_model_spec.rb +208 -79
  14. data/spec/nugets_pack_spec.rb +1 -353
  15. data/spec/paket_spec.rb +51 -2
  16. data/spec/project_spec.rb +118 -43
  17. data/spec/shared_contexts.rb +28 -14
  18. data/spec/testdata/Project/Project.fsproj +1 -1
  19. data/spec/testdata/console-core-argu/.gitignore +4 -0
  20. data/spec/testdata/console-core-argu/.paket/Paket.Restore.targets +239 -0
  21. data/spec/testdata/console-core-argu/.paket/paket.exe +0 -0
  22. data/spec/testdata/console-core-argu/.paket/paket.targets +72 -0
  23. data/spec/testdata/console-core-argu/ConsoleArgu.fsproj +12 -0
  24. data/spec/testdata/console-core-argu/Library.fs +31 -0
  25. data/spec/testdata/console-core-argu/build.sh +4 -0
  26. data/spec/testdata/console-core-argu/paket.dependencies +3 -0
  27. data/spec/testdata/console-core-argu/paket.lock +565 -0
  28. data/spec/testdata/console-core-argu/paket.references +2 -0
  29. data/spec/testdata/console-core-argu/paket.template +1 -0
  30. metadata +26 -16
  31. data/lib/albacore/app_spec.rb +0 -229
  32. data/lib/albacore/cpack_app_spec.rb +0 -135
  33. data/lib/albacore/task_types/nugets.rb +0 -8
  34. data/lib/albacore/task_types/nugets_restore.rb +0 -181
  35. data/spec/app_spec_spec.rb +0 -147
  36. data/spec/fpm_app_spec_spec.rb +0 -157
  37. data/spec/nugets_find_gem_exe_spec.rb +0 -21
  38. data/spec/nugets_restore_spec.rb +0 -77
@@ -0,0 +1,2 @@
1
+ FSharp.Core
2
+ Argu
@@ -0,0 +1 @@
1
+ type project
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.8.0
4
+ version: 3.0.0.pre.alpha
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: 2017-08-31 00:00:00.000000000 Z
12
+ date: 2017-09-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
@@ -122,7 +122,6 @@ extra_rdoc_files: []
122
122
  files:
123
123
  - "./lib/albacore.rb"
124
124
  - "./lib/albacore/albacore_module.rb"
125
- - "./lib/albacore/app_spec.rb"
126
125
  - "./lib/albacore/app_spec/README.md"
127
126
  - "./lib/albacore/app_spec/defaults.rb"
128
127
  - "./lib/albacore/app_spec/iis_site.rb"
@@ -131,7 +130,6 @@ files:
131
130
  - "./lib/albacore/cli_dsl.rb"
132
131
  - "./lib/albacore/cmd_config.rb"
133
132
  - "./lib/albacore/config_dsl.rb"
134
- - "./lib/albacore/cpack_app_spec.rb"
135
133
  - "./lib/albacore/cross_platform_cmd.rb"
136
134
  - "./lib/albacore/csharp_project.rb"
137
135
  - "./lib/albacore/dsl.rb"
@@ -164,10 +162,8 @@ files:
164
162
  - "./lib/albacore/task_types/build.rb"
165
163
  - "./lib/albacore/task_types/find_msbuild_versions.rb"
166
164
  - "./lib/albacore/task_types/is_package.rb"
167
- - "./lib/albacore/task_types/nugets.rb"
168
165
  - "./lib/albacore/task_types/nugets_authentication.rb"
169
166
  - "./lib/albacore/task_types/nugets_pack.rb"
170
- - "./lib/albacore/task_types/nugets_restore.rb"
171
167
  - "./lib/albacore/task_types/sql_cmd.rb"
172
168
  - "./lib/albacore/task_types/sql_package.rb"
173
169
  - "./lib/albacore/tasks/README.md"
@@ -186,7 +182,6 @@ files:
186
182
  - bin/albacore
187
183
  - spec/Rakefile
188
184
  - spec/albacore_spec.rb
189
- - spec/app_spec_spec.rb
190
185
  - spec/asmver_spec.rb
191
186
  - spec/asmver_task_spec.rb
192
187
  - spec/build_spec.rb
@@ -196,12 +191,9 @@ files:
196
191
  - spec/dsl_spec.rb
197
192
  - spec/ext_teamcity_spec.rb
198
193
  - spec/facts_spec.rb
199
- - spec/fpm_app_spec_spec.rb
200
194
  - spec/is_package_spec.rb
201
195
  - spec/nuget_model_spec.rb
202
- - spec/nugets_find_gem_exe_spec.rb
203
196
  - spec/nugets_pack_spec.rb
204
- - spec/nugets_restore_spec.rb
205
197
  - spec/package_repo_spec.rb
206
198
  - spec/package_spec.rb
207
199
  - spec/paket_spec.rb
@@ -395,6 +387,17 @@ files:
395
387
  - spec/testdata/TestingDependencies/vendor/FSharp.Core.optdata
396
388
  - spec/testdata/TestingDependencies/vendor/FSharp.Core.sigdata
397
389
  - spec/testdata/TestingDependencies/vendor/FSharp.Core.xml
390
+ - spec/testdata/console-core-argu/.gitignore
391
+ - spec/testdata/console-core-argu/.paket/Paket.Restore.targets
392
+ - spec/testdata/console-core-argu/.paket/paket.exe
393
+ - spec/testdata/console-core-argu/.paket/paket.targets
394
+ - spec/testdata/console-core-argu/ConsoleArgu.fsproj
395
+ - spec/testdata/console-core-argu/Library.fs
396
+ - spec/testdata/console-core-argu/build.sh
397
+ - spec/testdata/console-core-argu/paket.dependencies
398
+ - spec/testdata/console-core-argu/paket.lock
399
+ - spec/testdata/console-core-argu/paket.references
400
+ - spec/testdata/console-core-argu/paket.template
398
401
  - spec/testdata/csharp/Exemplar/Exemplar.sln
399
402
  - spec/testdata/csharp/Exemplar/Exemplar/Class1.cs
400
403
  - spec/testdata/csharp/Exemplar/Exemplar/Exemplar.csproj
@@ -427,9 +430,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
427
430
  version: '0'
428
431
  required_rubygems_version: !ruby/object:Gem::Requirement
429
432
  requirements:
430
- - - ">="
433
+ - - ">"
431
434
  - !ruby/object:Gem::Version
432
- version: '0'
435
+ version: 1.3.1
433
436
  requirements: []
434
437
  rubyforge_project: albacore
435
438
  rubygems_version: 2.5.1
@@ -439,7 +442,6 @@ summary: Dolphin-safe and awesome Mono and .Net Rake-tasks
439
442
  test_files:
440
443
  - spec/Rakefile
441
444
  - spec/albacore_spec.rb
442
- - spec/app_spec_spec.rb
443
445
  - spec/asmver_spec.rb
444
446
  - spec/asmver_task_spec.rb
445
447
  - spec/build_spec.rb
@@ -449,12 +451,9 @@ test_files:
449
451
  - spec/dsl_spec.rb
450
452
  - spec/ext_teamcity_spec.rb
451
453
  - spec/facts_spec.rb
452
- - spec/fpm_app_spec_spec.rb
453
454
  - spec/is_package_spec.rb
454
455
  - spec/nuget_model_spec.rb
455
- - spec/nugets_find_gem_exe_spec.rb
456
456
  - spec/nugets_pack_spec.rb
457
- - spec/nugets_restore_spec.rb
458
457
  - spec/package_repo_spec.rb
459
458
  - spec/package_spec.rb
460
459
  - spec/paket_spec.rb
@@ -648,6 +647,17 @@ test_files:
648
647
  - spec/testdata/TestingDependencies/vendor/FSharp.Core.optdata
649
648
  - spec/testdata/TestingDependencies/vendor/FSharp.Core.sigdata
650
649
  - spec/testdata/TestingDependencies/vendor/FSharp.Core.xml
650
+ - spec/testdata/console-core-argu/.gitignore
651
+ - spec/testdata/console-core-argu/.paket/Paket.Restore.targets
652
+ - spec/testdata/console-core-argu/.paket/paket.exe
653
+ - spec/testdata/console-core-argu/.paket/paket.targets
654
+ - spec/testdata/console-core-argu/ConsoleArgu.fsproj
655
+ - spec/testdata/console-core-argu/Library.fs
656
+ - spec/testdata/console-core-argu/build.sh
657
+ - spec/testdata/console-core-argu/paket.dependencies
658
+ - spec/testdata/console-core-argu/paket.lock
659
+ - spec/testdata/console-core-argu/paket.references
660
+ - spec/testdata/console-core-argu/paket.template
651
661
  - spec/testdata/csharp/Exemplar/Exemplar.sln
652
662
  - spec/testdata/csharp/Exemplar/Exemplar/Class1.cs
653
663
  - spec/testdata/csharp/Exemplar/Exemplar/Exemplar.csproj
@@ -1,229 +0,0 @@
1
- require 'yaml'
2
- require 'albacore/logging'
3
- require 'albacore/project'
4
- require 'xsemver'
5
-
6
- module Albacore
7
- # a spec object
8
- class AppSpec
9
- include ::Albacore::Logging
10
-
11
- # Create a new app spec from yaml data; will use heuristics to let the
12
- # developer avoid as much typing and definition mongering as possible; for
13
- # details see the unit tests and the documentation for this class.
14
- #
15
- # @descriptor_path [String] The location of the descriptor file (the .appspec)
16
- # @data [String] A yaml-containing string
17
- # @semver [::XSemVer] An optional semver instance that can be queried for what
18
- # version the package has.
19
- def initialize descriptor_path, data, semver = nil
20
- raise ArgumentError, 'data is nil' unless data
21
- @path = descriptor_path
22
- @conf = YAML.load(data) || Hash.new
23
-
24
- project_path = resolve_project descriptor_path, @conf
25
- raise ArgumentError, "couldn't find project, descriptor_path: #{descriptor_path.inspect}" unless valid_path project_path
26
-
27
- @proj = Project.new project_path
28
- @semver = semver
29
- end
30
-
31
- # Gets the path that the .appspec file was read from when it was initialised.
32
- #
33
- def path
34
- @path
35
- end
36
-
37
- # Gets the executable name if this service has one -- defaults to the
38
- # assembly name of the corresponding project, plus 'exe', which is how the
39
- # compilers name the executables.
40
- #
41
- def exe
42
- conf['exe'] || "#{proj.asmname}.exe"
43
- end
44
-
45
- # Resolves the project file given an optional descriptor path or a
46
- # configuration hash or both. One of the other of the parameters need to
47
- # exist, or an error will be thrown.
48
- #
49
- # @param descriptor_path May be nil
50
- # @param conf [#[]] A hash or something indexable
51
- def resolve_project descriptor_path, conf
52
- trace { "trying to resolve project, descriptor_path: #{descriptor_path.inspect}, conf: #{conf.inspect} [AppSpec#resolve_path]" }
53
-
54
- project_path = conf['project_path']
55
- return File.join File.dirname(descriptor_path), project_path if project_path and valid_path descriptor_path
56
-
57
- trace { 'didn\'t have both a project_path and a descriptor_path that was valid [AppSpec#resolve_project]' }
58
- return project_path if project_path
59
- find_first_project descriptor_path
60
- end
61
-
62
- # Given a descriptor path, tries to find the first matching project file. If
63
- # you have multiple project files, the order of which {Dir#glob} returns
64
- # values will determine which is chosen
65
- def find_first_project descriptor_path
66
- trace { "didn't have a valid project_path, trying to find first project at #{descriptor_path.inspect}" }
67
- dir = File.dirname descriptor_path
68
- abs_dir = File.expand_path dir
69
- Dir.glob(File.join(abs_dir, '*proj')).sort.first
70
- end
71
-
72
- # path of the *.appspec
73
- attr_reader :path
74
-
75
- # the loaded configuration in that appspec
76
- attr_reader :conf
77
-
78
- # the project the spec applies to
79
- attr_reader :proj
80
-
81
- # gets the fully qualified path of the directory where the appspec file is
82
- def dir_path
83
- File.expand_path(File.dirname(@path))
84
- end
85
-
86
- # title for puppet, title for app, title for process running on server
87
- def title
88
- title_raw.downcase
89
- end
90
-
91
- # the title as-is without any downcasing
92
- def title_raw
93
- conf['title'] || proj.title
94
- end
95
-
96
- alias_method :id, :title_raw
97
-
98
- # the description that is used when installing and reading about the package in the
99
- # package manager
100
- def description
101
- conf['description'] || proj.description
102
- end
103
-
104
- # gets the uri source of the project
105
- def uri
106
- conf['uri'] || git_source
107
- end
108
-
109
- # gets the category this package is in, both for the RPM and for puppet and
110
- # for possibly assigning to a work-stealing cluster or to start the app in
111
- # the correct node-cluster if you have that implemented
112
- def category
113
- conf['category'] || 'apps'
114
- end
115
-
116
- # gets the license that the app is licensed under
117
- def license
118
- conf['license'] || proj.license
119
- end
120
-
121
- # gets the version with the following priorities:
122
- # - semver version passed in c'tor
123
- # - ENV['FORMAL_VERSION']
124
- # - .appspec's version
125
- # - .xxproj's version
126
- # - semver from disk
127
- # - if all above fails; use '1.0.0'
128
- def version
129
- semver_version || ENV['FORMAL_VERSION'] || conf['version'] || proj.version || semver_disk_version || '1.0.0'
130
- end
131
-
132
- # gets the binary folder, first from .appspec then from proj given a
133
- # configuration mode (default: Release)
134
- def bin_folder configuration = 'Release'
135
- conf['bin'] || proj.output_path(configuration)
136
- end
137
-
138
- # gets the folder that is used to keep configuration that defaults to the
139
- # current (.) directory
140
- def conf_folder
141
- conf['conf_folder'] || '.'
142
- end
143
-
144
- # gets an enumerable list of paths that are the 'main' contents of the
145
- # package
146
- #
147
- def contents
148
- conf['contents'] || []
149
- end
150
-
151
- # gets the provider to use to calculate the directory paths to construct
152
- # inside the nuget
153
- #
154
- # defaults to the 'defaults' provider which can be found in
155
- # 'albacore/app_spec/defaults.rb'
156
- def provider
157
- conf['provider'] || 'defaults'
158
- end
159
-
160
- # Gets the configured port to bind the site to
161
- #
162
- def port
163
- conf['port'] || '80'
164
- end
165
-
166
- # Gets the host header to use for the binding in IIS - defaults to *, i.e.
167
- # binding to all hosts
168
- #
169
- def host_header
170
- conf['host_header'] || '*'
171
- end
172
-
173
- # TODO: support a few of these:
174
- # https://github.com/bernd/fpm-cookery/wiki/Recipe-Specification
175
-
176
- # load the App Spec from a descriptor path
177
- def self.load descriptor_path
178
- raise ArgumentError, 'missing parameter descriptor_path' unless descriptor_path
179
- raise ArgumentError, 'descriptor_path does not exist' unless File.exists? descriptor_path
180
- AppSpec.new(descriptor_path, File.read(descriptor_path))
181
- end
182
-
183
- # Customizing the to_s implementation to make the spec more amenable for printing
184
- def to_s
185
- "AppSpec[#{title}], #{@conf.keys.length} keys]"
186
- end
187
-
188
- private
189
- # determines whether the passed path is valid and existing
190
- def valid_path path
191
- path and File.exists? path
192
- end
193
-
194
- # gets the source from the current git repository: finds the first remote and uses
195
- # that as the source of the RPM
196
- def git_source
197
- `git remote -v`.
198
- split(/\n/).
199
- map(&:chomp).
200
- map { |s| s.split(/\t/)[1].split(/ /)[0] }.
201
- first
202
- end
203
-
204
- # Gets the semver version in %M.%m.%p form or nil if a semver isn't given
205
- # in the c'tor of this class. If we have gotten an explicit version in the constructor,
206
- # let's assume that version should be used in front of anything else and that the calling
207
- # libraries know what they are doing.
208
- def semver_version
209
- return @semver.format '%M.%m.%p' if @semver
210
- nil
211
- end
212
-
213
- # if everything else fails, return the semver from disk
214
- def semver_disk_version
215
- v = XSemVer::SemVer.find
216
- v.format '%M.%m.%p' if v
217
- rescue SemVerMissingError
218
- nil
219
- end
220
-
221
- # Listen to all 'getters'
222
- #
223
- def method_missing name, *args, &block
224
- unless name =~ /\w=$/
225
- @conf.send(:'[]', *[name.to_s, args].flatten, &block)
226
- end
227
- end
228
- end
229
- end
@@ -1,135 +0,0 @@
1
- require 'albacore/tools'
2
- require 'albacore/app_spec'
3
- require 'albacore/errors/invalid_app_spec_error'
4
- require 'map'
5
-
6
- module Albacore
7
- class CpackAppSpec
8
- end
9
-
10
- class CpackAppSpec::Config
11
- # create a new configuration for multiple xxproj-s to be packed with fpm into .deb/.rpm
12
- def initialize
13
- @files = []
14
- @out = '.'
15
- @configuration = 'Release'
16
- end
17
-
18
- # set the output path, defaults to '.'
19
- def out= out
20
- @out = out
21
- end
22
-
23
- # give the configuration a list of files to match
24
- def files= files
25
- @files = files
26
- end
27
-
28
- def configuration= conf
29
- @configuration = conf
30
- end
31
-
32
- def opts
33
- Map.new bundler: @bundler,
34
- files: @files,
35
- out: @out,
36
- configuration: @configuration
37
- end
38
- end
39
-
40
- class CpackAppSpec::Task
41
- include ::Albacore::Logging
42
- include ::Albacore::CrossPlatformCmd
43
-
44
- # create a new task instance with the given opts
45
- def initialize opts
46
- raise ArgumentError, 'opts is nil' if opts.nil?
47
- @opts = opts
48
- end
49
-
50
- def execute
51
- warn 'executing cpack app spec task, but there are no input files [cpack_app_spec::task#execute]' if
52
- @opts.get(:files).empty?
53
-
54
- cpack_package @opts.get(:out),
55
- @opts.get(:files),
56
- @opts.get(:configuration)
57
- end
58
-
59
- private
60
- def cpack_package out, appspecs, configuration
61
- appspecs.
62
- map { |path| Albacore::AppSpec.load path }.
63
- each do |spec|
64
- nuspec = create_nuspec spec
65
- debug { nuspec }
66
- create_cpack out, spec, nuspec, configuration
67
- end
68
- end
69
-
70
- def create_nuspec app_spec
71
- require 'albacore/nuget_model'
72
- p = Albacore::NugetModel::Package.new
73
- p.with_metadata do |m|
74
- m.id = app_spec.id
75
- m.title = app_spec.title_raw
76
- m.version = app_spec.version
77
- m.authors = app_spec.authors
78
- m.owners = app_spec.owners
79
- m.description = app_spec.description || app_spec.title_raw
80
- m.release_notes = app_spec.release_notes || Albacore::Tools.git_release_notes
81
- m.summary = app_spec.summary
82
- m.language = app_spec.language
83
- m.project_url = app_spec.project_url || 'https://haf.se'
84
- m.icon_url = app_spec.icon_url || 'https://haf.se/spacer.gif'
85
- m.license_url = app_spec.license_url || 'https://haf.se'
86
- m.copyright = app_spec.copyright || 'See Authors'
87
- m.tags = app_spec.tags
88
- end
89
- p.to_xml
90
- end
91
-
92
- def create_cpack out, app_spec, nuspec_xml, configuration
93
- provider = find_provider app_spec
94
-
95
- target = "#{out}/#{app_spec.id}"
96
- contents = "#{target}/#{provider.nuget_contents}/"
97
-
98
- debug { 'create target [cpack_app_spec#create_cpack]' }
99
- FileUtils.mkdir_p target
100
-
101
- debug { 'write nuspec [cpack_app_spec#create_cpack]' }
102
- File.open("#{target}/#{app_spec.id}.nuspec", 'w+') { |io| io.write nuspec_xml }
103
-
104
- debug { 'write tools/chocolateyInstall.ps1 [cpack_app_spec#create_cpack]' }
105
- provider.install_script out, app_spec
106
-
107
- debug { 'copy contents of package [cpack_app_spec#create_cpack]' }
108
- FileUtils.cp_r provider.source_dir(app_spec, configuration),
109
- contents,
110
- :verbose => true
111
-
112
- # package it
113
- Dir.chdir target do
114
- system 'cpack'
115
- end
116
-
117
- # publish it
118
- Albacore.publish :artifact, OpenStruct.new(
119
- :location => "#{target}/#{app_spec.id}.#{app_spec.version}.nupkg"
120
- )
121
- end
122
-
123
- def find_provider app_spec
124
- require "albacore/app_spec/#{app_spec.provider}"
125
- case app_spec.provider
126
- when 'defaults'
127
- AppSpec::Defaults.new
128
- when 'iis_site'
129
- AppSpec::IisSite.new
130
- else
131
- raise ArgumentError, "unknown app_spec.provider: #{app_spec.provider}"
132
- end
133
- end
134
- end
135
- end