Module: DNApi

Defined in:
lib/dnapi/test/sweatshop.rb,
lib/dnapi.rb,
lib/dnapi/app.rb,
lib/dnapi/cron.rb,
lib/dnapi/stack.rb,
lib/dnapi/vhost.rb,
lib/dnapi/recipe.rb,
lib/dnapi/struct.rb,
lib/dnapi/gem_dep.rb,
lib/dnapi/version.rb,
lib/dnapi/db_stack.rb,
lib/dnapi/instance.rb,
lib/dnapi/ssl_cert.rb,
lib/dnapi/test/ext.rb,
lib/dnapi/component.rb,
lib/dnapi/ebuild_dep.rb,
lib/dnapi/monitoring.rb,
lib/dnapi/environment.rb,
lib/dnapi/components/v8.rb,
lib/dnapi/components/php.rb,
lib/dnapi/components/exim.rb,
lib/dnapi/components/ruby.rb,
lib/dnapi/components/ssmtp.rb,
lib/dnapi/components/addons.rb,
lib/dnapi/components/apache.rb,
lib/dnapi/components/nagios.rb,
lib/dnapi/components/nodejs.rb,
lib/dnapi/components/volume.rb,
lib/dnapi/components/monitor.rb,
lib/dnapi/component_possessor.rb,
lib/dnapi/components/metadata.rb,
lib/dnapi/components/newrelic.rb,
lib/dnapi/components/rubygems.rb,
lib/dnapi/components/cloudkick.rb,
lib/dnapi/components/stunneled.rb,
lib/dnapi/components/passenger3.rb,
lib/dnapi/components/app_metadata.rb,
lib/dnapi/components/encrypted_backup.rb,
lib/dnapi/components/versioned_component.rb,
lib/dnapi/components/environment_metadata.rb,
lib/dnapi/test.rb

Overview

Vendoring dm-sweatshop This code hasn’t changed in over 2 years, and using dm-sweatshop means adding dm-sweatshop as a runtime dependency

Defined Under Namespace

Modules: Component, ComponentPossessor, Components, Test Classes: App, Cron, DbStack, EbuildDep, Environment, GemDep, Instance, InstanceNotFound, Monitoring, Recipe, SSLCert, Stack, Struct, Sweatshop, VHost

Constant Summary collapse

VERSION =
'1.1.98'

Class Method Summary collapse

Class Method Details

.build(attributes = {}) ⇒ Object



7
8
9
# File 'lib/dnapi.rb', line 7

def self.build(attributes = {})
  Environment.new(attributes)
end

.component(name, &block) ⇒ Object



23
24
25
26
27
28
29
30
# File 'lib/dnapi.rb', line 23

def self.component(name, &block)
  klass = Class.new(Component, &block)
  klass.name = name

  self.components << klass

  klass
end

.componentsObject



19
20
21
# File 'lib/dnapi.rb', line 19

def self.components
  @components ||= []
end

.from(json) ⇒ Object



11
12
13
14
15
16
17
# File 'lib/dnapi.rb', line 11

def self.from(json)
  jexp = (String === json) ? JSON.parse(json) : json

  engineyard = jexp["engineyard"]
  environment = Environment.from(engineyard["environment"])
  environment.instance_for(engineyard["this"])
end

.gen(cluster, stack_name, app_types, attributes = {}, &block) ⇒ Object



18
19
20
21
22
23
24
# File 'lib/dnapi/test.rb', line 18

def self.gen(cluster, stack_name, app_types, attributes = {}, &block)
  stack = DNApi::Stack.get(stack_name) || abort("Could not find the stack called #{stack_name.inspect}")
  apps = app_types.map do |app_type|
    DNApi::App.gen(app_type.to_sym)
  end
  Environment.gen(cluster.to_sym, attributes.merge(:stack => stack, :apps => apps), &block)
end