Class: AppBuilder::Config
- Inherits:
-
Object
- Object
- AppBuilder::Config
- Defined in:
- lib/app_builder/config.rb
Constant Summary collapse
- VALID_OPTIONS =
[ :build_id, :project_name, :remote_repository, :branch, :revision, :working_path, :repo_path, :archive_path, :build_path, :revision_path, :logger, ].freeze
Instance Method Summary collapse
-
#initialize ⇒ Config
constructor
A new instance of Config.
- #merge(params) ⇒ Object
- #reset ⇒ Object
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
19 20 21 |
# File 'lib/app_builder/config.rb', line 19 def initialize reset end |
Instance Method Details
#merge(params) ⇒ Object
23 24 25 26 27 28 |
# File 'lib/app_builder/config.rb', line 23 def merge(params) params.each do |key, value| self.send("#{key}=", value) end self end |
#reset ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/app_builder/config.rb', line 30 def reset self.build_id = Time.now.strftime("%Y%m%d%H%M%S") self.project_name = File.basename(`git rev-parse --show-toplevel`.chomp) self.remote_repository = `git remote get-url origin`.chomp self.branch = ENV.fetch("TARGET_BRANCH", "master") self.revision = `git rev-parse #{branch}`.chomp self.working_path = File.join("/var/tmp", project_name) self.repo_path = File.join(working_path, "repo") self.archive_path = File.join(working_path, "archive", build_id) self.build_path = File.join(working_path, "build", build_id) self.revision_path = File.join(archive_path, "revision.yml") self.logger = Logger.new(STDOUT) end |