Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Make base into a gem

Change-Id: I337fca56feefef656c40742cb4aafee40b9d9981
  • Loading branch information...
commit 44823cadee8c3ff407dc64d2c280e720deeb8c7d 1 parent 3341c28
@felixhoo felixhoo authored
View
16 Gemfile
@@ -1,22 +1,10 @@
source "http://rubygems.org"
-gem "nats", '>= 0.4.10'
-gem "datamapper", ">= 0.10.2"
-gem "do_sqlite3", :require => nil
-gem "eventmachine"
-gem "eventmachine_httpserver", :require => "evma_httpserver"
-gem "json"
-gem "uuidtools"
-gem "ruby-hmac", :require => "hmac-sha1"
-gem "em-http-request"
-gem "sinatra"
-gem "thin"
-
-gem 'vcap_common', :require => ['vcap/common', 'vcap/component']
-gem 'vcap_logging', '>=0.1.3', :require => ['vcap/logging']
+gemspec
group :test do
gem "rake"
+ gem "sinatra"
gem "rspec"
gem "rcov"
gem "ci_reporter"
View
69 Gemfile.lock
@@ -1,13 +1,31 @@
+PATH
+ remote: .
+ specs:
+ vcap_services_base (0.1.0)
+ datamapper (~> 1.1.0)
+ do_sqlite3 (~> 0.10.3)
+ em-http-request (~> 0.3.0)
+ eventmachine (~> 0.12.11.cloudfoundry.3)
+ eventmachine_httpserver (~> 0.2.1)
+ json (~> 1.4.6)
+ nats (~> 0.4.10)
+ ruby-hmac (~> 0.4.0)
+ sinatra (~> 1.2.3)
+ thin (~> 1.2.11)
+ uuidtools (~> 2.1.2)
+ vcap_common (~> 1.0.2)
+ vcap_logging (>= 0.1.3)
+
GEM
remote: http://rubygems.org/
specs:
- addressable (2.2.4)
+ addressable (2.2.6)
bcrypt-ruby (2.1.4)
builder (3.0.0)
ci_reporter (1.6.4)
builder (>= 2.1.2)
- daemons (1.1.3)
- data_objects (0.10.3)
+ daemons (1.1.4)
+ data_objects (0.10.7)
addressable (~> 2.1)
datamapper (1.1.0)
dm-aggregates (= 1.1.0)
@@ -45,22 +63,22 @@ GEM
uuidtools (~> 2.1.2)
dm-validations (1.1.0)
dm-core (~> 1.1.0)
- do_sqlite3 (0.10.3)
- data_objects (= 0.10.3)
+ do_sqlite3 (0.10.7)
+ data_objects (= 0.10.7)
em-http-request (0.3.0)
addressable (>= 2.0.0)
escape_utils
eventmachine (>= 0.12.9)
- escape_utils (0.2.3)
- eventmachine (0.12.10)
+ escape_utils (0.2.4)
+ eventmachine (0.12.11.cloudfoundry.3)
eventmachine_httpserver (0.2.1)
fastercsv (1.5.4)
json (1.4.6)
- json_pure (1.5.1)
- little-plugger (1.1.2)
- logging (1.5.0)
+ json_pure (1.6.3)
+ little-plugger (1.1.3)
+ logging (1.6.1)
little-plugger (>= 1.1.2)
- nats (0.4.10)
+ nats (0.4.12)
daemons (>= 1.1.0)
eventmachine (>= 0.12.10)
json_pure (>= 1.5.1)
@@ -80,41 +98,30 @@ GEM
sinatra (1.2.3)
rack (~> 1.1)
tilt (>= 1.2.2, < 2.0)
- stringex (1.2.1)
+ stringex (1.2.2)
thin (1.2.11)
daemons (>= 1.0.9)
eventmachine (>= 0.12.6)
rack (>= 1.0.0)
tilt (1.2.2)
uuidtools (2.1.2)
- vcap_common (0.99)
- eventmachine (~> 0.12.10)
+ vcap_common (1.0.2)
+ eventmachine (~> 0.12.11.cloudfoundry.3)
logging (>= 1.5.0)
- nats
- posix-spawn
- thin
- yajl-ruby
+ nats (~> 0.4.10)
+ posix-spawn (~> 0.3.6)
+ thin (~> 1.2.11)
+ yajl-ruby (~> 0.8.3)
vcap_logging (0.1.3)
- yajl-ruby (0.8.2)
+ yajl-ruby (0.8.3)
PLATFORMS
ruby
DEPENDENCIES
ci_reporter
- datamapper (>= 0.10.2)
- do_sqlite3
- em-http-request
- eventmachine
- eventmachine_httpserver
- json
- nats (>= 0.4.10)
rake
rcov
rspec
- ruby-hmac
sinatra
- thin
- uuidtools
- vcap_common
- vcap_logging (>= 0.1.3)
+ vcap_services_base!
View
11 Rakefile
@@ -1,4 +1,5 @@
require 'rake'
+require 'bundler'
desc "Run specs"
task "spec" => ["bundler:install:test", "test:spec"]
@@ -7,24 +8,34 @@ desc "Run specs using RCov"
task "spec:rcov" => ["bundler:install:test", "test:spec:rcov"]
namespace "bundler" do
+ gem_helper = Bundler::GemHelper.new(Dir.pwd)
+ desc "Build gem package"
+ task "build" do
+ gem_helper.build_gem
+ end
+
desc "Install gems"
task "install" do
sh("bundle install")
+ gem_helper.install_gem
end
desc "Install gems for test"
task "install:test" do
sh("bundle install --without development production")
+ gem_helper.install_gem
end
desc "Install gems for production"
task "install:production" do
sh("bundle install --without development test")
+ gem_helper.install_gem
end
desc "Install gems for development"
task "install:development" do
sh("bundle install --without test production")
+ gem_helper.install_gem
end
end
View
1  lib/base/api/message.rb
@@ -1,6 +1,5 @@
# Copyright (c) 2009-2011 VMware, Inc.
#
-$:.unshift(File.expand_path("../../../../../../lib", __FILE__))
$:.unshift(File.expand_path("../..", __FILE__))
require 'json_message'
require 'base'
View
3  lib/base/asynchronous_service_gateway.rb
@@ -8,12 +8,11 @@
require 'sinatra/base'
require 'uri'
require 'thread'
-
-$:.unshift(File.expand_path("../../../../../lib", __FILE__))
require 'json_message'
require 'services/api'
require 'services/api/const'
+$:.unshift(File.dirname(__FILE__))
require 'service_error'
module VCAP
View
9 lib/base/gateway.rb
@@ -30,8 +30,6 @@ class VCAP::Services::Base::Gateway
abstract :default_config_file
abstract :provisioner_class
- CC_CONFIG_FILE = File.expand_path("../../../../../cloud_controller/config/cloud_controller.yml", __FILE__)
-
def parse_config
config_file = default_config_file
@@ -80,7 +78,7 @@ def start
@config[:service][:label] = "#{@config[:service][:name]}-#{@config[:service][:version]}"
@config[:service][:url] = "http://#{@config[:host]}:#{@config[:port]}"
node_timeout = @config[:node_timeout] || 5
- cloud_controller_uri = @config[:cloud_controller_uri] || default_cloud_controller_uri
+ cloud_controller_uri = @config[:cloud_controller_uri] || "api.vcap.me"
# Go!
EM.run do
@@ -116,11 +114,6 @@ def async_gateway_class
VCAP::Services::AsynchronousServiceGateway
end
- def default_cloud_controller_uri
- config = YAML.load_file(CC_CONFIG_FILE)
- config['external_uri'] || "api.vcap.me"
- end
-
def parse_gateway_config(config_file)
config = YAML.load_file(config_file)
config = VCAP.symbolize_keys(config)
View
7 lib/base/version.rb
@@ -0,0 +1,7 @@
+module VCAP
+ module Services
+ module Base
+ VERSION = "0.1.0"
+ end
+ end
+end
View
8 lib/vcap_services_base.rb
@@ -0,0 +1,8 @@
+require 'base/gateway'
+require 'base/node_bin'
+require 'base/node'
+require 'base/provisioner'
+require 'base/backup'
+require 'base/service_error'
+require 'base/asynchronous_service_gateway'
+require 'base/datamapper_l'
View
28 vcap_services_base.gemspec
@@ -0,0 +1,28 @@
+$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), "lib"))
+require "base/version"
+
+Gem::Specification.new do |s|
+ s.name = "vcap_services_base"
+ s.version = VCAP::Services::Base::VERSION
+ s.platform = Gem::Platform::RUBY
+ s.summary = "VCAP services base module"
+ s.description = s.summary
+ s.files = `git ls-files`.split("\n")
+ s.require_path = [ "lib" ]
+ s.author = "CloudFoundry Services Team"
+ s.email = "cf-services-eng-cn@vmware.com"
+
+ s.add_dependency "nats", "~> 0.4.10"
+ s.add_dependency "datamapper", "~> 1.1.0"
+ s.add_dependency "do_sqlite3", "~> 0.10.3"
+ s.add_dependency "eventmachine", "~> 0.12.11.cloudfoundry.3"
+ s.add_dependency "eventmachine_httpserver", "~> 0.2.1"
+ s.add_dependency "json", "~> 1.4.6"
+ s.add_dependency "uuidtools", "~> 2.1.2"
+ s.add_dependency "ruby-hmac", "~> 0.4.0"
+ s.add_dependency "em-http-request", "~> 0.3.0"
+ s.add_dependency "sinatra", "~> 1.2.3"
+ s.add_dependency "thin", "~> 1.2.11"
+ s.add_dependency "vcap_common", "~> 1.0.2"
+ s.add_dependency "vcap_logging", ">=0.1.3"
+end
Please sign in to comment.
Something went wrong with that request. Please try again.