Module: FluentdUI

Defined in:
lib/fluentd-ui.rb,
lib/fluentd-ui/command.rb,
lib/fluentd-ui/version.rb

Defined Under Namespace

Classes: Command

Constant Summary collapse

VERSION =
"0.4.2"

Class Method Summary collapse

Class Method Details

.data_dirObject



23
24
25
26
27
28
29
30
31
# File 'lib/fluentd-ui.rb', line 23

def self.data_dir
  if Rails.env.test?
    dir = Rails.root.join("tmp", "core_data").to_s
  else
    dir = ENV["FLUENTD_UI_DATA_DIR"].presence || ENV["HOME"] + "/.fluentd-ui/core_data"
  end
  FileUtils.mkdir_p(dir) # ensure directory exists
  dir
end

.fluentd_versionObject



17
18
19
20
21
# File 'lib/fluentd-ui.rb', line 17

def self.fluentd_version
  setup_fluentd = Fluentd.instance
  return nil unless setup_fluentd
  setup_fluentd.agent.version
end

.latest_versionObject



6
7
8
# File 'lib/fluentd-ui.rb', line 6

def self.latest_version
  @latest
end

.latest_version=(version) ⇒ Object



2
3
4
# File 'lib/fluentd-ui.rb', line 2

def self.latest_version=(version)
  @latest = version
end

.platformObject



37
38
39
40
41
42
43
44
# File 'lib/fluentd-ui.rb', line 37

def self.platform
  case RbConfig::CONFIG['host_os']
  when /darwin|mac os/
    :macosx
  else # FIXME: windows is unix? :P
    :unix
  end
end

.td_agent_ui?Boolean

Returns:

  • (Boolean)


33
34
35
# File 'lib/fluentd-ui.rb', line 33

def self.td_agent_ui?
  ENV["FLUENTD_UI_TD_AGENT"].present?
end

.update_available?Boolean

Returns:

  • (Boolean)


10
11
12
13
14
15
# File 'lib/fluentd-ui.rb', line 10

def self.update_available?
  return unless @latest
  latest = Gem::Version.new(@latest)
  current = Gem::Version.new(::FluentdUI::VERSION)
  latest > current
end