Permalink
Browse files

Added handy scripts and optionally used gh mongodb port if available.

  • Loading branch information...
1 parent b67e902 commit 0e257fb250ef6f860b48b941c2893a27edfd9df9 @jnunemaker jnunemaker committed Jul 3, 2013
Showing with 86 additions and 4 deletions.
  1. +1 −0 .gitignore
  2. +0 −3 Rakefile
  3. +21 −0 script/bootstrap
  4. +42 −0 script/release
  5. +20 −0 script/test
  6. +2 −1 spec/helper.rb
View
@@ -4,3 +4,4 @@ log
Gemfile.lock
bin
vendor
+.bundle
View
@@ -1,6 +1,3 @@
-require 'bundler'
-Bundler::GemHelper.install_tasks
-
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new
View
@@ -0,0 +1,21 @@
+#!/bin/sh
+#/ Usage: bootstrap [bundle options]
+#/
+#/ Bundle install the dependencies.
+#/
+#/ Examples:
+#/
+#/ bootstrap
+#/ bootstrap --local
+#/
+
+set -e
+cd $(dirname "$0")/..
+
+[ "$1" = "--help" -o "$1" = "-h" -o "$1" = "help" ] && {
+ grep '^#/' <"$0"| cut -c4-
+ exit 0
+}
+
+rm -rf .bundle/{binstubs,config}
+bundle install --binstubs .bundle/binstubs --path .bundle --quiet "$@"
View
@@ -0,0 +1,42 @@
+#!/bin/sh
+#/ Usage: release
+#/
+#/ Tag the version in the repo and push the gem.
+#/
+
+set -e
+cd $(dirname "$0")/..
+
+[ "$1" = "--help" -o "$1" = "-h" -o "$1" = "help" ] && {
+ grep '^#/' <"$0"| cut -c4-
+ exit 0
+}
+
+gem_name=plucky
+
+# Build a new gem archive.
+rm -rf $gem_name-*.gem
+gem build -q $gem_name.gemspec
+
+# Make sure we're on the master branch.
+(git branch | grep -q '* master') || {
+ echo "Only release from the master branch."
+ exit 1
+}
+
+# Figure out what version we're releasing.
+tag=v`ls $gem_name-*.gem | sed "s/^$gem_name-\(.*\)\.gem$/\1/"`
+
+echo "Releasing $tag"
+
+# Make sure we haven't released this version before.
+git fetch -t origin
+
+(git tag -l | grep -q "$tag") && {
+ echo "Whoops, there's already a '${tag}' tag."
+ exit 1
+}
+
+# Tag it and bag it.
+gem push $gem_name-*.gem && git tag "$tag" &&
+ git push origin master && git push origin "$tag"
View
@@ -0,0 +1,20 @@
+#!/bin/sh
+#/ Usage: test
+#/
+#/ Bootstrap and run all tests.
+#/
+#/ Examples:
+#/
+#/ # run all tests
+#/ test
+#/
+
+set -e
+cd $(dirname "$0")/..
+
+[ "$1" = "--help" -o "$1" = "-h" -o "$1" = "help" ] && {
+ grep '^#/' <"$0"| cut -c4-
+ exit 0
+}
+
+script/bootstrap && bundle exec rake
View
@@ -17,7 +17,8 @@
LogBuddy.init :logger => Log
-connection = Mongo::MongoClient.new('127.0.0.1', 27017, :logger => Log)
+port = ENV.fetch "GH_MONGODB_PORT", 27017
+connection = Mongo::MongoClient.new('127.0.0.1', port.to_i, :logger => Log)
DB = connection.db('test')
RSpec.configure do |config|

0 comments on commit 0e257fb

Please sign in to comment.