Class: Docman::Application

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/application.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeApplication

Returns a new instance of Application.



19
20
21
22
23
# File 'lib/application.rb', line 19

def initialize
  # TODO: Define workspace properly
  @workspace_dir = Dir.pwd
  @config = YAML::load_file(File.join(Pathname(__FILE__).dirname.parent, 'config', 'config.yaml'))
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



14
15
16
# File 'lib/application.rb', line 14

def config
  @config
end

#deploy_targetObject

Returns the value of attribute deploy_target.



15
16
17
# File 'lib/application.rb', line 15

def deploy_target
  @deploy_target
end

#optionsObject (readonly)

Returns the value of attribute options.



14
15
16
# File 'lib/application.rb', line 14

def options
  @options
end

Class Method Details

.binObject



46
47
48
# File 'lib/application.rb', line 46

def self.bin
  File.join root, 'bin'
end

.libObject



50
51
52
# File 'lib/application.rb', line 50

def self.lib
  File.join root, 'lib'
end

.rootObject



42
43
44
# File 'lib/application.rb', line 42

def self.root
  Pathname(__FILE__).dirname.parent
end

Instance Method Details

#build(deploy_target, state, options = false) ⇒ Object



29
30
31
32
# File 'lib/application.rb', line 29

def build(deploy_target, state, options = false)
  @options = options
  DocrootController.new(@workspace_dir, deploy_target, options).build(state)
end

#deploy(deploy_target, name, type, version) ⇒ Object



34
35
36
# File 'lib/application.rb', line 34

def deploy(deploy_target, name, type, version)
  DocrootController.new(@workspace_dir, deploy_target).deploy(name, type, version)
end

#init(name, repo) ⇒ Object



25
26
27
# File 'lib/application.rb', line 25

def init(name, repo)
  `mkdir #{name} && cd #{name} && git clone #{repo} config`
end

#state(name, type, version) ⇒ Object



38
39
40
# File 'lib/application.rb', line 38

def state(name, type, version)
  DocrootController.new(@workspace_dir, deploy_target).state(name, type, version)
end