Skip to content

Commit

Permalink
Merge pull request #4 from Sage/feature_travis_ci_setup
Browse files Browse the repository at this point in the history
updated repo to use travis ci
  • Loading branch information
vaughanbrittonsage authored Nov 30, 2016
2 parents 1b5a4d5 + 023c1a9 commit cc99da3
Show file tree
Hide file tree
Showing 9 changed files with 68 additions and 11 deletions.
15 changes: 15 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
language: ruby
rvm:
- 2.3.0
- 2.3.1

cache: bundler

deploy:
provider: rubygems
api_key:
secure: "YymT9pXiLoxk3ceH7SHHPXgxAZc1Hu2HIBp8saryrOdhb0RZ1yYTyG0lIDs30YG85UCxVMN9rwNZrJOTE4GsZNBuTubEK+k9f701pvP6hnmAtUUUt1QwAMi9sz5IKURk1SPI7R/iRTkOcCyM6mhKSC/ItjQfuLsWOCE8snugzKi0cQC3vSonIBal5iJjgeYZkuncZOJcYSyuIfbQaZBBMu7uBGQrykg8fLWX9Sreh9KmFRb9A3FiuH0kroQCrivl/d/X7u4a3WmFXR0Bqj39+C2B4LRuUJ37PHkXgogvpgNyeR/+t4kTWfv96aa3NirxaFc3LB0Zl9ZdEBrNURN+awLmyBt8WmI25NahydGsZMuwWMMXhjx1NWfYGdI53ZAwA8fOsBASqntvtkAWLSpr8Lekv3S844545zHtqeYtYY1egWZ/aHwAckkfRoKJOAyStrN59DHKquJPRdhMEPKM23YwtUrXmjoJ+B/KC/Z6bFiWnDvq5V7FMt3twGmwabHGD+cSglTCdHbpEEbfZYV24NBBclzXhRtAgVUG3obcfJvKPY/f889JlIpWzRdxu74G8K9uxq3ku21EIfWIMKv3Nx4yPyKDdu60RbkUyq7VwvWyO7WgBhU+Vh1pVqMVAe4EErJTqMCXlJulzy8oE3IOhB1oUHyfxTE+dimwX6je4Qc="
gem: hash_kit
on:
tags: true

2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
source 'https://rubygems.org'
source 'http://rubygems.org'

# Specify your gem's dependencies in hash_kit.gemspec
gemspec
8 changes: 6 additions & 2 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
require "bundler/gem_tasks"
task :default => :spec
require 'rake'
require 'rspec/core/rake_task'

RSpec::Core::RakeTask.new(:spec)

task :default => :spec
28 changes: 24 additions & 4 deletions hash_kit.gemspec
Original file line number Diff line number Diff line change
@@ -1,17 +1,37 @@
# coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'hash_kit/version'

####################
#### Set GEM Version based on GIT Release TAG when built with Travis
####################
version = ''
if ENV['TRAVIS_TAG'] != nil
puts "CI Branch - '#{ENV['TRAVIS_TAG']}'"
version = ENV['TRAVIS_TAG']
end

#if the tag version starts with v (e.g. vx.x.x)
if version.downcase.match /^v/
#trim the v and set the version to x.x.x
version = version.dup
version.slice!(0)
elsif ENV['TRAVIS_TAG'] != nil && ENV['TRAVIS_TAG'] != ''
version = "0.0.0.#{ENV['TRAVIS_TAG']}"
else
#otherwise it is not a valid release tag so set the version 0.0.0 as it not being released.
version = '0.0.0'
end

Gem::Specification.new do |spec|
spec.name = "hash_kit"
spec.version = HashKit::VERSION
spec.authors = ["vaughanbrittonsage"]
spec.version = version
spec.authors = ["Sage One"]
spec.email = ["[email protected]"]

spec.summary = 'Toolkit for working with Hashes'
spec.description = 'Toolkit for working with Hashes'
spec.homepage = "https://github.com/vaughanbrittonsage/hash_kit"
spec.homepage = "https://github.com/sage/hash_kit"
spec.license = "MIT"

spec.files = Dir.glob("{bin,lib}/**/**/**")
Expand Down
1 change: 0 additions & 1 deletion lib/hash_kit.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
require 'hash_kit/version'
require 'hash_kit/transform_item'
require 'hash_kit/helper'

3 changes: 0 additions & 3 deletions lib/hash_kit/version.rb

This file was deleted.

8 changes: 8 additions & 0 deletions script/cleanup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/sh
echo cleanup started
echo stop all containers
docker stop $(docker ps -a -q)
echo removed untagged images
docker rmi -f $(docker images | grep "<none>" | awk "{print \$3}")
docker rm -v $(docker ps -a -q -f status=exited)
echo cleanup complete
6 changes: 6 additions & 0 deletions script/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
gem_test_runner:
image: codeguru/ruby:2.3.1-alpine-3.4
container_name: gem_test_runner
command: bash -c "while true; do echo 'Container is running...'; sleep 2; done"
volumes:
- ../:/gem_src
8 changes: 8 additions & 0 deletions script/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/sh

echo start rspec tests
docker-compose up -d

spec_path=spec/$1

docker exec -it gem_test_runner bash -c "cd gem_src && bundle install && bundle exec rspec ${spec_path}"

0 comments on commit cc99da3

Please sign in to comment.