Module: Buildable

Includes:
Configureasy
Defined in:
lib/buildable.rb

Defined Under Namespace

Modules: FileMaker, RakeTask, Recipe, Shell

Constant Summary collapse

BUILD_DIR =
'./.build'
BUILD_ROOT_DIR =
'./.build/root'
PACKAGE_DIR =
'./pkg'

Class Method Summary collapse

Class Method Details

.buildObject



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

def build
  STDOUT.sync = true
  check_configs
  Recipe[:create_path]
  Recipe[:copy_source]
  Recipe[:vendor_gems]
  Recipe[:make_init_script] unless ARGV.include?('--no-init')
  Recipe[:make_package]
  Recipe[:remove_path]
end

.build_app_dirObject



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

def build_app_dir
  File.join(BUILD_ROOT_DIR, Buildable.config.root_dir)
end

.check_configsObject



46
47
48
49
50
# File 'lib/buildable.rb', line 46

def check_configs
  return if File.exist?('.buildable.yml') && File.exist?('production.env') && File.exist?('Procfile')
  puts "Missing config please run buildable init to create it."
  exit 1
end

.dependenciesObject

Return array with all dependencies specified in .buildable.yml



67
68
69
# File 'lib/buildable.rb', line 67

def dependencies
  self.config.depends || []
end

.files_to_packObject



52
53
54
55
# File 'lib/buildable.rb', line 52

def files_to_pack
  files_to_ignore = self.config.files_to_ignore + %w{. .. .build .buildable.yml vendor}
  Dir.entries('.') - files_to_ignore
end

.foreman_templatesObject



57
58
59
# File 'lib/buildable.rb', line 57

def foreman_templates
  File.expand_path('../../templates/foreman', __FILE__)
end

.initObject



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

def init
  Recipe[:init]
end

.initd_folderObject



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

def initd_folder
  File.join(BUILD_ROOT_DIR, 'etc/init.d')
end

.package_nameObject

Make package name using Organization name (when available) with project name



62
63
64
# File 'lib/buildable.rb', line 62

def package_name
  [self.config.organization, self.config.project_name].compact.collect(&:underscore).join('-')
end

.upstart_folderObject



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

def upstart_folder
  File.join(BUILD_ROOT_DIR, 'etc/init')
end