physique 0.3.10 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (109) hide show
  1. checksums.yaml +4 -4
  2. data/FLUENT_MIGRATOR.md +300 -300
  3. data/Gemfile +3 -3
  4. data/Gemfile.lock +51 -11
  5. data/Guardfile +34 -0
  6. data/README.md +368 -368
  7. data/RUBY_SETUP.md +14 -14
  8. data/Rakefile +1 -1
  9. data/lib/physique.rb +22 -22
  10. data/lib/physique/config.rb +23 -23
  11. data/lib/physique/dsl.rb +46 -46
  12. data/lib/physique/project_path_resolver.rb +45 -45
  13. data/lib/physique/solution.rb +72 -72
  14. data/lib/physique/task_builders/build.rb +76 -69
  15. data/lib/physique/task_builders/default.rb +19 -19
  16. data/lib/physique/task_builders/fluent_migrator.rb +302 -299
  17. data/lib/physique/task_builders/nuget.rb +18 -6
  18. data/lib/physique/task_builders/octopus.rb +4 -2
  19. data/lib/physique/task_builders/publish_nugets.rb +5 -3
  20. data/lib/physique/task_builders/test.rb +4 -4
  21. data/lib/physique/tasks/fluent_migrator.rb +158 -158
  22. data/lib/physique/tasks/nugets_pack.rb +12 -12
  23. data/lib/physique/tasks/octopus_pack.rb +1 -1
  24. data/lib/physique/tasks/sqlcmd.rb +109 -109
  25. data/lib/physique/tasks/versionizer.rb +112 -112
  26. data/lib/physique/tasks_builder.rb +59 -59
  27. data/lib/physique/tool_locator.rb +50 -50
  28. data/lib/physique/version.rb +3 -3
  29. data/physique.gemspec +29 -28
  30. data/spec/fluent_migrator_config_spec.rb +39 -39
  31. data/spec/project_spec.rb +42 -42
  32. data/spec/publish_nugets_spec.rb +40 -40
  33. data/spec/solution_spec.rb +11 -11
  34. data/spec/sqlcmd_spec.rb +146 -146
  35. data/spec/support/shared_contexts/rake.rb +20 -21
  36. data/spec/task_builders/build_spec.rb +25 -25
  37. data/spec/task_builders/default_spec.rb +17 -17
  38. data/spec/task_builders/fluent_migrator_spec.rb +70 -68
  39. data/spec/task_builders/nspec_spec.rb +13 -13
  40. data/spec/task_builders/nuget_spec.rb +16 -16
  41. data/spec/test_data/solutions/.nuget/NuGet.Config +5 -5
  42. data/spec/test_data/solutions/.nuget/NuGet.exe +0 -0
  43. data/spec/test_data/solutions/.nuget/NuGet.targets +144 -144
  44. data/spec/test_data/solutions/.nuget/packages.config +3 -3
  45. data/spec/test_data/solutions/basic/.semver +6 -6
  46. data/spec/test_data/solutions/basic/Basic.Tests/Basic.Tests.csproj +58 -58
  47. data/spec/test_data/solutions/basic/Basic.Tests/Class1.cs +14 -14
  48. data/spec/test_data/solutions/basic/Basic.Tests/Properties/AssemblyInfo.cs +36 -36
  49. data/spec/test_data/solutions/basic/Basic.Tests/packages.config +3 -3
  50. data/spec/test_data/solutions/basic/Basic.sln +28 -28
  51. data/spec/test_data/solutions/basic/Basic/Basic.csproj +52 -52
  52. data/spec/test_data/solutions/basic/Basic/Class1.cs +12 -12
  53. data/spec/test_data/solutions/basic/Basic/Properties/AssemblyInfo.cs +36 -36
  54. data/spec/test_data/solutions/basic/Rakefile.rb +10 -10
  55. data/spec/test_data/solutions/basic/packages.config +3 -3
  56. data/spec/test_data/solutions/fluent-migrator/.semver +6 -6
  57. data/spec/test_data/solutions/fluent-migrator/Basic.Migrations/Migrations/.gitkeep +0 -0
  58. data/spec/test_data/solutions/fluent-migrator/Basic.Migrations/Properties/AssemblyInfo.cs +36 -36
  59. data/spec/test_data/solutions/fluent-migrator/Basic.Migrations/TestMigration.cs +19 -19
  60. data/spec/test_data/solutions/fluent-migrator/Basic.Migrations/_Scripts/create.sql +1 -1
  61. data/spec/test_data/solutions/fluent-migrator/Basic.Migrations/_Scripts/drop.sql +4 -4
  62. data/spec/test_data/solutions/fluent-migrator/Basic.Migrations/_Scripts/seed.sql +1 -1
  63. data/spec/test_data/solutions/fluent-migrator/Basic.Migrations/packages.config +3 -3
  64. data/spec/test_data/solutions/fluent-migrator/Basic.Specs/Basic.Specs.csproj +59 -59
  65. data/spec/test_data/solutions/fluent-migrator/Basic.Specs/Class1.cs +12 -12
  66. data/spec/test_data/solutions/fluent-migrator/Basic.Specs/DebuggerShim.cs +42 -42
  67. data/spec/test_data/solutions/fluent-migrator/Basic.Specs/Properties/AssemblyInfo.cs +36 -36
  68. data/spec/test_data/solutions/fluent-migrator/Basic.Specs/packages.config +3 -3
  69. data/spec/test_data/solutions/fluent-migrator/Basic.sln +39 -39
  70. data/spec/test_data/solutions/fluent-migrator/Basic/Basic.csproj +55 -55
  71. data/spec/test_data/solutions/fluent-migrator/Basic/Class1.cs +12 -12
  72. data/spec/test_data/solutions/fluent-migrator/Basic/Properties/AssemblyInfo.cs +36 -36
  73. data/spec/test_data/solutions/fluent-migrator/Basic/packages.config +2 -2
  74. data/spec/test_data/solutions/fluent-migrator/Rakefile.rb +20 -20
  75. data/spec/test_data/solutions/multiple-fluent-migrator/.semver +6 -6
  76. data/spec/test_data/solutions/multiple-fluent-migrator/Basic.Migrations1/Basic.Migrations1.csproj +52 -52
  77. data/spec/test_data/solutions/multiple-fluent-migrator/Basic.Migrations1/Class1.cs +12 -12
  78. data/spec/test_data/solutions/multiple-fluent-migrator/Basic.Migrations1/Properties/AssemblyInfo.cs +36 -36
  79. data/spec/test_data/solutions/multiple-fluent-migrator/Basic.Migrations2/Basic.Migrations2.csproj +52 -52
  80. data/spec/test_data/solutions/multiple-fluent-migrator/Basic.Migrations2/Class1.cs +12 -12
  81. data/spec/test_data/solutions/multiple-fluent-migrator/Basic.Migrations2/Properties/AssemblyInfo.cs +36 -36
  82. data/spec/test_data/solutions/multiple-fluent-migrator/Basic.Specs/Basic.Specs.csproj +59 -59
  83. data/spec/test_data/solutions/multiple-fluent-migrator/Basic.Specs/Class1.cs +12 -12
  84. data/spec/test_data/solutions/multiple-fluent-migrator/Basic.Specs/DebuggerShim.cs +42 -42
  85. data/spec/test_data/solutions/multiple-fluent-migrator/Basic.Specs/Properties/AssemblyInfo.cs +36 -36
  86. data/spec/test_data/solutions/multiple-fluent-migrator/Basic.Specs/packages.config +3 -3
  87. data/spec/test_data/solutions/multiple-fluent-migrator/Basic.sln +45 -45
  88. data/spec/test_data/solutions/multiple-fluent-migrator/Basic/Basic.csproj +55 -55
  89. data/spec/test_data/solutions/multiple-fluent-migrator/Basic/Class1.cs +12 -12
  90. data/spec/test_data/solutions/multiple-fluent-migrator/Basic/Properties/AssemblyInfo.cs +36 -36
  91. data/spec/test_data/solutions/multiple-fluent-migrator/Basic/packages.config +2 -2
  92. data/spec/test_data/solutions/multiple-fluent-migrator/Rakefile.rb +28 -28
  93. data/spec/test_data/solutions/nspec/.semver +6 -6
  94. data/spec/test_data/solutions/nspec/Basic.Specs/Basic.Specs.csproj +59 -59
  95. data/spec/test_data/solutions/nspec/Basic.Specs/Class1.cs +12 -12
  96. data/spec/test_data/solutions/nspec/Basic.Specs/DebuggerShim.cs +42 -42
  97. data/spec/test_data/solutions/nspec/Basic.Specs/Properties/AssemblyInfo.cs +36 -36
  98. data/spec/test_data/solutions/nspec/Basic.Specs/packages.config +3 -3
  99. data/spec/test_data/solutions/nspec/Basic.sln +28 -28
  100. data/spec/test_data/solutions/nspec/Basic/Basic.csproj +55 -55
  101. data/spec/test_data/solutions/nspec/Basic/Class1.cs +12 -12
  102. data/spec/test_data/solutions/nspec/Basic/Properties/AssemblyInfo.cs +36 -36
  103. data/spec/test_data/solutions/nspec/Basic/packages.config +2 -2
  104. data/spec/test_data/solutions/nspec/Rakefile.rb +14 -14
  105. data/spec/test_data/tool_locator/Program Files/Microsoft SQL Server/110/Tools/Binn/SQLCMD.exe.txt b/data/spec/test_data/tool_locator/Program Files/Microsoft SQL → Server/110/Tools/Binn/SQLCMD.exe.txt +0 -0
  106. data/spec/test_data/tool_locator/Windows/Microsoft.NET/Framework/v3.5/MSBuild.exe.txt +0 -0
  107. data/spec/test_data/tool_locator/Windows/Microsoft.NET/Framework/v4.0.30319/MSBuild.exe.txt +0 -0
  108. data/spec/tool_locator_spec.rb +27 -29
  109. metadata +33 -16
@@ -1,6 +1,7 @@
1
1
  # Installing Ruby on Windows
2
2
 
3
3
  * The [Chocolatey Package Manager](http://chocolatey.org/) makes installing Ruby a breeze. Think of it as NuGet for your machine. To install it, follow the instructions on [their website](http://chocolatey.org/).
4
+
4
5
  * Certain Chocolatey packages might not work with older versions of Powershell so update it to the latest version.
5
6
 
6
7
  ```
@@ -14,27 +15,26 @@
14
15
  ```
15
16
 
16
17
  * Restart your shell to refresh the environment variables.
17
- * Install Ruby DevKit.
18
+
19
+ * After restarting, check that ruby is installed by running the following. Note that your version may be slightly different:
18
20
 
19
21
  ```
20
- $ choco install ruby2.devkit
22
+ $ ruby --version
23
+ ruby 2.2.3p173 (2015-08-18 revision 51636) [x64-mingw32]
21
24
  ```
22
25
 
23
- * Check that ruby is installed by running the following. Note that your version may be slightly different:
26
+ * Install Ruby DevKit.
24
27
 
25
28
  ```
26
- $ ruby --version
27
- ruby 2.1.5p273 (2014-11-13 revision 48405) [x64-mingw32]
29
+ $ choco install ruby2.devkit
28
30
  ```
29
31
 
30
- ## Troubleshooting
32
+ * Register Ruby with DevKit.
31
33
 
32
- When installing Ruby DevKit, it should automatically register itself with the
33
- installed ruby version. However, you may need to configure Ruby DevKit manually
34
- by running the following.
34
+ ```
35
+ $ cd \tools\DevKit2
36
+ $ echo - C:/tools/ruby22 >> config.yml
37
+ $ ruby dk.rb install --force
38
+ ```
35
39
 
36
- ```
37
- $ cd \tools\DevKit2
38
- $ echo "- C:/tools/ruby215" >> config.yml
39
- $ ruby dk.rb install --force
40
- ```
40
+ You should now be ready to Ruby!
data/Rakefile CHANGED
@@ -3,4 +3,4 @@ require 'rspec/core/rake_task'
3
3
 
4
4
  RSpec::Core::RakeTask.new(:spec) do |c|
5
5
  c.rspec_opts = %w(--color --format=doc)
6
- end
6
+ end
@@ -1,22 +1,22 @@
1
- # ******************************************* #
2
- # _ _ #
3
- # _ __ | |__ _ _ ___(_) __ _ _ _ ___ #
4
- # | '_ \| '_ \| | | / __| |/ _` | | | |/ _ \ #
5
- # | |_) | | | | |_| \__ \ | (_| | |_| | __/ #
6
- # | .__/|_| |_|\__, |___/_|\__, |\__,_|\___| #
7
- # |_| |___/ |_| #
8
- # #
9
- # ******************************************* #
10
-
11
- module Physique
12
- end
13
-
14
- require 'active_support/core_ext/string'
15
- require 'active_support/core_ext/array'
16
- require 'albacore'
17
- require 'albacore/dsl'
18
- require 'albacore/config_dsl'
19
- require 'albacore/nuget_model'
20
- require 'physique/version'
21
- require 'physique/dsl'
22
- require 'physique/solution'
1
+ # ******************************************* #
2
+ # _ _ #
3
+ # _ __ | |__ _ _ ___(_) __ _ _ _ ___ #
4
+ # | '_ \| '_ \| | | / __| |/ _` | | | |/ _ \ #
5
+ # | |_) | | | | |_| \__ \ | (_| | |_| | __/ #
6
+ # | .__/|_| |_|\__, |___/_|\__, |\__,_|\___| #
7
+ # |_| |___/ |_| #
8
+ # #
9
+ # ******************************************* #
10
+
11
+ module Physique
12
+ end
13
+
14
+ require 'active_support/core_ext/string'
15
+ require 'active_support/core_ext/array'
16
+ require 'albacore'
17
+ require 'albacore/dsl'
18
+ require 'albacore/config_dsl'
19
+ require 'albacore/nuget_model'
20
+ require 'physique/version'
21
+ require 'physique/dsl'
22
+ require 'physique/solution'
@@ -1,24 +1,24 @@
1
- module Physique
2
- class MetadataConfig
3
- def initialize
4
- @metadata = default_metadata
5
-
6
- Albacore.subscribe :build_version do |data|
7
- @metadata.version = data.nuget_version
8
- end
9
- end
10
-
11
- def with_metadata
12
- yield @metadata
13
- end
14
-
15
- private
16
-
17
- def default_metadata
18
- metadata = Albacore::NugetModel::Metadata.new
19
- metadata.description = 'MISSING'
20
- metadata.authors = 'MISSING'
21
- metadata
22
- end
23
- end
1
+ module Physique
2
+ class MetadataConfig
3
+ def initialize
4
+ @metadata = default_metadata
5
+
6
+ Albacore.subscribe :build_version do |data|
7
+ @metadata.version = data.nuget_version
8
+ end
9
+ end
10
+
11
+ def with_metadata
12
+ yield @metadata
13
+ end
14
+
15
+ private
16
+
17
+ def default_metadata
18
+ metadata = Albacore::NugetModel::Metadata.new
19
+ metadata.description = 'MISSING'
20
+ metadata.authors = 'MISSING'
21
+ metadata
22
+ end
23
+ end
24
24
  end
@@ -1,46 +1,46 @@
1
- require 'albacore/dsl'
2
-
3
- # Reopen Albacore DSL to get at the pre-built tasks
4
- # There is probably a better way to do this but ```me == :ruby_noob```
5
- module Physique
6
- module DSL
7
- include Albacore::DSL
8
-
9
- private
10
-
11
- # A rake task type for executing sqlcmd
12
- def sqlcmd(*args, &block)
13
- require 'physique/tasks/sqlcmd'
14
-
15
- Albacore.define_task *args do
16
- c = Physique::SqlCmd::Config.new
17
- yield c
18
- Physique::SqlCmd::Task.new(c.opts).execute
19
- end
20
- end
21
-
22
- # A rake task type for executing sqlcmd
23
- def fluent_migrator(*args, &block)
24
- require 'physique/tasks/fluent_migrator'
25
-
26
- Albacore.define_task *args do
27
- c = Physique::FluentMigrator::Config.new
28
- yield c
29
- Physique::FluentMigrator::Task.new(c.opts).execute
30
- end
31
- end
32
-
33
- # A rake task type for executing sqlcmd
34
- def octopus_pack(*args, &block)
35
- require 'physique/tasks/octopus_pack'
36
-
37
- Albacore.define_task *args do
38
- c = Physique::OctopusPack::Config.new
39
- yield c
40
- Physique::OctopusPack::Task.new(c.opts).execute
41
- end
42
- end
43
- end
44
- end
45
-
46
- self.extend Albacore::DSL
1
+ require 'albacore/dsl'
2
+
3
+ # Reopen Albacore DSL to get at the pre-built tasks
4
+ # There is probably a better way to do this but ```me == :ruby_noob```
5
+ module Physique
6
+ module DSL
7
+ include Albacore::DSL
8
+
9
+ private
10
+
11
+ # A rake task type for executing sqlcmd
12
+ def sqlcmd(*args, &block)
13
+ require 'physique/tasks/sqlcmd'
14
+
15
+ Albacore.define_task *args do
16
+ c = Physique::SqlCmd::Config.new
17
+ yield c
18
+ Physique::SqlCmd::Task.new(c.opts).execute
19
+ end
20
+ end
21
+
22
+ # A rake task type for executing sqlcmd
23
+ def fluent_migrator(*args, &block)
24
+ require 'physique/tasks/fluent_migrator'
25
+
26
+ Albacore.define_task *args do
27
+ c = Physique::FluentMigrator::Config.new
28
+ yield c
29
+ Physique::FluentMigrator::Task.new(c.opts).execute
30
+ end
31
+ end
32
+
33
+ # A rake task type for executing sqlcmd
34
+ def octopus_pack(*args, &block)
35
+ require 'physique/tasks/octopus_pack'
36
+
37
+ Albacore.define_task *args do
38
+ c = Physique::OctopusPack::Config.new
39
+ yield c
40
+ Physique::OctopusPack::Task.new(c.opts).execute
41
+ end
42
+ end
43
+ end
44
+ end
45
+
46
+ self.extend Albacore::DSL
@@ -1,46 +1,46 @@
1
- require 'albacore/project'
2
-
3
- module Physique
4
- module ProjectPathResolver
5
- extend self
6
-
7
- DEFAULT_PROJECT_FOLDER = 'src'
8
-
9
- @@project_folder = DEFAULT_PROJECT_FOLDER
10
-
11
- def project_dir
12
- @@project_folder
13
- end
14
-
15
- def project_dir=(val)
16
- @@project_folder = val
17
- end
18
-
19
- def resolve(name, ext = 'cs')
20
- return name if is_full_path name
21
- "#{@@project_folder}/#{name}/#{name}.#{ext}proj"
22
- end
23
-
24
- private
25
-
26
- def is_full_path(name)
27
- name =~ /^.*\.(cs|fs|vb)proj$/i
28
- end
29
- end
30
- end
31
-
32
- module Albacore
33
- class Project
34
- def add_compile_node(folder, name)
35
- if folder == :root
36
- add_include :Compile, "#{name}"
37
- else
38
- add_include :Compile, "#{folder.to_s}\\#{name}"
39
- end
40
- end
41
-
42
- def add_include(type, value)
43
- @proj_xml_node.xpath("//xmlns:ItemGroup[xmlns:#{type.to_s}]").first << "<#{type.to_s} Include=\"#{value}\" />"
44
- end
45
- end
1
+ require 'albacore/project'
2
+
3
+ module Physique
4
+ module ProjectPathResolver
5
+ extend self
6
+
7
+ DEFAULT_PROJECT_FOLDER = 'src'
8
+
9
+ @@project_folder = DEFAULT_PROJECT_FOLDER
10
+
11
+ def project_dir
12
+ @@project_folder
13
+ end
14
+
15
+ def project_dir=(val)
16
+ @@project_folder = val
17
+ end
18
+
19
+ def resolve(name, ext = 'cs')
20
+ return name if is_full_path name
21
+ "#{@@project_folder}/#{name}/#{name}.#{ext}proj"
22
+ end
23
+
24
+ private
25
+
26
+ def is_full_path(name)
27
+ name =~ /^.*\.(cs|fs|vb)proj$/i
28
+ end
29
+ end
30
+ end
31
+
32
+ module Albacore
33
+ class Project
34
+ def add_compile_node(folder, name)
35
+ if folder == :root
36
+ add_include :Compile, "#{name}"
37
+ else
38
+ add_include :Compile, "#{folder.to_s}\\#{name}"
39
+ end
40
+ end
41
+
42
+ def add_include(type, value)
43
+ @proj_xml_node.xpath("//xmlns:ItemGroup[xmlns:#{type.to_s}]").first << "<#{type.to_s} Include=\"#{value}\" />"
44
+ end
45
+ end
46
46
  end
@@ -1,73 +1,73 @@
1
- require 'rake'
2
- require 'albacore'
3
- require 'physique/tasks_builder'
4
-
5
- module Physique
6
- class SolutionConfig
7
- self.extend Albacore::ConfigDSL
8
- include Albacore::Logging
9
-
10
- # Path to the solution file
11
- attr_path_accessor :file
12
-
13
- def initialize
14
- @file = nil
15
- @compilation = CompileConfig.new
16
- @nuget = NugetConfig.new
17
- @tests = TestConfig.new
18
- end
19
-
20
- def use_nuget
21
- yield @nuget
22
- end
23
-
24
- def compile
25
- yield @compilation
26
- end
27
-
28
- def run_tests
29
- yield @tests
30
- end
31
-
32
- def fluently_migrate
33
- @dbs_to_migrate = @dbs_to_migrate || []
34
-
35
- migrator = FluentMigratorConfig.new
36
- yield migrator
37
-
38
- @dbs_to_migrate << migrator
39
- end
40
-
41
- alias_method :database, :fluently_migrate
42
-
43
- def octopus_deploy
44
- @octopus = OctopusDeployConfig.new
45
- yield @octopus
46
- end
47
-
48
- def publish_nugets
49
- @publish_nugets = PublishNugetsConfig.new
50
- yield @publish_nugets
51
- end
52
-
53
- def opts
54
- Map.new({
55
- file: @file,
56
- nuget: @nuget && @nuget.opts,
57
- compile: @compilation && @compilation.opts,
58
- test: @tests && @tests.opts,
59
- fluent_migrator_dbs: @dbs_to_migrate && @dbs_to_migrate.map {|db| db.opts },
60
- octopus: @octopus && @octopus.opts,
61
- publish_nugets: @publish_nugets && @publish_nugets.opts
62
- })
63
- end
64
- end
65
-
66
- class Solution
67
- def initialize(&block)
68
- config = SolutionConfig.new
69
- block.call config
70
- TasksBuilder.build_tasks_for config.opts
71
- end
72
- end
1
+ require 'rake'
2
+ require 'albacore'
3
+ require 'physique/tasks_builder'
4
+
5
+ module Physique
6
+ class SolutionConfig
7
+ self.extend Albacore::ConfigDSL
8
+ include Albacore::Logging
9
+
10
+ # Path to the solution file
11
+ attr_path_accessor :file
12
+
13
+ def initialize
14
+ @file = nil
15
+ @compilation = CompileConfig.new
16
+ @nuget = NugetConfig.new
17
+ @tests = TestConfig.new
18
+ end
19
+
20
+ def use_nuget
21
+ yield @nuget
22
+ end
23
+
24
+ def compile
25
+ yield @compilation
26
+ end
27
+
28
+ def run_tests
29
+ yield @tests
30
+ end
31
+
32
+ def fluently_migrate
33
+ @dbs_to_migrate = @dbs_to_migrate || []
34
+
35
+ migrator = FluentMigratorConfig.new
36
+ yield migrator
37
+
38
+ @dbs_to_migrate << migrator
39
+ end
40
+
41
+ alias_method :database, :fluently_migrate
42
+
43
+ def octopus_deploy
44
+ @octopus = OctopusDeployConfig.new
45
+ yield @octopus
46
+ end
47
+
48
+ def publish_nugets
49
+ @publish_nugets = PublishNugetsConfig.new
50
+ yield @publish_nugets
51
+ end
52
+
53
+ def opts
54
+ Map.new({
55
+ file: @file,
56
+ nuget: @nuget && @nuget.opts,
57
+ compile: @compilation && @compilation.opts,
58
+ test: @tests && @tests.opts,
59
+ fluent_migrator_dbs: @dbs_to_migrate && @dbs_to_migrate.map {|db| db.opts },
60
+ octopus: @octopus && @octopus.opts,
61
+ publish_nugets: @publish_nugets && @publish_nugets.opts
62
+ })
63
+ end
64
+ end
65
+
66
+ class Solution
67
+ def initialize(&block)
68
+ config = SolutionConfig.new
69
+ block.call config
70
+ TasksBuilder.build_tasks_for config.opts
71
+ end
72
+ end
73
73
  end