mirror of
https://github.com/fluent/fluentd-ui.git
synced 2026-05-05 19:06:12 +02:00
Rename Fluentd::Agent::Fluentd{,Gem} for fix autoload problem
This commit is contained in:
parent
81acdd9067
commit
9aed8408fb
@ -11,7 +11,7 @@ class Fluentd
|
||||
before_validation :expand_paths
|
||||
|
||||
COLUMNS = [:id, :variant, :log_file, :pid_file, :config_file, :api_endpoint]
|
||||
JSON_PATH = Rails.root + "db/fluentd.json"
|
||||
JSON_PATH = Rails.root + "db/#{Rails.env}-fluentd.json"
|
||||
DEFAULT_CONF = <<-CONF.strip_heredoc
|
||||
<source>
|
||||
type forward
|
||||
@ -38,12 +38,13 @@ class Fluentd
|
||||
attr_accessor(*COLUMNS)
|
||||
|
||||
def self.variants
|
||||
%w(fluentd td-agent)
|
||||
%w(fluentd_gem td-agent)
|
||||
end
|
||||
|
||||
def fluentd?
|
||||
variant == "fluentd"
|
||||
variant == "fluentd_gem"
|
||||
end
|
||||
alias :fluentd_gem? :fluentd?
|
||||
|
||||
def td_agent?
|
||||
variant == "td-agent"
|
||||
|
||||
@ -3,7 +3,7 @@ require 'fluent/env'
|
||||
require 'fluent/version'
|
||||
require 'fluent/supervisor'
|
||||
require "fluentd/agent/common"
|
||||
require "fluentd/agent/fluentd"
|
||||
require "fluentd/agent/fluentd_gem"
|
||||
require "fluentd/agent/td_agent"
|
||||
require "fluentd/agent/remote"
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
class Fluentd
|
||||
class Agent
|
||||
class Fluentd
|
||||
class FluentdGem
|
||||
include Common
|
||||
|
||||
def self.default_options
|
||||
@ -4,7 +4,7 @@
|
||||
%div.row
|
||||
%div.col-lg-6
|
||||
%div.well
|
||||
%span= link_to icon("fa-cog") << t(".setup", target: "fluentd"), new_fluentd_path(variant: "fluentd"), class: "btn btn-primary btn-lg"
|
||||
%span= link_to icon("fa-cog") << t(".setup", target: "fluentd"), new_fluentd_path(variant: "fluentd_gem"), class: "btn btn-primary btn-lg"
|
||||
%div.col-lg-6
|
||||
%div.well
|
||||
%span
|
||||
|
||||
@ -33,10 +33,5 @@ module FluentdUi
|
||||
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
||||
config.i18n.default_locale = 'en'
|
||||
config.autoload_paths += %W(#{config.root}/app/workers #{config.root}/lib)
|
||||
config.after_initialize do
|
||||
# http://qiita.com/tanaka51/items/c8873319689217bb81a9
|
||||
require File.join(Rails.root, "app", "models", "fluentd")
|
||||
require File.join(Rails.root, "app", "models", "fluentd", "agent", "fluentd")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
FactoryGirl.define do
|
||||
factory :fluentd do
|
||||
variant "fluentd"
|
||||
variant "fluentd_gem"
|
||||
log_file (Rails.root + "tmp/fluentd-test/fluentd.log").to_s
|
||||
pid_file (Rails.root + "tmp/fluentd-test/fluentd.pid").to_s
|
||||
config_file (Rails.root + "tmp/fluentd-test/fluentd.conf").to_s
|
||||
|
||||
@ -74,8 +74,8 @@ describe Fluentd::Agent do
|
||||
let(:instance) { described_class.new(options) }
|
||||
let(:options) { {} }
|
||||
|
||||
describe "Fluentd" do
|
||||
let(:described_class) { Fluentd::Agent::Fluentd } # override nested described_class behavior as https://github.com/rspec/rspec-core/issues/1114
|
||||
describe "FluentdGem" do
|
||||
let(:described_class) { Fluentd::Agent::FluentdGem } # override nested described_class behavior as https://github.com/rspec/rspec-core/issues/1114
|
||||
|
||||
it_should_behave_like "Agent has common behavior"
|
||||
|
||||
|
||||
@ -71,7 +71,7 @@ describe Fluentd do
|
||||
before { fluentd.variant = variant }
|
||||
|
||||
context "fluentd" do
|
||||
let(:variant) { "fluentd" }
|
||||
let(:variant) { "fluentd_gem" }
|
||||
it { should be_valid }
|
||||
end
|
||||
|
||||
@ -97,9 +97,9 @@ describe Fluentd do
|
||||
describe "variant" do
|
||||
before { fluentd.variant = variant }
|
||||
|
||||
context "= fluentd" do
|
||||
let(:variant) { "fluentd" }
|
||||
it { fluentd.should be_fluentd }
|
||||
context "= fluentd_gem" do
|
||||
let(:variant) { "fluentd_gem" }
|
||||
it { fluentd.should be_fluentd_gem }
|
||||
it { fluentd.should_not be_td_agent }
|
||||
|
||||
describe "#load_settings_from_agent_default" do
|
||||
@ -113,7 +113,7 @@ describe Fluentd do
|
||||
|
||||
context "= td-agent" do
|
||||
let(:variant) { "td-agent" }
|
||||
it { fluentd.should_not be_fluentd }
|
||||
it { fluentd.should_not be_fluentd_gem }
|
||||
it { fluentd.should be_td_agent }
|
||||
|
||||
describe "#load_settings_from_agent_default" do
|
||||
@ -130,9 +130,9 @@ describe Fluentd do
|
||||
before { fluentd.variant = variant }
|
||||
subject { fluentd.agent }
|
||||
|
||||
context "fluentd" do
|
||||
let(:variant) { "fluentd" }
|
||||
it { should be_instance_of(Fluentd::Agent::Fluentd) }
|
||||
context "fluentd_gem" do
|
||||
let(:variant) { "fluentd_gem" }
|
||||
it { should be_instance_of(Fluentd::Agent::FluentdGem) }
|
||||
end
|
||||
|
||||
context "td-agent" do
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user