Sha256: 851f51a1877b1958fa3f24959d15e97e30002ede2df7f7d124c2af08cac97b24

Contents?: true

Size: 1.97 KB

Versions: 7

Compression:

Stored size: 1.97 KB

Contents

module CORL
module Builder
class Identity < Nucleon.plugin_class(:CORL, :builder)

  #-----------------------------------------------------------------------------
  # Identity plugin interface

  def normalize(reload)
    super do
      @identities = {}
    end
  end

  #-----------------------------------------------------------------------------
  # Property accessors / modifiers

  def build_directory
    File.join(network.directory, 'config', 'identities')
  end

  #---

  def identities
    @identities
  end

  def set_identity(name, directory)
    @identities[name] = directory
  end

  #-----------------------------------------------------------------------------
  # Identity interface operations

  def build_provider(name, project_reference, environment)
    provider_id = id(name)
    directory   = File.join(internal_path(build_directory), provider_id.to_s)
    success     = true

    info("Building identity #{blue(name)} at #{purple(project_reference)} into #{green(directory)}", { :i18n => false })

    full_directory = File.join(network.directory, directory)

    unless identities.has_key?(provider_id)
      project = build_config.manage(:project, extended_config(:identity, {
        :directory     => full_directory,
        :url           => project_reference,
        :create        => File.directory?(full_directory) ? false : true,
        :pull          => true,
        :internal_ip   => CORL.public_ip, # Needed for seeding Vagrant VMs
        :manage_ignore => false
      }))
      unless project
        warn("Identity #{cyan(name)} failed to initialize", { :i18n => false })
        success = false
      end

      if success
        # Make thid project private.
        FileUtils.chmod_R('go-wrx', full_directory)

        set_identity(provider_id, full_directory)
        build_config.set_location(plugin_provider, name, directory)
      end
    end
    #success("Build of identity #{blue(name)} finished", { :i18n => false }) if success
    success
  end
end
end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
corl-0.5.11 lib/CORL/builder/identity.rb
corl-0.5.10 lib/CORL/builder/identity.rb
corl-0.5.9 lib/CORL/builder/identity.rb
corl-0.5.8 lib/CORL/builder/identity.rb
corl-0.5.7 lib/CORL/builder/identity.rb
corl-0.5.6 lib/CORL/builder/identity.rb
corl-0.5.5 lib/CORL/builder/identity.rb