class Neo4j::RakeTasks::WindowsServerManager

Represents and manages a server on Windows

Public Instance Methods

install() click to toggle source
Calls superclass method Neo4j::RakeTasks::ServerManager#install
# File lib/neo4j/rake_tasks/windows_server_manager.rb, line 15
def install
  super

  return unless nt_admin?

  system_or_fail(neo4j_command_path(:install))
  puts 'Neo4j Installed as a service.'
end
neo4j_binary_filename() click to toggle source
# File lib/neo4j/rake_tasks/windows_server_manager.rb, line 7
def neo4j_binary_filename
  'Neo4j.bat'
end
neo4j_shell_binary_filename() click to toggle source
# File lib/neo4j/rake_tasks/windows_server_manager.rb, line 11
def neo4j_shell_binary_filename
  'Neo4jShell.bat'
end
validate_is_system_admin!() click to toggle source
# File lib/neo4j/rake_tasks/windows_server_manager.rb, line 24
def validate_is_system_admin!
  return if nt_admin?

  fail 'You do not have administrative rights to stop the Neo4j Service'
end

Protected Instance Methods

download_url(version) click to toggle source
# File lib/neo4j/rake_tasks/windows_server_manager.rb, line 32
def download_url(version)
  "http://dist.neo4j.org/neo4j-#{version}-windows.zip"
end
extract!(zip_path) click to toggle source
# File lib/neo4j/rake_tasks/windows_server_manager.rb, line 36
def extract!(zip_path)
  each_file_in_zip(zip_path) do |file|
    f_path = @path.join(file.name)
    FileUtils.mkdir_p(File.dirname(f_path))
    begin
      file.extract(f_path) unless File.exist?(f_path)
    rescue
      puts "#{file.name} failed to extract."
    end
  end
end
start_argument(wait) click to toggle source
# File lib/neo4j/rake_tasks/windows_server_manager.rb, line 48
def start_argument(wait)
  nt_admin? ? super : ''
end

Private Instance Methods

each_file_in_zip(zip_path) { |file| ... } click to toggle source
# File lib/neo4j/rake_tasks/windows_server_manager.rb, line 54
def each_file_in_zip(zip_path)
  Zip::File.open(zip_path) do |zip_file|
    zip_file.each do |file|
      yield file
    end
  end
end
nt_admin?() click to toggle source
# File lib/neo4j/rake_tasks/windows_server_manager.rb, line 62
def nt_admin?
  system_or_fail('reg query "HKU\\S-1-5-19"').size > 0
end