physique 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ NzJjZThlOTNiYzUxZTIyYzliZjI2YjI4ZmM0MTA0NzcxMDk1MGQ3MA==
5
+ data.tar.gz: !binary |-
6
+ ZGYwZDUxOWQ2NWRhNDJmZTkyMWJmZWJkZmQ1YmFlOWE4ZDIzM2UyYw==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ MDlhZTI2YzAwODNkZWIyYmJjMWU4YTZjNjIwZDMwZThhYWEyNzkwNzU1ZTcy
10
+ ODJhODZjNmRlMjM5MDU1MzhlNjUyZDNlMTkzODQwOWEyODc3Y2FjZjdhN2I0
11
+ ZmFjMzFjMjlhMzA0OWEyYTI5MTVkZmNhYjQ0YWY5N2VmM2I2N2Q=
12
+ data.tar.gz: !binary |-
13
+ YmE1NDU2MDU0NTNjMmNlN2NlZGE1YjUzYzc3OGYyZGNhZTgwMTVjMGFkNmIy
14
+ YTg5ZmZjMTRlNzk3NDExNjM3M2NjOTkzM2RkMmIwMjQwMmU0NTYwOGU5ODZj
15
+ M2UxNWZkYTg1MTBiYmM4MzA0NzBiYmU0ZmVkNmQ4M2ZhNTFjMDg=
@@ -0,0 +1,36 @@
1
+ .idea/
2
+
3
+ *.gem
4
+ *.rbc
5
+ /.config
6
+ /coverage/
7
+ /InstalledFiles
8
+ /pkg/
9
+ /spec/reports/
10
+ /test/tmp/
11
+ /test/version_tmp/
12
+ /tmp/
13
+
14
+ ## Specific to RubyMotion:
15
+ .dat*
16
+ .repl_history
17
+ build/
18
+
19
+ ## Documentation cache and generated files:
20
+ /.yardoc/
21
+ /_yardoc/
22
+ /doc/
23
+ /rdoc/
24
+
25
+ ## Environment normalisation:
26
+ /.bundle/
27
+ /lib/bundler/man/
28
+
29
+ # for a library or gem, you might want to ignore these files since the code is
30
+ # intended to run in multiple environments; otherwise, check them in:
31
+ # Gemfile.lock
32
+ # .ruby-version
33
+ # .ruby-gemset
34
+
35
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
36
+ .rvmrc
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in physique.gemspec
4
+ gemspec
@@ -0,0 +1,60 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ physique (0.2.2)
5
+ activesupport (~> 4.1)
6
+ albacore (= 2.0.0.rc.12)
7
+ map (~> 6.5)
8
+
9
+ GEM
10
+ remote: https://rubygems.org/
11
+ specs:
12
+ ProcessPilot (2.0.0.20120301)
13
+ rUtilAnts (>= 1.0)
14
+ activesupport (4.1.4)
15
+ i18n (~> 0.6, >= 0.6.9)
16
+ json (~> 1.7, >= 1.7.7)
17
+ minitest (~> 5.1)
18
+ thread_safe (~> 0.1)
19
+ tzinfo (~> 1.1)
20
+ albacore (2.0.0.rc.12)
21
+ ProcessPilot (~> 2.0)
22
+ facter (~> 1.7)
23
+ highline (~> 1.6)
24
+ map (~> 6.5)
25
+ nokogiri (~> 1.5)
26
+ rake (> 10)
27
+ semver2 (~> 3.3)
28
+ diff-lcs (1.2.5)
29
+ facter (1.7.6)
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)
38
+ rUtilAnts (2.0.0.20130827)
39
+ rake (10.3.2)
40
+ rspec (2.14.1)
41
+ rspec-core (~> 2.14.0)
42
+ rspec-expectations (~> 2.14.0)
43
+ rspec-mocks (~> 2.14.0)
44
+ rspec-core (2.14.8)
45
+ rspec-expectations (2.14.5)
46
+ diff-lcs (>= 1.1.3, < 2.0)
47
+ rspec-mocks (2.14.6)
48
+ semver2 (3.3.3)
49
+ thread_safe (0.3.4)
50
+ tzinfo (1.2.1)
51
+ thread_safe (~> 0.1)
52
+
53
+ PLATFORMS
54
+ ruby
55
+ x86-mingw32
56
+
57
+ DEPENDENCIES
58
+ bundler
59
+ physique!
60
+ rspec (= 2.14.1)
@@ -0,0 +1,41 @@
1
+ # physique
2
+
3
+ Beautiful builds for .NET
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'physique'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install physique
18
+
19
+ ## Usage
20
+
21
+ In your project's Rakefile:
22
+
23
+ ```ruby
24
+ require 'physique'
25
+
26
+ Physique::Solution.new do |s|
27
+ s.file = 'src/your-solution.sln'
28
+ end
29
+ ```
30
+
31
+ To view the available `rake` tasks:
32
+
33
+ $ rake --tasks
34
+
35
+ ## Contributing
36
+
37
+ 1. Fork it ( https://github.com/scardetto/physique/fork )
38
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
39
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
40
+ 4. Push to the branch (`git push origin my-new-feature`)
41
+ 5. Create a new Pull Request
@@ -0,0 +1,6 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new(:spec) do |c|
5
+ c.rspec_opts = %w(--color --format=doc)
6
+ end
@@ -0,0 +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'
@@ -0,0 +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
24
+ end
@@ -0,0 +1,76 @@
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 Albacore
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
38
+
39
+ private
40
+
41
+ # A rake task type for executing sqlcmd
42
+ def sqlcmd(*args, &block)
43
+ require 'physique/tasks/sqlcmd'
44
+
45
+ Albacore.define_task *args do
46
+ c = Physique::SqlCmd::Config.new
47
+ yield c
48
+ Physique::SqlCmd::Task.new(c.opts).execute
49
+ end
50
+ end
51
+
52
+ # A rake task type for executing sqlcmd
53
+ def fluent_migrator(*args, &block)
54
+ require 'physique/tasks/fluent_migrator'
55
+
56
+ Albacore.define_task *args do
57
+ c = Physique::FluentMigrator::Config.new
58
+ yield c
59
+ Physique::FluentMigrator::Task.new(c.opts).execute
60
+ end
61
+ end
62
+
63
+ # A rake task type for executing sqlcmd
64
+ def octopus_pack(*args, &block)
65
+ require 'physique/tasks/octopus_pack'
66
+
67
+ Albacore.define_task *args do
68
+ c = Physique::OctopusPack::Config.new
69
+ yield c
70
+ Physique::OctopusPack::Task.new(c.opts).execute
71
+ end
72
+ end
73
+ end
74
+ end
75
+
76
+ self.extend Albacore::DSL
@@ -0,0 +1,34 @@
1
+ require 'albacore/project'
2
+
3
+ module Physique
4
+ module Project
5
+ extend self
6
+
7
+ def get_path(name, ext = 'cs')
8
+ return name if is_full_path name
9
+ "src/#{name}/#{name}.#{ext}proj"
10
+ end
11
+
12
+ private
13
+
14
+ def is_full_path(name)
15
+ name =~ /^.*\.(cs|fs|vb)proj$/i
16
+ end
17
+ end
18
+ end
19
+
20
+ module Albacore
21
+ class Project
22
+ def add_compile_node(folder, name)
23
+ if folder == :root
24
+ add_include :Compile, "#{name}"
25
+ else
26
+ add_include :Compile, "#{folder.to_s}\\#{name}"
27
+ end
28
+ end
29
+
30
+ def add_include(type, value)
31
+ @proj_xml_node.xpath("//xmlns:ItemGroup[xmlns:#{type.to_s}]").first << "<#{type.to_s} Include=\"#{value}\" />"
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,69 @@
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
+ @migrator = FluentMigratorConfig.new
34
+ yield @migrator
35
+ end
36
+
37
+ alias_method :database, :fluently_migrate
38
+
39
+ def octopus_deploy
40
+ @octopus = OctopusDeployConfig.new
41
+ yield @octopus
42
+ end
43
+
44
+ def publish_nugets
45
+ @publish_nugets = PublishNugetsConfig.new
46
+ yield @publish_nugets
47
+ end
48
+
49
+ def opts
50
+ Map.new({
51
+ file: @file,
52
+ nuget: @nuget.opts && @nuget.opts,
53
+ compile: @compilation && @compilation.opts,
54
+ test: @tests && @tests.opts,
55
+ migrator: @migrator && @migrator.opts,
56
+ octopus: @octopus && @octopus.opts,
57
+ publish_nugets: @publish_nugets && @publish_nugets.opts,
58
+ })
59
+ end
60
+ end
61
+
62
+ class Solution
63
+ def initialize(&block)
64
+ config = SolutionConfig.new
65
+ block.call config
66
+ TasksBuilder.build_tasks_for config.opts
67
+ end
68
+ end
69
+ end
@@ -0,0 +1,62 @@
1
+ module Physique
2
+ class CompileConfig
3
+ attr_writer :configuration, # Build configuration (Release, Debug, etc.)
4
+ :logging # MSBuild Logging level (normal, verbose, etc.)
5
+
6
+ def initialize
7
+ @targets = []
8
+ end
9
+
10
+ def add_target(val)
11
+ @targets << val
12
+ end
13
+
14
+ def opts
15
+ @targets = %w(Clean Build Rebuild) if @targets.blank?
16
+
17
+ Map.new({
18
+ configuration: @configuration,
19
+ logging: @logging,
20
+ targets: @targets
21
+ }).apply(
22
+ configuration: 'Release',
23
+ logging: 'normal'
24
+ )
25
+ end
26
+ end
27
+
28
+ class BuildTasksBuilder < TasksBuilder
29
+ def build_tasks
30
+ add_version_task
31
+ add_compile_tasks
32
+ end
33
+
34
+ private
35
+
36
+ def add_version_task
37
+ require 'albacore/tasks/versionizer'
38
+ Albacore::Tasks::Versionizer.new :versionizer
39
+ end
40
+
41
+ def add_compile_tasks
42
+ block = lambda &method(:configure_build)
43
+
44
+ task = build_task :compile => [ :restore ], &block.curry.(%w(Clean Rebuild))
45
+ task.add_description 'Builds the solution'
46
+
47
+ namespace :compile do
48
+ solution.compile.targets.each do |t|
49
+ task = build_task t.downcase, &block.curry.(t)
50
+ task.add_description "Builds the solution using the #{t} target"
51
+ end
52
+ end
53
+ end
54
+
55
+ def configure_build(target, config)
56
+ config.sln = solution.file
57
+ config.prop 'Configuration', solution.compile.configuration
58
+ config.logging = solution.compile.logging
59
+ config.target = target
60
+ end
61
+ end
62
+ end