diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..5293b9b --- /dev/null +++ b/.drone.yml @@ -0,0 +1,26 @@ +matrix: + include: + - DOCKER_RUBY_VERSION: 1.9.3 + RUBY_IMAGE_TAG: 1.9.3-2 + + - DOCKER_RUBY_VERSION: 2.2 + RUBY_IMAGE_TAG: 2.2-2 + +build: + image: abakpress/dind:2 + privileged: true + volumes: + - /home/data/drone/images:/images + - /home/data/drone/gems:/bundle + environment: + - COMPOSE_FILE_EXT=drone + commands: + - wrapdocker docker -v + + - if [ ! -e /images/ruby_$RUBY_IMAGE_TAG.tar ]; then docker pull abakpress/ruby:$RUBY_IMAGE_TAG; docker save abakpress/ruby:$RUBY_IMAGE_TAG > /images/ruby_$RUBY_IMAGE_TAG.tar; fi + + - docker load -i /images/ssh-agent.tar + - docker load -i /images/ruby_$RUBY_IMAGE_TAG.tar + + - dip provision + - dip rspec diff --git a/.gitignore b/.gitignore index 4ad65c5..c0efe39 100644 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,5 @@ /spec/reports/ /tmp/ gemfiles/ -spec/internal/config/database.yml spec/internal/test_other spec/internal/test diff --git a/Appraisals b/Appraisals index ebd16ab..cab7054 100644 --- a/Appraisals +++ b/Appraisals @@ -1,6 +1,6 @@ appraise 'rails3.1' do gem 'rails', '~> 3.1.0' -end +end if RUBY_VERSION < '2' appraise 'rails3.2' do gem 'rails', '~> 3.2.0' diff --git a/Gemfile b/Gemfile index 453a8c3..ed75467 100644 --- a/Gemfile +++ b/Gemfile @@ -2,7 +2,13 @@ source 'https://rubygems.org' gemspec -if RUBY_VERSION < '2' - gem 'mime-types', '< 3.0' - gem 'json', '< 2.0' +group :test do + if RUBY_VERSION < '2' + gem 'mime-types', '< 3.0' + gem 'json', '< 2.0' + gem 'nokogiri', '< 1.7.0' + else + gem 'test-unit' + gem 'pry-byebug' + end end diff --git a/Makefile b/Makefile deleted file mode 100644 index 110f22d..0000000 --- a/Makefile +++ /dev/null @@ -1,31 +0,0 @@ -BUNDLE = bundle -BUNDLE_OPTIONS = -j 3 -RSPEC = ${APPRAISAL} rspec -APPRAISAL = ${BUNDLE} exec appraisal - -all: test - -test: configs bundler appraisal - ${RSPEC} 2>&1 - -define DATABASE_YML -test: - adapter: sqlite3 - database: test -test_other: - adapter: sqlite3 - database: test_other -endef -export DATABASE_YML - -configs: - echo "$${DATABASE_YML}" > spec/internal/config/database.yml - -bundler: - if ! gem list bundler -i > /dev/null; then \ - gem install bundler; \ - fi - ${BUNDLE} install ${BUNDLE_OPTIONS} - -appraisal: - ${APPRAISAL} install diff --git a/dip.yml b/dip.yml new file mode 100644 index 0000000..38e4488 --- /dev/null +++ b/dip.yml @@ -0,0 +1,45 @@ +version: '1' + +environment: + DOCKER_RUBY_VERSION: 1.9.3 + RUBY_IMAGE_TAG: 1.9.3-2 + COMPOSE_FILE_EXT: development + RAILS_ENV: test + +compose: + files: + - docker-compose.yml + - docker-compose.${COMPOSE_FILE_EXT}.yml + +interaction: + sh: + service: app + + irb: + service: app + command: irb + + bundle: + service: app + command: bundle + + rake: + service: app + command: bundle exec rake + + appraisal: + service: app + command: bundle exec appraisal + + rspec: + service: app + command: bundle exec appraisal bundle exec rspec + + clean: + service: app + command: rm -f Gemfile.lock gemfiles/*.gemfile.* + +provision: + - docker volume create --name bundler_data + - dip bundle install + - dip appraisal install diff --git a/docker-compose.development.yml b/docker-compose.development.yml new file mode 100644 index 0000000..aaf78be --- /dev/null +++ b/docker-compose.development.yml @@ -0,0 +1,14 @@ +version: '2' + +services: + app: + volumes: + - .:/app + - ../:/localgems + - bundler-data:/bundle + +volumes: + bundler-data: + external: + name: bundler_data + diff --git a/docker-compose.drone.yml b/docker-compose.drone.yml new file mode 100644 index 0000000..5d1bed6 --- /dev/null +++ b/docker-compose.drone.yml @@ -0,0 +1,8 @@ +version: '2' + +services: + app: + volumes: + - .:/app + - /bundle:/bundle + diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..b977b7e --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,10 @@ +version: '2' + +services: + app: + image: abakpress/ruby:$RUBY_IMAGE_TAG + environment: + - SSH_AUTH_SOCK=/ssh/auth/sock + - BUNDLE_PATH=/bundle/$DOCKER_RUBY_VERSION + command: bash + diff --git a/slaver.gemspec b/slaver.gemspec index 478e0be..347f701 100644 --- a/slaver.gemspec +++ b/slaver.gemspec @@ -27,7 +27,6 @@ Gem::Specification.new do |spec| spec.add_development_dependency 'rspec-rails' spec.add_development_dependency 'combustion', '>= 0.5.0', '< 0.5.5' spec.add_development_dependency 'appraisal' - spec.add_development_dependency 'pry-debugger' spec.add_development_dependency 'shoulda-matchers', '< 3.0.0' spec.add_development_dependency 'simplecov' spec.add_development_dependency 'database_cleaner' diff --git a/spec/internal/config/database.yml b/spec/internal/config/database.yml new file mode 100644 index 0000000..edddf3e --- /dev/null +++ b/spec/internal/config/database.yml @@ -0,0 +1,6 @@ +test: + adapter: sqlite3 + database: test +test_other: + adapter: sqlite3 + database: test_other