couch_potato 0.7.0.pre.1 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
data/.travis.yml CHANGED
@@ -1,8 +1,6 @@
1
1
  rvm:
2
2
  - 1.9.2
3
3
  - 1.9.3
4
- - 1.8.7
5
- - ree
6
4
  gemfile:
7
5
  - active_support_3_0
8
6
  - active_support_3_1
data/CHANGES.md CHANGED
@@ -11,6 +11,8 @@
11
11
  * improve compatibility with state_machine (Alexander Lang)
12
12
  * allow false as default value for properties (Matthias Jakel)
13
13
  * support for Erlang views (Alexander Lang)
14
+ * don't crash, only warn if couchdb.yml is missing (Alexander Lang)
15
+ * use the therubyracer gem to run view specs instead of relying on a `js` executable (Alexander Lang)
14
16
 
15
17
  ### 0.6.0
16
18
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- couch_potato (0.6.0)
4
+ couch_potato (0.7.0.pre.1)
5
5
  activemodel
6
6
  couchrest (>= 1.0.1)
7
7
  json (~> 1.6.0)
@@ -9,11 +9,11 @@ PATH
9
9
  GEM
10
10
  remote: http://rubygems.org/
11
11
  specs:
12
- activemodel (3.1.1)
13
- activesupport (= 3.1.1)
12
+ activemodel (3.2.1)
13
+ activesupport (= 3.2.1)
14
14
  builder (~> 3.0.0)
15
+ activesupport (3.2.1)
15
16
  i18n (~> 0.6)
16
- activesupport (3.1.1)
17
17
  multi_json (~> 1.0)
18
18
  builder (3.0.0)
19
19
  couchrest (1.1.2)
@@ -22,10 +22,10 @@ GEM
22
22
  rest-client (~> 1.6.1)
23
23
  diff-lcs (1.1.3)
24
24
  i18n (0.6.0)
25
- json (1.6.1)
25
+ json (1.6.5)
26
26
  libv8 (3.3.10.4)
27
- mime-types (1.16)
28
- multi_json (1.0.3)
27
+ mime-types (1.17.2)
28
+ multi_json (1.0.4)
29
29
  rake (0.9.2)
30
30
  rest-client (1.6.7)
31
31
  mime-types (>= 1.16)
data/README.md CHANGED
@@ -22,7 +22,7 @@ Lastly Couch Potato aims to provide a seamless integration with Ruby on Rails, e
22
22
 
23
23
  ### Supported Environments
24
24
 
25
- * Ruby 1.8.7, 1.9.2
25
+ * Ruby 1.9.2
26
26
  * CouchDB 1.1.0
27
27
 
28
28
  (Supported means I run the specs against those before releasing a new gem.)
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- couch_potato (0.6.0)
4
+ couch_potato (0.7.0.pre.1)
5
5
  activemodel
6
6
  couchrest (>= 1.0.1)
7
7
  json (~> 1.6.0)
@@ -21,10 +21,10 @@ GEM
21
21
  rest-client (~> 1.6.1)
22
22
  diff-lcs (1.1.2)
23
23
  i18n (0.5.0)
24
- json (1.6.1)
24
+ json (1.6.5)
25
25
  libv8 (3.3.10.4)
26
- mime-types (1.16)
27
- multi_json (1.0.3)
26
+ mime-types (1.17.2)
27
+ multi_json (1.0.4)
28
28
  rake (0.8.7)
29
29
  rest-client (1.6.7)
30
30
  mime-types (>= 1.16)
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- couch_potato (0.6.0)
4
+ couch_potato (0.7.0.pre.1)
5
5
  activemodel
6
6
  couchrest (>= 1.0.1)
7
7
  json (~> 1.6.0)
@@ -24,9 +24,9 @@ GEM
24
24
  rest-client (~> 1.6.1)
25
25
  diff-lcs (1.1.2)
26
26
  i18n (0.6.0)
27
- json (1.6.1)
27
+ json (1.6.5)
28
28
  libv8 (3.3.10.4)
29
- mime-types (1.16)
29
+ mime-types (1.17.2)
30
30
  multi_json (1.0.3)
31
31
  rake (0.9.2)
32
32
  rest-client (1.6.7)
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- couch_potato (0.6.0)
4
+ couch_potato (0.7.0.pre.1)
5
5
  activemodel
6
6
  couchrest (>= 1.0.1)
7
7
  json (~> 1.6.0)
@@ -64,6 +64,7 @@ module CouchPotato
64
64
 
65
65
  # returns the first result from a #view query or nil
66
66
  def first(spec)
67
+ spec.view_parameters = spec.view_parameters.merge({:limit => 1})
67
68
  view(spec).first
68
69
  end
69
70
 
@@ -3,13 +3,18 @@ require 'erb'
3
3
 
4
4
  module CouchPotato
5
5
  def self.rails_init
6
- config = YAML::load(ERB.new(File.read(Rails.root.join('config/couchdb.yml'))).result)[Rails.env]
7
- if config.is_a?(String)
8
- CouchPotato::Config.database_name = config
6
+ path = Rails.root.join('config/couchdb.yml')
7
+ if File.exist?(path)
8
+ config = YAML::load(ERB.new(File.read(path)).result)[Rails.env]
9
+ if config.is_a?(String)
10
+ CouchPotato::Config.database_name = config
11
+ else
12
+ CouchPotato::Config.database_name = config['database']
13
+ CouchPotato::Config.split_design_documents_per_view = config['split_design_documents_per_view'] if config['split_design_documents_per_view']
14
+ CouchPotato::Config.default_language = config['default_language'] if config['default_language']
15
+ end
9
16
  else
10
- CouchPotato::Config.database_name = config['database']
11
- CouchPotato::Config.split_design_documents_per_view = config['split_design_documents_per_view'] if config['split_design_documents_per_view']
12
- CouchPotato::Config.default_language = config['default_language'] if config['default_language']
17
+ Rails.logger.warn "Rails.root/config/couchdb.yml does not exist. Not configuring a database."
13
18
  end
14
19
  end
15
20
 
@@ -1,3 +1,3 @@
1
1
  module CouchPotato
2
- VERSION = "0.7.0.pre.1"
2
+ VERSION = "0.7.0"
3
3
  end
@@ -1,8 +1,9 @@
1
1
  module CouchPotato
2
2
  module View
3
3
  class BaseViewSpec
4
- attr_reader :reduce_function, :list_name, :list_function, :design_document, :view_name,
5
- :view_parameters, :klass, :options, :language
4
+ attr_reader :reduce_function, :list_name, :list_function, :design_document, :view_name, :klass, :options, :language
5
+ attr_accessor :view_parameters
6
+
6
7
  private :klass, :options
7
8
 
8
9
  def initialize(klass, view_name, options, view_parameters)
data/spec/railtie_spec.rb CHANGED
@@ -6,6 +6,7 @@ module Rails
6
6
  def self.env
7
7
  'test'
8
8
  end
9
+
9
10
  class Railtie
10
11
  def self.initializer(*args)
11
12
  end
@@ -14,6 +15,10 @@ module Rails
14
15
  def self.root
15
16
  RSpec::Mocks::Mock.new :join => ''
16
17
  end
18
+
19
+ def self.logger
20
+ RSpec::Mocks::Mock.new :warn => nil
21
+ end
17
22
  end
18
23
 
19
24
  require 'couch_potato/railtie'
@@ -29,6 +34,22 @@ describe "railtie" do
29
34
  CouchPotato::Config.default_language = @default_language
30
35
  end
31
36
 
37
+ before(:each) do
38
+ File.stub(exist?: true)
39
+ end
40
+
41
+ context 'when the yml file does not exist' do
42
+ before(:each) do
43
+ File.stub(exist?: false)
44
+ end
45
+
46
+ it 'does not configure the database' do
47
+ CouchPotato::Config.should_not_receive(:database_name=)
48
+
49
+ CouchPotato.rails_init
50
+ end
51
+ end
52
+
32
53
  context 'yaml file contains only database names' do
33
54
  it "should set the database name from the yaml file" do
34
55
  File.stub(:read => "test: test_db")
metadata CHANGED
@@ -1,19 +1,19 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: couch_potato
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0.pre.1
5
- prerelease: 6
4
+ version: 0.7.0
5
+ prerelease:
6
6
  platform: ruby
7
7
  authors:
8
8
  - Alexander Lang
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-04-17 00:00:00.000000000 Z
12
+ date: 2012-08-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: json
16
- requirement: &70113496423300 !ruby/object:Gem::Requirement
16
+ requirement: &70254093121880 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 1.6.0
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70113496423300
24
+ version_requirements: *70254093121880
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: couchrest
27
- requirement: &70113496422680 !ruby/object:Gem::Requirement
27
+ requirement: &70254093121340 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 1.0.1
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70113496422680
35
+ version_requirements: *70254093121340
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: activemodel
38
- requirement: &70113496422120 !ruby/object:Gem::Requirement
38
+ requirement: &70254093120940 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *70113496422120
46
+ version_requirements: *70254093120940
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: rspec
49
- requirement: &70113496421240 !ruby/object:Gem::Requirement
49
+ requirement: &70254093120100 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '2.0'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *70113496421240
57
+ version_requirements: *70254093120100
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: timecop
60
- requirement: &70113496436300 !ruby/object:Gem::Requirement
60
+ requirement: &70254093119400 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '0'
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *70113496436300
68
+ version_requirements: *70254093119400
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: tzinfo
71
- requirement: &70113496434780 !ruby/object:Gem::Requirement
71
+ requirement: &70254093134340 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: '0'
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *70113496434780
79
+ version_requirements: *70254093134340
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: rake
82
- requirement: &70113496434200 !ruby/object:Gem::Requirement
82
+ requirement: &70254093133340 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ! '>='
@@ -87,10 +87,10 @@ dependencies:
87
87
  version: '0'
88
88
  type: :development
89
89
  prerelease: false
90
- version_requirements: *70113496434200
90
+ version_requirements: *70254093133340
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: therubyracer
93
- requirement: &70113496433500 !ruby/object:Gem::Requirement
93
+ requirement: &70254093132300 !ruby/object:Gem::Requirement
94
94
  none: false
95
95
  requirements:
96
96
  - - ! '>='
@@ -98,7 +98,7 @@ dependencies:
98
98
  version: '0'
99
99
  type: :development
100
100
  prerelease: false
101
- version_requirements: *70113496433500
101
+ version_requirements: *70254093132300
102
102
  description: Ruby persistence layer for CouchDB
103
103
  email: alex@upstre.am
104
104
  executables: []
@@ -209,9 +209,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
209
209
  required_rubygems_version: !ruby/object:Gem::Requirement
210
210
  none: false
211
211
  requirements:
212
- - - ! '>'
212
+ - - ! '>='
213
213
  - !ruby/object:Gem::Version
214
- version: 1.3.1
214
+ version: '0'
215
215
  requirements: []
216
216
  rubyforge_project:
217
217
  rubygems_version: 1.8.11