From af54420b6ae2706071ea999d86b5aafe6f8565c3 Mon Sep 17 00:00:00 2001 From: Jon Stroop Date: Mon, 29 Feb 2016 14:12:46 -0500 Subject: [PATCH] move oci-8 to Gemfile --- Gemfile | 3 +++ README.md | 13 +++++++++++-- Rakefile | 6 +++--- VERSION | 2 +- circle.yml | 6 ++++++ lib/voyager_helpers.rb | 1 - lib/voyager_helpers/liberator.rb | 2 +- lib/voyager_helpers/oracle_connection.rb | 4 +++- spec/unit/voyager_helpers/connection_spec.rb | 6 +++++- voyager_helpers.gemspec | 1 - 10 files changed, 33 insertions(+), 11 deletions(-) diff --git a/Gemfile b/Gemfile index 0a8c0bd..0ea4f8a 100644 --- a/Gemfile +++ b/Gemfile @@ -1,4 +1,7 @@ source 'https://rubygems.org' +gem 'ruby-oci8', '~> 2.2.1', group: :development +gem 'rspec', '~> 3.4', group: :test + # Specify your gem's dependencies in marc_liberation.gemspec gemspec diff --git a/README.md b/README.md index 966fe57..6220bf5 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,8 @@ A set of methods for retrieving data from Voyager. +[![Circle CI](https://circleci.com/gh/pulibrary/voyager_helpers.svg?style=svg)](https://circleci.com/gh/pulibrary/voyager_helpers) + ## Installation On __Ubuntu__ systems, do [this](https://help.ubuntu.com/community/Oracle%20Instant%20Client). __All of it.__ @@ -10,7 +12,7 @@ Add configuration for VGER In `$ORACLE_HOME/network/admin/tnsnames.ora` (ask DBA In `/etc/profile.d/oracle.sh` Append: -``` +```bash export ORACLE_LIB=$ORACLE_HOME/lib export TNS_ADMIN=$ORACLE_HOME/network/admin ``` @@ -24,7 +26,14 @@ install the 11.2 client, which works fine with 10.2 Oracle servers. ## Configuration -The gem needs to know the database username, password and database name. Put +Add the `voyager_helpers` and `ruby-oci8` gems to your application's Gemfile + +```ruby +gem 'ruby-oci8' +gem 'voyager_helpers' +``` + +The gem needs to know the database username, password and database name. Put this somewhere: ```ruby diff --git a/Rakefile b/Rakefile index df817f2..8ae58da 100644 --- a/Rakefile +++ b/Rakefile @@ -3,14 +3,14 @@ require "bundler/gem_tasks" require 'rspec/core/rake_task' -RSpec::Core::RakeTask.new(:spec) +RSpec::Core::RakeTask.new(:all_specs) -RSpec::Core::RakeTask.new(:ci_specs) do |task| +RSpec::Core::RakeTask.new(:spec) do |task| task.rspec_opts = '--tag ~skip_ci' end task :ci do - Rake::Task['ci_specs'].invoke + Rake::Task['spec'].invoke end task default: :ci diff --git a/VERSION b/VERSION index f483adc..6e8bf73 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.0.1.dev +0.1.0 diff --git a/circle.yml b/circle.yml index c1756a5..b96ec4d 100644 --- a/circle.yml +++ b/circle.yml @@ -1,3 +1,9 @@ machine: ruby: version: 2.3.0 +dependencies: + bundler: + without: [development, production] +test: + override: + - bundle exec rspec --color --require spec_helper --tag ~skip_ci --format documentation spec diff --git a/lib/voyager_helpers.rb b/lib/voyager_helpers.rb index 2fdb7b8..95ec7c9 100644 --- a/lib/voyager_helpers.rb +++ b/lib/voyager_helpers.rb @@ -22,4 +22,3 @@ def configure end # class << self end # module VoyagerHelpers - diff --git a/lib/voyager_helpers/liberator.rb b/lib/voyager_helpers/liberator.rb index c21cc88..df2c072 100644 --- a/lib/voyager_helpers/liberator.rb +++ b/lib/voyager_helpers/liberator.rb @@ -1,7 +1,7 @@ -require 'oci8' require 'marc' require_relative 'queries' require_relative 'oracle_connection' +require 'oci8' unless ENV['CI'] module VoyagerHelpers class Liberator diff --git a/lib/voyager_helpers/oracle_connection.rb b/lib/voyager_helpers/oracle_connection.rb index fe1a266..33681cc 100644 --- a/lib/voyager_helpers/oracle_connection.rb +++ b/lib/voyager_helpers/oracle_connection.rb @@ -8,9 +8,11 @@ def connection(opts={}) VoyagerHelpers.config.db_name ) yield conn + rescue NameError + return if ENV['CI'] ensure conn.logoff unless conn.nil? end end # module Connection -end # module VoyagerHelpers \ No newline at end of file +end # module VoyagerHelpers diff --git a/spec/unit/voyager_helpers/connection_spec.rb b/spec/unit/voyager_helpers/connection_spec.rb index 207883d..8e18742 100644 --- a/spec/unit/voyager_helpers/connection_spec.rb +++ b/spec/unit/voyager_helpers/connection_spec.rb @@ -1,6 +1,10 @@ require 'spec_helper' -describe OCI8, :skip_ci do +# These specs are left over from when this gem was included with MARC +# liberation. They are now skipped by `rake ci` and `rake spec`, and can't be +# run unless the database is configured as described in the README file. + +describe 'OCI8', :skip_ci do let(:holding_id) { 2281830 } let(:item_id) { 23672 } diff --git a/voyager_helpers.gemspec b/voyager_helpers.gemspec index e61a156..96c169f 100644 --- a/voyager_helpers.gemspec +++ b/voyager_helpers.gemspec @@ -21,7 +21,6 @@ Gem::Specification.new do |spec| spec.add_dependency 'activesupport', '~> 4.1' spec.add_dependency 'marc', '~> 1.0' - spec.add_dependency 'ruby-oci8', '~> 2.2.1' spec.add_dependency 'diffy', '~> 3.0.7' end