Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Connect works now

  • Loading branch information...
commit c18fef709fe78a15f669b70081578db9b719fbd4 0 parents
@sreeix authored
1  .rvmrc
@@ -0,0 +1 @@
+rvm ruby-1.9.2@couchup --create
2  Gemfile
@@ -0,0 +1,2 @@
+source :rubygems
+gem 'couchrest'
17 Gemfile.lock
@@ -0,0 +1,17 @@
+GEM
+ remote: http://rubygems.org/
+ specs:
+ couchrest (1.0.1)
+ json (>= 1.4.6)
+ mime-types (>= 1.15)
+ rest-client (>= 1.5.1)
+ json (1.5.1)
+ mime-types (1.16)
+ rest-client (1.6.1)
+ mime-types (>= 1.16)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ couchrest
39 bin/couchup
@@ -0,0 +1,39 @@
+#!/usr/bin/env ruby
+begin
+ require "rubygems"
+ require "bundler"
+rescue LoadError
+ raise "Could not load the bundler gem. Install it with `gem install bundler`."
+end
+
+if Gem::Version.new(Bundler::VERSION) <= Gem::Version.new("0.9.24")
+ raise RuntimeError, "Your bundler version is too old for Rails 2.3." +
+ "Run `gem install bundler` to upgrade."
+end
+
+begin
+ # Set up load paths for all bundled gems
+ ENV["BUNDLE_GEMFILE"] = File.expand_path("../../Gemfile", __FILE__)
+ Bundler.setup
+rescue Bundler::GemNotFound
+ raise RuntimeError, "Bundler couldn't find some gems." +
+ "Did you run `bundle install`?"
+end
+
+Bundler.require :default
+require File.expand_path( "../../lib/couchup", __FILE__)
+require 'irb'
+require 'irb/completion'
+
+if File.exists? ".irbrc"
+ ENV['IRBRC'] = ".irbrc"
+end
+
+if File.exists?( File.expand_path(rcfile = "~/.couchuprc") )
+ load(rcfile)
+end
+
+ARGV.clear
+
+IRB.start
+exit!
3  lib/couchup.rb
@@ -0,0 +1,3 @@
+require File.expand_path '../couchup/couchup', __FILE__
+Dir[File.expand_path('../couchup/commands/*.rb',__FILE__)].each { |file| require file}
+
9 lib/couchup/commands/connect.rb
@@ -0,0 +1,9 @@
+module Commands
+ class Connect
+ def run(params ={})
+ Couchup.host = params[:host] || "locahost"
+ Couchup.port = params[:post] || 5984
+ puts "Connected to #{Couchup.host}:#{Couchup.port}" if(Couchup.ready?)
+ end
+ end
+end
11 lib/couchup/commands/help.rb
@@ -0,0 +1,11 @@
+module Commands
+ class Help
+ def run(option={})
+
+ end
+
+ def describe
+ "Help on the system, help put will provider help about put."
+ end
+ end
+end
17 lib/couchup/couchup.rb
@@ -0,0 +1,17 @@
+class Couchup
+ class << self
+ attr_accessor :port, :host
+ def ready?
+ uuid = nil
+ begin
+ puts "#{host}:#{port}"
+ uuid = CouchRest::Server.new("#{host}:#{port}").next_uuid
+ rescue
+ puts $!.backtrace
+ puts $!.inspect
+ end
+ puts uuid
+ !uuid.nil?
+ end
+ end
+end
Please sign in to comment.
Something went wrong with that request. Please try again.