Class: VagrantPlugins::Solidus::Site::Create

Inherits:
Subcommand
  • Object
show all
Defined in:
lib/vagrant-solidus/site/create.rb

Constant Summary

Constants included from VagrantPlugins::Solidus::SiteHelpers

VagrantPlugins::Solidus::SiteHelpers::BASE_PORT, VagrantPlugins::Solidus::SiteHelpers::BASE_UTILS_PORT, VagrantPlugins::Solidus::SiteHelpers::DEFAULT_NODE_VERSION, VagrantPlugins::Solidus::SiteHelpers::DEFAULT_NPM_VERSION, VagrantPlugins::Solidus::SiteHelpers::PROVISION_ID, VagrantPlugins::Solidus::SiteHelpers::SITE_STATUS_WATCHER_POLLING_FREQUENCY, VagrantPlugins::Solidus::SiteHelpers::SITE_TEMPLATE_GIT_TAG, VagrantPlugins::Solidus::SiteHelpers::SITE_TEMPLATE_GIT_URL

Instance Method Summary collapse

Methods included from VagrantPlugins::Solidus::SiteHelpers

#build_site, #clone_site_template, #create_site_from_template, #directory_exists?, #fail, #find_port, #follow_site_log, #guest_exec, #help_command_line_option, #host_exec, #install_pow_site, #install_site_dependencies, #install_site_node, #install_site_node_packages, #install_site_service, #ip_address, #load_site, #log, #log_callback, #log_site_log_tail, #log_site_urls, #node_command, #node_version, #npm_version, #pow_installed?, #provisioned!, #provisioned?, #quiet_command_line_option, #save_site, #set_site_ports, #site_commands_arguments, #site_name_command_line_option, #site_responding?, #site_service_name, #site_start_command_line_options, #site_started?, #site_template_command_line_options, #site_watcher_service_name, #sites, #solidus_server_service_name, #start_site_service, #start_site_watcher, #stop_site, #stop_site_service, #uninstall_pow_site, #uninstall_site_service, #validate_site, #wait_for_site_watcher_to_stop, #wait_until_guest_directory_exists, #with_log, #with_mutex

Instance Method Details

#executeObject



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/vagrant-solidus/site/create.rb', line 22

def execute
  with_running_vm do
    unless @site_template_guest_path
      @env.ui.info("Cloning site template...")
      clone_site_template(@site_template_git_url)
    end

    @env.ui.info("Creating site from template...")
    create_site_from_template(@site_template_guest_path)

    @env.ui.success("#{@site_name} is created, ready to be started")
  end

  # Success, exit status 0
  0
end

#parse_argumentsObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/vagrant-solidus/site/create.rb', line 7

def parse_arguments
  extra_argv = parse_argv([1]) do |opts|
    opts.banner << " <site>"
    opts.separator "Create a new Solidus site, based on a Solidus site template."
    opts.separator "See https://github.com/solidusjs/solidus-site-template for more information."
    opts.separator ""
    site_template_command_line_options(opts)
  end

  @site_name = extra_argv[0]

  load_site
  fail("Directory already exists and is not empty: #{@site_host_path}") if directory_exists?(@site_host_path)
end