Class: Hem::Lib::Seed::Project

Inherits:
Object
  • Object
show all
Includes:
Helper
Defined in:
lib/hem/lib/seed/project.rb

Instance Method Summary collapse

Methods included from Helper

#bundle_shell, #chunk_line_iterator, #convert_args, #create_command, #create_mysql_command, #get_run_environment, #http_download, #locate, #parse_github_url, #run, #shell, #vm_command, #vm_mysql, #vm_shell

Constructor Details

#initialize(opts = {}) ⇒ Project

Returns a new instance of Project.



7
8
9
10
11
12
13
14
# File 'lib/hem/lib/seed/project.rb', line 7

def initialize(opts = {})
  @opts = {
    :replacer => Replacer.new,
    :config_class => Hem::Config::File,
    :template_excludes => [],
  }.merge! opts
  @replace_done = false
end

Instance Method Details

#configObject



48
49
50
# File 'lib/hem/lib/seed/project.rb', line 48

def config
  Hem.project_config
end

#option(key, value) ⇒ Object



52
53
54
# File 'lib/hem/lib/seed/project.rb', line 52

def option key, value
  @opts[key] = value
end

#setup(seed, config) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/hem/lib/seed/project.rb', line 16

def setup seed, config
  config = DeepStruct.wrap(config)
  project_path = config.project_path

  seed.update
  seed.export project_path, config

  Dir.chdir(project_path) do
    config.seed.version = seed.version
    config.hostname = "#{config.name}.dev"
    config.asset_bucket = "inviqa-assets-#{config.name}"
    config.vm = {
      :project_mount_path => "/vagrant"
    }
    config.tmp = {}

    Hem.project_path = project_path
    load_seed_init(config)

    @opts[:replacer].replace(project_path, config, @opts[:template_excludes])

    config.delete :project_path
    config.delete :tmp

    Hem.detect_project_type project_path
    @opts[:project_config_file] = Hem.project_config_file
    @opts[:config_class].save @opts[:project_config_file], config
  end

  initialize_git project_path, config[:git_url]
end