Class: Wukong::Deploy::Repo

Inherits:
Object
  • Object
show all
Defined in:
lib/wukong-deploy/repo.rb

Overview

A class to represent a deploy pack repository as a collection of files on disk.

Constant Summary collapse

TOP_LEVEL_DIR_NAMES =

The names of the top level directories in the deploy pack.

%w[app config data lib log script spec tmp]

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(root) ⇒ Repo

Initialize a new deploy pack repo at the given root.

Parameters:

  • root (String)


18
19
20
# File 'lib/wukong-deploy/repo.rb', line 18

def initialize root
  @root = Pathname.new(root)
end

Instance Attribute Details

#rootObject (readonly)

The root directory where this deploy pack repo is or will be located.



13
14
15
# File 'lib/wukong-deploy/repo.rb', line 13

def root
  @root
end

Instance Method Details

#dirs_to_createArray<String>

The directories to create within this repo.

Returns:

  • (Array<String>)


31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/wukong-deploy/repo.rb', line 31

def dirs_to_create
  [
   root,
   app_dir('models'),
   app_dir('processors'),
   app_dir('flows'),
   app_dir('jobs'),
   
   config_dir('environments'),
   config_dir('initializers'),
   
   data_dir,
   lib_dir,
   log_dir,
   script_dir,
   
   spec_dir('models'),
   spec_dir('processors'),
   spec_dir('flows'),
   spec_dir('jobs'),
   spec_dir('support'),
   
   tmp_dir
  ]
end

#files_to_templateArray<String>

The files to template within this repo, relative to the repo's

root.

Returns:

  • (Array<String>)


61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/wukong-deploy/repo.rb', line 61

def files_to_template
  %w[
   config/boot.rb
   config/application.rb
   config/environment.rb
   config/settings.yml
   config/environments/development.yml
   config/environments/test.yml
   config/environments/production.yml

   config/initializers/event_machine.rb

   Gemfile
   Rakefile
   README.md

   spec/spec_helper.rb
   ]
end