Permalink
Browse files

added rspec and watchr stuff

  • Loading branch information...
1 parent 4abc1c5 commit fa6ce14761044dbc4854bc7335172e730151e2ef @longcao longcao committed Dec 1, 2011
Showing with 66 additions and 7 deletions.
  1. +2 −1 Rakefile
  2. +15 −0 spec/fixtures/demo_pig_script.pig.erb
  3. +16 −0 spec/spec_helper.rb
  4. +20 −0 spec/swineherd/template_spec.rb
  5. +13 −6 swineherd.gemspec
View
@@ -14,7 +14,8 @@ Jeweler::Tasks.new do |gem|
# Include your dependencies below. Runtime dependencies are required when using your gem,
# and development dependencies are only needed for development (ie running rake tasks, tests, etc)
# gem.add_runtime_dependency 'jabber4r', '> 0.1'
- # gem.add_development_dependency 'rspec', '> 1.2.3'
+ gem.add_development_dependency 'rspec', '> 2.7.0'
+ gem.add_development_dependency 'watchr', '> 0.7'
gem.add_development_dependency "yard", "~> 0.6.0"
gem.add_development_dependency "jeweler", "~> 1.5.2"
gem.add_development_dependency "rcov", ">= 0"
@@ -0,0 +1,15 @@
+graph = LOAD '<%= multigraph %>' AS (user_a_id:long, user_b_id:long, a_fo_b:int, b_fo_a:int, me_o:long, me_i:long, re_o:long, re_i:long, rt_o:long, rt_i:long);
+grouped = GROUP graph BY user_a_id PARALLEL <%= reduce_tasks %>;
+degrees = FOREACH grouped GENERATE
+ group AS uid,
+ SUM(graph.a_fo_b) AS fo_o,
+ SUM(graph.b_fo_a) AS fo_i,
+ SUM(graph.me_o) AS me_o,
+ SUM(graph.me_i) AS me_i,
+ SUM(graph.re_o) AS re_o,
+ SUM(graph.re_i) AS re_i,
+ SUM(graph.rt_o) AS rt_o,
+ SUM(graph.rt_i) AS rt_i
+ ;
+
+STORE degrees INTO '<%= degree_distribution %>';
View
@@ -0,0 +1,16 @@
+require 'rspec'
+require 'erubis'
+
+ROOT_DIR = File.expand_path('..',File.dirname(__FILE__))
+def ROOT_PATH(*paths)
+ File.expand_path(File.join(*paths), ROOT_DIR)
+end
+
+$LOAD_PATH.unshift(ROOT_PATH('lib'))
+
+# Configure rspec
+RSpec.configure do |config|
+ # config.include Cornelius::TestHelper, :example_group => {
+ # :file_path => /spec/
+ # }
+end
@@ -0,0 +1,20 @@
+require File.expand_path('../spec_helper', File.dirname(__FILE__))
+
+require 'swineherd/template'
+
+describe Swineherd::Template do
+ let(:demo_pig_script_filename){ ROOT_PATH('spec/fixtures/demo_pig_script_filename.pig.erb') }
+ let(:demo_pig_script){ Swineherd::Template.new(demo_pig_script_filename, :multigraph => 'my_multigraph', :reduce_tasks => 'reduce_tasks', :degree_distribution => 'my_degree_distribution' ) }
+ subject{ demo_pig_script }
+
+ it 'should work' do
+ demo_pig_script.should be_a(Swineherd::Template)
+ end
+
+ context '#contents' do
+ it 'autovivifies from its template' do
+ subject.content.should =~ /graph = LOAD .*my_degree_distribution';/
+ end
+ end
+
+end
View
@@ -8,10 +8,10 @@ Gem::Specification.new do |s|
s.version = "0.0.6"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
- s.authors = ["Jacob Perkins","Infochimps"]
- s.date = %q{2011-10-05}
+ s.authors = ["Jacob Perkins"]
+ s.date = %q{2011-12-01}
s.description = %q{Swineherd is for running scripts and workflows on filesystems.}
- s.email = ["jacob.a.perkins@gmail.com","coders@infochimps.com"]
+ s.email = %q{jacob.a.perkins@gmail.com}
s.executables = ["hdp-tree", "hadoop-stream"]
s.extra_rdoc_files = [
"LICENSE",
@@ -51,18 +51,21 @@ Gem::Specification.new do |s|
"swineherd.gemspec",
"tests/test_filesystem.rb",
"tests/test_s3_filesystem.rb",
- "tests/testcfg.yaml"
+ "tests/testcfg.yaml.example"
]
s.homepage = %q{http://github.com/Ganglion/swineherd}
s.licenses = ["MIT"]
s.require_paths = ["lib"]
- s.rubygems_version = %q{1.3.7}
+ s.rubygems_version = %q{1.3.6}
s.summary = %q{Flexible data workflow glue.}
if s.respond_to? :specification_version then
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
s.specification_version = 3
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
+ s.add_development_dependency(%q<rspec>, ["> 2.7.0"])
+ s.add_development_dependency(%q<watchr>, ["> 0.7"])
s.add_development_dependency(%q<yard>, ["~> 0.6.0"])
s.add_development_dependency(%q<jeweler>, ["~> 1.5.2"])
s.add_development_dependency(%q<rcov>, [">= 0"])
@@ -71,6 +74,8 @@ Gem::Specification.new do |s|
s.add_runtime_dependency(%q<erubis>, [">= 0"])
s.add_runtime_dependency(%q<right_aws>, [">= 0"])
else
+ s.add_dependency(%q<rspec>, ["> 2.7.0"])
+ s.add_dependency(%q<watchr>, ["> 0.7"])
s.add_dependency(%q<yard>, ["~> 0.6.0"])
s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
s.add_dependency(%q<rcov>, [">= 0"])
@@ -80,6 +85,8 @@ Gem::Specification.new do |s|
s.add_dependency(%q<right_aws>, [">= 0"])
end
else
+ s.add_dependency(%q<rspec>, ["> 2.7.0"])
+ s.add_dependency(%q<watchr>, ["> 0.7"])
s.add_dependency(%q<yard>, ["~> 0.6.0"])
s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
s.add_dependency(%q<rcov>, [">= 0"])

0 comments on commit fa6ce14

Please sign in to comment.