cloudpi-source 0.1.0 → 0.1.1
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/lib/client/MemcacheClient.rb +23 -0
- data/lib/client/MongoClient.rb +28 -0
- data/lib/client/MySql2Client.rb +22 -0
- data/lib/client/RabbitMQClient.rb +23 -0
- data/lib/client/RedisClient.rb +23 -0
- metadata +10 -5
@@ -0,0 +1,23 @@
|
|
1
|
+
require '../CloudpiRuntime'
|
2
|
+
require 'memcache'
|
3
|
+
|
4
|
+
$:.unshift(File.expand_path(File.join(File.dirname(__FILE__),'..','..','vendor','cache')))
|
5
|
+
|
6
|
+
module CloudpiRuntime
|
7
|
+
class MemcacheClient
|
8
|
+
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
class CloudpiRuntime::MemcacheClient
|
13
|
+
include CloudpiRuntime
|
14
|
+
def create_from_svc(hostname)
|
15
|
+
m = credential_map("membase")
|
16
|
+
c = m[hostname];
|
17
|
+
p c
|
18
|
+
client = MemCache.new(c.host+":"+c.port)
|
19
|
+
return client
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
#CloudpiRuntime::MemcacheClient.new.create_from_svc("ec2-23-20-254-0.compute-1.amazonaws.com")
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require '../CloudpiRuntime'
|
2
|
+
require 'mongo'
|
3
|
+
$:.unshift(File.expand_path(File.join(File.dirname(__FILE__),'..','..','vendor','cache')))
|
4
|
+
|
5
|
+
|
6
|
+
|
7
|
+
module CloudpiRuntime
|
8
|
+
class MongoClient
|
9
|
+
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
class CloudpiRuntime::MongoClient
|
14
|
+
include CloudpiRuntime
|
15
|
+
def create_from_svc(hostname)
|
16
|
+
m = credential_map("mongo")
|
17
|
+
c = m[hostname];
|
18
|
+
p c
|
19
|
+
db = Mongo::Connection.new(c.host,c.port).db(c.db)
|
20
|
+
auth = db.authenticate(c.username,c.password)
|
21
|
+
return db
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
#db = CloudpiRuntime::MongoClient.new.create_from_svc("ec2-23-20-254-0.compute-1.amazonaws.com")
|
26
|
+
#coll = db.collection("users")
|
27
|
+
#coll.insert("name" => "tian","age" => "25")
|
28
|
+
#p coll.find("name" => "tian").to_a.to_s
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require "json"
|
2
|
+
require 'mysql2'
|
3
|
+
require '../CloudpiRuntime'
|
4
|
+
|
5
|
+
#$LOAD_PATH.unshift(File.expand_path(File.join(File.dirname(__FILE__),'..','..','vendor','cache')))
|
6
|
+
|
7
|
+
module CloudpiRuntime
|
8
|
+
class MySql2Client
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
class CloudpiRuntime::MySql2Client
|
13
|
+
include CloudpiRuntime
|
14
|
+
def create_from_svc(hostname)
|
15
|
+
m = credential_map("mysql")
|
16
|
+
c = m[hostname]
|
17
|
+
p c
|
18
|
+
client = Mysql2::Client.new(:host => c.host,:username => c.username,:password=>c.password,:database=>c.db,:port=>c.port)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
CloudpiRuntime::MySql2Client.new.create_from_svc("ec2-23-20-254-0.compute-1.amazonaws.com")
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require '../CloudpiRuntime'
|
2
|
+
require 'bunny'
|
3
|
+
|
4
|
+
$:.unshift(File.expand_path(File.join(File.dirname(__FILE__),'..','..','vendor','cache')))
|
5
|
+
|
6
|
+
module CloudpiRuntime
|
7
|
+
class RabbitMQClient
|
8
|
+
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
class CloudpiRuntime::RabbitMQClient
|
13
|
+
include CloudpiRuntime
|
14
|
+
def create_from_svc(hostname)
|
15
|
+
m = credential_map("rabbit")
|
16
|
+
c = m[hostname];
|
17
|
+
p c
|
18
|
+
client = Bunny.new(:host => c.host,:port => c.port,:pass => c.password,:user=>c.username,:vhost=>c.vhost)
|
19
|
+
return client
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
#CloudpiRuntime::RabbitMQClient.new.create_from_svc("ec2-23-20-254-0.compute-1.amazonaws.com")
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require '../CloudpiRuntime'
|
2
|
+
require 'redis'
|
3
|
+
|
4
|
+
$:.unshift(File.expand_path(File.join(File.dirname(__FILE__),'..','..','vendor','cache')))
|
5
|
+
|
6
|
+
module CloudpiRuntime
|
7
|
+
class RedisClient
|
8
|
+
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
class CloudpiRuntime::RedisClient
|
13
|
+
include CloudpiRuntime
|
14
|
+
def create_from_svc(hostname)
|
15
|
+
m = credential_map("redis")
|
16
|
+
c = m[hostname];
|
17
|
+
p c
|
18
|
+
client = Redis.new(:host => c.host,:port => c.port,:password => c.password)
|
19
|
+
return client
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
#CloudpiRuntime::RedisClient.new.create_from_svc("ec2-23-20-254-0.compute-1.amazonaws.com")
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cloudpi-source
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,9 +9,9 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-04-
|
12
|
+
date: 2012-04-05 00:00:00.000000000Z
|
13
13
|
dependencies: []
|
14
|
-
description:
|
14
|
+
description: get service from cloudpi
|
15
15
|
email: xiaoliang.tian@gmail.com
|
16
16
|
executables: []
|
17
17
|
extensions: []
|
@@ -19,7 +19,12 @@ extra_rdoc_files: []
|
|
19
19
|
files:
|
20
20
|
- lib/CloudpiRuntime.rb
|
21
21
|
- lib/Credential.rb
|
22
|
-
|
22
|
+
- lib/client/MemcacheClient.rb
|
23
|
+
- lib/client/MongoClient.rb
|
24
|
+
- lib/client/MySql2Client.rb
|
25
|
+
- lib/client/RabbitMQClient.rb
|
26
|
+
- lib/client/RedisClient.rb
|
27
|
+
homepage: http://www.samsungcloud.org
|
23
28
|
licenses: []
|
24
29
|
post_install_message:
|
25
30
|
rdoc_options: []
|
@@ -42,5 +47,5 @@ rubyforge_project:
|
|
42
47
|
rubygems_version: 1.7.2
|
43
48
|
signing_key:
|
44
49
|
specification_version: 3
|
45
|
-
summary:
|
50
|
+
summary: support for cloudpi service
|
46
51
|
test_files: []
|