Class: Taps::Cli

Inherits:
Thor
  • Object
show all
Defined in:
lib/taps/cli.rb

Instance Method Summary collapse

Instance Method Details

#clientxfer(method, database_url, remote_url) ⇒ Object



44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/taps/cli.rb', line 44

def clientxfer(method, database_url, remote_url)
	if options[:chunksize]
		Taps::Config.chunksize = options[:chunksize] < 100 ? 100 : options[:chunksize]
	else
		Taps::Config.chunksize = 1000
	end
	Taps::Config.database_url = database_url
	Taps::Config.remote_url = remote_url

	Taps::Config.verify_database_url

	require 'taps/client_session'

	Taps::ClientSession.quickstart do |session|
		session.send(method)
	end
end

#pull(database_url, remote_url) ⇒ Object



29
30
31
# File 'lib/taps/cli.rb', line 29

def pull(database_url, remote_url)
	clientxfer(:cmd_receive, database_url, remote_url)
end

#push(database_url, remote_url) ⇒ Object



35
36
37
# File 'lib/taps/cli.rb', line 35

def push(database_url, remote_url)
	clientxfer(:cmd_send, database_url, remote_url)
end

#server(database_url, login, password) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/taps/cli.rb', line 10

def server(database_url, , password)
	Taps::Config.database_url = database_url
	Taps::Config. = 
	Taps::Config.password = password

	port = options[:port] || 5000

	Taps::Config.verify_database_url

	require 'taps/server'
	Taps::Server.run!({
		:port => port,
		:environment => :production,
		:logging => true
	})
end

#versionObject



40
41
42
# File 'lib/taps/cli.rb', line 40

def version
	puts Taps.version
end