Sha256: 2f4384155412cb75627b43437f7f7a1b6c2d3b20853fe42ebe04917f44b17e98

Contents?: true

Size: 1.03 KB

Versions: 19

Compression:

Stored size: 1.03 KB

Contents

module Writefully
  module Workers
    class Handyman < BaseWorker
      include Helpers::Handyman::Builder

      attr_reader :site

      def build
        @site      = Site.where(id: message[:site_id]).first
        @hammer    = Tools::Hammer.new_link(message.merge({ domain: site.domain }))
        # create the repository
        repo = @hammer.future.forge

        # add sample content
        @initializer = Tools::Initializer.new_link(message.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

      def synchronize
        @synchronizer = Tools::Synchronizer.new_link(message)
        synced = @synchronizer.future.sync
        Writefully.logger.info "Synchronized #{message[:site_slug]}" if synced.value
      ensure
        @synchronizer.terminate
      end

    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
writefully-0.8.2 lib/writefully/workers/handyman.rb
writefully-0.8.1 lib/writefully/workers/handyman.rb
writefully-0.8.0 lib/writefully/workers/handyman.rb
writefully-0.7.1 lib/writefully/workers/handyman.rb
writefully-0.6.12 lib/writefully/workers/handyman.rb
writefully-0.6.11 lib/writefully/workers/handyman.rb
writefully-0.6.10 lib/writefully/workers/handyman.rb
writefully-0.6.9 lib/writefully/workers/handyman.rb
writefully-0.6.7 lib/writefully/workers/handyman.rb
writefully-0.6.6 lib/writefully/workers/handyman.rb
writefully-0.6.5 lib/writefully/workers/handyman.rb
writefully-0.6.4 lib/writefully/workers/handyman.rb
writefully-0.6.3 lib/writefully/workers/handyman.rb
writefully-0.6.2 lib/writefully/workers/handyman.rb
writefully-0.5.1 lib/writefully/workers/handyman.rb
writefully-0.5.0 lib/writefully/workers/handyman.rb
writefully-0.4.10 lib/writefully/workers/handyman.rb
writefully-0.4.8 lib/writefully/workers/handyman.rb
writefully-0.4.7 lib/writefully/workers/handyman.rb