Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Using standard gem format.

  • Loading branch information...
commit 212e0200556687a545494b252e42e388692de197 1 parent eaf0f5f
@empjustine authored
View
10 Gemfile
@@ -1,8 +1,4 @@
-source 'http://rubygems.org'
-
-gem 'nokogiri', '~>1.5.0'
-gem 'rest-client', '~>1.6.7'
-gem 'resque', '~>1.20'
-
-gem 'rake', '0.9.2'
+source "http://rubygems.org"
+# Specify your gem's dependencies in lolcats.gemspec
+gemspec
View
1  Rakefile
@@ -0,0 +1 @@
+require "bundler/gem_tasks"
View
7 lib/peter_parser.rb
@@ -0,0 +1,7 @@
+require 'peter_parser/version'
+require 'peter_parser/errors.rb'
+require 'peter_parser/post_process.rb'
+require 'peter_parser/components.rb'
+require 'peter_parser/behaviours.rb'
+require 'peter_parser/parser.rb'
+require 'peter_parser/env_fixes.rb'
View
0  peter-parser/behaviours.rb → lib/peter_parser/behaviours.rb
File renamed without changes
View
24 peter-parser/components.rb → lib/peter_parser/components.rb
@@ -5,7 +5,7 @@ def _init_comp()
@postprocess = [] if not @postprocess
return true
end
-
+
def _do_pp(res)
_init_comp()
@postprocess.each{|proc|
@@ -13,13 +13,13 @@ def _do_pp(res)
}
return res
end
-
+
def extract(job)
res = _extract(job)
res = _do_pp(res)
return res
end
-
+
def pp_push(&block)
_init_comp()
if block
@@ -28,7 +28,7 @@ def pp_push(&block)
end
return false
end
-
+
def pproc(&block)
if block
block = PeterParser::PostProcess::Block.get(&block)
@@ -36,7 +36,7 @@ def pproc(&block)
end
return self
end
-
+
def iter(&block)
if block
iter = PeterParser::PostProcess::Iterator.get(&block)
@@ -44,7 +44,7 @@ def iter(&block)
end
return self
end
-
+
def to(*args, &block)
args.each{ |descriptor|
if self.class == Array and descriptor == Hash
@@ -63,10 +63,10 @@ def to(*args, &block)
return self
end
end
-
+
module NonNativeComponent
include Component
-
+
def initialize(*args, &block)
_init(*args, &block)
pproc(&block)
@@ -75,7 +75,7 @@ def initialize(*args, &block)
end
end
-require_relative './components/xpath_selector.rb'
-require_relative './components/ruleset.rb'
-require_relative './components/or.rb'
-require_relative './components/lazy_evaluator.rb'
+require 'peter_parser/components/xpath_selector.rb'
+require 'peter_parser/components/ruleset.rb'
+require 'peter_parser/components/or.rb'
+require 'peter_parser/components/lazy_evaluator.rb'
View
0  peter-parser/components/lazy_evaluator.rb → lib/peter_parser/components/lazy_evaluator.rb
File renamed without changes
View
0  peter-parser/components/or.rb → lib/peter_parser/components/or.rb
File renamed without changes
View
0  peter-parser/components/ruleset.rb → lib/peter_parser/components/ruleset.rb
File renamed without changes
View
0  peter-parser/components/xpath_selector.rb → lib/peter_parser/components/xpath_selector.rb
File renamed without changes
View
0  peter-parser/env_fixes.rb → lib/peter_parser/env_fixes.rb
File renamed without changes
View
0  peter-parser/errors.rb → lib/peter_parser/errors.rb
File renamed without changes
View
0  peter-parser/parser.rb → lib/peter_parser/parser.rb
File renamed without changes
View
0  peter-parser/post_process.rb → lib/peter_parser/post_process.rb
File renamed without changes
View
3  lib/peter_parser/version.rb
@@ -0,0 +1,3 @@
+module PeterParser
+ VERSION = "0.0.1.pre"
+end
View
7 peter-parser.rb
@@ -1,7 +0,0 @@
-require_relative './peter-parser/errors.rb'
-require_relative './peter-parser/post_process.rb'
-require_relative './peter-parser/components.rb'
-require_relative './peter-parser/behaviours.rb'
-require_relative './peter-parser/parser.rb'
-require_relative './peter-parser/env_fixes.rb'
-
View
21 peter_parser.gemspec
@@ -0,0 +1,21 @@
+# -*- encoding: utf-8 -*-
+$:.push File.expand_path('../lib', __FILE__)
+require 'peter_parser/version'
+
+Gem::Specification.new do |s|
+ s.name = 'peter_parser'
+ s.version = PeterParser::VERSION
+ s.authors = ['lggassert']
+ s.email = ['lggassert@gmail.com']
+ s.homepage = "https://github.com/lggassert/peter-parser'
+
+ s.files = `git ls-files`.split("\n")
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
+ s.require_paths = ['lib']
+
+ s.add_runtime_dependency 'nokogiri', ['~>1.5.0']
+ s.add_runtime_dependency 'rest-client', ['~>1.6.7']
+ s.add_runtime_dependency 'resque', ['~>1.20']
+ s.add_runtime_dependency 'rake', ['0.9.2']
+end
View
0  test.xml → test/assets/test.xml
File renamed without changes
View
8 test.rb → test/test.rb
@@ -1,15 +1,15 @@
# -*- encoding: utf-8 -*-
-require_relative './peter-parser'
+require 'peter_parser'
class TestParser < PeterParser::Parser
include PeterParser::XMLParser
#include PeterParser::LocalFile
@default_job = {
- #'url' => './test.xml',
+ #'url' => './assets/test.xml',
'url' => 'http://ws.audioscrobbler.com/1.0/user/lggassert/recenttracks.rss',
}
-
+
@extractor = R(
{
'a_number' => 222,
@@ -20,7 +20,7 @@ class TestParser < PeterParser::Parser
'some_info' => R({
'version' => x("/rss/@version", 0),
}),
- 'source' => 'last.fm',
+ 'source' => 'last.fm',
'or' => or_(x("//language", 1), "a"),
'url' => url,
},
Please sign in to comment.
Something went wrong with that request. Please try again.