Top Level Namespace

Defined Under Namespace

Modules: Block Classes: Reader

Instance Method Summary collapse

Instance Method Details

#check_for_file(args) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/block.rb', line 21

def check_for_file(args)
  if args[:file].nil?
    help_now!("Need a filename.") 
  else
    file = File.join(Dir.pwd,args[:file])
    if File.exist?(file)
      true
    else
      help_now!("File needs to exist.") 
    end
  end
end

#check_for_redis(args) ⇒ Object

Add requires for other files you add to your project here, so you just need to require this one file in your bin file



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/block.rb', line 9

def check_for_redis(args)
  uri = URI.parse(args[:redis])
  $redis = Redis.new(:host => uri.host, :port => uri.port, :password => uri.password)
  begin
    $redis.ping
    true
  rescue
    help_now!("######### WARNING: Redis needs to be running. #########")
    false
  end
end

#check_for_searches(args) ⇒ Object



34
35
36
37
38
39
40
# File 'lib/block.rb', line 34

def check_for_searches(args)
  if args[:search].nil?
    help_now!("Need some searches - separated by commas.") 
  else
    true
  end
end