physique 0.2.2 → 0.3.0

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.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NzJjZThlOTNiYzUxZTIyYzliZjI2YjI4ZmM0MTA0NzcxMDk1MGQ3MA==
4
+ MTk4ZGQ1NDM0Mzc2MDY1MjljNjRhZTc5ZDg1ZjZmZjk3ZjU3MjQ1Ng==
5
5
  data.tar.gz: !binary |-
6
- ZGYwZDUxOWQ2NWRhNDJmZTkyMWJmZWJkZmQ1YmFlOWE4ZDIzM2UyYw==
6
+ ZTZhNGMyN2ZiMGNhMjZjYjM3MDIwZmRkMTc2NWQ0NGQ0NTY3YjVmZQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- MDlhZTI2YzAwODNkZWIyYmJjMWU4YTZjNjIwZDMwZThhYWEyNzkwNzU1ZTcy
10
- ODJhODZjNmRlMjM5MDU1MzhlNjUyZDNlMTkzODQwOWEyODc3Y2FjZjdhN2I0
11
- ZmFjMzFjMjlhMzA0OWEyYTI5MTVkZmNhYjQ0YWY5N2VmM2I2N2Q=
9
+ NjQzZmI2MTY2M2I1MDZmM2E5NWZkNTJlMTBlNzNlNTY1YzQyYTFhZWEwMDU3
10
+ YTgyMTA1Nzk5NWQ5ZWZlNzgxOWY4ODNlMDBmMzY4NjMyYTZlMjIxOWRkZjAx
11
+ M2NjODhhOTgzMGY3OWE0M2ZhOTIxMmI1Yjk5ZDQ1OWZkYmY3YTM=
12
12
  data.tar.gz: !binary |-
13
- YmE1NDU2MDU0NTNjMmNlN2NlZGE1YjUzYzc3OGYyZGNhZTgwMTVjMGFkNmIy
14
- YTg5ZmZjMTRlNzk3NDExNjM3M2NjOTkzM2RkMmIwMjQwMmU0NTYwOGU5ODZj
15
- M2UxNWZkYTg1MTBiYmM4MzA0NzBiYmU0ZmVkNmQ4M2ZhNTFjMDg=
13
+ N2FkYTlmMThhNzEzNjhjNDA5ZGNkNTcxMTgxNTcxYmM4M2ViMDhlNWE0MTgy
14
+ NjYzZWU0YTYwYjY5NjExNWE4N2U1MmQ5ZmJmNDQyOTI0ZDEyZmZiMjI1OGE0
15
+ MGY3ODk4NDhmYzgxNjE4Njk4YzQ1N2EyMDk4OGIzM2Y3MDFlNWE=
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- physique (0.2.2)
4
+ physique (0.3.0)
5
5
  activesupport (~> 4.1)
6
6
  albacore (= 2.0.0.rc.12)
7
7
  map (~> 6.5)
@@ -11,11 +11,11 @@ GEM
11
11
  specs:
12
12
  ProcessPilot (2.0.0.20120301)
13
13
  rUtilAnts (>= 1.0)
14
- activesupport (4.1.4)
15
- i18n (~> 0.6, >= 0.6.9)
14
+ activesupport (4.2.0)
15
+ i18n (~> 0.7)
16
16
  json (~> 1.7, >= 1.7.7)
17
17
  minitest (~> 5.1)
18
- thread_safe (~> 0.1)
18
+ thread_safe (~> 0.3, >= 0.3.4)
19
19
  tzinfo (~> 1.1)
20
20
  albacore (2.0.0.rc.12)
21
21
  ProcessPilot (~> 2.0)
@@ -28,15 +28,15 @@ GEM
28
28
  diff-lcs (1.2.5)
29
29
  facter (1.7.6)
30
30
  highline (1.6.21)
31
- i18n (0.6.9)
32
- json (1.8.1)
33
- map (6.5.4)
34
- mini_portile (0.6.0)
35
- minitest (5.4.0)
36
- nokogiri (1.6.2.1-x86-mingw32)
37
- mini_portile (= 0.6.0)
31
+ i18n (0.7.0)
32
+ json (1.8.2)
33
+ map (6.5.5)
34
+ mini_portile (0.6.2)
35
+ minitest (5.5.1)
36
+ nokogiri (1.6.6.2-x86-mingw32)
37
+ mini_portile (~> 0.6.0)
38
38
  rUtilAnts (2.0.0.20130827)
39
- rake (10.3.2)
39
+ rake (10.4.2)
40
40
  rspec (2.14.1)
41
41
  rspec-core (~> 2.14.0)
42
42
  rspec-expectations (~> 2.14.0)
@@ -45,9 +45,9 @@ GEM
45
45
  rspec-expectations (2.14.5)
46
46
  diff-lcs (>= 1.1.3, < 2.0)
47
47
  rspec-mocks (2.14.6)
48
- semver2 (3.3.3)
48
+ semver2 (3.4.1)
49
49
  thread_safe (0.3.4)
50
- tzinfo (1.2.1)
50
+ tzinfo (1.2.2)
51
51
  thread_safe (~> 0.1)
52
52
 
53
53
  PLATFORMS
@@ -2,39 +2,9 @@ require 'albacore/dsl'
2
2
 
3
3
  # Reopen Albacore DSL to get at the pre-built tasks
4
4
  # There is probably a better way to do this but ```me == :ruby_noob```
5
- module Albacore
5
+ module Physique
6
6
  module DSL
7
- def asmver_task(*args, &block)
8
- asmver *args, &block
9
- end
10
-
11
- def build_task(*args, &block)
12
- build *args, &block
13
- end
14
-
15
- def nugets_restore_task(*args, &block)
16
- nugets_restore *args, &block
17
- end
18
-
19
- def test_runner_task(*args, &block)
20
- test_runner *args, &block
21
- end
22
-
23
- def sqlcmd_task(*args, &block)
24
- sqlcmd *args, &block
25
- end
26
-
27
- def fluent_migrator_task(*args, &block)
28
- fluent_migrator *args, &block
29
- end
30
-
31
- def nugets_pack_task(*args, &block)
32
- nugets_pack *args, &block
33
- end
34
-
35
- def octopus_pack_task(*args, &block)
36
- octopus_pack *args, &block
37
- end
7
+ include Albacore::DSL
38
8
 
39
9
  private
40
10
 
@@ -49,7 +49,7 @@ module Physique
49
49
  def opts
50
50
  Map.new({
51
51
  file: @file,
52
- nuget: @nuget.opts && @nuget.opts,
52
+ nuget: @nuget && @nuget.opts,
53
53
  compile: @compilation && @compilation.opts,
54
54
  test: @tests && @tests.opts,
55
55
  migrator: @migrator && @migrator.opts,
@@ -41,12 +41,12 @@ module Physique
41
41
  def add_compile_tasks
42
42
  block = lambda &method(:configure_build)
43
43
 
44
- task = build_task :compile => [ :restore ], &block.curry.(%w(Clean Rebuild))
44
+ task = build :compile => [ :restore ], &block.curry.(%w(Clean Rebuild))
45
45
  task.add_description 'Builds the solution'
46
46
 
47
47
  namespace :compile do
48
48
  solution.compile.targets.each do |t|
49
- task = build_task t.downcase, &block.curry.(t)
49
+ task = build t.downcase, &block.curry.(t)
50
50
  task.add_description "Builds the solution using the #{t} target"
51
51
  end
52
52
  end
@@ -53,7 +53,7 @@ module Physique
53
53
  FileList["#{@options.scripts_dir}/*.sql"].each do |f|
54
54
  namespace :db do
55
55
  task_name = File.basename(f, '.*')
56
- task = sqlcmd_task task_name do |s|
56
+ task = sqlcmd task_name do |s|
57
57
  s.file = f
58
58
  s.server_name = @options.instance
59
59
  s.set_variable 'DATABASE_NAME', @options.name
@@ -67,7 +67,7 @@ module Physique
67
67
  default_tasks(@options.name).each do |task_name,sql|
68
68
  unless Rake::Task.task_defined? "db:#{task_name.to_s}"
69
69
  namespace :db do
70
- task = sqlcmd_task task_name do |s|
70
+ task = sqlcmd task_name do |s|
71
71
  s.command = sql
72
72
  s.server_name = @options.instance
73
73
  s.set_variable 'DATABASE_NAME', @options.name
@@ -99,7 +99,7 @@ module Physique
99
99
  require 'physique/tasks/fluent_migrator'
100
100
 
101
101
  namespace :db do
102
- build_task :compile_db do |b|
102
+ build :compile_db do |b|
103
103
  b.target = [ 'Build' ]
104
104
  b.file = solution.migrator.project_file
105
105
  b.prop 'Configuration', solution.compile.configuration
@@ -109,11 +109,11 @@ module Physique
109
109
  block = lambda &method(:configure_migration)
110
110
 
111
111
  # Migrate up
112
- task = fluent_migrator_task :migrate => [ :compile_db ], &block.curry.('migrate:up')
112
+ task = fluent_migrator :migrate => [ :compile_db ], &block.curry.('migrate:up')
113
113
  task.add_description 'Migrate database to the latest version'
114
114
 
115
115
  # Migrate down
116
- task = fluent_migrator_task :rollback => [ :compile_db ], &block.curry.('rollback')
116
+ task = fluent_migrator :rollback => [ :compile_db ], &block.curry.('rollback')
117
117
  task.add_description 'Rollback the database to the previous version'
118
118
  end
119
119
  end
@@ -35,7 +35,7 @@ module Physique
35
35
  private
36
36
 
37
37
  def add_restore
38
- task = nugets_restore_task :restore do |r|
38
+ task = nugets_restore :restore do |r|
39
39
  r.out = solution.nuget.restore_location
40
40
  r.exe = solution.nuget.exe
41
41
  end
@@ -93,7 +93,7 @@ module Physique
93
93
  @options.apps.each do |a|
94
94
  namespace :octo do
95
95
  namespace :package do
96
- task = octopus_pack_task a.name => [:versionizer, :test] do |o|
96
+ task = octopus_pack a.name => [:versionizer, :test] do |o|
97
97
  ensure_output_location solution.nuget.build_location
98
98
 
99
99
  o.project_file = a.project_file
@@ -1,15 +1,17 @@
1
1
  require 'physique/config'
2
+ require 'forwardable'
2
3
 
3
4
  module Physique
4
5
  class PublishNugetsConfig < MetadataConfig
6
+ extend Forwardable
7
+
5
8
  attr_writer :project_files, # Project files to include
6
9
  :exclude, # Project files to exclude
7
- :local_path, # Path to publish locally
8
- :feed_url, # Nuget feed to publish packages
9
- :api_key # Nuget API key
10
+ :local_path # Path to publish locally
10
11
 
11
12
  def initialize
12
13
  super
14
+ @feeds = []
13
15
  @alias_tasks = true
14
16
  end
15
17
 
@@ -18,10 +20,7 @@ module Physique
18
20
  @alias_tasks = false
19
21
  end
20
22
 
21
- def symbols_feed_url=(value)
22
- @gen_symbols = true
23
- @symbols_feed_url = value
24
- end
23
+ def_delegators :default_feed, :feed_url=, :symbols_feed_url=, :api_key=
25
24
 
26
25
  def opts
27
26
  Map.new(
@@ -32,7 +31,8 @@ module Physique
32
31
  gen_symbols: @gen_symbols,
33
32
  symbols_feed_url: @symbols_feed_url,
34
33
  api_key: @api_key,
35
- alias_tasks: @alias_tasks
34
+ alias_tasks: @alias_tasks,
35
+ feeds: @feeds.map { |f| f.opts }
36
36
  ).apply(
37
37
  local_path: 'C:/Nuget.Local'
38
38
  )
@@ -45,6 +45,45 @@ module Physique
45
45
  def exclude_or_default
46
46
  @exclude || /Tests/
47
47
  end
48
+
49
+ private
50
+
51
+ def default_feed
52
+ @default_feed || create_default_feed
53
+ end
54
+
55
+ def create_default_feed
56
+ PublishNugetsFeedConfig.new.tap do |feed|
57
+ feed.name = 'default'
58
+ @default_feed = feed
59
+ @feeds << feed
60
+ end
61
+ end
62
+ end
63
+
64
+ class PublishNugetsFeedConfig
65
+ attr_writer :name, # Name of the nuget feed
66
+ :feed_url, # Nuget feed to publish packages
67
+ :api_key # Nuget API key
68
+
69
+ # Nuget feed to publish symbol packages
70
+ def symbols_feed_url=(value)
71
+ @gen_symbols = true
72
+ @symbols_feed_url = value
73
+ end
74
+
75
+ def opts
76
+ raise ArgumentError, 'You must specify a name for all nuget feeds' if @name.blank?
77
+ raise ArgumentError, "You must specify a feed_url for feed #{name}" if @feed_url.blank?
78
+
79
+ Map.new(
80
+ name: @name,
81
+ feed_url: @feed_url,
82
+ gen_symbols: @gen_symbols,
83
+ symbols_feed_url: @symbols_feed_url,
84
+ api_key: @api_key
85
+ )
86
+ end
48
87
  end
49
88
 
50
89
  class PublishNugetsTasksBuilder < TasksBuilder
@@ -65,7 +104,7 @@ module Physique
65
104
 
66
105
  def add_package_nugets_task
67
106
  namespace :nuget do
68
- task = nugets_pack_task :package => [ :versionizer, :test ] do |p|
107
+ task = nugets_pack :package => [ :versionizer, :test ] do |p|
69
108
  ensure_output_location solution.nuget.build_location
70
109
 
71
110
  p.configuration = solution.compile.configuration
@@ -25,12 +25,11 @@ module Physique
25
25
  configuration = solution.compile.configuration
26
26
  package_dir = solution.nuget.restore_location
27
27
 
28
- task = test_runner_task :test => test_dependencies do |tests|
28
+ task = test_runner :test => test_dependencies do |tests|
29
29
  tests.files = FileList["**/*.Tests/bin/#{configuration}/*.Tests.dll"]
30
30
  tests.exe = locate_tool("#{package_dir}/NUnit.Runners.*/tools/nunit-console.exe")
31
31
  tests.parameters.add('/labels')
32
32
  tests.parameters.add('/trace=Verbose')
33
- tests.parameters.add('/exclude=PersistenceTest')
34
33
  end
35
34
  task.add_description 'Run unit tests'
36
35
  end
@@ -80,7 +80,7 @@ module Physique
80
80
  work_dir: cwd,
81
81
  out: out
82
82
 
83
- # Octopus packages don't confirm to NuGet standards so
83
+ # Octopus packages don't conform to NuGet standards so
84
84
  # disable package analysis to prevent unnecessary warnings.
85
85
  cmd.disable_package_analysis
86
86
 
@@ -3,8 +3,8 @@ require 'physique/tool_locator'
3
3
 
4
4
  module Physique
5
5
  class TasksBuilder
6
- include Albacore::DSL
7
6
  include Albacore::Logging
7
+ include Physique::DSL
8
8
  include Physique::ToolLocator
9
9
 
10
10
  @subclasses = []
@@ -12,7 +12,7 @@ module Physique
12
12
  # The tool sorts any matching executables in descending order to that the most recent version is returned. To
13
13
  # change this behavior call the method with the reverse option.
14
14
  #
15
- # locate_tool 'C:/path/to/**/tool.exe', reverse: false
15
+ # locate_tool 'C:/path/to/**/tool.exe', find_latest: false
16
16
  #
17
17
  # Throws a ToolNotFoundError if no tool could be found.
18
18
  def locate_tool(paths, options = {})
@@ -24,9 +24,9 @@ module Physique
24
24
 
25
25
  info { "Attempting to locate tool in the following paths #{paths}" }
26
26
  opts = Map.options(options)
27
- opts = opts.apply :reverse => true
27
+ opts = opts.apply :find_latest => true
28
28
  paths = paths.collect { |p| which(p) }.compact.sort
29
- paths = paths.reverse if opts[:reverse]
29
+ paths = paths.reverse if opts[:find_latest]
30
30
  tool = paths.first
31
31
 
32
32
  raise ToolNotFoundError, "Could not find tool in the following paths: \n #{paths}" if tool.nil?
@@ -1,3 +1,3 @@
1
1
  module Physique
2
- VERSION = '0.2.2'
2
+ VERSION = '0.3.0'
3
3
  end
@@ -0,0 +1,40 @@
1
+ FEED_URL = 'https://www.nuget.org'
2
+ SYMBOLS_FEED_URL = 'http://nuget.gw.symbolsource.org/Public/NuGet'
3
+
4
+ describe Physique::PublishNugetsConfig do
5
+ let(:config) { Physique::PublishNugetsConfig.new }
6
+ let(:opts) { config.opts }
7
+
8
+ describe 'when setting feed data directly' do
9
+ let(:first_feed) { opts.feeds[0] }
10
+
11
+ it 'should create a default feed and delegate its configuration' do
12
+ config.feed_url = FEED_URL
13
+ config.symbols_feed_url = SYMBOLS_FEED_URL
14
+
15
+ opts.feeds.count.should eq(1)
16
+
17
+ first_feed.name.should eq('default')
18
+ first_feed.feed_url.should eq(FEED_URL)
19
+ first_feed.symbols_feed_url.should eq(SYMBOLS_FEED_URL)
20
+ first_feed.gen_symbols.should be_true
21
+ end
22
+ end
23
+ end
24
+
25
+ describe Physique::PublishNugetsFeedConfig do
26
+ let(:config) { Physique::PublishNugetsFeedConfig.new }
27
+ let(:feed) { config.opts }
28
+
29
+ it 'should set opts values' do
30
+ config.name = 'default'
31
+ config.feed_url = FEED_URL
32
+ config.symbols_feed_url = SYMBOLS_FEED_URL
33
+ config.api_key = 'API_KEY'
34
+
35
+ feed.name.should eq('default')
36
+ feed.feed_url.should eq(FEED_URL)
37
+ feed.symbols_feed_url.should eq(SYMBOLS_FEED_URL)
38
+ feed.gen_symbols.should be_true
39
+ end
40
+ end
@@ -0,0 +1 @@
1
+ This is just a place holder to make tests pass.
@@ -0,0 +1 @@
1
+ This is just a place holder to make tests pass.
@@ -0,0 +1 @@
1
+ This is just a place holder to make tests pass.
@@ -10,13 +10,20 @@ describe Physique::ToolLocator do
10
10
  end
11
11
 
12
12
  it 'should find tool based on file spec' do
13
- result = locate_tool('C:/Program Files/Microsoft SQL Server/**/Tools/Binn/SQLCMD.EXE')
14
- expect(result).to eq('C:/Program Files/Microsoft SQL Server/110/Tools/Binn/SQLCMD.EXE')
13
+ result = locate_tool('./spec/test_data/tool_locator/Program Files/Microsoft SQL Server/**/Tools/Binn/SQLCMD.exe.txt')
14
+ expect(result).to eq('./spec/test_data/tool_locator/Program Files/Microsoft SQL Server/110/Tools/Binn/SQLCMD.exe.txt')
15
15
  end
16
16
 
17
- it 'should find tool based on file spec' do
18
- result = Physique::ToolLocator.locate_tool('C:/Windows/Microsoft.NET/Framework/**/msbuild.exe')
17
+ MS_BUILD_PATH = './spec/test_data/tool_locator/Windows/Microsoft.NET/Framework/**/msbuild.exe.txt'
18
+
19
+ it 'should find latest version of a tool based on file spec' do
20
+ result = locate_tool(MS_BUILD_PATH)
19
21
  expect(result).to match(%r{v4.0}i)
20
22
  end
23
+
24
+ it 'should find first version of a tool if specified' do
25
+ result = locate_tool(MS_BUILD_PATH, find_latest: false)
26
+ expect(result).to match(%r{v3.5}i)
27
+ end
21
28
  end
22
29
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: physique
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Scaduto
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-25 00:00:00.000000000 Z
11
+ date: 2015-02-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -115,8 +115,12 @@ files:
115
115
  - physique.gemspec
116
116
  - spec/config_spec.rb
117
117
  - spec/project_spec.rb
118
+ - spec/publish_nugets_spec.rb
118
119
  - spec/solution_spec.rb
119
120
  - spec/sqlcmd_spec.rb
121
+ - spec/test_data/tool_locator/Program Files/Microsoft SQL Server/110/Tools/Binn/SQLCMD.exe.txt
122
+ - spec/test_data/tool_locator/Windows/Microsoft.NET/Framework/v3.5/MSBuild.exe.txt
123
+ - spec/test_data/tool_locator/Windows/Microsoft.NET/Framework/v4.0.30319/MSBuild.exe.txt
120
124
  - spec/tool_locator_spec.rb
121
125
  homepage: http://github.com/scardetto/physique
122
126
  licenses:
@@ -138,7 +142,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
138
142
  version: '0'
139
143
  requirements: []
140
144
  rubyforge_project:
141
- rubygems_version: 2.4.1
145
+ rubygems_version: 2.3.0
142
146
  signing_key:
143
147
  specification_version: 4
144
148
  summary: A conventional build framework supporting NUnit, FluentMigrator and Octopus
@@ -146,6 +150,10 @@ summary: A conventional build framework supporting NUnit, FluentMigrator and Oct
146
150
  test_files:
147
151
  - spec/config_spec.rb
148
152
  - spec/project_spec.rb
153
+ - spec/publish_nugets_spec.rb
149
154
  - spec/solution_spec.rb
150
155
  - spec/sqlcmd_spec.rb
156
+ - spec/test_data/tool_locator/Program Files/Microsoft SQL Server/110/Tools/Binn/SQLCMD.exe.txt
157
+ - spec/test_data/tool_locator/Windows/Microsoft.NET/Framework/v3.5/MSBuild.exe.txt
158
+ - spec/test_data/tool_locator/Windows/Microsoft.NET/Framework/v4.0.30319/MSBuild.exe.txt
151
159
  - spec/tool_locator_spec.rb