Class: Vara::Cli
- Inherits:
-
Thor
- Object
- Thor
- Vara::Cli
- Defined in:
- lib/vara/cli.rb
Class Method Summary collapse
Instance Method Summary collapse
- #build_metadata(product_dir) ⇒ Object
- #build_migrations(product_dir) ⇒ Object
- #build_pivotal(product_dir) ⇒ Object
- #download_artifacts(product_metadata) ⇒ Object
- #lint(product_metadata) ⇒ Object
- #update_product_version(pivotal_file_path, version) ⇒ Object
- #zip_pivotal(product_dir) ⇒ Object
Class Method Details
.exit_on_failure? ⇒ Boolean
6 7 8 |
# File 'lib/vara/cli.rb', line 6 def self.exit_on_failure? true end |
Instance Method Details
#build_metadata(product_dir) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/vara/cli.rb', line 15 def (product_dir) require 'vara/prerelease_versioner' require 'vara/static_versioner' require 'vara/product_metadata_processor' versioner = Vara::PrereleaseVersioner.new(File.(product_dir), .fetch('cycle')) versioner.override_prerelease_version!('') if ['final'] if ['version'] && !['version'].empty? versioner = Vara::StaticVersioner.new(File.(product_dir), .fetch('version')) end = Vara::ProductMetadataProcessor.new( File.(product_dir), versioner, external_release_paths: .fetch('external_releases', '').split(',') ).process say("#{} has been created") end |
#build_migrations(product_dir) ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/vara/cli.rb', line 37 def build_migrations(product_dir) require 'vara/prerelease_versioner' require 'vara/static_versioner' require 'vara/content_migrations_processor' versioner = Vara::PrereleaseVersioner.new(File.(product_dir), .fetch('cycle')) versioner.override_prerelease_version!('') if ['final'] if ['version'] && !['version'].empty? versioner = Vara::StaticVersioner.new(File.(product_dir), .fetch('version')) end content_migrations_path = Vara::ContentMigrationsProcessor.new(File.(product_dir), versioner).process say("#{content_migrations_path} has been created") unless content_migrations_path.nil? content_migrations_path end |
#build_pivotal(product_dir) ⇒ Object
81 82 83 84 85 86 87 |
# File 'lib/vara/cli.rb', line 81 def build_pivotal(product_dir) = (product_dir) build_migrations(product_dir) lint() download_artifacts() unless [:exclude_releases] zip_pivotal(product_dir) end |
#download_artifacts(product_metadata) ⇒ Object
59 60 61 62 63 |
# File 'lib/vara/cli.rb', line 59 def download_artifacts() require 'vara/product_resource_downloader' product_resource_downloader = Vara::ProductResourceDownloader.build(File.()) product_resource_downloader.download end |
#lint(product_metadata) ⇒ Object
52 53 54 55 56 |
# File 'lib/vara/cli.rb', line 52 def lint() require 'vara/linter' linter = Vara::Linter.build(File.()) linter.lint! end |
#update_product_version(pivotal_file_path, version) ⇒ Object
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 |
# File 'lib/vara/cli.rb', line 90 def update_product_version(pivotal_file_path, version) require 'vara/content_migrations_processor' require 'vara/product' require 'vara/static_versioner' pivotal_file_path = File.(pivotal_file_path) Dir.mktmpdir do |temp_dir| FileUtils.cd(temp_dir) do `unzip #{pivotal_file_path} -d .` output_dir = File.dirname(pivotal_file_path) versioner = Vara::StaticVersioner.new(temp_dir, version) Vara::ContentMigrationsProcessor.new(temp_dir, versioner).update_product_version_migrations product = Vara::Product.new(temp_dir) product.update_product_version(version) product.build product.paths.each do |path| FileUtils.mv(path, output_dir) end end end end |
#zip_pivotal(product_dir) ⇒ Object
66 67 68 69 70 71 72 73 |
# File 'lib/vara/cli.rb', line 66 def zip_pivotal(product_dir) require 'vara/product' product = Vara::Product.new(File.(product_dir), ) product.build say("file #{product.path} has been created") say("file #{product.bom_path} has been created") say("file #{product.md5_path} has been created") end |