Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Overhaul the gem directory structure, add Travis and Gitlab build support #61

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
Open
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

Gemfile.lock
*.swp
*.gem
*.so
Expand Down
27 changes: 27 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
.base: &base
variables:
RAKE_VERSION: 10.4.2
before_script:
- apt-get update && apt-get install -y debconf-utils git-core
- echo "firebird2.5-super shared/firebird/sysdba_password/new_password password masterkey" | debconf-set-selections
- DEBIAN_FRONTEND=noninteractive apt-get install -y build-essential patch ruby-dev zlib1g-dev liblzma-dev firebird-dev firebird2.5-super
- service firebird2.5-super start
- gem install bundler && bundle
script:
- bundle exec rake compile:fb_ext test

ruby-1.9.3:
<<: *base
image: zedtux/ruby-1.9.3:latest

ruby-2.2:
<<: *base
image: ruby:2.2-jessie

ruby-2.3:
<<: *base
image: ruby:2.3-jessie

ruby-2.4:
<<: *base
image: ruby:2.4-jessie
22 changes: 22 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
language: ruby
install:
- sudo apt-get update
# && sudo apt-get install debconf-utils
# - echo "firebird2.5-super shared/firebird/sysdba_password/new_password password masterkey" | sudo debconf-set-selections
- sudo apt-get install -y build-essential patch ruby-dev zlib1g-dev liblzma-dev firebird-dev firebird2.5-super
- bundle
before_script:
- export ISC_PASSWORD=$(sudo grep ISC_PASSWORD /etc/firebird/2.5/SYSDBA.password | ruby -e "puts STDIN.read.split(/[=\"]/)[2]")
- echo "modify sysdba -pw masterkey" | gsec -user SYSDBA -password $ISC_PASSWORD
- sudo mkdir -p /tmp/firebird
- sudo chown firebird.firebird /tmp/firebird
- sudo chmod 0777 /tmp/firebird
script:
- bundle exec rake compile:fb_ext test
rvm:
- 1.9.3
- 2.0.0
- 2.1
- 2.2
- 2.3
- 2.4
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
source 'http://rubygems.org'
gemspec
14 changes: 0 additions & 14 deletions MANIFEST

This file was deleted.

15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Fb - Ruby Firebird Extension Library

[![Build Status](https://travis-ci.org/rowland/fb.svg?branch=master)](https://travis-ci.org/rowland/fb)

This is a Ruby driver for the [Firebird](https://firebirdsql.org/) database.

# Sample usage

* See the [API Documentation](http://www.rubydoc.info/github/rowland/fb)
* See [USAGE.txt](USAGE.txt) for a brief tutorial on the usage.

# Running Tests

bundle exec rake compile:fb_ext
bundle exec rake
13 changes: 13 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
require "rake/testtask"
require "rake/extensiontask"

Rake::ExtensionTask.new "fb_ext" do |ext|
ext.ext_dir = 'ext/fb'
ext.lib_dir = 'lib/fb'
end

Rake::TestTask.new do |t|
t.test_files = FileList['test/**/*.rb'] - FileList['test/test_helper.rb']
end

task :default => :test
File renamed without changes.
2 changes: 1 addition & 1 deletion extconf.rb → ext/fb/extconf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,4 @@ def search_firebird_path
libs.find {|lib| have_library(lib, test_func) }
end

create_makefile("fb")
create_makefile("fb_ext")
14 changes: 7 additions & 7 deletions fb.c → ext/fb/fb_ext.c
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ typedef struct trans_opts
#define UPPER(c) (((c) >= 'a' && (c)<= 'z') ? (c) - 'a' + 'A' : (c))
#define FREE(p) if (p) { xfree(p); p = 0; }
#define SETNULL(p) if (p && strlen(p) == 0) { p = 0; }
// #define HERE(s) printf("%s\n", s)
// #define HERE(s) printf("%s\n", s)
#define HERE(s)

static long calculate_buffsize(XSQLDA *sqlda)
Expand Down Expand Up @@ -255,13 +255,13 @@ static VALUE fb_mkdate(struct tm *tm)
{
return rb_funcall(
rb_cDate, rb_intern("civil"), 3,
INT2FIX(1900 + tm->tm_year), INT2FIX(tm->tm_mon + 1), INT2FIX(tm->tm_mday));
INT2FIX(1900 + tm->tm_year), INT2FIX(tm->tm_mon + 1), INT2FIX(tm->tm_mday));
}

static int responds_like_date(VALUE obj)
{
return rb_respond_to(obj, rb_intern("year")) &&
rb_respond_to(obj, rb_intern("month")) &&
return rb_respond_to(obj, rb_intern("year")) &&
rb_respond_to(obj, rb_intern("month")) &&
rb_respond_to(obj, rb_intern("day"));
}
static void tm_from_date(struct tm *tm, VALUE date)
Expand Down Expand Up @@ -1532,7 +1532,7 @@ static void fb_cursor_set_inputparams(struct FbCursor *fb_cursor, long argc, VAL
offset = FB_ALIGN(offset, alignment);
var->sqldata = (char *)(fb_cursor->i_buffer + offset);
*(bool *)var->sqldata = obj;
offset += alignment;
offset += alignment;
break;
#endif
default :
Expand Down Expand Up @@ -1809,7 +1809,7 @@ static VALUE fb_cursor_fetch(struct FbCursor *fb_cursor)
dtp = var->sqltype & ~1;

/* Check if column is null */


if ((var->sqltype & 1) && (*var->sqlind < 0)) {
val = Qnil;
Expand Down Expand Up @@ -2937,7 +2937,7 @@ static VALUE database_s_drop(int argc, VALUE *argv, VALUE klass)
return database_drop(obj);
}

void Init_fb()
void Init_fb_ext()
{
rb_funcall(rb_mKernel, rb_intern("require"), 1, rb_str_new2("bigdecimal"));

Expand Down
28 changes: 18 additions & 10 deletions fb.gemspec
Original file line number Diff line number Diff line change
@@ -1,26 +1,34 @@
require 'rubygems'
# coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'fb/version'

Gem::Specification.new do |s|
s.name = "fb"
s.version = "0.9.0"
s.date = "2018-01-10"
s.version = Fb::VERSION
s.date = "2018-03-04"
s.summary = "Firebird database driver"
s.description = "Ruby Firebird Extension Library"
s.licenses = ["MIT"]
s.requirements = "Firebird client library fbclient.dll, libfbclient.so or Firebird.framework."
s.require_path = '.'
s.require_paths = ["lib", "ext"]
s.author = "Brent Rowland"
s.email = "[email protected]"
s.homepage = "http://github.com/rowland/fb"
s.test_file = "test/FbTestSuite.rb"
s.has_rdoc = true
s.extra_rdoc_files = ['README']
s.rdoc_options << '--title' << 'Fb -- Ruby Firebird Extension' << '--main' << 'README' << '-x' << 'test'
s.files = ['extconf.rb', 'fb.c', 'README', 'fb_extensions.rb'] + Dir.glob("test/*.rb")
# s.has_rdoc = true
# s.extra_rdoc_files = ['README']
# s.rdoc_options << '--title' << 'Fb -- Ruby Firebird Extension' << '--main' << 'README' << '-x' << 'test'
# s.files = ['ext/fb/extconf.rb', 'ext/fb/fb.c', 'README', 'lib/fb.rb'] + Dir.glob("test/*.rb")
s.files = `git ls-files`.split($/)
s.platform = case RUBY_PLATFORM
when /win32/ then Gem::Platform::WIN32
else
Gem::Platform::RUBY
end
s.extensions = ['extconf.rb'] if s.platform == Gem::Platform::RUBY
s.extensions = ['ext/fb/extconf.rb'] if s.platform == Gem::Platform::RUBY
s.add_development_dependency "rake", ">= 0"
s.add_development_dependency "rake-compiler", ">= 0"
if RUBY_VERSION =~ /^2/
s.add_development_dependency "minitest", ">= 0"
end
end
2 changes: 2 additions & 0 deletions fb_extensions.rb → lib/fb.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
require 'fb/fb_ext'

module Fb
class Connection
def execute_script(sql)
Expand Down
3 changes: 3 additions & 0 deletions lib/fb/version.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module Fb
VERSION = "0.10.0"
end
Loading