mirror of
https://github.com/elastic/logstash.git
synced 2025-04-24 14:47:19 -04:00
parent
a1e806d2c5
commit
f18992c647
5 changed files with 15 additions and 11 deletions
|
@ -42,7 +42,7 @@ module LogStash
|
||||||
!File.exists?(File.join(LogStash::Environment::LOGSTASH_HOME, "x-pack"))
|
!File.exists?(File.join(LogStash::Environment::LOGSTASH_HOME, "x-pack"))
|
||||||
end
|
end
|
||||||
|
|
||||||
def windows?
|
def win_platform?
|
||||||
::Gem.win_platform?
|
::Gem.win_platform?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
require_relative "pack_command"
|
require_relative "pack_command"
|
||||||
|
|
||||||
class LogStash::PluginManager::Pack < LogStash::PluginManager::PackCommand
|
class LogStash::PluginManager::Pack < LogStash::PluginManager::PackCommand
|
||||||
option "--tgz", :flag, "compress package as a tar.gz file", :default => !LogStash::Environment.windows?
|
option "--tgz", :flag, "compress package as a tar.gz file", :default => !LogStash::Environment.win_platform?
|
||||||
option "--zip", :flag, "compress package as a zip file", :default => LogStash::Environment.windows?
|
option "--zip", :flag, "compress package as a zip file", :default => LogStash::Environment.win_platform?
|
||||||
option "--[no-]clean", :flag, "clean up the generated dump of plugins", :default => true
|
option "--[no-]clean", :flag, "clean up the generated dump of plugins", :default => true
|
||||||
option "--overwrite", :flag, "Overwrite a previously generated package file", :default => false
|
option "--overwrite", :flag, "Overwrite a previously generated package file", :default => false
|
||||||
|
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
require_relative "pack_command"
|
require_relative "pack_command"
|
||||||
|
|
||||||
class LogStash::PluginManager::Unpack < LogStash::PluginManager::PackCommand
|
class LogStash::PluginManager::Unpack < LogStash::PluginManager::PackCommand
|
||||||
option "--tgz", :flag, "unpack a packaged tar.gz file", :default => !LogStash::Environment.windows?
|
option "--tgz", :flag, "unpack a packaged tar.gz file", :default => !LogStash::Environment.win_platform?
|
||||||
option "--zip", :flag, "unpack a packaged zip file", :default => LogStash::Environment.windows?
|
option "--zip", :flag, "unpack a packaged zip file", :default => LogStash::Environment.win_platform?
|
||||||
|
|
||||||
parameter "file", "the package file name", :attribute_name => :package_file, :required => true
|
parameter "file", "the package file name", :attribute_name => :package_file, :required => true
|
||||||
|
|
||||||
|
|
|
@ -164,11 +164,15 @@ module LogStash
|
||||||
end
|
end
|
||||||
|
|
||||||
def windows?
|
def windows?
|
||||||
RbConfig::CONFIG['host_os'] =~ WINDOW_OS_RE
|
host_os =~ WINDOW_OS_RE
|
||||||
end
|
end
|
||||||
|
|
||||||
def linux?
|
def linux?
|
||||||
RbConfig::CONFIG['host_os'] =~ LINUX_OS_RE
|
host_os =~ LINUX_OS_RE
|
||||||
|
end
|
||||||
|
|
||||||
|
def host_os
|
||||||
|
RbConfig::CONFIG['host_os']
|
||||||
end
|
end
|
||||||
|
|
||||||
def locales_path(path)
|
def locales_path(path)
|
||||||
|
|
|
@ -57,14 +57,14 @@ describe LogStash::Environment do
|
||||||
context "windows" do
|
context "windows" do
|
||||||
windows_host_os.each do |host|
|
windows_host_os.each do |host|
|
||||||
it "#{host} returns true" do
|
it "#{host} returns true" do
|
||||||
expect(RbConfig::CONFIG).to receive(:[]).with("host_os").and_return(host)
|
allow(LogStash::Environment).to receive(:host_os).and_return(host)
|
||||||
expect(LogStash::Environment.windows?).to be_truthy
|
expect(LogStash::Environment.windows?).to be_truthy
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
linux_host_os.each do |host|
|
linux_host_os.each do |host|
|
||||||
it "#{host} returns false" do
|
it "#{host} returns false" do
|
||||||
expect(RbConfig::CONFIG).to receive(:[]).with("host_os").and_return(host)
|
allow(LogStash::Environment).to receive(:host_os).and_return(host)
|
||||||
expect(LogStash::Environment.windows?).to be_falsey
|
expect(LogStash::Environment.windows?).to be_falsey
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -73,14 +73,14 @@ describe LogStash::Environment do
|
||||||
context "Linux" do
|
context "Linux" do
|
||||||
windows_host_os.each do |host|
|
windows_host_os.each do |host|
|
||||||
it "#{host} returns true" do
|
it "#{host} returns true" do
|
||||||
expect(RbConfig::CONFIG).to receive(:[]).with("host_os").and_return(host)
|
allow(LogStash::Environment).to receive(:host_os).and_return(host)
|
||||||
expect(LogStash::Environment.linux?).to be_falsey
|
expect(LogStash::Environment.linux?).to be_falsey
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
linux_host_os.each do |host|
|
linux_host_os.each do |host|
|
||||||
it "#{host} returns false" do
|
it "#{host} returns false" do
|
||||||
expect(RbConfig::CONFIG).to receive(:[]).with("host_os").and_return(host)
|
allow(LogStash::Environment).to receive(:host_os).and_return(host)
|
||||||
expect(LogStash::Environment.linux?).to be_truthy
|
expect(LogStash::Environment.linux?).to be_truthy
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue