Class: Vines::Services::Command::Views

Inherits:
Object
  • Object
show all
Defined in:
lib/vines/services/command/views.rb

Instance Method Summary collapse

Instance Method Details

#run(opts) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/vines/services/command/views.rb', line 7

def run(opts)
  raise 'vines-services views <domain>' unless opts[:args].size == 1
  require opts[:config]
  domain = opts[:args].first
  unless host = Config.instance.vhosts[domain]
    raise "#{domain} virtual host not found in conf/config.rb"
  end
  unless host.storage.respond_to?(:create_views)
    raise "CouchDB storage not configured for #{domain} virtual host"
  end
  begin
    host.storage.create_views
  rescue Exception => e
    raise "View creation failed: #{e.message}"
  end
end