picky-client 0.2.4 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/picky-client +14 -0
- data/lib/picky-client/generator.rb +180 -0
- data/sinatra_prototype/Gemfile +13 -0
- data/sinatra_prototype/app.rb +59 -0
- data/sinatra_prototype/book.rb +42 -0
- data/sinatra_prototype/config.ru +2 -0
- data/sinatra_prototype/images/picky.png +0 -0
- data/sinatra_prototype/javascripts/compiler.jar +0 -0
- data/sinatra_prototype/javascripts/generate_bundles +25 -0
- data/sinatra_prototype/javascripts/jquery-1.3.2.js +4376 -0
- data/sinatra_prototype/javascripts/jquery-1.4.3.min.js +166 -0
- data/sinatra_prototype/javascripts/jquery.scrollTo-1.4.2.js +215 -0
- data/sinatra_prototype/javascripts/jquery.timer.js +75 -0
- data/sinatra_prototype/javascripts/picky.addination.js +36 -0
- data/sinatra_prototype/javascripts/picky.allocation_renderer.js +291 -0
- data/sinatra_prototype/javascripts/picky.allocations_cloud.js +91 -0
- data/sinatra_prototype/javascripts/picky.backend.js +86 -0
- data/sinatra_prototype/javascripts/picky.client.js +62 -0
- data/sinatra_prototype/javascripts/picky.controller.js +107 -0
- data/sinatra_prototype/javascripts/picky.data.js +78 -0
- data/sinatra_prototype/javascripts/picky.extensions.js +15 -0
- data/sinatra_prototype/javascripts/picky.min.js +17 -0
- data/sinatra_prototype/javascripts/picky.results_renderer.js +103 -0
- data/sinatra_prototype/javascripts/picky.source.js.tar +0 -0
- data/sinatra_prototype/javascripts/picky.translations.js +50 -0
- data/sinatra_prototype/javascripts/picky.view.js +214 -0
- data/sinatra_prototype/library.csv +540 -0
- data/sinatra_prototype/stylesheets/stylesheet.css +175 -0
- data/sinatra_prototype/stylesheets/stylesheet.sass +216 -0
- data/sinatra_prototype/views/search.haml +107 -0
- data/spec/picky-client/generator_spec.rb +141 -0
- metadata +38 -6
@@ -0,0 +1,141 @@
|
|
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
|
metadata
CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease: false
|
5
5
|
segments:
|
6
6
|
- 0
|
7
|
-
-
|
8
|
-
-
|
9
|
-
version: 0.
|
7
|
+
- 3
|
8
|
+
- 0
|
9
|
+
version: 0.3.0
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Florian Hanke
|
@@ -15,7 +15,7 @@ bindir: bin
|
|
15
15
|
cert_chain: []
|
16
16
|
|
17
17
|
date: 2010-10-24 00:00:00 +02:00
|
18
|
-
default_executable:
|
18
|
+
default_executable: picky-client
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: yajl-ruby
|
@@ -34,8 +34,8 @@ dependencies:
|
|
34
34
|
version_requirements: *id001
|
35
35
|
description:
|
36
36
|
email: florian.hanke+picky-client@gmail.com
|
37
|
-
executables:
|
38
|
-
|
37
|
+
executables:
|
38
|
+
- picky-client
|
39
39
|
extensions: []
|
40
40
|
|
41
41
|
extra_rdoc_files:
|
@@ -43,12 +43,43 @@ extra_rdoc_files:
|
|
43
43
|
files:
|
44
44
|
- lib/picky-client/convenience.rb
|
45
45
|
- lib/picky-client/engine.rb
|
46
|
+
- lib/picky-client/generator.rb
|
46
47
|
- lib/picky-client/helper.rb
|
47
48
|
- lib/picky-client.rb
|
49
|
+
- sinatra_prototype/app.rb
|
50
|
+
- sinatra_prototype/book.rb
|
51
|
+
- sinatra_prototype/config.ru
|
52
|
+
- sinatra_prototype/Gemfile
|
53
|
+
- sinatra_prototype/images/picky.png
|
54
|
+
- sinatra_prototype/javascripts/compiler.jar
|
55
|
+
- sinatra_prototype/javascripts/generate_bundles
|
56
|
+
- sinatra_prototype/javascripts/jquery-1.3.2.js
|
57
|
+
- sinatra_prototype/javascripts/jquery-1.4.3.min.js
|
58
|
+
- sinatra_prototype/javascripts/jquery.scrollTo-1.4.2.js
|
59
|
+
- sinatra_prototype/javascripts/jquery.timer.js
|
60
|
+
- sinatra_prototype/javascripts/picky.addination.js
|
61
|
+
- sinatra_prototype/javascripts/picky.allocation_renderer.js
|
62
|
+
- sinatra_prototype/javascripts/picky.allocations_cloud.js
|
63
|
+
- sinatra_prototype/javascripts/picky.backend.js
|
64
|
+
- sinatra_prototype/javascripts/picky.client.js
|
65
|
+
- sinatra_prototype/javascripts/picky.controller.js
|
66
|
+
- sinatra_prototype/javascripts/picky.data.js
|
67
|
+
- sinatra_prototype/javascripts/picky.extensions.js
|
68
|
+
- sinatra_prototype/javascripts/picky.min.js
|
69
|
+
- sinatra_prototype/javascripts/picky.results_renderer.js
|
70
|
+
- sinatra_prototype/javascripts/picky.source.js.tar
|
71
|
+
- sinatra_prototype/javascripts/picky.translations.js
|
72
|
+
- sinatra_prototype/javascripts/picky.view.js
|
73
|
+
- sinatra_prototype/library.csv
|
74
|
+
- sinatra_prototype/stylesheets/stylesheet.css
|
75
|
+
- sinatra_prototype/stylesheets/stylesheet.sass
|
76
|
+
- sinatra_prototype/views/search.haml
|
48
77
|
- README.rdoc
|
49
78
|
- spec/picky-client/convenience_spec.rb
|
50
79
|
- spec/picky-client/engine_spec.rb
|
80
|
+
- spec/picky-client/generator_spec.rb
|
51
81
|
- spec/picky-client/helper_spec.rb
|
82
|
+
- bin/picky-client
|
52
83
|
has_rdoc: false
|
53
84
|
homepage: http://floere.github.com/picky
|
54
85
|
licenses: []
|
@@ -84,4 +115,5 @@ summary: picky Search Engine Client
|
|
84
115
|
test_files:
|
85
116
|
- spec/picky-client/convenience_spec.rb
|
86
117
|
- spec/picky-client/engine_spec.rb
|
118
|
+
- spec/picky-client/generator_spec.rb
|
87
119
|
- spec/picky-client/helper_spec.rb
|