[DRE-commits] [ruby-org] 151/303: Organize requires within the gem
Jérémy Bobbio
lunar at alioth.debian.org
Fri Aug 9 17:33:47 UTC 2013
This is an automated email from the git hooks/post-receive script.
lunar pushed a commit to branch master
in repository ruby-org.
commit 7d89a6a21b474a52e5f8863b6b97ec5737ad4f2d
Author: Waldemar Quevedo <waldemar.quevedo at gmail.com>
Date: Tue Jun 12 00:01:06 2012 +0900
Organize requires within the gem
---
bin/org-ruby | 6 +-----
lib/org-ruby.rb | 42 +++++++++++++++++-------------------
lib/org-ruby/headline.rb | 2 --
lib/org-ruby/html_output_buffer.rb | 3 ---
spec/headline_spec.rb | 2 +-
spec/line_spec.rb | 2 +-
spec/output_buffer_spec.rb | 2 +-
spec/parser_spec.rb | 2 +-
spec/regexp_helper_spec.rb | 2 +-
spec/spec_helper.rb | 4 +---
spec/textile_output_buffer_spec.rb | 2 +-
tasks/test_case.rake | 4 ----
12 files changed, 28 insertions(+), 45 deletions(-)
diff --git a/bin/org-ruby b/bin/org-ruby
index 2a2c33f..48e7e37 100755
--- a/bin/org-ruby
+++ b/bin/org-ruby
@@ -1,11 +1,7 @@
#!/usr/bin/env ruby
-
-require File.expand_path(
- File.join(File.dirname(__FILE__), %w[.. lib org-ruby]))
+require 'org-ruby'
require 'optparse'
-# Put your code here
-
options = {}
options_parser = OptionParser.new do |opts|
options[:help] = false
diff --git a/lib/org-ruby.rb b/lib/org-ruby.rb
index b32a8c0..43ed6c7 100644
--- a/lib/org-ruby.rb
+++ b/lib/org-ruby.rb
@@ -1,4 +1,22 @@
-unless defined? ::OrgRuby
+$:.unshift File.dirname(__FILE__) # For use/testing when no gem is installed
+
+# internal requires
+require 'org-ruby/parser'
+require 'org-ruby/regexp_helper'
+require 'org-ruby/line'
+require 'org-ruby/headline'
+require 'org-ruby/output_buffer'
+
+# HTML exporter
+require 'org-ruby/html_output_buffer'
+require 'org-ruby/html_symbol_replace'
+
+# Textile exporter
+require 'org-ruby/textile_output_buffer'
+require 'org-ruby/textile_symbol_replace'
+
+# Tilt support
+require 'org-ruby/tilt'
module OrgRuby
@@ -14,22 +32,6 @@ module OrgRuby
VERSION
end
- # Returns the library path for the module. If any arguments are given,
- # they will be joined to the end of the libray path using
- # <tt>File.join</tt>.
- #
- def self.libpath( *args )
- args.empty? ? LIBPATH : ::File.join(LIBPATH, args.flatten)
- end
-
- # Returns the lpath for the module. If any arguments are given,
- # they will be joined to the end of the path using
- # <tt>File.join</tt>.
- #
- def self.path( *args )
- args.empty? ? PATH : ::File.join(PATH, args.flatten)
- end
-
# Utility method used to require all files ending in .rb that lie in the
# directory below this file that has the same name as the filename passed
# in. Optionally, a specific _directory_ name can be passed in such that
@@ -43,8 +45,4 @@ module OrgRuby
Dir.glob(search_me).sort.each {|rb| require rb}
end
-end # module OrgmodeParser
-
-OrgRuby.require_all_libs_relative_to(__FILE__)
-
-end # unless defined?
+end
diff --git a/lib/org-ruby/headline.rb b/lib/org-ruby/headline.rb
index 33481bb..3b2ed7a 100644
--- a/lib/org-ruby/headline.rb
+++ b/lib/org-ruby/headline.rb
@@ -1,5 +1,3 @@
-require OrgRuby.libpath(*%w[org-ruby line])
-
module Orgmode
# Represents a headline in an orgmode file.
diff --git a/lib/org-ruby/html_output_buffer.rb b/lib/org-ruby/html_output_buffer.rb
index a29f3d9..437e96e 100644
--- a/lib/org-ruby/html_output_buffer.rb
+++ b/lib/org-ruby/html_output_buffer.rb
@@ -1,6 +1,3 @@
-require OrgRuby.libpath(*%w[org-ruby html_symbol_replace])
-require OrgRuby.libpath(*%w[org-ruby output_buffer])
-
module Orgmode
class HtmlOutputBuffer < OutputBuffer
diff --git a/spec/headline_spec.rb b/spec/headline_spec.rb
index 50cb19a..7fa7c45 100644
--- a/spec/headline_spec.rb
+++ b/spec/headline_spec.rb
@@ -1,4 +1,4 @@
-require File.join(File.dirname(__FILE__), %w[spec_helper])
+require 'spec_helper'
describe Orgmode::Headline do
diff --git a/spec/line_spec.rb b/spec/line_spec.rb
index 789fc88..e63a5c4 100644
--- a/spec/line_spec.rb
+++ b/spec/line_spec.rb
@@ -1,4 +1,4 @@
-require File.join(File.dirname(__FILE__), %w[spec_helper])
+require 'spec_helper'
describe Orgmode::Line do
diff --git a/spec/output_buffer_spec.rb b/spec/output_buffer_spec.rb
index 533d359..d2f3929 100644
--- a/spec/output_buffer_spec.rb
+++ b/spec/output_buffer_spec.rb
@@ -1,4 +1,4 @@
-require File.join(File.dirname(__FILE__), %w[spec_helper])
+require 'spec_helper'
describe Orgmode::OutputBuffer do
diff --git a/spec/parser_spec.rb b/spec/parser_spec.rb
index 7557ccb..3999453 100644
--- a/spec/parser_spec.rb
+++ b/spec/parser_spec.rb
@@ -1,4 +1,4 @@
-require File.join(File.dirname(__FILE__), %w[spec_helper])
+require 'spec_helper'
describe Orgmode::Parser do
it "should open ORG files" do
diff --git a/spec/regexp_helper_spec.rb b/spec/regexp_helper_spec.rb
index ae4f47d..e3d1933 100644
--- a/spec/regexp_helper_spec.rb
+++ b/spec/regexp_helper_spec.rb
@@ -1,4 +1,4 @@
-require File.join(File.dirname(__FILE__), %w[spec_helper])
+require 'spec_helper'
describe Orgmode::RegexpHelper do
it "should recognize simple markup" do
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index d350757..22103d3 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -1,6 +1,4 @@
-require File.expand_path(
- File.join(File.dirname(__FILE__), %w[.. lib org-ruby]))
-
+require 'org-ruby'
RememberFile = File.join(File.dirname(__FILE__), %w[data remember.org])
FreeformFile = File.join(File.dirname(__FILE__), %w[data freeform.org])
diff --git a/spec/textile_output_buffer_spec.rb b/spec/textile_output_buffer_spec.rb
index 0b1d4a5..1efe417 100644
--- a/spec/textile_output_buffer_spec.rb
+++ b/spec/textile_output_buffer_spec.rb
@@ -1,4 +1,4 @@
-require File.join(File.dirname(__FILE__), %w[spec_helper])
+require 'spec_helper'
describe Orgmode::TextileOutputBuffer do
it "should substitute / with _" do
diff --git a/tasks/test_case.rake b/tasks/test_case.rake
index 451362b..406704b 100644
--- a/tasks/test_case.rake
+++ b/tasks/test_case.rake
@@ -1,6 +1,3 @@
-require File.expand_path(
- File.join(File.dirname(__FILE__), %w[.. lib org-ruby]))
-
namespace :testcase do
@data_directory = File.join(File.dirname(__FILE__), "../spec/html_examples")
@@ -46,4 +43,3 @@ end
desc "Alias for testcase:list"
task :testcase => ["testcase:list"]
-
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/ruby-org.git
More information about the Pkg-ruby-extras-commits
mailing list