databasedotcom_console 0.0.6 → 0.0.7
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.
- data/bin/dbdc +39 -11
- data/lib/databasedotcom_console/version.rb +1 -1
- metadata +1 -1
data/bin/dbdc
CHANGED
@@ -3,36 +3,64 @@
|
|
3
3
|
require 'databasedotcom_console'
|
4
4
|
require 'irb'
|
5
5
|
require 'io/console'
|
6
|
+
require 'optparse'
|
6
7
|
|
7
8
|
### RANDOM UTIL METHOD
|
8
|
-
def get_creds
|
9
|
+
def get_creds(opts={})
|
9
10
|
creds = {}
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
11
|
+
if opts[:host]
|
12
|
+
creds[:host] = opts[:host]
|
13
|
+
else
|
14
|
+
print "HOST (test.salesforce.com, login.salesforce.com, etc): "
|
15
|
+
creds[:host] = gets.strip
|
16
|
+
end
|
17
|
+
if opts[:un]
|
18
|
+
creds[:un] = opts[:un]
|
19
|
+
else
|
20
|
+
print "USERNAME: "
|
21
|
+
creds[:un] = gets.strip
|
22
|
+
end
|
23
|
+
if opts[:pw]
|
24
|
+
creds[:pw] = opts[:pw]
|
25
|
+
else
|
26
|
+
print "PASSWORD (and security token if necessary): "
|
27
|
+
creds[:pw] = STDIN.noecho(&:gets)
|
28
|
+
end
|
16
29
|
creds
|
17
30
|
end
|
18
31
|
|
32
|
+
options = {}
|
33
|
+
parser = OptionParser.new do |opts|
|
34
|
+
opts.banner = "Usage: dbdc [options]"
|
35
|
+
opts.on("-h","--host HOST","enter the host (login.salesforce.com or test.salesforce.com") do |arg|
|
36
|
+
options[:host] = arg
|
37
|
+
end
|
38
|
+
opts.on("-u","--username USERNAME","your username") do |arg|
|
39
|
+
options[:un] = arg
|
40
|
+
end
|
41
|
+
opts.on("-p","--password PASSWORD","your password") do |arg|
|
42
|
+
options[:pw] = arg
|
43
|
+
end
|
44
|
+
end
|
45
|
+
parser.parse!
|
46
|
+
|
19
47
|
if ARGV[0] == "exec"
|
20
48
|
path = ARGV[1]
|
21
49
|
ARGV.clear
|
22
|
-
creds = get_creds
|
50
|
+
creds = get_creds(options)
|
23
51
|
@dbdc = DatabasedotcomConsole.new_client(creds[:host], creds[:un], creds[:pw])
|
24
52
|
DatabasedotcomConsole::ScriptRunner.new(path, @dbdc)
|
25
53
|
else
|
26
54
|
begin
|
27
|
-
creds = get_creds
|
55
|
+
creds = get_creds(options)
|
28
56
|
@dbdc = DatabasedotcomConsole.new_client(creds[:host], creds[:un], creds[:pw])
|
29
57
|
|
30
58
|
def dbdc
|
31
59
|
@dbdc
|
32
60
|
end
|
33
61
|
|
34
|
-
puts "\n\nWelcome to the Databasedotcom Ruby Console. \nYou you can access your databasedotcom client via the variable @dbdc"
|
35
|
-
puts "\nExamples
|
62
|
+
puts "\n\nWelcome to the Databasedotcom Ruby Console. \nYou you can access your databasedotcom client via the variable: @dbdc"
|
63
|
+
puts "\nExamples:\n"
|
36
64
|
puts "@dbdc.list_sobjects"
|
37
65
|
puts "@dbdc.materialze \'Account\'"
|
38
66
|
puts "john = Account.find_by_LastName \'Yamaguchi\'"
|