Remove unused methods

This commit is contained in:
uu59 2014-07-03 15:16:38 +09:00
parent de5baff221
commit 61bef0fe3c
2 changed files with 0 additions and 21 deletions

View File

@ -100,11 +100,6 @@ class Plugin
"https://rubygems.org/gems/#{gem_name}" "https://rubygems.org/gems/#{gem_name}"
end end
def self.gemfile_changed?
# if true, rails server needs to restart. new installed/removed gems are.
@initial_gemfile_content != File.read(gemfile_path)
end
def self.installed def self.installed
return [] unless File.exist?(gemfile_path) return [] unless File.exist?(gemfile_path)
File.read(gemfile_path).scan(/"(.*?)", "(.*?)"/).map do |plugin| File.read(gemfile_path).scan(/"(.*?)", "(.*?)"/).map do |plugin|
@ -136,16 +131,6 @@ class Plugin
Rails.root + "Gemfile.plugins" Rails.root + "Gemfile.plugins"
end end
def self.pristine!
unless File.exists?(gemfile_path)
File.open(gemfile_path, "w") do |f|
f.write "# USED BY fluentd-ui internally\n"
end
end
@initial_gemfile_content = File.read(gemfile_path)
end
pristine!
def gemfile_path def gemfile_path
self.class.gemfile_path self.class.gemfile_path
end end

View File

@ -9,7 +9,6 @@ describe Plugin do
after do after do
File.unlink Plugin.gemfile_path if File.exist?(Plugin.gemfile_path) File.unlink Plugin.gemfile_path if File.exist?(Plugin.gemfile_path)
Plugin.pristine!
end end
describe "#valid?" do describe "#valid?" do
@ -104,7 +103,6 @@ describe Plugin do
plugin.install! plugin.install!
end end
it { Plugin.should be_gemfile_changed }
it { plugin.should be_installed } it { plugin.should be_installed }
end end
end end
@ -115,7 +113,6 @@ describe Plugin do
before do before do
installed_plugin.stub(:fluent_gem).and_return(true) installed_plugin.stub(:fluent_gem).and_return(true)
installed_plugin.install! installed_plugin.install!
Plugin.pristine!
end end
before do before do
@ -123,7 +120,6 @@ describe Plugin do
end end
it { installed_plugin.should_not be_installed } it { installed_plugin.should_not be_installed }
it { Plugin.should be_gemfile_changed }
end end
describe "#upgrade!" do describe "#upgrade!" do
@ -134,12 +130,10 @@ describe Plugin do
before do before do
Plugin.any_instance.stub(:fluent_gem).and_return(true) # NOTE: not `plugin.stub` because upgrade! creates new Plugin instance internally Plugin.any_instance.stub(:fluent_gem).and_return(true) # NOTE: not `plugin.stub` because upgrade! creates new Plugin instance internally
installed_plugin.install! installed_plugin.install!
Plugin.pristine!
installed_plugin.upgrade!(target_version) installed_plugin.upgrade!(target_version)
end end
it { installed_plugin.should be_installed } it { installed_plugin.should be_installed }
it { Plugin.should be_gemfile_changed }
it { installed_plugin.installed_version.should == target_version } it { installed_plugin.installed_version.should == target_version }
end end