[DRE-commits] [ruby-browser] 04/04: Make tests run

Balasankar C balasankarc-guest at moszumanska.debian.org
Wed May 20 17:17:43 UTC 2015


This is an automated email from the git hooks/post-receive script.

balasankarc-guest pushed a commit to branch master
in repository ruby-browser.

commit 530d1f46e8bd18b75390c8f70be28c181fd601e3
Author: Balasankar C <balasankarc at autistici.org>
Date:   Wed May 20 22:42:00 2015 +0530

    Make tests run
---
 debian/dirs                  |  1 +
 debian/install               |  1 +
 debian/patches/bundler       | 12 ++++++++++++
 debian/patches/relative_path | 32 ++++++++++++++++++++++++++++++++
 debian/patches/series        |  2 ++
 debian/ruby-test-files.yaml  |  5 -----
 debian/ruby-tests.rake       |  6 ++++++
 debian/rules                 | 13 +++++++++++++
 8 files changed, 67 insertions(+), 5 deletions(-)

diff --git a/debian/dirs b/debian/dirs
new file mode 100644
index 0000000..eb6a64d
--- /dev/null
+++ b/debian/dirs
@@ -0,0 +1 @@
+/usr/share/ruby-browser
diff --git a/debian/install b/debian/install
new file mode 100644
index 0000000..2cc869f
--- /dev/null
+++ b/debian/install
@@ -0,0 +1 @@
+languages.yml /usr/share/ruby-browser
diff --git a/debian/patches/bundler b/debian/patches/bundler
new file mode 100644
index 0000000..06b2406
--- /dev/null
+++ b/debian/patches/bundler
@@ -0,0 +1,12 @@
+Description: Remove bundler dependency
+ Remove need of bundler while running tests.
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+--- a/test/spec_helper.rb
++++ b/test/spec_helper.rb
+@@ -1,5 +1,4 @@
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", __FILE__)
+-require "bundler/setup"
+ require "minitest/autorun"
+ require "minitest/unit"
+ require "browser"
diff --git a/debian/patches/relative_path b/debian/patches/relative_path
new file mode 100644
index 0000000..6e896ec
--- /dev/null
+++ b/debian/patches/relative_path
@@ -0,0 +1,32 @@
+Description: Fix relative path issue
+ Tweak the file open statement to point to /usr/share/ location
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+--- a/lib/browser/methods/language.rb
++++ b/lib/browser/methods/language.rb
+@@ -1,6 +1,10 @@
+ class Browser
+   module Language
+-    LANGUAGES = YAML.load_file(File.expand_path("../../../../languages.yml", __FILE__))
++    if File.exist?(File.expand_path("../../../../../../share/ruby-browser/languages.yml", __FILE__)) then
++        LANGUAGES = YAML.load_file(File.expand_path("../../../../../../share/ruby-browser/languages.yml", __FILE__))
++    else
++        LANGUAGES = YAML.load_file(File.expand_path("usr/share/ruby-browser/languages.yml", __FILE__))
++    end
+ 
+     # Set browser's preferred language
+     attr_writer :accept_language
+--- a/lib/browser/methods/bots.rb
++++ b/lib/browser/methods/bots.rb
+@@ -1,6 +1,10 @@
+ class Browser
+   module Bots
+-    root = Pathname.new(File.expand_path("../../../..", __FILE__))
++    if File.exist?(File.expand_path("../../../../../../share/ruby-browser/bots.yml", __FILE__)) and File.exist?(File.expand_path("../../../../../../share/ruby-browser/search_engines.yml", __FILE__)) then
++        root = Pathname.new(File.expand_path("../../../../../../share/ruby-browser/", __FILE__))
++    else
++        root = Pathname.new(File.expand_path("/usr/share/ruby-browser/", __FILE__))
++    end
+     BOTS = YAML.load_file(root.join("bots.yml"))
+     SEARCH_ENGINES = YAML.load_file(root.join("search_engines.yml"))
+ 
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..09159d5
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1,2 @@
+bundler
+relative_path
diff --git a/debian/ruby-test-files.yaml b/debian/ruby-test-files.yaml
deleted file mode 100644
index ae99f24..0000000
--- a/debian/ruby-test-files.yaml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-- test/browser_spec.rb
-- test/middleware_spec.rb
-- test/sample_app.rb
-- test/spec_helper.rb
diff --git a/debian/ruby-tests.rake b/debian/ruby-tests.rake
new file mode 100644
index 0000000..82c3c44
--- /dev/null
+++ b/debian/ruby-tests.rake
@@ -0,0 +1,6 @@
+require 'gem2deb/rake/testtask'
+
+Gem2Deb::Rake::TestTask.new do |t|
+  t.libs << 'test'
+  t.test_files = FileList['test/**/*_spec.rb']
+end
diff --git a/debian/rules b/debian/rules
index 5e904b3..454667d 100755
--- a/debian/rules
+++ b/debian/rules
@@ -13,3 +13,16 @@
 
 %:
 	dh $@ --buildsystem=ruby --with ruby
+override_dh_auto_install:
+	cp languages.yml debian/ruby-browser/usr/share/ruby-browser/
+	cp bots.yml debian/ruby-browser/usr/share/ruby-browser/
+	cp search_engines.yml debian/ruby-browser/usr/share/ruby-browser/
+	dh_auto_install
+override_dh_auto_clean:
+	if [ -e Gemfile.lock ]; then\
+	   	rm Gemfile.lock; \
+	fi
+	if [ -e log/* ]; then \
+		rm log/*; \
+	fi
+	dh_auto_clean

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/ruby-browser.git



More information about the Pkg-ruby-extras-commits mailing list