databasedotcom_console 0.0.4 → 0.0.5
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 +41 -27
- data/foo.rb +1 -0
- data/lib/databasedotcom_console/version.rb +1 -1
- data/lib/databasedotcom_console.rb +7 -8
- metadata +2 -1
data/bin/dbdc
CHANGED
@@ -2,35 +2,49 @@
|
|
2
2
|
|
3
3
|
require 'databasedotcom_console'
|
4
4
|
require 'irb'
|
5
|
+
require 'io/console'
|
5
6
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
ohnoes = true
|
17
|
-
puts "ERROR: #{e.message}"
|
18
|
-
puts "\nOh Noes! Looks like an error occurred. Make sure you include your salesforce credentials in the following format: \n"
|
19
|
-
puts " >> dbdc [host] [username] [password]"
|
20
|
-
puts "\nwhere host is likely either \'test.salesforce.com\'' or \'login.salesforce.com\' \n"
|
21
|
-
puts "If your org requires a security token, please be sure to concatenate it at the end of your password. \n\n"
|
7
|
+
### RANDOM UTIL METHOD
|
8
|
+
def get_creds
|
9
|
+
creds = {}
|
10
|
+
print "HOST (test.salesforce.com, login.salesforce.com, etc): "
|
11
|
+
creds[:host] = gets.strip
|
12
|
+
print "USERNAME: "
|
13
|
+
creds[:un] = gets.strip
|
14
|
+
print "PASSWORD (and security token if necessary): "
|
15
|
+
creds[:pw] = STDIN.noecho(&:gets)
|
16
|
+
creds
|
22
17
|
end
|
23
18
|
|
24
|
-
|
25
|
-
|
26
|
-
puts "\nExamples: \n"
|
27
|
-
puts "@dbdc.list_sobjects"
|
28
|
-
puts "@dbdc.materialze \'Account\'"
|
29
|
-
puts "john = Account.find_by_LastName \'Yamaguchi\'"
|
30
|
-
puts "account_list = Account.query \'FirstName != null AND My_Custom_Field__C > 7 LIMIT 10\' \n"
|
31
|
-
puts "\n\n"
|
32
|
-
puts "Check out https://github.com/heroku/databasedotcom for more documentation on the databasedotcom gem\n\n"
|
33
|
-
|
19
|
+
if ARGV[0] == "exec"
|
20
|
+
path = ARGV[1]
|
34
21
|
ARGV.clear
|
35
|
-
|
22
|
+
creds = get_creds
|
23
|
+
@dbdc = DatabasedotcomConsole.new_client(creds[:host], creds[:un], creds[:pw])
|
24
|
+
DatabasedotcomConsole::ScriptRunner.new(path, @dbdc)
|
25
|
+
else
|
26
|
+
begin
|
27
|
+
creds = get_creds
|
28
|
+
@dbdc = DatabasedotcomConsole.new_client(creds[:host], creds[:un], creds[:pw])
|
29
|
+
|
30
|
+
def dbdc
|
31
|
+
@dbdc
|
32
|
+
end
|
33
|
+
|
34
|
+
puts "\n\nWelcome to the Databasedotcom Ruby Console. \nYou you can access your databasedotcom client via the variable @dbdc"
|
35
|
+
puts "\nExamples: \n"
|
36
|
+
puts "dbdc.list_sobjects"
|
37
|
+
puts "dbdc.materialze \'Account\'"
|
38
|
+
puts "john = Account.find_by_LastName \'Yamaguchi\'"
|
39
|
+
puts "account_list = Account.query \'FirstName != null AND My_Custom_Field__C > 7 LIMIT 10\' \n"
|
40
|
+
puts "\n\n"
|
41
|
+
puts "Check out https://github.com/heroku/databasedotcom for more documentation on the databasedotcom gem\n\n"
|
42
|
+
|
43
|
+
ARGV.clear
|
44
|
+
IRB.start
|
45
|
+
rescue Exception => e
|
46
|
+
puts "ERROR: #{e.message}"
|
47
|
+
puts "\nOh Noes! Looks like an error occurred. Make sure you have correctly entered your salesforce credentials!\n"
|
48
|
+
puts "PROTIP: If your org requires a security token, please be sure to concatenate it at the end of your password. \n\n"
|
49
|
+
end
|
36
50
|
end
|
data/foo.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
puts @dbdc.list_sobjects
|
@@ -2,13 +2,6 @@ require "databasedotcom_console/version"
|
|
2
2
|
require "databasedotcom"
|
3
3
|
|
4
4
|
module DatabasedotcomConsole
|
5
|
-
clients = []
|
6
|
-
|
7
|
-
## Return a list of all clients
|
8
|
-
def self.clients
|
9
|
-
clients
|
10
|
-
end
|
11
|
-
|
12
5
|
## Create a new client for use with multiple orgs
|
13
6
|
def self.new_client(host, username, password)
|
14
7
|
client = Databasedotcom::Client.new(
|
@@ -17,8 +10,14 @@ module DatabasedotcomConsole
|
|
17
10
|
:host => host
|
18
11
|
)
|
19
12
|
client.authenticate(:username => username, :password => password)
|
20
|
-
#clients << client
|
21
13
|
client
|
22
14
|
end
|
23
15
|
|
16
|
+
class ScriptRunner
|
17
|
+
def initialize(path, connection)
|
18
|
+
@dbdc = connection
|
19
|
+
vars = binding
|
20
|
+
eval(File.read(path), vars) if path.class == String
|
21
|
+
end
|
22
|
+
end
|
24
23
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: databasedotcom_console
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -42,6 +42,7 @@ files:
|
|
42
42
|
- Rakefile
|
43
43
|
- bin/dbdc
|
44
44
|
- databasedotcom_console.gemspec
|
45
|
+
- foo.rb
|
45
46
|
- lib/databasedotcom_console.rb
|
46
47
|
- lib/databasedotcom_console/version.rb
|
47
48
|
homepage: http://mavens.io/
|