shutter 0.0.5 → 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -18,8 +18,11 @@ module Shutter
18
18
  @config_path = path
19
19
  end
20
20
 
21
+ def iptables
22
+ @iptables ||= Shutter::IPTables::Base.new(@config_path)
23
+ end
24
+
21
25
  def execute
22
- @iptables = Shutter::IPTables::Base.new(@config_path)
23
26
  options = {}
24
27
  optparse = OptionParser.new do |opts|
25
28
  opts.banner = "Usage: shutter [options]"
@@ -84,13 +87,13 @@ module Shutter
84
87
 
85
88
  def save
86
89
  init
87
- @ipt = @iptables.generate
90
+ @ipt = iptables.generate
88
91
  puts @ipt
89
92
  end
90
93
 
91
94
  def restore
92
95
  init
93
- @ipt = @iptables.generate
96
+ @ipt = iptables.generate
94
97
  IO.popen("#{Shutter::IPTables::IPTABLES_RESTORE}", "r+") do |iptr|
95
98
  iptr.puts @ipt ; iptr.close_write
96
99
  end
@@ -98,7 +101,7 @@ module Shutter
98
101
  end
99
102
 
100
103
  def persist
101
- pfile = ENV['SHUTTER_PERSIST_FILE'] ? ENV['SHUTTER_PERSIST_FILE'] : @iptables.persist_file(@os)
104
+ pfile = ENV['SHUTTER_PERSIST_FILE'] ? ENV['SHUTTER_PERSIST_FILE'] : iptables.persist_file(@os)
102
105
  File.open(pfile, "w") do |f|
103
106
  f.write(@ipt)
104
107
  end
@@ -1,3 +1,3 @@
1
1
  module Shutter
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shutter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: