picky-client 1.1.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (31) hide show
  1. metadata +2 -33
  2. data/sinatra_prototype/Gemfile +0 -13
  3. data/sinatra_prototype/app.rb +0 -65
  4. data/sinatra_prototype/book.rb +0 -42
  5. data/sinatra_prototype/config.ru +0 -2
  6. data/sinatra_prototype/images/picky.png +0 -0
  7. data/sinatra_prototype/javascripts/compiler.jar +0 -0
  8. data/sinatra_prototype/javascripts/generate_bundles +0 -25
  9. data/sinatra_prototype/javascripts/jquery-1.3.2.js +0 -4376
  10. data/sinatra_prototype/javascripts/jquery-1.4.3.min.js +0 -166
  11. data/sinatra_prototype/javascripts/jquery.scrollTo-1.4.2.js +0 -215
  12. data/sinatra_prototype/javascripts/jquery.timer.js +0 -75
  13. data/sinatra_prototype/javascripts/picky.addination.js +0 -36
  14. data/sinatra_prototype/javascripts/picky.allocation_renderer.js +0 -291
  15. data/sinatra_prototype/javascripts/picky.allocations_cloud.js +0 -91
  16. data/sinatra_prototype/javascripts/picky.backend.js +0 -86
  17. data/sinatra_prototype/javascripts/picky.client.js +0 -62
  18. data/sinatra_prototype/javascripts/picky.controller.js +0 -107
  19. data/sinatra_prototype/javascripts/picky.data.js +0 -78
  20. data/sinatra_prototype/javascripts/picky.extensions.js +0 -15
  21. data/sinatra_prototype/javascripts/picky.min.js +0 -17
  22. data/sinatra_prototype/javascripts/picky.results_renderer.js +0 -103
  23. data/sinatra_prototype/javascripts/picky.source.js.tar +0 -0
  24. data/sinatra_prototype/javascripts/picky.translations.js +0 -50
  25. data/sinatra_prototype/javascripts/picky.view.js +0 -214
  26. data/sinatra_prototype/library.csv +0 -540
  27. data/sinatra_prototype/stylesheets/stylesheet.css +0 -184
  28. data/sinatra_prototype/stylesheets/stylesheet.sass +0 -225
  29. data/sinatra_prototype/views/configure.haml +0 -170
  30. data/sinatra_prototype/views/search.haml +0 -108
  31. data/spec/picky-client/generator_spec.rb +0 -141
@@ -1,108 +0,0 @@
1
- !!!
2
- %html{ :lang => 'en' }
3
- %head
4
- %link{:href => "stylesheets/stylesheet.css", :media => "screen", :rel => "stylesheet", :type => "text/css"}/
5
- = js 'jquery-1.4.3.min'
6
- = js 'jquery.scrollTo-1.4.2'
7
- = js 'jquery.timer'
8
-
9
- / = js 'picky.extensions'
10
- / = js 'picky.translations'
11
- / = js 'picky.data'
12
- / = js 'picky.view'
13
- / = js 'picky.backend'
14
- / = js 'picky.controller'
15
- / = js 'picky.client'
16
- / = js 'picky.addination'
17
- / = js 'picky.results_renderer'
18
- / = js 'picky.allocation_renderer'
19
- / = js 'picky.allocations_cloud'
20
-
21
- = js 'picky.min'
22
- %body
23
- %img{:src => "images/picky.png"}/
24
- %p
25
- %a{:href => "http://floere.github.com/picky"} To the Picky Homepage
26
- \/
27
- %a{:href => '/configure' } Configuring this app server
28
- %p
29
- Try a few examples
30
- = succeed ":" do
31
- %span.explanation (on a simple database with 540 books - note that the server is on Heroku and needs a little time to ramp up)
32
- %p
33
- A simple word,
34
- = succeed "." do
35
- %a{:href => "#", :onclick => "pickyClient.insert('alan');"} alan
36
- %span.explanation
37
- (Finds Alan in the title, and Alans who wrote books. The title is ranked higher due to weighing.)
38
- %span
39
- %p
40
- With qualifier,
41
- = succeed "." do
42
- %a{:href => "#", :onclick => "pickyClient.insert('title:women');"} title:women
43
- %span.explanation
44
- (Finds "women*" just in titles.)
45
- %span
46
- %p
47
- With similarity,
48
- = succeed "." do
49
- %a{:href => "#", :onclick => "pickyClient.insert('pinchn~');"} pinchn~
50
- %span.explanation (Finds "pynchon", note: Only title in example with similarity. Uses a combination of double metaphone and Levenshtein.)
51
- %p
52
- More complex,
53
- = succeed "." do
54
- %a{:href => "#", :onclick => "pickyClient.insert('title:lyterature~');"} title:lyterature~
55
- %span.explanation (Finds similar titles)
56
- %p
57
- With choice,
58
- = succeed "." do
59
- %a{:href => "#", :onclick => "pickyClient.insert('sp');"} sp
60
- %span.explanation (Finds "sp*" in multiple categories. Choose the one you're looking for.)
61
- %p
62
- More complex,
63
- = succeed "." do
64
- %a{:href => "#", :onclick => "pickyClient.insert('soc* p');"} soc* p
65
- %span.explanation (this is where Picky really shines, "the title started with soc, and the author starts with p")
66
- = Picky::Helper.cached_interface
67
- :javascript
68
- pickyClient = new PickyClient({
69
- // A full query displays the rendered results.
70
- //
71
- full: '/search/full',
72
-
73
- // A live query just updates the count.
74
- //
75
- live: '/search/live',
76
-
77
- // showResultsLimit: 10, // Optional. Default is 10.
78
-
79
- // before: function(params, query, offset) { }, // Optional. Before Picky sends any data.
80
- // success: function(data, query) { }, // Optional. Just after Picky receives data. (Get a PickyData object)
81
- // after: function(data, query) { }, // Optional. After Picky has handled the data and updated the view.
82
-
83
- // This is used to generate the correct query strings, localized. E.g. "subject:war".
84
- // Optional. If you don't give these, the field identifier given in the Picky server is used.
85
- //
86
- qualifiers: {
87
- en:{
88
- subjects: 'subject'
89
- }
90
- },
91
-
92
- // This is used to explain the preceding word in the suggestion text, localized. E.g. "Peter (author)".
93
- // Optional. Default are the field identifiers from the Picky server.
94
- //
95
- explanations: {
96
- en:{
97
- title: 'titled',
98
- author: 'written by',
99
- year: 'published in'
100
- // publisher: 'published by',
101
- // subjects: 'topics'
102
- }
103
- }
104
- });
105
-
106
- // An initial search text, prefilled.
107
- //
108
- pickyClient.insert('italy');
@@ -1,141 +0,0 @@
1
- # encoding: utf-8
2
- require 'spec_helper'
3
-
4
- describe Picky::Client::Generator do
5
-
6
- describe "main class" do
7
- before(:each) do
8
- @generator = Picky::Client::Generator.new
9
- end
10
-
11
- describe "generator_for_class" do
12
- it "should return me a generator for the given class" do
13
- @generator.generator_for_class(Picky::Client::Generator::Project, :identifier, :some_args).should be_kind_of(Picky::Client::Generator::Project)
14
- end
15
- end
16
-
17
- describe "generator_for" do
18
- it "should not raise if a generator is available" do
19
- lambda { @generator.generator_for('sinatra', 'some_project') }.should_not raise_error
20
- end
21
- it "should raise if a generator is not available" do
22
- lambda { @generator.generator_for('blarf', 'gnorf') }.should raise_error(Picky::Client::NoGeneratorException)
23
- end
24
- it "should return a generator if it is available" do
25
- @generator.generator_for('sinatra', 'some_project').should be_kind_of(Picky::Client::Generator::Project)
26
- end
27
- end
28
-
29
- describe "generate" do
30
- it "should raise a NoGeneratorException if called with the wrong params" do
31
- lambda { @generator.generate(['blarf', 'gnorf']) }.should raise_error(Picky::Client::NoGeneratorException)
32
- end
33
- it "should not raise on the right params" do
34
- @generator.stub! :generator_for_class => stub(:generator, :generate => nil)
35
-
36
- lambda { @generator.generate(['sinatra', 'some_project']) }.should_not raise_error
37
- end
38
- end
39
- end
40
-
41
- describe Picky::Client::Generator::Project do
42
-
43
- before(:each) do
44
- @generator = Picky::Client::Generator::Project.new :identifier, 'some_name', []
45
- @generator.stub! :exclaim
46
- end
47
-
48
- context "after initialize" do
49
- it "should have a prototype project basedir" do
50
- lambda {
51
- @generator.prototype_project_basedir
52
- }.should_not raise_error
53
- end
54
- it "should have a name" do
55
- @generator.name.should == 'some_name'
56
- end
57
- end
58
-
59
- describe "prototype_project_basedir" do
60
- it "should be the right basedir" do
61
- @generator.prototype_project_basedir.should == File.expand_path('../../../identifier_prototype', __FILE__)
62
- end
63
- end
64
-
65
- describe "generate" do
66
- it "should do things in order" do
67
- @generator.should_receive(:create_target_directory).once.ordered
68
- @generator.should_receive(:copy_all_files).once.ordered
69
-
70
- @generator.generate
71
- end
72
- end
73
-
74
- describe "create_target_directory" do
75
- context "file exists" do
76
- before(:each) do
77
- File.stub! :exists? => true
78
- end
79
- it "should just tell the user that" do
80
- @generator.stub! :target_directory => :some_target_directory
81
-
82
- @generator.should_receive(:exists).once.with :some_target_directory
83
-
84
- @generator.create_target_directory
85
- end
86
- it "should not make the directory" do
87
- FileUtils.should_receive(:mkdir).never
88
-
89
- @generator.create_target_directory
90
- end
91
- end
92
- context "file does not exist" do
93
- before(:each) do
94
- File.stub! :exists? => false
95
- FileUtils.stub! :mkdir
96
- end
97
- it "should make the directory" do
98
- @generator.stub! :target_directory => :some_target_directory
99
-
100
- FileUtils.should_receive(:mkdir).once.with :some_target_directory
101
-
102
- @generator.create_target_directory
103
- end
104
- it "should tell the user" do
105
- @generator.stub! :target_directory => :some_target_directory
106
-
107
- @generator.should_receive(:created).once.with :some_target_directory
108
-
109
- @generator.create_target_directory
110
- end
111
- end
112
- end
113
-
114
- describe "target_filename_for" do
115
- it "should return the right filename" do
116
- @generator.stub! :target_directory => 'some_target_directory'
117
-
118
- test_filename = File.expand_path 'some/file/name', @generator.prototype_project_basedir
119
-
120
- @generator.target_filename_for(test_filename).should == 'some_target_directory/some/file/name'
121
- end
122
- end
123
-
124
- describe "generate" do
125
- it "should copy recursively" do
126
- @generator.should_receive(:create_target_directory).once.with
127
- @generator.should_receive(:copy_all_files).once.with
128
-
129
- @generator.generate
130
- end
131
- end
132
-
133
- describe "target_directory" do
134
- it "should return the right dir name" do
135
- @generator.target_directory.should == File.expand_path('../../../some_name', __FILE__)
136
- end
137
- end
138
-
139
- end
140
-
141
- end