Module: Moku

Defined in:
lib/moku.rb,
lib/moku/cli.rb,
lib/moku/push.rb,
lib/moku/sites.rb,
lib/moku/config.rb,
lib/moku/policy.rb,
lib/moku/status.rb,
lib/moku/upload.rb,
lib/moku/command.rb,
lib/moku/invoker.rb,
lib/moku/release.rb,
lib/moku/scm/git.rb,
lib/moku/version.rb,
lib/moku/artifact.rb,
lib/moku/instance.rb,
lib/moku/pipeline.rb,
lib/moku/scm/file.rb,
lib/moku/sequence.rb,
lib/moku/plan/plan.rb,
lib/moku/task/task.rb,
lib/moku/task_file.rb,
lib/moku/bundleable.rb,
lib/moku/task/shell.rb,
lib/moku/shell/basic.rb,
lib/moku/sites/scope.rb,
lib/moku/task/bundle.rb,
lib/moku/task/enable.rb,
lib/moku/task/upload.rb,
lib/moku/auth_service.rb,
lib/moku/command/exec.rb,
lib/moku/command/init.rb,
lib/moku/plan/restart.rb,
lib/moku/task/restart.rb,
lib/moku/artifact_repo.rb,
lib/moku/cached_bundle.rb,
lib/moku/deploy_config.rb,
lib/moku/pipeline/exec.rb,
lib/moku/pipeline/init.rb,
lib/moku/command/caches.rb,
lib/moku/command/deploy.rb,
lib/moku/logged_release.rb,
lib/moku/reference_repo.rb,
lib/moku/command/command.rb,
lib/moku/logged_releases.rb,
lib/moku/pipeline/caches.rb,
lib/moku/pipeline/deploy.rb,
lib/moku/command/releases.rb,
lib/moku/command/rollback.rb,
lib/moku/plan/basic_build.rb,
lib/moku/task/set_current.rb,
lib/moku/archive_reference.rb,
lib/moku/pipeline/pipeline.rb,
lib/moku/pipeline/releases.rb,
lib/moku/pipeline/rollback.rb,
lib/moku/plan/basic_deploy.rb,
lib/moku/release_signature.rb,
lib/moku/shell/passthrough.rb,
lib/moku/task/remote_shell.rb,
lib/moku/task/validate_pin.rb,
lib/moku/validator/gemfile.rb,
lib/moku/file_instance_repo.rb,
lib/moku/task/overlay_sites.rb,
lib/moku/instance_busy_error.rb,
lib/moku/shell/secure_remote.rb,
lib/moku/validator/validator.rb,
lib/core_extensions/hash/keys.rb,
lib/moku/file_permissions_repo.rb,
lib/moku/scm/working_directory.rb,
lib/moku/task/create_structure.rb,
lib/moku/scm/git/local_resolver.rb,
lib/moku/task/build_permissions.rb,
lib/moku/validator/ruby_version.rb,
lib/moku/scm/git/remote_resolver.rb,
lib/moku/task/download_references.rb,
lib/moku/command/set_default_branch.rb,
lib/moku/command/read_default_branch.rb,
lib/moku/pipeline/set_default_branch.rb,
lib/moku/pipeline/read_default_branch.rb,
lib/core_extensions/hash/deep_transform.rb

Overview

This copyright notice applies to this file only. The original source was taken from: github.com/basecamp/deep_hash_transform

Copyright © 2005-2014 David Heinemeier Hansson

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Defined Under Namespace

Modules: Bundleable, Command, Config, DeepTransform, Keys, Pipeline, Plan, SCM, Shell, Task, Validator Classes: ArchiveReference, Artifact, ArtifactRepo, AuthService, CLI, CachedBundle, DeployConfig, FileInstanceRepo, FilePermissionsRepo, Instance, InstanceBusyError, Invoker, LoggedRelease, LoggedReleases, Policy, Push, ReferenceRepo, Release, ReleaseSignature, Sequence, Sites, Status, TaskFile, Upload

Constant Summary collapse

VERSION =
"2.1.0"

Class Method Summary collapse

Class Method Details

.initialize!Object

rubocop:disable Metrics/AbcSize rubocop:disable Metrics/BlockLength rubocop:disable Metrics/MethodLength


39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# File 'lib/moku.rb', line 39

def initialize!
  settings # eager load
  config.tap do |container| # rubocoop:
    if settings.verbose
      container.register(:logger) { Logger.new(STDOUT, level: :debug) }
      container.register(:system_runner) { Moku::Shell::Passthrough.new(STDOUT) }
    else
      container.register(:logger) { Logger.new(STDOUT, level: :info) }
      container.register(:system_runner) { Moku::Shell::Basic.new }
    end
    container.register(:remote_runner) {|c| Moku::Shell::SecureRemote.new(c.system_runner) }
    container.register(:backend_runner) {|c| Moku::CapRunner.new(c.system_runner) }
    container.register(:upload_factory) { Moku::Upload }
    container.register(:git_runner) {|c| Moku::SCM::Git.new(system_runner: c.system_runner) }
    container.register(:artifact_repo) {|c| Moku::ArtifactRepo.new(c.build_root) }
    container.register(:ref_repo) do |c|
      Moku::ReferenceRepo.new(
        c.ref_root,
        c.git_runner
      )
    end
    container.register(:instance_repo) do |c|
      Moku::FileInstanceRepo.new(
        instances_path: c.instance_root,
        releases_path: c.releases_root,
        branches_path: c.branches_root,
        git_runner: c.git_runner
      )
    end
    container.register(:permissions_repo) do |c|
      Moku::FilePermissionsRepo.new(c.instance_root)
    end
    container.register(:auth) do |c|
      data = c.permissions_repo.find
      Moku::AuthService.new(
        global: data.fetch(:all, {}),
        instances: data.fetch(:instances, {}),
        policy_factory: Moku::Policy
      )
    end

    container.register(:bundle_cache_path) do
      Pathname.new(settings.bundle_cache_path).expand_path(Moku.root)
    end
    container.register(:cached_bundle) do |c|
      Moku::CachedBundle.new(c.bundle_cache_path)
    end

    container.register(:invoker) { Moku::Invoker.new }
    [
      :instance_root,
      :releases_root,
      :deployer_env_root,
      :ref_root,
      :branches_root,
      :build_root,
      :default_root,
      :tmp_root,
      :locks_root
    ].each do |root|
      container.register(root) do
        Pathname.new(settings.public_send(root)).expand_path(Moku.root)
      end
    end
  end
end