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 CHANGED
@@ -16,3 +16,4 @@ test/tmp
16
16
  test/version_tmp
17
17
  tmp
18
18
  *~
19
+ /.ruby-version
@@ -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 = group.free_cart_number if group
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
@@ -1,5 +1,5 @@
1
1
  module Rivendell
2
2
  module DB
3
- VERSION = "0.2"
3
+ VERSION = "0.3"
4
4
  end
5
5
  end
@@ -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
@@ -1,15 +1,15 @@
1
1
  namespace :db do
2
2
 
3
3
  def mysql_execute(database, command)
4
- system "echo \"#{command}\" | sudo -H mysql #{database}"
4
+ system "echo \"#{command}\" | mysql #{database}"
5
5
  end
6
6
 
7
7
  def mysql_load(database, file)
8
- system "sudo -H mysql #{database} < #{file}"
8
+ system "mysql #{database} < #{file}"
9
9
  end
10
10
 
11
11
  def mysql_admin(*args)
12
- system "sudo -H mysqladmin #{args.join(' ')}"
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
- hash: 15
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
- date: 2013-12-12 00:00:00 Z
19
- dependencies:
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
- type: :runtime
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
- hash: 3
41
- segments:
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
- type: :runtime
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
- hash: 3
55
- segments:
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
- type: :runtime
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
- hash: 3
69
- segments:
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
- type: :runtime
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
- hash: 3
83
- segments:
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
- type: :runtime
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
- hash: 3
97
- segments:
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
- type: :development
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
- hash: 3
111
- segments:
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
- type: :development
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
- hash: 3
125
- segments:
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
- type: :development
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
- hash: 3
139
- segments:
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
- type: :development
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
- hash: 3
153
- segments:
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
- type: :development
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
- hash: 3
167
- segments:
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
- type: :development
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
- hash: 3
181
- segments:
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
- version_requirements: *id012
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
- hash: 3
236
- segments:
246
+ requirements:
247
+ - - ! '>='
248
+ - !ruby/object:Gem::Version
249
+ version: '0'
250
+ segments:
237
251
  - 0
238
- version: "0"
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
- hash: 3
245
- segments:
255
+ requirements:
256
+ - - ! '>='
257
+ - !ruby/object:Gem::Version
258
+ version: '0'
259
+ segments:
246
260
  - 0
247
- version: "0"
261
+ hash: -4448408842086997654
248
262
  requirements: []
249
-
250
263
  rubyforge_project:
251
- rubygems_version: 1.8.24
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