Skip to content

Commit

Permalink
Added handy scripts and optionally used gh mongodb port if available.
Browse files Browse the repository at this point in the history
  • Loading branch information
jnunemaker committed Jul 3, 2013
1 parent b67e902 commit 0e257fb
Show file tree
Hide file tree
Showing 6 changed files with 86 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -4,3 +4,4 @@ log
Gemfile.lock
bin
vendor
.bundle
3 changes: 0 additions & 3 deletions Rakefile
@@ -1,6 +1,3 @@
require 'bundler'
Bundler::GemHelper.install_tasks

require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new

Expand Down
21 changes: 21 additions & 0 deletions script/bootstrap
@@ -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 "$@"
42 changes: 42 additions & 0 deletions script/release
@@ -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"
20 changes: 20 additions & 0 deletions script/test
@@ -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
3 changes: 2 additions & 1 deletion spec/helper.rb
Expand Up @@ -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|
Expand Down

0 comments on commit 0e257fb

Please sign in to comment.