Class: Writefully::Workers::Handyman
- Inherits:
-
BaseWorker
- Object
- BaseWorker
- Writefully::Workers::Handyman
- Defined in:
- lib/writefully/workers/handyman.rb
Instance Attribute Summary collapse
-
#site ⇒ Object
readonly
Returns the value of attribute site.
Attributes inherited from BaseWorker
Instance Method Summary collapse
Methods included from Writefully::Workers::Helpers::Handyman::Builder
#complete_site_setup, #initialize_sample_content
Methods inherited from BaseWorker
#actor_died, #close_db_connection!, #perform
Instance Attribute Details
#site ⇒ Object (readonly)
Returns the value of attribute site.
6 7 8 |
# File 'lib/writefully/workers/handyman.rb', line 6 def site @site end |
Instance Method Details
#build ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/writefully/workers/handyman.rb', line 8 def build @site = Site.where(id: [:site_id]).first @hammer = Tools::Hammer.new_link(.merge({ domain: site.domain })) # create the repository repo = @hammer.future.forge # add sample content @initializer = Tools::Initializer.new_link(.merge({ ssh_url: repo.value.ssh_url })) initialize_sample_content # add web hook hook = @hammer.future.add_hook_for(repo.value.name) complete_site_setup(repo.value, hook.value) ensure @hammer.terminate @initializer.terminate close_db_connection! end |
#synchronize ⇒ Object
27 28 29 30 31 32 33 |
# File 'lib/writefully/workers/handyman.rb', line 27 def synchronize @synchronizer = Tools::Synchronizer.new_link() synced = @synchronizer.future.sync Writefully.logger.info "Synchronized #{[:site_slug]}" if synced.value ensure @synchronizer.terminate end |