Class: Sumodev::Commands::Project

Inherits:
Sumodev::Command show all
Defined in:
lib/sumodev/commands/project.rb

Instance Method Summary collapse

Methods inherited from Sumodev::Command

banner

Instance Method Details

#get(repo, stage = "staging") ⇒ Object



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
47
48
49
# File 'lib/sumodev/commands/project.rb', line 18

def get(repo, stage="staging")
  begin
    tmp_path = File.expand_path(Sumodev::Config.get('SUMO_TEMP_PATH'));
    capfile_path = "#{tmp_path}/temp_project/Capfile"
    sites_path = File.expand_path(Sumodev::Config.get('SUMO_SITES_PATH'))

    clone_repo(repo, "#{tmp_path}/temp_project")

    if options[:project_path].nil?
      client, project = process_capfile(capfile_path)
      project_path = File.expand_path("#{sites_path}/#{client}/#{project}")
    else
      project_path = File.expand_path(options[:project_path])
    end

    move_project("#{tmp_path}/temp_project", project_path)

    if !options[:only_clone]
      install_bundles(project_path) if options[:bundles]
      install_node_modules(project_path) if options[:node_modules]
      install_bower_packages(project_path) if options[:bower]
      install_composer_packages(project_path, options[:composer_run_scripts]) if options[:composer]
      fetch_data(project_path, stage) if options[:fetch_data]
      mark_as_installed(project_path) if options[:mark_as_installed]
    end

    change_location(project_path)
    say "All done", :green
  rescue Exception => e
    say e.message, :red
  end
end