Sha256: 82542b91730cdd066bc9c765faa3212d3745ba76f3bb60cab9a699aba6f63f56

Contents?: true

Size: 928 Bytes

Versions: 5

Compression:

Stored size: 928 Bytes

Contents

require 'mattock'
require 'logical-construct/ground-control/run-on-target'

module LogicalConstruct
  module GroundControl
    class InstallInit < RunOnTarget
      required_fields :source_path, :target_path
      setting :construct_dir
      setting :service_name, "logical-construct"
      setting :initd_path, "/etc/init.d"

      def default_configuration(setup)
        super
        setup.copy_settings_to(self)
      end

      def resolve_configuration
        super
        self.source_path ||= File::join(construct_dir, "construct.init.d")
        self.target_path ||= File::join(initd_path, service_name)
      end

      def define
        remote_task(:install_init) do |task|
          task.command = cmd("install", "-T", source_path, target_path) &
            ["rc-update", "add", service_name, "default"]
        end
        bracket_task(:remote_config, :install_init, :remote_setup)
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
logical-construct-0.0.5 lib/logical-construct/ground-control/setup/install-init.rb
logical-construct-0.0.4 lib/logical-construct/ground-control/setup/install-init.rb
logical-construct-0.0.3 lib/logical-construct/ground-control/setup/install-init.rb
logical-construct-0.0.2 lib/logical-construct/ground-control/setup/install-init.rb
logical-construct-0.0.1 lib/logical-construct/ground-control/setup/install-init.rb