Class: Potemkin::Builder
- Inherits:
-
Object
- Object
- Potemkin::Builder
- Defined in:
- lib/potemkin/builder.rb
Direct Known Subclasses
Instance Method Summary collapse
-
#build ⇒ Object
Will build the actual APK.
- #clean ⇒ Object
-
#config ⇒ Object
Returns the config, mainly here to mock in tests.
-
#env_vars ⇒ Object
No environment variables by default.
-
#logger ⇒ Object
Returns the logger, mainly here to mock in tests.
-
#with_env_vars(env_vars) ⇒ Object
Takes a hash and a block, wrapping the block with the env variables found in the hash.
Instance Method Details
#build ⇒ Object
Will build the actual APK
10 11 12 13 |
# File 'lib/potemkin/builder.rb', line 10 def build logger.describe "creating build" with_env_vars(env_vars) { Potemkin.run build_command } end |
#clean ⇒ Object
15 16 17 18 |
# File 'lib/potemkin/builder.rb', line 15 def clean logger.describe "cleaning build" with_env_vars(env_vars) { Potemkin.run clean_command } end |
#config ⇒ Object
Returns the config, mainly here to mock in tests
39 40 41 |
# File 'lib/potemkin/builder.rb', line 39 def config Potemkin.config end |
#env_vars ⇒ Object
No environment variables by default
5 6 7 |
# File 'lib/potemkin/builder.rb', line 5 def env_vars {} end |
#logger ⇒ Object
Returns the logger, mainly here to mock in tests
44 45 46 |
# File 'lib/potemkin/builder.rb', line 44 def logger Potemkin.logger end |
#with_env_vars(env_vars) ⇒ Object
Takes a hash and a block, wrapping the block with the env variables found in the hash.
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/potemkin/builder.rb', line 22 def with_env_vars(env_vars) old_values = {} env_vars.each do |key,new_value| old_values[key] = ENV[key] ENV[key] = new_value end return_value = yield env_vars.each_key do |key| ENV[key] = old_values[key] end return_value end |