rivendell-db 0.2 → 0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/lib/rivendell/db/cart.rb +20 -1
- data/lib/rivendell/db/version.rb +1 -1
- data/spec/rivendell/db/cart_spec.rb +19 -1
- data/tasks/db.rake +3 -3
- metadata +182 -169
data/.gitignore
CHANGED
data/lib/rivendell/db/cart.rb
CHANGED
@@ -18,7 +18,7 @@ class Rivendell::DB::Cart
|
|
18
18
|
before :valid?, :use_free_number
|
19
19
|
|
20
20
|
def use_free_number(context = :default)
|
21
|
-
self.number
|
21
|
+
self.number ||= group.free_cart_number if group
|
22
22
|
end
|
23
23
|
|
24
24
|
def self.duplicated(*fields)
|
@@ -31,4 +31,23 @@ class Rivendell::DB::Cart
|
|
31
31
|
{ :numbers => numbers, :fields => field_values }
|
32
32
|
end
|
33
33
|
end
|
34
|
+
|
35
|
+
property :sched_codes, String
|
36
|
+
|
37
|
+
def scheduler_codes
|
38
|
+
if sched_codes
|
39
|
+
sched_codes.scan(/.{11}/).map(&:strip)
|
40
|
+
else
|
41
|
+
[]
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def scheduler_codes=(scheduler_codes)
|
46
|
+
self.sched_codes =
|
47
|
+
if scheduler_codes and !scheduler_codes.empty?
|
48
|
+
scheduler_codes.uniq.sort.map { |c| c.ljust(11) }.join + "."
|
49
|
+
else
|
50
|
+
""
|
51
|
+
end
|
52
|
+
end
|
34
53
|
end
|
data/lib/rivendell/db/version.rb
CHANGED
@@ -5,7 +5,7 @@ describe Rivendell::DB::Cart do
|
|
5
5
|
let(:group) { Rivendell::DB::Group.create :name => "Dummy", :default_cart_range => 1..10 }
|
6
6
|
|
7
7
|
describe ".duplicated!" do
|
8
|
-
|
8
|
+
|
9
9
|
it "should return Carts " do
|
10
10
|
original = group.carts.create :title => "Example 1", :artist => "First Artist"
|
11
11
|
group.carts.create :title => "Example 2", :artist => "First Artist"
|
@@ -20,4 +20,22 @@ describe Rivendell::DB::Cart do
|
|
20
20
|
|
21
21
|
end
|
22
22
|
|
23
|
+
describe "#scheduler_codes" do
|
24
|
+
|
25
|
+
it "shoud parse sched_codes value" do
|
26
|
+
subject.sched_codes = "FRENCH REGGAE ."
|
27
|
+
subject.scheduler_codes.should =~ ["FRENCH", "REGGAE"]
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
|
32
|
+
describe "#scheduler_codes=" do
|
33
|
+
|
34
|
+
it "shoud generate sched_codes value" do
|
35
|
+
subject.scheduler_codes = ["REGGAE", "FRENCH"]
|
36
|
+
subject.sched_codes.should == "FRENCH REGGAE ."
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
|
23
41
|
end
|
data/tasks/db.rake
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
namespace :db do
|
2
2
|
|
3
3
|
def mysql_execute(database, command)
|
4
|
-
system "echo \"#{command}\" |
|
4
|
+
system "echo \"#{command}\" | mysql #{database}"
|
5
5
|
end
|
6
6
|
|
7
7
|
def mysql_load(database, file)
|
8
|
-
system "
|
8
|
+
system "mysql #{database} < #{file}"
|
9
9
|
end
|
10
10
|
|
11
11
|
def mysql_admin(*args)
|
12
|
-
system "
|
12
|
+
system "mysqladmin #{args.join(' ')}"
|
13
13
|
end
|
14
14
|
|
15
15
|
namespace :test do
|
metadata
CHANGED
@@ -1,201 +1,217 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: rivendell-db
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: '0.3'
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 2
|
9
|
-
version: "0.2"
|
10
6
|
platform: ruby
|
11
|
-
authors:
|
7
|
+
authors:
|
12
8
|
- Alban Peignier
|
13
9
|
- Florent Peyraud
|
14
10
|
autorequire:
|
15
11
|
bindir: bin
|
16
12
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
- !ruby/object:Gem::Dependency
|
21
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
22
|
-
none: false
|
23
|
-
requirements:
|
24
|
-
- - ">="
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
hash: 3
|
27
|
-
segments:
|
28
|
-
- 0
|
29
|
-
version: "0"
|
30
|
-
prerelease: false
|
13
|
+
date: 2014-09-29 00:00:00.000000000 Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
31
16
|
name: dm-core
|
32
|
-
|
33
|
-
version_requirements: *id001
|
34
|
-
- !ruby/object:Gem::Dependency
|
35
|
-
requirement: &id002 !ruby/object:Gem::Requirement
|
17
|
+
requirement: !ruby/object:Gem::Requirement
|
36
18
|
none: false
|
37
|
-
requirements:
|
38
|
-
- -
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
|
41
|
-
|
42
|
-
- 0
|
43
|
-
version: "0"
|
19
|
+
requirements:
|
20
|
+
- - ! '>='
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '0'
|
23
|
+
type: :runtime
|
44
24
|
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
none: false
|
27
|
+
requirements:
|
28
|
+
- - ! '>='
|
29
|
+
- !ruby/object:Gem::Version
|
30
|
+
version: '0'
|
31
|
+
- !ruby/object:Gem::Dependency
|
45
32
|
name: dm-mysql-adapter
|
46
|
-
|
47
|
-
version_requirements: *id002
|
48
|
-
- !ruby/object:Gem::Dependency
|
49
|
-
requirement: &id003 !ruby/object:Gem::Requirement
|
33
|
+
requirement: !ruby/object:Gem::Requirement
|
50
34
|
none: false
|
51
|
-
requirements:
|
52
|
-
- -
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
|
55
|
-
|
56
|
-
- 0
|
57
|
-
version: "0"
|
35
|
+
requirements:
|
36
|
+
- - ! '>='
|
37
|
+
- !ruby/object:Gem::Version
|
38
|
+
version: '0'
|
39
|
+
type: :runtime
|
58
40
|
prerelease: false
|
41
|
+
version_requirements: !ruby/object:Gem::Requirement
|
42
|
+
none: false
|
43
|
+
requirements:
|
44
|
+
- - ! '>='
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '0'
|
47
|
+
- !ruby/object:Gem::Dependency
|
59
48
|
name: dm-serializer
|
60
|
-
|
61
|
-
version_requirements: *id003
|
62
|
-
- !ruby/object:Gem::Dependency
|
63
|
-
requirement: &id004 !ruby/object:Gem::Requirement
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
64
50
|
none: false
|
65
|
-
requirements:
|
66
|
-
- -
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
|
69
|
-
|
70
|
-
- 0
|
71
|
-
version: "0"
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
type: :runtime
|
72
56
|
prerelease: false
|
57
|
+
version_requirements: !ruby/object:Gem::Requirement
|
58
|
+
none: false
|
59
|
+
requirements:
|
60
|
+
- - ! '>='
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '0'
|
63
|
+
- !ruby/object:Gem::Dependency
|
73
64
|
name: dm-types
|
74
|
-
|
75
|
-
version_requirements: *id004
|
76
|
-
- !ruby/object:Gem::Dependency
|
77
|
-
requirement: &id005 !ruby/object:Gem::Requirement
|
65
|
+
requirement: !ruby/object:Gem::Requirement
|
78
66
|
none: false
|
79
|
-
requirements:
|
80
|
-
- -
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
|
83
|
-
|
84
|
-
- 0
|
85
|
-
version: "0"
|
67
|
+
requirements:
|
68
|
+
- - ! '>='
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: '0'
|
71
|
+
type: :runtime
|
86
72
|
prerelease: false
|
73
|
+
version_requirements: !ruby/object:Gem::Requirement
|
74
|
+
none: false
|
75
|
+
requirements:
|
76
|
+
- - ! '>='
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: '0'
|
79
|
+
- !ruby/object:Gem::Dependency
|
87
80
|
name: dm-validations
|
88
|
-
|
89
|
-
version_requirements: *id005
|
90
|
-
- !ruby/object:Gem::Dependency
|
91
|
-
requirement: &id006 !ruby/object:Gem::Requirement
|
81
|
+
requirement: !ruby/object:Gem::Requirement
|
92
82
|
none: false
|
93
|
-
requirements:
|
94
|
-
- -
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
|
97
|
-
|
98
|
-
- 0
|
99
|
-
version: "0"
|
83
|
+
requirements:
|
84
|
+
- - ! '>='
|
85
|
+
- !ruby/object:Gem::Version
|
86
|
+
version: '0'
|
87
|
+
type: :runtime
|
100
88
|
prerelease: false
|
89
|
+
version_requirements: !ruby/object:Gem::Requirement
|
90
|
+
none: false
|
91
|
+
requirements:
|
92
|
+
- - ! '>='
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: '0'
|
95
|
+
- !ruby/object:Gem::Dependency
|
101
96
|
name: simplecov
|
102
|
-
|
103
|
-
version_requirements: *id006
|
104
|
-
- !ruby/object:Gem::Dependency
|
105
|
-
requirement: &id007 !ruby/object:Gem::Requirement
|
97
|
+
requirement: !ruby/object:Gem::Requirement
|
106
98
|
none: false
|
107
|
-
requirements:
|
108
|
-
- -
|
109
|
-
- !ruby/object:Gem::Version
|
110
|
-
|
111
|
-
|
112
|
-
- 0
|
113
|
-
version: "0"
|
99
|
+
requirements:
|
100
|
+
- - ! '>='
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: '0'
|
103
|
+
type: :development
|
114
104
|
prerelease: false
|
105
|
+
version_requirements: !ruby/object:Gem::Requirement
|
106
|
+
none: false
|
107
|
+
requirements:
|
108
|
+
- - ! '>='
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
115
112
|
name: rspec
|
116
|
-
|
117
|
-
version_requirements: *id007
|
118
|
-
- !ruby/object:Gem::Dependency
|
119
|
-
requirement: &id008 !ruby/object:Gem::Requirement
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
120
114
|
none: false
|
121
|
-
requirements:
|
122
|
-
- -
|
123
|
-
- !ruby/object:Gem::Version
|
124
|
-
|
125
|
-
|
126
|
-
- 0
|
127
|
-
version: "0"
|
115
|
+
requirements:
|
116
|
+
- - ! '>='
|
117
|
+
- !ruby/object:Gem::Version
|
118
|
+
version: '0'
|
119
|
+
type: :development
|
128
120
|
prerelease: false
|
121
|
+
version_requirements: !ruby/object:Gem::Requirement
|
122
|
+
none: false
|
123
|
+
requirements:
|
124
|
+
- - ! '>='
|
125
|
+
- !ruby/object:Gem::Version
|
126
|
+
version: '0'
|
127
|
+
- !ruby/object:Gem::Dependency
|
129
128
|
name: guard
|
130
|
-
|
131
|
-
version_requirements: *id008
|
132
|
-
- !ruby/object:Gem::Dependency
|
133
|
-
requirement: &id009 !ruby/object:Gem::Requirement
|
129
|
+
requirement: !ruby/object:Gem::Requirement
|
134
130
|
none: false
|
135
|
-
requirements:
|
136
|
-
- -
|
137
|
-
- !ruby/object:Gem::Version
|
138
|
-
|
139
|
-
|
140
|
-
- 0
|
141
|
-
version: "0"
|
131
|
+
requirements:
|
132
|
+
- - ! '>='
|
133
|
+
- !ruby/object:Gem::Version
|
134
|
+
version: '0'
|
135
|
+
type: :development
|
142
136
|
prerelease: false
|
137
|
+
version_requirements: !ruby/object:Gem::Requirement
|
138
|
+
none: false
|
139
|
+
requirements:
|
140
|
+
- - ! '>='
|
141
|
+
- !ruby/object:Gem::Version
|
142
|
+
version: '0'
|
143
|
+
- !ruby/object:Gem::Dependency
|
143
144
|
name: guard-rspec
|
144
|
-
|
145
|
-
version_requirements: *id009
|
146
|
-
- !ruby/object:Gem::Dependency
|
147
|
-
requirement: &id010 !ruby/object:Gem::Requirement
|
145
|
+
requirement: !ruby/object:Gem::Requirement
|
148
146
|
none: false
|
149
|
-
requirements:
|
150
|
-
- -
|
151
|
-
- !ruby/object:Gem::Version
|
152
|
-
|
153
|
-
|
154
|
-
- 0
|
155
|
-
version: "0"
|
147
|
+
requirements:
|
148
|
+
- - ! '>='
|
149
|
+
- !ruby/object:Gem::Version
|
150
|
+
version: '0'
|
151
|
+
type: :development
|
156
152
|
prerelease: false
|
153
|
+
version_requirements: !ruby/object:Gem::Requirement
|
154
|
+
none: false
|
155
|
+
requirements:
|
156
|
+
- - ! '>='
|
157
|
+
- !ruby/object:Gem::Version
|
158
|
+
version: '0'
|
159
|
+
- !ruby/object:Gem::Dependency
|
157
160
|
name: rake
|
158
|
-
|
159
|
-
version_requirements: *id010
|
160
|
-
- !ruby/object:Gem::Dependency
|
161
|
-
requirement: &id011 !ruby/object:Gem::Requirement
|
161
|
+
requirement: !ruby/object:Gem::Requirement
|
162
162
|
none: false
|
163
|
-
requirements:
|
164
|
-
- -
|
165
|
-
- !ruby/object:Gem::Version
|
166
|
-
|
167
|
-
|
168
|
-
- 0
|
169
|
-
version: "0"
|
163
|
+
requirements:
|
164
|
+
- - ! '>='
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: '0'
|
167
|
+
type: :development
|
170
168
|
prerelease: false
|
169
|
+
version_requirements: !ruby/object:Gem::Requirement
|
170
|
+
none: false
|
171
|
+
requirements:
|
172
|
+
- - ! '>='
|
173
|
+
- !ruby/object:Gem::Version
|
174
|
+
version: '0'
|
175
|
+
- !ruby/object:Gem::Dependency
|
171
176
|
name: dm-transactions
|
172
|
-
|
173
|
-
version_requirements: *id011
|
174
|
-
- !ruby/object:Gem::Dependency
|
175
|
-
requirement: &id012 !ruby/object:Gem::Requirement
|
177
|
+
requirement: !ruby/object:Gem::Requirement
|
176
178
|
none: false
|
177
|
-
requirements:
|
178
|
-
- -
|
179
|
-
- !ruby/object:Gem::Version
|
180
|
-
|
181
|
-
|
182
|
-
- 0
|
183
|
-
version: "0"
|
179
|
+
requirements:
|
180
|
+
- - ! '>='
|
181
|
+
- !ruby/object:Gem::Version
|
182
|
+
version: '0'
|
183
|
+
type: :development
|
184
184
|
prerelease: false
|
185
|
+
version_requirements: !ruby/object:Gem::Requirement
|
186
|
+
none: false
|
187
|
+
requirements:
|
188
|
+
- - ! '>='
|
189
|
+
- !ruby/object:Gem::Version
|
190
|
+
version: '0'
|
191
|
+
- !ruby/object:Gem::Dependency
|
185
192
|
name: rdoc
|
193
|
+
requirement: !ruby/object:Gem::Requirement
|
194
|
+
none: false
|
195
|
+
requirements:
|
196
|
+
- - ! '>='
|
197
|
+
- !ruby/object:Gem::Version
|
198
|
+
version: '0'
|
186
199
|
type: :development
|
187
|
-
|
200
|
+
prerelease: false
|
201
|
+
version_requirements: !ruby/object:Gem::Requirement
|
202
|
+
none: false
|
203
|
+
requirements:
|
204
|
+
- - ! '>='
|
205
|
+
- !ruby/object:Gem::Version
|
206
|
+
version: '0'
|
188
207
|
description: Rivendell database mapping
|
189
|
-
email:
|
208
|
+
email:
|
190
209
|
- alban@tryphon.eu
|
191
210
|
- florent@tryphon.eu
|
192
211
|
executables: []
|
193
|
-
|
194
212
|
extensions: []
|
195
|
-
|
196
213
|
extra_rdoc_files: []
|
197
|
-
|
198
|
-
files:
|
214
|
+
files:
|
199
215
|
- .gitignore
|
200
216
|
- COPYING
|
201
217
|
- COPYRIGHT
|
@@ -221,38 +237,35 @@ files:
|
|
221
237
|
- tasks/rspec.rake
|
222
238
|
homepage: http://projects.tryphon.eu/projects/rivendell-db
|
223
239
|
licenses: []
|
224
|
-
|
225
240
|
post_install_message:
|
226
241
|
rdoc_options: []
|
227
|
-
|
228
|
-
require_paths:
|
242
|
+
require_paths:
|
229
243
|
- lib
|
230
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
244
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
231
245
|
none: false
|
232
|
-
requirements:
|
233
|
-
- -
|
234
|
-
- !ruby/object:Gem::Version
|
235
|
-
|
236
|
-
segments:
|
246
|
+
requirements:
|
247
|
+
- - ! '>='
|
248
|
+
- !ruby/object:Gem::Version
|
249
|
+
version: '0'
|
250
|
+
segments:
|
237
251
|
- 0
|
238
|
-
|
239
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
252
|
+
hash: -4448408842086997654
|
253
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
240
254
|
none: false
|
241
|
-
requirements:
|
242
|
-
- -
|
243
|
-
- !ruby/object:Gem::Version
|
244
|
-
|
245
|
-
segments:
|
255
|
+
requirements:
|
256
|
+
- - ! '>='
|
257
|
+
- !ruby/object:Gem::Version
|
258
|
+
version: '0'
|
259
|
+
segments:
|
246
260
|
- 0
|
247
|
-
|
261
|
+
hash: -4448408842086997654
|
248
262
|
requirements: []
|
249
|
-
|
250
263
|
rubyforge_project:
|
251
|
-
rubygems_version: 1.8.
|
264
|
+
rubygems_version: 1.8.23
|
252
265
|
signing_key:
|
253
266
|
specification_version: 3
|
254
267
|
summary: Access to Rivendell database
|
255
|
-
test_files:
|
268
|
+
test_files:
|
256
269
|
- spec/rivendell/db/cart_spec.rb
|
257
270
|
- spec/rivendell/db/cut_spec.rb
|
258
271
|
- spec/rivendell/db/group_spec.rb
|