picky-generators 3.0.0.pre1 → 3.0.0.pre2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. data/lib/picky-generators/generators/selector.rb +3 -4
  2. data/lib/picky-generators/generators/server/{unicorn.rb → classic.rb} +6 -6
  3. data/lib/picky-generators/generators/server/sinatra.rb +3 -2
  4. data/lib/picky-generators.rb +3 -2
  5. data/prototypes/server/classic/Gemfile +27 -0
  6. data/prototypes/server/classic/app/README +4 -0
  7. data/prototypes/server/{unicorn → classic}/app/application.rb +8 -3
  8. data/prototypes/server/{shared_unicorn → classic}/app/db.yml +0 -0
  9. data/prototypes/server/{shared_unicorn → classic}/app/logging.rb +7 -4
  10. data/prototypes/server/{shared_unicorn → classic}/config.ru +1 -7
  11. data/prototypes/server/{shared_unicorn → classic}/log/README +0 -0
  12. data/prototypes/server/{shared_unicorn → classic}/script/console +1 -1
  13. data/prototypes/server/classic/spec/spec_helper.rb +8 -0
  14. data/prototypes/server/{sinatra → shared}/Rakefile +0 -0
  15. data/prototypes/server/{sinatra → shared}/data/development/library.csv +0 -0
  16. data/prototypes/server/{sinatra → shared}/data/production/library.csv +0 -0
  17. data/prototypes/server/{sinatra → shared}/data/test/library.csv +0 -0
  18. data/prototypes/server/{sinatra → shared}/spec/integration_spec.rb +0 -0
  19. data/prototypes/server/{sinatra → shared}/tmp/pids/README +0 -0
  20. data/prototypes/server/{shared_unicorn → shared}/unicorn.rb +0 -0
  21. data/prototypes/server/sinatra/Gemfile +2 -3
  22. data/prototypes/server/sinatra/app.rb +5 -3
  23. data/prototypes/server/sinatra/logging.rb +24 -0
  24. data/spec/lib/picky-generators/generators/selector_spec.rb +2 -2
  25. data/spec/lib/picky-generators/generators/server/classic_spec.rb +35 -0
  26. data/spec/lib/picky-generators/generators/server/sinatra_spec.rb +1 -1
  27. metadata +24 -34
  28. data/lib/picky-generators/generators/server/empty_unicorn.rb +0 -40
  29. data/prototypes/server/empty_unicorn/app/application.rb +0 -10
  30. data/prototypes/server/shared_unicorn/Gemfile +0 -35
  31. data/prototypes/server/shared_unicorn/Rakefile +0 -1
  32. data/prototypes/server/shared_unicorn/app/README +0 -5
  33. data/prototypes/server/shared_unicorn/tmp/README +0 -0
  34. data/prototypes/server/shared_unicorn/tmp/pids/README +0 -0
  35. data/prototypes/server/sinatra/unicorn.rb +0 -17
  36. data/prototypes/server/unicorn/Rakefile +0 -6
  37. data/prototypes/server/unicorn/data/development/library.csv +0 -540
  38. data/prototypes/server/unicorn/data/production/library.csv +0 -540
  39. data/prototypes/server/unicorn/data/test/library.csv +0 -540
  40. data/prototypes/server/unicorn/spec/integration_spec.rb +0 -28
  41. data/prototypes/server/unicorn/spec/spec_helper.rb +0 -8
  42. data/spec/lib/picky-generators/generators/server/unicorn_spec.rb +0 -35
@@ -13,12 +13,11 @@ module Picky
13
13
  def initialize
14
14
  @types = {
15
15
  :sinatra_client => [Client::Sinatra, :sinatra_client_name],
16
- :client => [Client::Sinatra, :client_name],
16
+ :client => [Client::Sinatra, :sinatra_client_name],
17
17
 
18
- :unicorn_server => [Server::Unicorn, :unicorn_server_name],
19
- :empty_unicorn_server => [Server::EmptyUnicorn, :empty_unicorn_server_name],
18
+ :classic_server => [Server::Classic, :unicorn_server_name],
20
19
  :sinatra_server => [Server::Sinatra, :sinatra_server_name],
21
- :server => [Server::Sinatra, :server_name]
20
+ :server => [Server::Sinatra, :sinatra_server_name]
22
21
  }
23
22
  end
24
23
 
@@ -4,24 +4,24 @@ module Picky
4
4
 
5
5
  module Server
6
6
 
7
- # Generates a new Picky Unicorn Server Example.
7
+ # Generates a new Picky Classic Server Example.
8
8
  #
9
9
  # Example:
10
- # > picky-generate unicorn_server my_lovely_unicorn
10
+ # > picky-generate classic_server my_classic_directory
11
11
  #
12
- class Unicorn < Picky::Generators::Base
12
+ class Classic < Picky::Generators::Base
13
13
 
14
14
  def initialize identifier, name, *args
15
- super identifier, name, 'server/unicorn', *args
15
+ super identifier, name, 'server/classic', *args
16
16
  end
17
17
 
18
18
  #
19
19
  #
20
20
  def generate
21
- exclaim "Setting up Picky Unicorn Server \"#{name}\"."
21
+ exclaim "Setting up Picky Classic Server \"#{name}\"."
22
22
  create_target_directory
23
23
  copy_all_files
24
- copy_all_files expand_prototype_path('server/shared_unicorn')
24
+ copy_all_files expand_prototype_path('server/shared')
25
25
  exclaim "\"#{name}\" is a great project name! Have fun :)\n"
26
26
  exclaim ""
27
27
  exclaim "Next steps:"
@@ -7,7 +7,7 @@ module Picky
7
7
  # Generates a new Picky Sinatra/Unicorn Server Example.
8
8
  #
9
9
  # Example:
10
- # > picky-generate sinatra_server my_lovely_unicorn
10
+ # > picky-generate sinatra_server my_sinatra_directory
11
11
  #
12
12
  class Sinatra < Picky::Generators::Base
13
13
 
@@ -20,7 +20,8 @@ module Picky
20
20
  def generate
21
21
  exclaim "Setting up Picky Sinatra Server \"#{name}\"."
22
22
  create_target_directory
23
- copy_all_files expand_prototype_path('server/sinatra')
23
+ copy_all_files
24
+ copy_all_files expand_prototype_path('server/shared')
24
25
  exclaim "\"#{name}\" is a great project name! Have fun :)\n"
25
26
  exclaim ""
26
27
  exclaim "Next steps:"
@@ -1,9 +1,10 @@
1
1
  require File.expand_path '../picky-generators/generators/not_found_exception', __FILE__
2
2
 
3
3
  require File.expand_path '../picky-generators/generators/base', __FILE__
4
+
4
5
  require File.expand_path '../picky-generators/generators/client/sinatra', __FILE__
5
- require File.expand_path '../picky-generators/generators/server/unicorn', __FILE__
6
- require File.expand_path '../picky-generators/generators/server/empty_unicorn', __FILE__
6
+
7
+ require File.expand_path '../picky-generators/generators/server/classic', __FILE__
7
8
  require File.expand_path '../picky-generators/generators/server/sinatra', __FILE__
8
9
 
9
10
  require File.expand_path '../picky-generators/generators/selector', __FILE__
@@ -0,0 +1,27 @@
1
+ source :gemcutter
2
+
3
+ # Gems required by Picky.
4
+ #
5
+ gem 'picky', '3.0.0.pre2'
6
+ gem 'rake'
7
+ gem 'rack'
8
+ gem 'rack-mount'
9
+ gem 'rack_fast_escape', '2009.06.24' # Optional.
10
+ gem 'text'
11
+ gem 'yajl-ruby', :require => 'yajl'
12
+
13
+ # Should be optional, but isn't yet.
14
+ #
15
+ gem 'activesupport', '~> 3.0', :require => 'active_support/core_ext'
16
+ gem 'activerecord', '~> 3.0', :require => 'active_record'
17
+
18
+ # Required by your project.
19
+ #
20
+ gem 'unicorn'
21
+ gem 'mysql' # Project specific.
22
+ gem 'redis' # Project specific.
23
+
24
+ group :test do
25
+ gem 'picky-client', '3.0.0.pre2'
26
+ gem 'rspec'
27
+ end
@@ -0,0 +1,4 @@
1
+ All your application definitions go here.
2
+
3
+ /app needs a the file defined by picky:
4
+ * application.rb - how to handle indexing, queries, routing.
@@ -1,11 +1,13 @@
1
1
  # encoding: utf-8
2
2
  #
3
+ require File.expand_path '../logging', __FILE__
4
+
3
5
  # TODO Adapt the generated example
4
6
  # (a library books finder) to what you need.
5
7
  #
6
8
  # Questions? Mail me, IRC #picky, the google group, http://github.com/floere/picky/wiki.
7
9
  #
8
- class PickySearch < Picky::Application
10
+ class BookSearch < Picky::Application
9
11
 
10
12
  # So we don't have to write Picky::
11
13
  # in front of everything.
@@ -35,8 +37,11 @@ class PickySearch < Picky::Application
35
37
  category :year, partial: Partial::None.new
36
38
  end
37
39
 
38
- route %r{\A/books\Z} => Search.new(books_index) do
39
- boost [:title, :author] => +3, [:title] => +1
40
+ books = Search.new books_index do
41
+ boost [:title, :author] => +3,
42
+ [:title] => +1
40
43
  end
41
44
 
45
+ route %r{\A/books\Z} => books
46
+
42
47
  end
@@ -1,7 +1,11 @@
1
+ # Separate file since this is usually what is
2
+ # environment specific.
3
+ #
4
+
1
5
  # Standard logging.
2
6
  #
3
7
  require 'logger'
4
- PickyLog = Picky::Loggers::Search.new ::Logger.new(File.expand_path('log/search.log', PICKY_ROOT))
8
+ Picky.logger = Logger.new File.expand_path('log/search.log', PICKY_ROOT)
5
9
 
6
10
  # Example with using the syslog logger.
7
11
  # Falling back to the standard log if it isn't available.
@@ -10,11 +14,10 @@ PickyLog = Picky::Loggers::Search.new ::Logger.new(File.expand_path('log/search.
10
14
  #
11
15
  # begin
12
16
  # log_program_name = 'search/query'
13
- # logger = SyslogLogger.new log_program_name
14
- # PickyLog = Picky::Loggers::Search.new logger
17
+ # Picky.logger = SyslogLogger.new log_program_name
15
18
  # puts "Logging on syslog #{log_program_name}."
16
19
  # rescue StandardError
17
20
  # puts "Could not connect to the syslog, using the normal log."
18
21
  # require 'logger'
19
- # PickyLog = Picky::Loggers::Search.new ::Logger.new(File.join(PICKY_ROOT, 'log/search.log'))
22
+ # Picky.logger = Logger.new(File.join(PICKY_ROOT, 'log/search.log'))
20
23
  # end
@@ -4,12 +4,6 @@ require 'picky'
4
4
 
5
5
  # Load your application. This requires the following files in
6
6
  #
7
- # * lib/initializers/*.rb
8
- # * lib/tokenizers/*.rb
9
- # * lib/indexers/*.rb
10
- # * lib/query/*.rb
11
- #
12
- # * app/logging.rb
13
7
  # * app/application.rb
14
8
  #
15
9
  # (in that order).
@@ -34,4 +28,4 @@ Picky::Indexes.reload
34
28
  #
35
29
  # Note: Needs to be the same constant name as in app/application.rb.
36
30
  #
37
- run PickySearch
31
+ run BookSearch
@@ -30,5 +30,5 @@ puts ""
30
30
  puts "Now you can for example create a query instance."
31
31
  puts "\x1b[1;30mbooks = Search.new(Indexes[:books]); nil\x1b[m"
32
32
  puts "and search on it"
33
- puts "\x1b[1;30mbooks.search_with_text 'bla'\x1b[m"
33
+ puts "\x1b[1;30mbooks.search 'bla', 20, 0\x1b[m"
34
34
  exec "#{options[:irb]} #{libs} --simple-prompt"
@@ -0,0 +1,8 @@
1
+ ENV['PICKY_ENV'] = 'test'
2
+
3
+ require 'picky'
4
+
5
+ Picky.logger = Logger.new STDOUT
6
+ puts "Using STDOUT as test log."
7
+
8
+ Picky::Loader.load_application
File without changes
@@ -2,8 +2,7 @@ source :gemcutter
2
2
 
3
3
  # Gems required by Picky.
4
4
  #
5
- gem 'picky', '3.0.0.pre1'
6
- gem 'bundler'
5
+ gem 'picky', '3.0.0.pre2'
7
6
  gem 'rake'
8
7
  gem 'rack'
9
8
  gem 'rack_fast_escape', '2009.06.24' # Optional.
@@ -23,6 +22,6 @@ gem 'mysql' # Project specific.
23
22
  gem 'redis' # Project specific.
24
23
 
25
24
  group :test do
26
- gem 'picky-client', '3.0.0.pre1'
25
+ gem 'picky-client', '3.0.0.pre2'
27
26
  gem 'rspec'
28
27
  end
@@ -1,5 +1,6 @@
1
1
  require 'sinatra/base'
2
2
  require 'picky'
3
+ require File.expand_path '../logging', __FILE__
3
4
 
4
5
  class BookSearch < Sinatra::Application
5
6
 
@@ -30,7 +31,7 @@ class BookSearch < Sinatra::Application
30
31
 
31
32
  # Define a search over the books index.
32
33
  #
33
- search = Search.new(books_index) do
34
+ books = Search.new books_index do
34
35
  searching removes_characters: /[^a-zA-Z0-9\s\/\-\_\&\.\"\~\*\:\,]/i, # Picky needs control chars *"~:, to pass through.
35
36
  stopwords: /\b(and|the|of|it|in|for)\b/i,
36
37
  splits_text_on: /[\s\/\-\&]+/,
@@ -38,10 +39,11 @@ class BookSearch < Sinatra::Application
38
39
  boost [:title, :author] => +3, [:title] => +1
39
40
  end
40
41
 
41
- # Route /books to the books search.
42
+ # Route /books to the books search and log when searching.
42
43
  #
43
44
  get '/books' do
44
- results = search.search_with_text params[:query], params[:ids] || 20, params[:offset] || 0
45
+ results = books.search params[:query], params[:ids] || 20, params[:offset] || 0
46
+ AppLogger.info results.to_log(params[:query])
45
47
  results.to_json
46
48
  end
47
49
 
@@ -0,0 +1,24 @@
1
+ # Separate file since this is usually what is
2
+ # environment specific.
3
+ # (But go ahead and place the code in app.rb if you wish)
4
+ #
5
+
6
+ # Standard logging.
7
+ #
8
+ require 'logger'
9
+ AppLogger = Logger.new File.expand_path('log/search.log', PICKY_ROOT)
10
+
11
+ # Example with using the syslog logger.
12
+ # Falling back to the standard log if it isn't available.
13
+ # (For example, because it is used locally and syslog is
14
+ # only available on the servers)
15
+ #
16
+ # begin
17
+ # log_program_name = 'search/query'
18
+ # Picky.logger = SyslogLogger.new log_program_name
19
+ # puts "Logging on syslog #{log_program_name}."
20
+ # rescue StandardError
21
+ # puts "Could not connect to the syslog, using the normal log."
22
+ # require 'logger'
23
+ # Picky.logger = Logger.new(File.join(PICKY_ROOT, 'log/search.log'))
24
+ # end
@@ -10,7 +10,7 @@ describe Picky::Generators::Selector do
10
10
 
11
11
  describe "generator_for_class" do
12
12
  it "should return me a generator for the given class" do
13
- @selector.generator_for_class(Picky::Generators::Server::Unicorn, :identifier, :some_args).should be_kind_of(Picky::Generators::Server::Unicorn)
13
+ @selector.generator_for_class(Picky::Generators::Server::Classic, :identifier, :some_args).should be_kind_of(Picky::Generators::Server::Classic)
14
14
  end
15
15
  end
16
16
 
@@ -19,7 +19,7 @@ describe Picky::Generators::Selector do
19
19
  lambda { @selector.generator_for('sinatra_client', 'some_project') }.should_not raise_error
20
20
  end
21
21
  it "should not raise if a generator is available" do
22
- lambda { @selector.generator_for('unicorn_server', 'some_project') }.should_not raise_error
22
+ lambda { @selector.generator_for('classic_server', 'some_project') }.should_not raise_error
23
23
  end
24
24
  it "should not raise if a generator is available" do
25
25
  lambda { @selector.generator_for('sinatra_server', 'some_project') }.should_not raise_error
@@ -0,0 +1,35 @@
1
+ # encoding: utf-8
2
+ #
3
+ require 'spec_helper'
4
+
5
+ describe Picky::Generators::Server::Classic do
6
+
7
+ before(:each) do
8
+ @classic = Picky::Generators::Server::Classic.new :classic_server, 'classic_server_dir_name'
9
+ @classic.stub! :exclaim
10
+ end
11
+
12
+ context "after initialize" do
13
+ it 'has the right identifier' do
14
+ @classic.identifier.should == :classic_server
15
+ end
16
+ it 'has the right name' do
17
+ @classic.name.should == 'classic_server_dir_name'
18
+ end
19
+ it 'has the right prototype dir' do
20
+ @classic.prototype_basedir.should == File.expand_path('../../../../../../prototypes/server/classic', __FILE__)
21
+ end
22
+ end
23
+
24
+ describe "generate" do
25
+ it "should do things in order" do
26
+ @classic.should_receive(:exclaim).once.ordered # Initial explanation
27
+ @classic.should_receive(:create_target_directory).once.ordered
28
+ @classic.should_receive(:copy_all_files).twice.ordered
29
+ @classic.should_receive(:exclaim).at_least(9).times.ordered # Some user steps to do
30
+
31
+ @classic.generate
32
+ end
33
+ end
34
+
35
+ end
@@ -25,7 +25,7 @@ describe Picky::Generators::Server::Sinatra do
25
25
  it "should do things in order" do
26
26
  @sinatra.should_receive(:exclaim).once.ordered # Initial explanation
27
27
  @sinatra.should_receive(:create_target_directory).once.ordered
28
- @sinatra.should_receive(:copy_all_files)
28
+ @sinatra.should_receive(:copy_all_files).twice.ordered
29
29
  @sinatra.should_receive(:exclaim).at_least(9).times.ordered # Some user steps to do
30
30
 
31
31
  @sinatra.generate
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: picky-generators
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease: 6
5
- version: 3.0.0.pre1
5
+ version: 3.0.0.pre2
6
6
  platform: ruby
7
7
  authors:
8
8
  - Florian Hanke
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-08-07 00:00:00 +10:00
13
+ date: 2011-08-11 00:00:00 +10:00
14
14
  default_executable: picky-generate
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -32,7 +32,7 @@ dependencies:
32
32
  requirements:
33
33
  - - ~>
34
34
  - !ruby/object:Gem::Version
35
- version: 3.0.0.pre1
35
+ version: 3.0.0.pre2
36
36
  type: :runtime
37
37
  version_requirements: *id002
38
38
  - !ruby/object:Gem::Dependency
@@ -43,7 +43,7 @@ dependencies:
43
43
  requirements:
44
44
  - - ~>
45
45
  - !ruby/object:Gem::Version
46
- version: 3.0.0.pre1
46
+ version: 3.0.0.pre2
47
47
  type: :runtime
48
48
  version_requirements: *id003
49
49
  description: Generators for Picky.
@@ -59,9 +59,8 @@ files:
59
59
  - lib/picky-generators/generators/client/sinatra.rb
60
60
  - lib/picky-generators/generators/not_found_exception.rb
61
61
  - lib/picky-generators/generators/selector.rb
62
- - lib/picky-generators/generators/server/empty_unicorn.rb
62
+ - lib/picky-generators/generators/server/classic.rb
63
63
  - lib/picky-generators/generators/server/sinatra.rb
64
- - lib/picky-generators/generators/server/unicorn.rb
65
64
  - lib/picky-generators.rb
66
65
  - prototypes/client/sinatra/app.rb
67
66
  - prototypes/client/sinatra/book.rb
@@ -78,44 +77,35 @@ files:
78
77
  - prototypes/client/sinatra/stylesheets/picky.css
79
78
  - prototypes/client/sinatra/views/configure.haml
80
79
  - prototypes/client/sinatra/views/search.haml
81
- - prototypes/server/empty_unicorn/app/application.rb
82
- - prototypes/server/shared_unicorn/app/db.yml
83
- - prototypes/server/shared_unicorn/app/logging.rb
84
- - prototypes/server/shared_unicorn/app/README
85
- - prototypes/server/shared_unicorn/config.ru
86
- - prototypes/server/shared_unicorn/Gemfile
87
- - prototypes/server/shared_unicorn/log/README
88
- - prototypes/server/shared_unicorn/Rakefile
89
- - prototypes/server/shared_unicorn/script/console
90
- - prototypes/server/shared_unicorn/tmp/pids/README
91
- - prototypes/server/shared_unicorn/tmp/README
92
- - prototypes/server/shared_unicorn/unicorn.rb
80
+ - prototypes/server/classic/app/application.rb
81
+ - prototypes/server/classic/app/db.yml
82
+ - prototypes/server/classic/app/logging.rb
83
+ - prototypes/server/classic/app/README
84
+ - prototypes/server/classic/config.ru
85
+ - prototypes/server/classic/Gemfile
86
+ - prototypes/server/classic/log/README
87
+ - prototypes/server/classic/script/console
88
+ - prototypes/server/classic/spec/spec_helper.rb
89
+ - prototypes/server/shared/data/development/library.csv
90
+ - prototypes/server/shared/data/production/library.csv
91
+ - prototypes/server/shared/data/test/library.csv
92
+ - prototypes/server/shared/Rakefile
93
+ - prototypes/server/shared/spec/integration_spec.rb
94
+ - prototypes/server/shared/tmp/pids/README
95
+ - prototypes/server/shared/unicorn.rb
93
96
  - prototypes/server/sinatra/app.rb
94
97
  - prototypes/server/sinatra/config.ru
95
- - prototypes/server/sinatra/data/development/library.csv
96
- - prototypes/server/sinatra/data/production/library.csv
97
- - prototypes/server/sinatra/data/test/library.csv
98
98
  - prototypes/server/sinatra/Gemfile
99
99
  - prototypes/server/sinatra/log/README
100
100
  - prototypes/server/sinatra/log/unicorn.stderr.log
101
101
  - prototypes/server/sinatra/log/unicorn.stdout.log
102
- - prototypes/server/sinatra/Rakefile
103
- - prototypes/server/sinatra/spec/integration_spec.rb
102
+ - prototypes/server/sinatra/logging.rb
104
103
  - prototypes/server/sinatra/spec/spec_helper.rb
105
- - prototypes/server/sinatra/tmp/pids/README
106
- - prototypes/server/sinatra/unicorn.rb
107
- - prototypes/server/unicorn/app/application.rb
108
- - prototypes/server/unicorn/data/development/library.csv
109
- - prototypes/server/unicorn/data/production/library.csv
110
- - prototypes/server/unicorn/data/test/library.csv
111
- - prototypes/server/unicorn/Rakefile
112
- - prototypes/server/unicorn/spec/integration_spec.rb
113
- - prototypes/server/unicorn/spec/spec_helper.rb
114
104
  - spec/lib/picky-generators/generators/base_spec.rb
115
105
  - spec/lib/picky-generators/generators/client/sinatra_spec.rb
116
106
  - spec/lib/picky-generators/generators/selector_spec.rb
107
+ - spec/lib/picky-generators/generators/server/classic_spec.rb
117
108
  - spec/lib/picky-generators/generators/server/sinatra_spec.rb
118
- - spec/lib/picky-generators/generators/server/unicorn_spec.rb
119
109
  - bin/picky-generate
120
110
  has_rdoc: true
121
111
  homepage: http://floere.github.com/picky
@@ -149,5 +139,5 @@ test_files:
149
139
  - spec/lib/picky-generators/generators/base_spec.rb
150
140
  - spec/lib/picky-generators/generators/client/sinatra_spec.rb
151
141
  - spec/lib/picky-generators/generators/selector_spec.rb
142
+ - spec/lib/picky-generators/generators/server/classic_spec.rb
152
143
  - spec/lib/picky-generators/generators/server/sinatra_spec.rb
153
- - spec/lib/picky-generators/generators/server/unicorn_spec.rb
@@ -1,40 +0,0 @@
1
- module Picky
2
-
3
- module Generators
4
-
5
- module Server
6
-
7
- # Generates a new empty Picky Unicorn Server.
8
- #
9
- # Example:
10
- # > picky-generate unicorn_server my_lovely_unicorn
11
- #
12
- class EmptyUnicorn < Picky::Generators::Base
13
-
14
- def initialize identifier, name, *args
15
- super identifier, name, 'server/empty_unicorn', *args
16
- end
17
-
18
- #
19
- #
20
- def generate
21
- exclaim "Setting up Picky Unicorn Server \"#{name}\"."
22
- create_target_directory
23
- copy_all_files expand_prototype_path('server/shared_unicorn')
24
- copy_all_files
25
- exclaim "\"#{name}\" is a great project name! Have fun :)\n"
26
- exclaim ""
27
- exclaim "Next steps:"
28
- exclaim "1. cd #{name}"
29
- exclaim "2. bundle install"
30
- exclaim "3. rake todo # (optional) shows you where Picky needs input from you"
31
- exclaim " # if you want to define your own search."
32
- end
33
-
34
- end
35
-
36
- end
37
-
38
- end
39
-
40
- end
@@ -1,10 +0,0 @@
1
- # encoding: utf-8
2
- #
3
- # Check the Wiki http://github.com/floere/picky/wiki for more options.
4
- # Ask me or the google group if you have questions or specific requests.
5
- #
6
- class PickySearch < Picky::Application
7
-
8
- # TODO Your search configuration here.
9
-
10
- end
@@ -1,35 +0,0 @@
1
- source :gemcutter
2
-
3
- # Gems required by Picky.
4
- #
5
- gem 'picky', '3.0.0.pre1'
6
- gem 'rake'
7
- gem 'bundler'
8
- gem 'rack', '~> 1.2.2'
9
- gem 'rack-mount', '~> 0.6.13'
10
- gem 'text', '~> 0.2.0'
11
- gem 'yajl-ruby', '~> 0.8.1', :require => 'yajl'
12
-
13
- # Should be optional, but isn't yet. Sorry.
14
- #
15
- gem 'activesupport', '~> 3.0', :require => 'active_support/core_ext'
16
- gem 'activerecord', '~> 3.0', :require => 'active_record'
17
-
18
- # Optional. Makes rack faster.
19
- #
20
- gem 'rack_fast_escape', '2009.06.24'
21
-
22
- # Optional. Use your preferred web server.
23
- #
24
- gem 'unicorn'
25
-
26
- # Optional. Use your preferred database adapter.
27
- #
28
- gem 'mysql'
29
-
30
- # Integration testing needs the client.
31
- #
32
- group :test do
33
- gem 'picky-client', '3.0.0.pre1'
34
- gem 'rspec'
35
- end
@@ -1 +0,0 @@
1
- require 'picky/tasks'
@@ -1,5 +0,0 @@
1
- All your application definitions go here.
2
-
3
- /app needs a few files defined by picky:
4
- * application.rb - how to handle indexing, queries, routing.
5
- * logging.rb
File without changes
File without changes
@@ -1,17 +0,0 @@
1
- listen '0.0.0.0:8080'
2
- pid 'tmp/pids/unicorn.pid'
3
- preload_app true
4
- stderr_path 'log/unicorn.stderr.log'
5
- stdout_path 'log/unicorn.stdout.log'
6
- timeout 10
7
- worker_processes 3
8
-
9
- # TODO Decide if you want to use the Unicorn killing trick. (Good with large data sets)
10
- #
11
- # After forking, the GC is disabled, because we
12
- # kill off the workers after x requests and fork
13
- # new ones – so the GC doesn't run.
14
- #
15
- # after_fork do |_, _|
16
- # GC.disable
17
- # end
@@ -1,6 +0,0 @@
1
- require 'picky/tasks'
2
-
3
- require 'rspec'
4
- require 'rspec/core/rake_task'
5
-
6
- RSpec::Core::RakeTask.new :spec