relaxo-query-server 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -7,8 +7,6 @@ Relaxo Query Server
7
7
 
8
8
  The Relaxo Query Server implements the CouchDB Query Server protocol for CouchDB 1.1.0+. It provides a comprehensive Ruby-style view server along with full support for Design Document based processing.
9
9
 
10
- *This software is currently under development and not ready for stable production usage.*
11
-
12
10
  Installation
13
11
  ------------
14
12
 
@@ -118,7 +116,7 @@ To Do
118
116
  License
119
117
  -------
120
118
 
121
- Copyright (c) 2010, 2011 Samuel G. D. Williams. <http://www.oriontransfer.co.nz>
119
+ Copyright (c) 2010, 2012 Samuel G. D. Williams. <http://www.oriontransfer.co.nz>
122
120
 
123
121
  Permission is hereby granted, free of charge, to any person obtaining a copy
124
122
  of this software and associated documentation files (the "Software"), to deal
@@ -55,14 +55,16 @@ module Relaxo
55
55
  def instance
56
56
  unless @klass
57
57
  @klass = Class.new
58
+ @klass.const_set(:ROOT, @root)
58
59
 
59
60
  # Not sure if this is the best way to implement the `load` function
60
- @klass.const_set('ROOT', @root)
61
- @klass.class_exec(@root) do |root|
62
- @@root = root
63
-
61
+ @klass.class_eval do
62
+ def self.root
63
+ self.const_get(:ROOT)
64
+ end
65
+
64
66
  def self.load(path)
65
- Library.for(@@root, path)
67
+ Library.for(root, path)
66
68
  end
67
69
 
68
70
  def load(path)
@@ -23,7 +23,7 @@ module Relaxo
23
23
  module VERSION
24
24
  MAJOR = 0
25
25
  MINOR = 1
26
- TINY = 1
26
+ TINY = 2
27
27
 
28
28
  STRING = [MAJOR, MINOR, TINY].join('.')
29
29
  end
@@ -0,0 +1,9 @@
1
+
2
+ require 'rake/testtask'
3
+
4
+ Rake::TestTask.new do |t|
5
+ t.libs << 'test'
6
+ end
7
+
8
+ desc "Run tests"
9
+ task :default => :test
@@ -1,12 +1,16 @@
1
1
 
2
2
  $LOAD_PATH.unshift File.expand_path("../../lib/", __FILE__)
3
3
 
4
+ require 'rubygems'
4
5
  require 'test/unit'
5
6
  require 'stringio'
6
7
 
8
+ require "relaxo/json"
7
9
  require "relaxo/query_server"
8
10
 
9
- class ContextTest < Test::Unit::TestCase
11
+ class ContextualTestCase < Test::Unit::TestCase
12
+ undef_method :default_test
13
+
10
14
  def setup_context(options)
11
15
  @shell = Relaxo::QueryServer::MockShell.new
12
16
  @context = Relaxo::QueryServer::Context.new(@shell, options)
@@ -1,7 +1,7 @@
1
1
 
2
- require 'context_test'
2
+ require 'helper'
3
3
 
4
- class FiltersTest < ContextTest
4
+ class FiltersTest < ContextualTestCase
5
5
  BASIC = "lambda{|doc, req| doc['good'] == true}"
6
6
 
7
7
  def run_filter(opts={})
@@ -1,8 +1,11 @@
1
1
 
2
- require 'context_test'
2
+ require 'helper'
3
3
  require 'relaxo/query_server/library'
4
4
 
5
- class LibrariesTest < ContextTest
5
+ require 'bigdecimal'
6
+ require 'bigdecimal/util'
7
+
8
+ class LibrariesTest < ContextualTestCase
6
9
  def test_libraries
7
10
  root = {
8
11
  'lib' => {
@@ -14,7 +17,7 @@ class LibrariesTest < ContextTest
14
17
  load('lib/all')
15
18
 
16
19
  def bar
17
- 10.to_d
20
+ "10".to_d
18
21
  end
19
22
  }
20
23
  }
@@ -25,7 +28,7 @@ class LibrariesTest < ContextTest
25
28
  assert_not_nil object
26
29
  assert object.respond_to? :bar
27
30
 
28
- assert_equal 10.to_d, object.bar
31
+ assert_equal "10".to_d, object.bar
29
32
 
30
33
  # For efficiency, the same object is returned both times
31
34
  same_object = Relaxo::QueryServer::Library.for(root, 'lib/bar')
@@ -1,7 +1,7 @@
1
1
 
2
- require 'context_test'
2
+ require 'helper'
3
3
 
4
- class ListsTest < ContextTest
4
+ class ListsTest < ContextualTestCase
5
5
  ENTIRE = <<-RUBY
6
6
  lambda{|head,request|
7
7
  send "<ul>"
@@ -1,7 +1,7 @@
1
1
 
2
- require 'context_test'
2
+ require 'helper'
3
3
 
4
- class MapTest < ContextTest
4
+ class MapTest < ContextualTestCase
5
5
  def test_map
6
6
  response = @context.run ["add_fun", "lambda{|doc| emit('foo', doc['a']); emit('bar', doc['a'])}"]
7
7
  assert_equal true, response
@@ -1,7 +1,7 @@
1
1
 
2
- require 'context_test'
2
+ require 'helper'
3
3
 
4
- class ReduceTest < ContextTest
4
+ class ReduceTest < ContextualTestCase
5
5
  SUM = "lambda{|k,v,r| v.inject &:+ }"
6
6
  CONCAT = "lambda{|k,v,r| r ? v.join('_') : v.join(':') }"
7
7
 
@@ -1,7 +1,7 @@
1
1
 
2
- require 'context_test'
2
+ require 'helper'
3
3
 
4
- class ShowsTest < ContextTest
4
+ class ShowsTest < ContextualTestCase
5
5
  STRING = "lambda{|doc, req| [doc['title'], doc['body']].join(' - ') }"
6
6
  HASH = <<-EOF
7
7
  lambda{|doc, req|
@@ -1,7 +1,7 @@
1
1
 
2
- require 'context_test'
2
+ require 'helper'
3
3
 
4
- class UpdatesTest < ContextTest
4
+ class UpdatesTest < ContextualTestCase
5
5
  def test_compiles_functions
6
6
  create_design_document "test", {
7
7
  "updates" => {
@@ -1,7 +1,7 @@
1
1
 
2
- require 'context_test'
2
+ require 'helper'
3
3
 
4
- class ValidationsTest < ContextTest
4
+ class ValidationsTest < ContextualTestCase
5
5
  def test_compiles_functions
6
6
  create_design_document "test", {
7
7
  "validate_doc_update" => %q{
@@ -1,7 +1,7 @@
1
1
 
2
- require 'context_test'
2
+ require 'helper'
3
3
 
4
- class ViewsTest < ContextTest
4
+ class ViewsTest < ContextualTestCase
5
5
  def test_compiles_functions
6
6
  response = @context.run ["add_fun", "lambda {|doc| emit(nil, nil)}"]
7
7
  assert_equal true, response
metadata CHANGED
@@ -1,55 +1,59 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: relaxo-query-server
3
- version: !ruby/object:Gem::Version
4
- version: 0.1.1
5
- prerelease:
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 1
8
+ - 2
9
+ version: 0.1.2
6
10
  platform: ruby
7
- authors:
11
+ authors:
8
12
  - Samuel Williams
9
13
  autorequire:
10
14
  bindir: bin
11
15
  cert_chain: []
12
- date: 2012-07-22 00:00:00.000000000 Z
13
- dependencies:
14
- - !ruby/object:Gem::Dependency
16
+
17
+ date: 2012-10-14 00:00:00 +13:00
18
+ default_executable:
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
15
21
  name: relaxo
16
- requirement: !ruby/object:Gem::Requirement
17
- none: false
18
- requirements:
19
- - - ~>
20
- - !ruby/object:Gem::Version
21
- version: 0.3.1
22
- type: :runtime
23
22
  prerelease: false
24
- version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
- requirements:
27
- - - ~>
28
- - !ruby/object:Gem::Version
29
- version: 0.3.1
30
- - !ruby/object:Gem::Dependency
31
- name: json
32
- requirement: !ruby/object:Gem::Requirement
33
- none: false
34
- requirements:
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ requirements:
35
25
  - - ~>
36
- - !ruby/object:Gem::Version
37
- version: 1.7.3
26
+ - !ruby/object:Gem::Version
27
+ segments:
28
+ - 0
29
+ - 4
30
+ - 0
31
+ version: 0.4.0
38
32
  type: :runtime
33
+ version_requirements: *id001
34
+ - !ruby/object:Gem::Dependency
35
+ name: json
39
36
  prerelease: false
40
- version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
- requirements:
37
+ requirement: &id002 !ruby/object:Gem::Requirement
38
+ requirements:
43
39
  - - ~>
44
- - !ruby/object:Gem::Version
40
+ - !ruby/object:Gem::Version
41
+ segments:
42
+ - 1
43
+ - 7
44
+ - 3
45
45
  version: 1.7.3
46
+ type: :runtime
47
+ version_requirements: *id002
46
48
  description:
47
49
  email: samuel.williams@oriontransfer.co.nz
48
- executables:
50
+ executables:
49
51
  - relaxo-query-server
50
52
  extensions: []
53
+
51
54
  extra_rdoc_files: []
52
- files:
55
+
56
+ files:
53
57
  - bin/relaxo-query-server
54
58
  - lib/relaxo/query_server/context.rb
55
59
  - lib/relaxo/query_server/designer.rb
@@ -60,7 +64,7 @@ files:
60
64
  - lib/relaxo/query_server/shell.rb
61
65
  - lib/relaxo/query_server/version.rb
62
66
  - lib/relaxo/query_server.rb
63
- - test/context_test.rb
67
+ - test/helper.rb
64
68
  - test/test_filters.rb
65
69
  - test/test_libraries.rb
66
70
  - test/test_lists.rb
@@ -70,31 +74,37 @@ files:
70
74
  - test/test_updates.rb
71
75
  - test/test_validations.rb
72
76
  - test/test_views.rb
77
+ - rakefile.rb
73
78
  - README.md
79
+ has_rdoc: true
74
80
  homepage: http://www.oriontransfer.co.nz/gems/relaxo
75
81
  licenses: []
82
+
76
83
  post_install_message:
77
84
  rdoc_options: []
78
- require_paths:
85
+
86
+ require_paths:
79
87
  - lib
80
- required_ruby_version: !ruby/object:Gem::Requirement
81
- none: false
82
- requirements:
83
- - - ! '>='
84
- - !ruby/object:Gem::Version
85
- version: '0'
86
- required_rubygems_version: !ruby/object:Gem::Requirement
87
- none: false
88
- requirements:
89
- - - ! '>='
90
- - !ruby/object:Gem::Version
91
- version: '0'
88
+ required_ruby_version: !ruby/object:Gem::Requirement
89
+ requirements:
90
+ - - ">="
91
+ - !ruby/object:Gem::Version
92
+ segments:
93
+ - 0
94
+ version: "0"
95
+ required_rubygems_version: !ruby/object:Gem::Requirement
96
+ requirements:
97
+ - - ">="
98
+ - !ruby/object:Gem::Version
99
+ segments:
100
+ - 0
101
+ version: "0"
92
102
  requirements: []
103
+
93
104
  rubyforge_project:
94
- rubygems_version: 1.8.23
105
+ rubygems_version: 1.3.6
95
106
  signing_key:
96
107
  specification_version: 3
97
- summary: Relaxo Query Server provides support for executing CouchDB functions using
98
- Ruby.
108
+ summary: Relaxo Query Server provides support for executing CouchDB functions using Ruby.
99
109
  test_files: []
100
- has_rdoc:
110
+