lucid_works 0.6.15 → 0.6.16
Sign up to get free protection for your applications and to get access to all the features.
- data/config/locales/en.yml +1 -1
- data/lib/lucid_works/collection/activity.rb +0 -27
- data/lib/lucid_works/collection.rb +16 -1
- data/lib/lucid_works/gem_version.rb +3 -0
- data/lib/lucid_works/version.rb +0 -2
- data/lucid_works.gemspec +1 -1
- data/spec/lib/lucid_works/collection/activity_spec.rb +0 -124
- data/spec/lib/lucid_works/collection/prime_activities_spec.rb +1 -1
- metadata +77 -83
data/config/locales/en.yml
CHANGED
@@ -81,7 +81,7 @@ en:
|
|
81
81
|
query_time_stopwords: Include stop words in searches
|
82
82
|
query_time_synonyms: Use synomyms
|
83
83
|
search_server_list: Search server list
|
84
|
-
show_similar: Show similar
|
84
|
+
show_similar: Show "find similar" links
|
85
85
|
spellcheck: Spell-check
|
86
86
|
ssl: SSL
|
87
87
|
stopword_list: Stopword list
|
@@ -176,33 +176,6 @@ module LucidWorks
|
|
176
176
|
save
|
177
177
|
end
|
178
178
|
|
179
|
-
def human_readable_period
|
180
|
-
case
|
181
|
-
when result = exact('weeks', period) then [result, 'weeks']
|
182
|
-
when result = exact('days', period) then [result, 'days']
|
183
|
-
when hours = exact('hours', period) then [hours, 'hours']
|
184
|
-
when period < 1.hours then [1, 'hours']
|
185
|
-
else [(period / 1.hours).round, 'hours']
|
186
|
-
end
|
187
|
-
end
|
188
|
-
|
189
|
-
def human_readable_period=(params)
|
190
|
-
number, type, junk = params
|
191
|
-
raise "invalid parameters #{number.class}, #{type.class}, #{junk.nil? ? 'nothing extra' : extra.class}" unless number.is_a?(Fixnum) && type.is_a?(String) && junk.nil?
|
192
|
-
raise "invalid parameters #{type}" unless %(hours days weeks).include?(type.to_s)
|
193
|
-
number = number.to_i
|
194
|
-
self.period = number * 1.send(type).to_i
|
195
|
-
[number, type]
|
196
|
-
end
|
197
|
-
|
198
|
-
def ruby_start_time
|
199
|
-
Time.iso8601 self.start_time
|
200
|
-
end
|
201
|
-
|
202
|
-
def ruby_start_time=(time_value)
|
203
|
-
self.start_time = time_value.iso8601
|
204
|
-
end
|
205
|
-
|
206
179
|
private
|
207
180
|
|
208
181
|
def exact(interval, period)
|
@@ -24,15 +24,30 @@ module LucidWorks
|
|
24
24
|
build_index.destroy(:params => {:key => 'iaccepttherisk'})
|
25
25
|
end
|
26
26
|
|
27
|
+
# Sometimes we want to use the raw Rsolr class, instead of Rsolr::Ext
|
27
28
|
def rsolr
|
28
29
|
unless @rsolr
|
29
30
|
server_uri = self.server.host
|
30
31
|
@path_prefix = URI.parse(server_uri).path # The API key
|
31
|
-
@rsolr = RSolr
|
32
|
+
@rsolr = RSolr.connect :url => server_uri.dup
|
32
33
|
end
|
33
34
|
@rsolr
|
34
35
|
end
|
35
36
|
|
37
|
+
def rsolr_ext
|
38
|
+
unless @rsolr_ext
|
39
|
+
server_uri = self.server.host
|
40
|
+
@path_prefix = URI.parse(server_uri).path # The API key
|
41
|
+
@rsolr_ext = RSolr::Ext.connect :url => server_uri.dup
|
42
|
+
end
|
43
|
+
@rsolr_ext
|
44
|
+
end
|
45
|
+
|
46
|
+
# Lower level access to rsolr, for things like autocomplete queries
|
47
|
+
def rsolr_get(path_suffix, search_params)
|
48
|
+
rsolr.get "#{@path_prefix}/solr/#{name}/#{path_suffix}", :params => search_params
|
49
|
+
end
|
50
|
+
|
36
51
|
# Perform a Solr search using RSolr
|
37
52
|
def search(search_params={})
|
38
53
|
search_params[:page] ||= 1
|
data/lib/lucid_works/version.rb
CHANGED
data/lucid_works.gemspec
CHANGED
@@ -388,128 +388,4 @@ describe LucidWorks::Collection::Activity do
|
|
388
388
|
end
|
389
389
|
end
|
390
390
|
end
|
391
|
-
|
392
|
-
# context "Custom Activity schedule functionality" do
|
393
|
-
# before :all do
|
394
|
-
# @server = connect_to_live_server
|
395
|
-
# @server.reset_collections!
|
396
|
-
# @collection = @server.collections!.first
|
397
|
-
# end
|
398
|
-
#
|
399
|
-
# def activity_count
|
400
|
-
# @collection.activities!.size
|
401
|
-
# end
|
402
|
-
#
|
403
|
-
# class LucidWorks::Collection::Activity
|
404
|
-
# def history_size
|
405
|
-
# self.histories!.size
|
406
|
-
# end
|
407
|
-
# end
|
408
|
-
#
|
409
|
-
# describe "CRUD" do
|
410
|
-
# describe ".create"do
|
411
|
-
# context "with invalid parameters" do
|
412
|
-
# before do
|
413
|
-
# @activity_params = {:type => 'bogus', :start_time => 8600}
|
414
|
-
# end
|
415
|
-
#
|
416
|
-
# it "should not create, and should add errors to model" do
|
417
|
-
# a = nil
|
418
|
-
# lambda {
|
419
|
-
# a = LucidWorks::Collection::Activity.create(@activity_params.merge(:parent => @collection))
|
420
|
-
# }.should_not change(self, :activity_count)
|
421
|
-
# a.should_not be_persisted
|
422
|
-
# a.errors[:type].should_not be_blank
|
423
|
-
# end
|
424
|
-
# end
|
425
|
-
#
|
426
|
-
# context "with valid parameters" do
|
427
|
-
# before do
|
428
|
-
# @activity_params = {:type => 'optimize', :start_time => 8600}
|
429
|
-
# end
|
430
|
-
# it "should create a new activity" do
|
431
|
-
# a = nil
|
432
|
-
# lambda {
|
433
|
-
# a = LucidWorks::Collection::Activity.create(@activity_params.merge(:parent => @collection))
|
434
|
-
# }.should change(self, :activity_count).by(1)
|
435
|
-
# a.should be_persisted
|
436
|
-
# a.errors[:type].should be_blank
|
437
|
-
# end
|
438
|
-
# end
|
439
|
-
#
|
440
|
-
# describe ".find" do
|
441
|
-
# before do
|
442
|
-
# @activity = LucidWorks::Collection::Activity.create(
|
443
|
-
# :type => 'optimize',
|
444
|
-
# :start_time => 8600,
|
445
|
-
# :collection => @collection
|
446
|
-
# )
|
447
|
-
# @activity.should be_persisted
|
448
|
-
# end
|
449
|
-
#
|
450
|
-
# it "should return a valid activity" do
|
451
|
-
# a = LucidWorks::Collection::Activity.find(@activity.id, :parent => @collection)
|
452
|
-
# a.should be_a(LucidWorks::Collection::Activity)
|
453
|
-
# end
|
454
|
-
#
|
455
|
-
# %w{ type period start_time }.each do |attr|
|
456
|
-
# it "should have a value for #{attr}" do
|
457
|
-
# @activity.send(attr.to_sym).should_not be_nil
|
458
|
-
# end
|
459
|
-
# end
|
460
|
-
# end
|
461
|
-
#
|
462
|
-
# describe "#start" do
|
463
|
-
# before do
|
464
|
-
# @activity = LucidWorks::Collection::Activity.first(:parent => @collection)
|
465
|
-
# end
|
466
|
-
#
|
467
|
-
# # can't check #running? b/c w/out a big index, operation is done faster than we can check
|
468
|
-
#
|
469
|
-
# it "should create a new history" do
|
470
|
-
# lambda {
|
471
|
-
# @collection.activities!.first.start
|
472
|
-
# }.should change(@activity, :history_size).by(1)
|
473
|
-
# end
|
474
|
-
# end
|
475
|
-
#
|
476
|
-
# describe "#human_readable_period" do
|
477
|
-
# it "should return hours if divisible by 1.hours but not by 1.days or 1.weeks" do
|
478
|
-
# activity = LucidWorks::Collection::Activity.new(:period => 3600*2, :parent => @collection)
|
479
|
-
# activity.human_readable_period.should == [2, 'hours']
|
480
|
-
# end
|
481
|
-
# it "should return nearest hours if not divisible by 1.hours"do
|
482
|
-
# activity = LucidWorks::Collection::Activity.new(:period => 3600*2.4, :parent => @collection)
|
483
|
-
# activity.human_readable_period.should == [2, 'hours']
|
484
|
-
# activity = LucidWorks::Collection::Activity.new(:period => 3600*4.6, :parent => @collection)
|
485
|
-
# activity.human_readable_period.should == [5, 'hours']
|
486
|
-
# activity = LucidWorks::Collection::Activity.new(:period => 3600*10.01, :parent => @collection)
|
487
|
-
# activity.human_readable_period.should == [10, 'hours']
|
488
|
-
# end
|
489
|
-
# it "should return 1 hours if < 1.hours"do
|
490
|
-
# activity = LucidWorks::Collection::Activity.new(:period => 3599, :parent => @collection)
|
491
|
-
# activity.human_readable_period.should == [1, 'hours']
|
492
|
-
# end
|
493
|
-
# it "should return days if divisible by 1.days but not 1.weeks" do
|
494
|
-
# activity = LucidWorks::Collection::Activity.new(:period => 3600*48, :parent => @collection)
|
495
|
-
# activity.human_readable_period.should == [2, 'days']
|
496
|
-
# end
|
497
|
-
# it "should return weeks if divisible by 1.weeks" do
|
498
|
-
# activity = LucidWorks::Collection::Activity.new(:period => 3600*24*7, :parent => @collection)
|
499
|
-
# activity.human_readable_period.should == [1, 'weeks']
|
500
|
-
# end
|
501
|
-
# end
|
502
|
-
#
|
503
|
-
# describe "#human_readable_period=" do
|
504
|
-
# it "should set correct period if given a number and hours/days/weeks" do
|
505
|
-
# activity = LucidWorks::Collection::Activity.new(:parent => @collection)
|
506
|
-
# activity.human_readable_period = [2, 'hours']
|
507
|
-
# activity.period.should == 3600*2
|
508
|
-
# activity.human_readable_period = [2, 'days']
|
509
|
-
# activity.period.should == 3600*2*24
|
510
|
-
# end
|
511
|
-
# end
|
512
|
-
# end
|
513
|
-
# end
|
514
|
-
# end
|
515
391
|
end
|
@@ -72,7 +72,7 @@ describe "LucidWorks::Collection#prime_activities" do
|
|
72
72
|
end
|
73
73
|
|
74
74
|
it "should have start times at least an hour apart for each activity" do
|
75
|
-
start_times = @collection.activities!.map(&:start_time).
|
75
|
+
start_times = @collection.activities!.map(&:start_time).sort
|
76
76
|
last_time = nil
|
77
77
|
start_times.each do |time|
|
78
78
|
(last_time = time) && next unless last_time
|
metadata
CHANGED
@@ -1,105 +1,101 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: lucid_works
|
3
|
-
version: !ruby/object:Gem::Version
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.6.16
|
4
5
|
prerelease:
|
5
|
-
version: 0.6.15
|
6
6
|
platform: ruby
|
7
|
-
authors:
|
7
|
+
authors:
|
8
8
|
- Sam Pierson
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
|
13
|
-
date: 2011-06-08 00:00:00 -04:00
|
12
|
+
date: 2011-06-12 00:00:00.000000000 +01:00
|
14
13
|
default_executable:
|
15
|
-
dependencies:
|
16
|
-
- !ruby/object:Gem::Dependency
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
17
16
|
name: activesupport
|
18
|
-
|
19
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
17
|
+
requirement: &2168834560 !ruby/object:Gem::Requirement
|
20
18
|
none: false
|
21
|
-
requirements:
|
22
|
-
- -
|
23
|
-
- !ruby/object:Gem::Version
|
24
|
-
version:
|
19
|
+
requirements:
|
20
|
+
- - ! '>='
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '3'
|
25
23
|
type: :runtime
|
26
|
-
version_requirements: *id001
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: activemodel
|
29
24
|
prerelease: false
|
30
|
-
|
25
|
+
version_requirements: *2168834560
|
26
|
+
- !ruby/object:Gem::Dependency
|
27
|
+
name: activemodel
|
28
|
+
requirement: &2168834060 !ruby/object:Gem::Requirement
|
31
29
|
none: false
|
32
|
-
requirements:
|
33
|
-
- -
|
34
|
-
- !ruby/object:Gem::Version
|
35
|
-
version:
|
30
|
+
requirements:
|
31
|
+
- - ! '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '3'
|
36
34
|
type: :runtime
|
37
|
-
version_requirements: *id002
|
38
|
-
- !ruby/object:Gem::Dependency
|
39
|
-
name: rest-client
|
40
35
|
prerelease: false
|
41
|
-
|
36
|
+
version_requirements: *2168834060
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
name: rest-client
|
39
|
+
requirement: &2168833600 !ruby/object:Gem::Requirement
|
42
40
|
none: false
|
43
|
-
requirements:
|
44
|
-
- -
|
45
|
-
- !ruby/object:Gem::Version
|
41
|
+
requirements:
|
42
|
+
- - ! '>='
|
43
|
+
- !ruby/object:Gem::Version
|
46
44
|
version: 1.6.1
|
47
45
|
type: :runtime
|
48
|
-
version_requirements: *id003
|
49
|
-
- !ruby/object:Gem::Dependency
|
50
|
-
name: json
|
51
46
|
prerelease: false
|
52
|
-
|
47
|
+
version_requirements: *2168833600
|
48
|
+
- !ruby/object:Gem::Dependency
|
49
|
+
name: json
|
50
|
+
requirement: &2168833220 !ruby/object:Gem::Requirement
|
53
51
|
none: false
|
54
|
-
requirements:
|
55
|
-
- -
|
56
|
-
- !ruby/object:Gem::Version
|
57
|
-
version:
|
52
|
+
requirements:
|
53
|
+
- - ! '>='
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '0'
|
58
56
|
type: :runtime
|
59
|
-
version_requirements: *id004
|
60
|
-
- !ruby/object:Gem::Dependency
|
61
|
-
name: rsolr
|
62
57
|
prerelease: false
|
63
|
-
|
58
|
+
version_requirements: *2168833220
|
59
|
+
- !ruby/object:Gem::Dependency
|
60
|
+
name: rsolr
|
61
|
+
requirement: &2168832760 !ruby/object:Gem::Requirement
|
64
62
|
none: false
|
65
|
-
requirements:
|
66
|
-
- -
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version:
|
63
|
+
requirements:
|
64
|
+
- - ! '>='
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: '0'
|
69
67
|
type: :runtime
|
70
|
-
version_requirements: *id005
|
71
|
-
- !ruby/object:Gem::Dependency
|
72
|
-
name: rsolr-ext
|
73
68
|
prerelease: false
|
74
|
-
|
69
|
+
version_requirements: *2168832760
|
70
|
+
- !ruby/object:Gem::Dependency
|
71
|
+
name: rsolr-ext
|
72
|
+
requirement: &2168832340 !ruby/object:Gem::Requirement
|
75
73
|
none: false
|
76
|
-
requirements:
|
77
|
-
- -
|
78
|
-
- !ruby/object:Gem::Version
|
79
|
-
version:
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
80
78
|
type: :runtime
|
81
|
-
version_requirements: *id006
|
82
|
-
- !ruby/object:Gem::Dependency
|
83
|
-
name: nokogiri
|
84
79
|
prerelease: false
|
85
|
-
|
80
|
+
version_requirements: *2168832340
|
81
|
+
- !ruby/object:Gem::Dependency
|
82
|
+
name: nokogiri
|
83
|
+
requirement: &2168831920 !ruby/object:Gem::Requirement
|
86
84
|
none: false
|
87
|
-
requirements:
|
88
|
-
- -
|
89
|
-
- !ruby/object:Gem::Version
|
90
|
-
version:
|
85
|
+
requirements:
|
86
|
+
- - ! '>='
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '0'
|
91
89
|
type: :runtime
|
92
|
-
|
90
|
+
prerelease: false
|
91
|
+
version_requirements: *2168831920
|
93
92
|
description: Ruby wrapper for the LucidWorks REST API
|
94
|
-
email:
|
93
|
+
email:
|
95
94
|
- sam.pierson@lucidimagination.com
|
96
95
|
executables: []
|
97
|
-
|
98
96
|
extensions: []
|
99
|
-
|
100
97
|
extra_rdoc_files: []
|
101
|
-
|
102
|
-
files:
|
98
|
+
files:
|
103
99
|
- .autotest
|
104
100
|
- .gitignore
|
105
101
|
- .rspec
|
@@ -134,6 +130,7 @@ files:
|
|
134
130
|
- lib/lucid_works/datasource/status.rb
|
135
131
|
- lib/lucid_works/exceptions.rb
|
136
132
|
- lib/lucid_works/field.rb
|
133
|
+
- lib/lucid_works/gem_version.rb
|
137
134
|
- lib/lucid_works/logs.rb
|
138
135
|
- lib/lucid_works/logs/index.rb
|
139
136
|
- lib/lucid_works/logs/index/summary.rb
|
@@ -168,34 +165,31 @@ files:
|
|
168
165
|
- spec/lib/lucid_works/utils_spec.rb
|
169
166
|
- spec/spec_helper.rb
|
170
167
|
has_rdoc: true
|
171
|
-
homepage:
|
168
|
+
homepage: ''
|
172
169
|
licenses: []
|
173
|
-
|
174
170
|
post_install_message:
|
175
171
|
rdoc_options: []
|
176
|
-
|
177
|
-
require_paths:
|
172
|
+
require_paths:
|
178
173
|
- lib
|
179
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
174
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
180
175
|
none: false
|
181
|
-
requirements:
|
182
|
-
- -
|
183
|
-
- !ruby/object:Gem::Version
|
184
|
-
version:
|
185
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
176
|
+
requirements:
|
177
|
+
- - ! '>='
|
178
|
+
- !ruby/object:Gem::Version
|
179
|
+
version: '0'
|
180
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
186
181
|
none: false
|
187
|
-
requirements:
|
188
|
-
- -
|
189
|
-
- !ruby/object:Gem::Version
|
190
|
-
version:
|
182
|
+
requirements:
|
183
|
+
- - ! '>='
|
184
|
+
- !ruby/object:Gem::Version
|
185
|
+
version: '0'
|
191
186
|
requirements: []
|
192
|
-
|
193
187
|
rubyforge_project: lucid_works
|
194
188
|
rubygems_version: 1.6.2
|
195
189
|
signing_key:
|
196
190
|
specification_version: 3
|
197
191
|
summary: Ruby wrapper for the LucidWorks REST API
|
198
|
-
test_files:
|
192
|
+
test_files:
|
199
193
|
- spec/lib/lucid_works/associations/has_many_spec.rb
|
200
194
|
- spec/lib/lucid_works/associations/has_one_spec.rb
|
201
195
|
- spec/lib/lucid_works/associations_spec.rb
|