diff --git a/app/models/plugin.rb b/app/models/plugin.rb index 9511e00..0d257ad 100644 --- a/app/models/plugin.rb +++ b/app/models/plugin.rb @@ -100,11 +100,6 @@ class Plugin "https://rubygems.org/gems/#{gem_name}" 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 return [] unless File.exist?(gemfile_path) File.read(gemfile_path).scan(/"(.*?)", "(.*?)"/).map do |plugin| @@ -136,16 +131,6 @@ class Plugin Rails.root + "Gemfile.plugins" 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 self.class.gemfile_path end diff --git a/spec/models/plugin_spec.rb b/spec/models/plugin_spec.rb index e9867b5..be874bc 100644 --- a/spec/models/plugin_spec.rb +++ b/spec/models/plugin_spec.rb @@ -9,7 +9,6 @@ describe Plugin do after do File.unlink Plugin.gemfile_path if File.exist?(Plugin.gemfile_path) - Plugin.pristine! end describe "#valid?" do @@ -104,7 +103,6 @@ describe Plugin do plugin.install! end - it { Plugin.should be_gemfile_changed } it { plugin.should be_installed } end end @@ -115,7 +113,6 @@ describe Plugin do before do installed_plugin.stub(:fluent_gem).and_return(true) installed_plugin.install! - Plugin.pristine! end before do @@ -123,7 +120,6 @@ describe Plugin do end it { installed_plugin.should_not be_installed } - it { Plugin.should be_gemfile_changed } end describe "#upgrade!" do @@ -134,12 +130,10 @@ describe Plugin do before do Plugin.any_instance.stub(:fluent_gem).and_return(true) # NOTE: not `plugin.stub` because upgrade! creates new Plugin instance internally installed_plugin.install! - Plugin.pristine! installed_plugin.upgrade!(target_version) end it { installed_plugin.should be_installed } - it { Plugin.should be_gemfile_changed } it { installed_plugin.installed_version.should == target_version } end