Class: AlpacaBuildTool::Application
- Inherits:
-
Object
- Object
- AlpacaBuildTool::Application
- Includes:
- Log
- Defined in:
- lib/alpacabuildtool/application.rb
Overview
Application is a main entry point for CLI
Instance Attribute Summary
Attributes included from Log
Instance Method Summary collapse
-
#compile(pattern, options) ⇒ Object
Compiles solution [s].
-
#configure_global(properties) ⇒ Object
Update/create *~/.alpaca.conf*.
-
#configure_local(pattern, properties) ⇒ Object
Update/create *local configuration*.
-
#package(pattern, options) ⇒ Object
Create packages for solution [s].
-
#release(pattern, options) ⇒ Object
Release packages for solution [s].
-
#report(pattern, options) ⇒ Object
Convert test results into reports for solution [s].
-
#test(pattern, options) ⇒ Object
Run tests for solution [s].
-
#update(pattern, options) ⇒ Object
Update .semver files for solution [s].
Instance Method Details
#compile(pattern, options) ⇒ Object
Compiles solution [s]
pattern
-
pattern for solutions search
options
-
hash with compilation options
options[:debug] = true
is to compile solution in debug mode
options[:update_version] = true
is to update project versions before compiling
app.compile('**/*.sln', debug: true, update_version: true)
# => building found solutions in debug mode
# with updating project versions
26 27 28 29 30 31 32 |
# File 'lib/alpacabuildtool/application.rb', line 26 def compile(pattern, ) log.header 'Compile' each_solution(pattern) do |solution| build_manager = BuildManager.new(solution) build_manager.build([:debug], [:update_version]) end end |
#configure_global(properties) ⇒ Object
Update/create *~/.alpaca.conf*
properties
-
array of properties to store in global configuration
in format node1.node2.property=value
app.configure_global(['hello.world=yay'])
# => produce yaml text in ~/.alpaca.conf:
# hello:
# world: yay
157 158 159 160 |
# File 'lib/alpacabuildtool/application.rb', line 157 def configure_global(properties) log.header 'Configure' Configuration.set(properties) end |
#configure_local(pattern, properties) ⇒ Object
Update/create *local configuration*
pattern
-
pattern for solutions search
properties
-
array of properties to store in global configuration
in format node1.node2.property=value
app.configure_local('**/*.sln', ['hello.world=yay'])
# => produce yaml text in .alpaca.conf for each solution:
# hello:
# world: yay
173 174 175 176 177 178 179 |
# File 'lib/alpacabuildtool/application.rb', line 173 def configure_local(pattern, properties) log.header 'Configure' Solutions.each(pattern) do |solution| log.puts "saving configuration for #{solution.name}" Configuration.new(solution).set(properties) end end |
#package(pattern, options) ⇒ Object
Create packages for solution [s]
pattern
-
pattern for solutions search
options
-
hash with packaging options
options[:debug] = true
is to create packages from debug mode<br> options[:push] = true
is to push packages after they are created <br> options[:force] = true
is to create/push packages even if it has no changes
app.package('**/*.sln')
# => creating only packages with changes in release mode without
# pushing them
88 89 90 91 92 93 94 95 96 97 |
# File 'lib/alpacabuildtool/application.rb', line 88 def package(pattern, ) log.header 'Package' each_solution(pattern) do |solution| version = solution.package_version package_manager = PackageManager.new(solution) (solution.configuration['packages'] || []).each do |package| package_manager.create_package(package, version, ) end end end |
#release(pattern, options) ⇒ Object
Release packages for solution [s]
Updates .semver file to get release version if it is not release yet Rebuilds solution and create release package Changes are checked from last release package
pattern
-
pattern for solutions search
options
-
hash with releasing options
options[:push] = true
is to push packages after they are created
options[:force] = true
is to create/push packages even if it has no changes
app.release('**/*.sln')
# => creating only packages with changes without pushing them
115 116 117 118 119 120 121 122 123 124 125 126 |
# File 'lib/alpacabuildtool/application.rb', line 115 def release(pattern, ) log.header 'Release' each_solution(pattern) do |solution| semver = Versioning.find(solution.dir) semver.release if semver.prerelease? Versioning.save semver end compile(pattern, debug: false, update_version: true) test(pattern, {}) [:debug] = false package(pattern, ) end |
#report(pattern, options) ⇒ Object
Convert test results into reports for solution [s]
pattern
-
pattern for solutions search
options
-
hash with reporting options
options[:type] = 'all'
is to convert ‘all’ results into reports (‘all’, ‘tests’, ‘coverage’)
app.report('**/*.sln', type: 'coverage')
# => converting coverage results into html reports
66 67 68 69 70 71 72 |
# File 'lib/alpacabuildtool/application.rb', line 66 def report(pattern, ) log.header 'Report' each_solution(pattern) do |solution| report_manager = ReportManager.new(solution) report_manager.convert([:type]) end end |
#test(pattern, options) ⇒ Object
Run tests for solution [s]
pattern
-
pattern for solutions search
options
-
hash with testing options
options[:debug] = true
is to run tests in debug mode
options[:coverage] = true
is to run coverage
options[:type] = 'all'
is to run ‘all’ test types (‘all’, ‘unit’, ‘service’)
app.test('**/*.sln', coverage: true, type: 'unit')
# => running unit tests with coverage
46 47 48 49 50 51 52 53 54 |
# File 'lib/alpacabuildtool/application.rb', line 46 def test(pattern, ) log.header 'Test' each_solution(pattern) do |solution| test_projects = solution.specific_projects([:type]) next log.info 'no tests discovered' if test_projects.empty? test_manager = TestManager.new(solution) test_manager.test(test_projects, [:coverage], [:debug]) end end |
#update(pattern, options) ⇒ Object
Update .semver files for solution [s]
pattern
-
pattern for solutions search
options
-
hash with releasing options
options['dimension'] = :patch
is to update version patch (major, minor, patch, prerelease)
app.update('**/*.sln', 'dimension' => :minor)
# => increase minor version in .semver by 1
138 139 140 141 142 143 144 145 |
# File 'lib/alpacabuildtool/application.rb', line 138 def update(pattern, ) log.header 'Update' each_solution(pattern) do |solution| semver = Versioning.find(solution.dir) semver.increase(['dimension'].to_sym) Versioning.save semver end end |