Permalink
Browse files

Cleanup ruby -w alerts

  • Loading branch information...
1 parent b861665 commit 8a4a4df383ced7280e07b234c75b624d5e55912a @copiousfreetime committed Feb 17, 2012
View
8 lib/tyrant_manager.rb
@@ -160,7 +160,7 @@ def setup( dir = default_directory )
# setting the home directory.
#
def initialize( directory = TyrantManager.default_directory )
- self.home_dir = File.expand_path( directory )
+ self.home_dir = File.expand_path( directory )
if File.exist?( self.config_file ) then
configuration # force a load
else
@@ -176,14 +176,14 @@ def logger
# The configuration file for the manager
#
def config_file
- @config_file ||= File.join( home_dir, TyrantManager.config_file_basename )
+ @config_file ||= File.join( home_dir, TyrantManager.config_file_basename )
end
#
# load the configuration
#
def configuration
- unless @configuration
+ unless defined? @configuration
eval( IO.read( self.config_file ) )
@configuration = Loquacious::Configuration.for("manager")
end
@@ -201,7 +201,7 @@ def runner_for( options )
# Return the list of instances that the manager knows about
#
def instances
- unless @instances then
+ unless defined? @instances then
candidates = [ self.instances_path ]
if configuration.instances then
candidates = configuration.instances
View
22 lib/tyrant_manager/tyrant_instance.rb
@@ -49,7 +49,7 @@ def setup( dir )
attr_reader :home_dir
# the name of this instance
- attr_reader :name
+ attr_reader :name
# the manager that is associated with this instance
attr_accessor :manager
@@ -82,7 +82,7 @@ def config_file
# load the configuration
#
def configuration
- unless @configuration then
+ unless defined? @configuration then
eval( IO.read( self.config_file ) )
@configuration = Loquacious::Configuration.for( name )
end
@@ -135,7 +135,7 @@ def data_dir
# The full path to the database file.
#
def db_file( type = configuration.type )
- unless @db_file then
+ unless defined? @db_file then
@db_file = case type
when "memory-hash" then "*"
when "memory-tree" then "+"
@@ -165,20 +165,6 @@ def ulog_files
end
#
- # The lua extension file
- #
- def lua_extension_file
- @lua_extension_file ||= append_to_home_if_not_absolute( configuration.lua_extension_file )
- end
-
- #
- # The replication timestamp file
- #
- def replication_timestamp_file
- @replication_timestamp_file ||= append_to_home_if_not_absolute( configuration.replication_timestamp_file )
- end
-
- #
# Valid index styles as defined by Tokyo Cabinet
#
# See Tokyo Cabinet source code, tctdbstrtoindex() in
@@ -197,7 +183,7 @@ def index_types
# into one big commandline item.
#
def start_command
- unless @start_command then
+ unless defined? @start_command then
##-- ttserver executable
parts = [ manager.configuration.ttserver ]
View
2 spec/command_spec.rb
@@ -31,7 +31,7 @@ class Junk < TyrantManager::Command; end
it "classes cannot be run without implementing 'run'" do
j = Junk.new( nil )
- j.respond_to?(:run).should == true
+ j.respond_to?(:run).should be == true
lambda { j.run }.should raise_error( NotImplementedError, /The #run method must be implemented/)
end
end
View
26 spec/tyrant_instance_spec.rb
@@ -50,12 +50,12 @@
end
it "#config_file" do
- @instances['standalone'].config_file.should == File.join( @tyrant_manager_dir, "instances", "standalone", "config.rb" )
- File.exist?( @instances['standalone'].config_file ).should == true
+ @instances['standalone'].config_file.should be == File.join( @tyrant_manager_dir, "instances", "standalone", "config.rb" )
+ File.exist?( @instances['standalone'].config_file ).should be == true
end
it "#configuration" do
- @instances['standalone'].configuration.nil?.should == false
+ @instances['standalone'].configuration.nil?.should be == false
end
it "#pid_file" do
@@ -118,26 +118,26 @@
end
it "#is_slave? when it is NOT a slave" do
- @instances['standalone'].running?.should == true
- @instances['standalone'].is_slave?.should == false
+ @instances['standalone'].running?.should be == true
+ @instances['standalone'].is_slave?.should be == false
end
it "#is_slave? when it IS a slave" do
- @instances['slave_1'].running?.should == true
- @instances['slave_1'].is_slave?.should == true
+ @instances['slave_1'].running?.should be == true
+ @instances['slave_1'].is_slave?.should be == true
end
it "#is_master_master? when it is NOT in a master_master relationship" do
- @instances['slave_1'].running?.should == true
- @instances['slave_1'].is_master_master?.should == false
+ @instances['slave_1'].running?.should be == true
+ @instances['slave_1'].is_master_master?.should be == false
end
it "#is_master_master? when it IS in a master_master relationship" do
- @instances['master_master_1'].running?.should == true
- @instances['master_master_1'].is_master_master?.should == true
+ @instances['master_master_1'].running?.should be== true
+ @instances['master_master_1'].is_master_master?.should be == true
- @instances['master_master_2'].running?.should == true
- @instances['master_master_2'].is_master_master?.should == true
+ @instances['master_master_2'].running?.should be == true
+ @instances['master_master_2'].is_master_master?.should be == true
end
end
View
8 spec/tyrant_manager_spec.rb
@@ -61,8 +61,8 @@
end
it "#config_file" do
- @mgr.config_file.should == File.join( @tdir, "config.rb" )
- File.exist?( @mgr.config_file ).should == true
+ @mgr.config_file.should be == File.join( @tdir, "config.rb" )
+ File.exist?( @mgr.config_file ).should be == true
end
it "#configuration" do
@@ -79,7 +79,7 @@
TyrantManager::TyrantInstance.setup( idir )
end
- @mgr.instances.size.should == 3
+ @mgr.instances.size.should be == 3
names = []
@mgr.each_instance do |i|
i.name.should =~ /test\d/
@@ -95,7 +95,7 @@
TyrantManager::TyrantInstance.setup( idir )
end
- @mgr.instances.size.should == 3
+ @mgr.instances.size.should be == 3
names = []
@mgr.each_instance( %w[ test0 test2] ) do |i|
i.name.should =~ /test\d/

0 comments on commit 8a4a4df

Please sign in to comment.