Class: VagrantPlugins::Solidus::Site::Watch

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

Constant Summary collapse

IGNORED_SITE_DIRECTORIES =
[/\.sass-cache/, /deploy/, /node_modules/]

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



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/vagrant-solidus/site/watch.rb', line 19

def execute
  with_running_vm do
    @env.ui.info("Watching #{@site_name} (press Ctrl+C to quit)...") unless @quiet

    @listener = Listen.to(@site_host_path, ignore: IGNORED_SITE_DIRECTORIES, &method(:send_file_events_to_vm))
    @listener.start

    Vagrant::Util::Busy.busy(-> {@listener.stop}) do
      wait_until_listener_or_site_is_stopped
    end
  end

  # Success, exit status 0
  0
end

#parse_argumentsObject



10
11
12
13
14
15
16
17
# File 'lib/vagrant-solidus/site/watch.rb', line 10

def parse_arguments
  parse_argv do |opts|
    opts.separator "Watch the site's files (the default VirtualBox watcher is not reliable)."
    opts.separator ""
    site_name_command_line_option(opts)
    quiet_command_line_option(opts)
  end
end