Skip to content

Commit

Permalink
[paket] started added configuration
Browse files Browse the repository at this point in the history
Ref #174
  • Loading branch information
haf committed Nov 4, 2016
1 parent abed6f7 commit 09b41aa
Show file tree
Hide file tree
Showing 5 changed files with 76 additions and 64 deletions.
13 changes: 10 additions & 3 deletions lib/albacore/task_types/nugets_pack.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,11 @@ def execute nuspec_file, nuspec_symbols_file = nil
# regexpes the package path from the output
def get_nuget_path_of
out = yield
out.match /Successfully created package '([:\s\p{Word}\\\/\d\.\-]+\.symbols\.nupkg)'./iu if out.respond_to? :match
out.match(/Successfully created package '([:\s\p{Word}\\\/\d\.\-]+\.symbols\.nupkg)'./iu) if out.respond_to? :match
trace "Got symbols return value: '#{out}', matched: '#{$1}'" if $1
return $1 if $1

out.match /Successfully created package '([:\s\p{Word}\\\/\d\.\-]+\.nupkg)'./iu if out.respond_to? :match
out.match(/Successfully created package '([:\s\p{Word}\\\/\d\.\-]+\.nupkg)'./iu) if out.respond_to? :match
trace "Got NOT-symbols return value: '#{out}', matched: '#{$1}'"

unless $1
Expand Down Expand Up @@ -151,6 +151,7 @@ def initialize
@nuget_dependencies = true
@package_analysis = true
@leave_nuspec = false
@use_paket = true
fill_required
end

Expand Down Expand Up @@ -187,6 +188,12 @@ def no_nuget_dependencies
@nuget_dependencies = false
end

# Call this if you want to use the legacy NuGet.exe infrastructure instead
# of the more modern Paket infrastructure
def use_legacy_exe
@use_paket = false
end

# call this if you want to disable NuGet's package analysis
# when creating the nupkg file
def no_package_analysis
Expand Down Expand Up @@ -214,7 +221,7 @@ def opts
:symbols => @symbols,
:package => @package,
:target => @target,
:files => @files,
:files => files,
:configuration => @configuration,
:project_dependencies => @project_dependencies,
:nuget_dependencies => @nuget_dependencies,
Expand Down
56 changes: 0 additions & 56 deletions spec/nugets_pack_shared.rb

This file was deleted.

9 changes: 7 additions & 2 deletions spec/nugets_pack_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
require 'spec_helper'
require 'shared_contexts'
require 'support/sh_interceptor'
require 'nugets_pack_shared'
require 'albacore'
require 'albacore/task_types/nugets_pack'
require 'albacore/nuget_model'
Expand All @@ -14,7 +13,13 @@
it 'should be set to path that exists' do
subject.nuget_gem_exe
expect(subject.exe).to be_a String
expect(File.exists?( subject.exe)).to be true
expect(File.exists?(subject.exe)).to be true
end

# this denotes that the user wishes to use the buggy NuGet.exe instead of
# paket
it 'should respond to #use_legacy_exe' do
expect(subject).to respond_to :use_legacy_exe
end
end

Expand Down
1 change: 0 additions & 1 deletion spec/project_task_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

require 'spec_helper'
require 'shared_contexts'
require 'nugets_pack_shared'
require 'support/sh_interceptor'
require 'albacore'
require 'albacore/task_types/nugets_pack'
Expand Down
61 changes: 59 additions & 2 deletions spec/shared_contexts.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,62 @@
# encoding: utf-8

require 'albacore/paths'

class ConfigFac
def self.create id, curr, gen_symbols = true
cfg = Albacore::NugetsPack::Config.new
cfg.target = 'mono32'
cfg.configuration = 'Debug'
cfg.files = Dir.glob(File.join(curr, 'testdata', 'Project', '*.fsproj'))
cfg.out = 'spec/testdata/pkg'
cfg.exe = 'NuGet.exe'
cfg.with_metadata do |m|
m.id = id
m.authors = 'haf'
m.owners = 'haf owner'
m.description = 'a nice lib'
m.language = 'Danish'
m.project_url = 'https://github.com/haf/Reasonable'
m.license_url = 'https://github.com/haf/README.md'
m.version = '0.2.3'
m.release_notes = %{
v10.0.0:
- Some notes
}
m.require_license_acceptance = false

m.add_dependency 'Abc.Package', '>= 1.0.2'
m.add_framework_dependency 'System.Transactions', '4.0.0'
end
cfg.gen_symbols if gen_symbols # files: *.{pdb,dll,all compiled files}
cfg
end
end

shared_context 'pack_config' do
let :id do
'Sample.Nuget'
end
let :curr do
File.dirname(__FILE__)
end
let :config do
ConfigFac.create id, curr, true
end
end

shared_context 'pack_config no symbols' do
let :id do
'Sample.Nuget'
end
let :curr do
File.dirname(__FILE__)
end
let :config do
ConfigFac.create id, curr, false
end
end

shared_context 'package_metadata_dsl' do
let :m do
subject.metadata
Expand Down Expand Up @@ -41,7 +98,7 @@ def self.has_file src, target, exclude = nil
it "has file[#{src}].target == '#{target}'" do
file = subject.files.find { |f| f.src == src }
expect(file.target).to eq target
end
end
end

def self.has_not_file src
Expand All @@ -54,6 +111,6 @@ def self.has_not_file src

def self.norm str
Albacore::Paths.normalise_slashes str
end
end
end

0 comments on commit 09b41aa

Please sign in to comment.