picky-generators 1.1.1 → 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/picky-generators/generators/base.rb +10 -6
- data/lib/picky-generators/generators/selector.rb +3 -2
- data/lib/picky-generators/generators/server/empty_unicorn.rb +40 -0
- data/lib/picky-generators/generators/server/unicorn.rb +2 -1
- data/lib/picky-generators.rb +1 -0
- data/prototypes/server/empty_unicorn/app/application.rb +10 -0
- data/prototypes/server/{unicorn → shared_unicorn}/Gemfile +0 -0
- data/prototypes/server/{unicorn → shared_unicorn}/Rakefile +0 -0
- data/prototypes/server/{unicorn → shared_unicorn}/app/README +0 -0
- data/prototypes/server/{unicorn → shared_unicorn}/app/db.yml +0 -0
- data/prototypes/server/{unicorn → shared_unicorn}/app/logging.rb +0 -0
- data/prototypes/server/{unicorn → shared_unicorn}/config.ru +0 -0
- data/prototypes/server/{unicorn → shared_unicorn}/log/README +0 -0
- data/prototypes/server/{unicorn → shared_unicorn}/script/console +0 -0
- data/prototypes/server/{unicorn → shared_unicorn}/tmp/README +0 -0
- data/prototypes/server/{unicorn → shared_unicorn}/tmp/pids/README +0 -0
- data/prototypes/server/{unicorn → shared_unicorn}/unicorn.ru +0 -0
- data/spec/lib/picky-generators/generators/server/unicorn_spec.rb +1 -1
- metadata +19 -17
@@ -21,7 +21,11 @@ module Picky
|
|
21
21
|
def initialize identifier, name, prototype_path, *args
|
22
22
|
@identifier = identifier
|
23
23
|
@name = name
|
24
|
-
@prototype_basedir =
|
24
|
+
@prototype_basedir = expand_prototype_path prototype_path
|
25
|
+
end
|
26
|
+
|
27
|
+
def expand_prototype_path prototype_path
|
28
|
+
File.expand_path "../../../../prototypes/#{prototype_path}", __FILE__
|
25
29
|
end
|
26
30
|
|
27
31
|
#
|
@@ -40,19 +44,19 @@ module Picky
|
|
40
44
|
def copy_all_files from = nil
|
41
45
|
all_prototype_files(from).each do |filename|
|
42
46
|
next if filename.match(/\.textile$/)
|
43
|
-
copy_single_file filename
|
47
|
+
copy_single_file filename, from
|
44
48
|
end
|
45
49
|
end
|
46
50
|
|
47
51
|
#
|
48
52
|
#
|
49
|
-
def target_filename_for filename
|
50
|
-
filename.gsub(%r{#{prototype_basedir}}, target_directory)
|
53
|
+
def target_filename_for filename, from = nil
|
54
|
+
filename.gsub(%r{#{from || prototype_basedir}}, target_directory)
|
51
55
|
end
|
52
56
|
#
|
53
57
|
#
|
54
|
-
def copy_single_file filename
|
55
|
-
target = target_filename_for filename
|
58
|
+
def copy_single_file filename, from = nil
|
59
|
+
target = target_filename_for filename, from
|
56
60
|
if File.exists? target
|
57
61
|
exists target
|
58
62
|
else
|
@@ -10,8 +10,9 @@ module Picky
|
|
10
10
|
|
11
11
|
def initialize
|
12
12
|
@types = {
|
13
|
-
:sinatra_client
|
14
|
-
:unicorn_server
|
13
|
+
:sinatra_client => [Client::Sinatra, :sinatra_client_name],
|
14
|
+
:unicorn_server => [Server::Unicorn, :unicorn_server_name],
|
15
|
+
:empty_unicorn_server => [Server::EmptyUnicorn, :empty_unicorn_server_name]
|
15
16
|
}
|
16
17
|
end
|
17
18
|
|
@@ -0,0 +1,40 @@
|
|
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 # (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
|
@@ -4,7 +4,7 @@ module Picky
|
|
4
4
|
|
5
5
|
module Server
|
6
6
|
|
7
|
-
# Generates a new Picky Unicorn Server.
|
7
|
+
# Generates a new Picky Unicorn Server Example.
|
8
8
|
#
|
9
9
|
# Example:
|
10
10
|
# > picky-generate unicorn_server my_lovely_unicorn
|
@@ -20,6 +20,7 @@ module Picky
|
|
20
20
|
def generate
|
21
21
|
exclaim "Setting up Picky Unicorn Server \"#{name}\"."
|
22
22
|
create_target_directory
|
23
|
+
copy_all_files expand_prototype_path('server/shared_unicorn')
|
23
24
|
copy_all_files
|
24
25
|
exclaim "\"#{name}\" is a great project name! Have fun :)\n"
|
25
26
|
exclaim ""
|
data/lib/picky-generators.rb
CHANGED
@@ -3,5 +3,6 @@ require File.expand_path '../picky-generators/generators/not_found_exception', _
|
|
3
3
|
require File.expand_path '../picky-generators/generators/base', __FILE__
|
4
4
|
require File.expand_path '../picky-generators/generators/client/sinatra', __FILE__
|
5
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
|
|
7
8
|
require File.expand_path '../picky-generators/generators/selector', __FILE__
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -25,7 +25,7 @@ describe Picky::Generators::Server::Unicorn do
|
|
25
25
|
it "should do things in order" do
|
26
26
|
@unicorn.should_receive(:exclaim).once.ordered # Initial explanation
|
27
27
|
@unicorn.should_receive(:create_target_directory).once.ordered
|
28
|
-
@unicorn.should_receive(:copy_all_files).
|
28
|
+
@unicorn.should_receive(:copy_all_files).twice
|
29
29
|
@unicorn.should_receive(:exclaim).at_least(9).times.ordered # Some user steps to do
|
30
30
|
|
31
31
|
@unicorn.generate
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 1
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
version: 1.1.
|
8
|
+
- 2
|
9
|
+
version: 1.1.2
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Florian Hanke
|
@@ -41,8 +41,8 @@ dependencies:
|
|
41
41
|
segments:
|
42
42
|
- 1
|
43
43
|
- 1
|
44
|
-
-
|
45
|
-
version: 1.1.
|
44
|
+
- 2
|
45
|
+
version: 1.1.2
|
46
46
|
type: :runtime
|
47
47
|
version_requirements: *id002
|
48
48
|
- !ruby/object:Gem::Dependency
|
@@ -56,8 +56,8 @@ dependencies:
|
|
56
56
|
segments:
|
57
57
|
- 1
|
58
58
|
- 1
|
59
|
-
-
|
60
|
-
version: 1.1.
|
59
|
+
- 2
|
60
|
+
version: 1.1.2
|
61
61
|
type: :runtime
|
62
62
|
version_requirements: *id003
|
63
63
|
description: Generators for Picky.
|
@@ -73,6 +73,7 @@ files:
|
|
73
73
|
- lib/picky-generators/generators/client/sinatra.rb
|
74
74
|
- lib/picky-generators/generators/not_found_exception.rb
|
75
75
|
- lib/picky-generators/generators/selector.rb
|
76
|
+
- lib/picky-generators/generators/server/empty_unicorn.rb
|
76
77
|
- lib/picky-generators/generators/server/unicorn.rb
|
77
78
|
- lib/picky-generators.rb
|
78
79
|
- prototypes/client/sinatra/app.rb
|
@@ -90,19 +91,20 @@ files:
|
|
90
91
|
- prototypes/client/sinatra/stylesheets/stylesheet.sass
|
91
92
|
- prototypes/client/sinatra/views/configure.haml
|
92
93
|
- prototypes/client/sinatra/views/search.haml
|
94
|
+
- prototypes/server/empty_unicorn/app/application.rb
|
95
|
+
- prototypes/server/shared_unicorn/app/db.yml
|
96
|
+
- prototypes/server/shared_unicorn/app/logging.rb
|
97
|
+
- prototypes/server/shared_unicorn/app/README
|
98
|
+
- prototypes/server/shared_unicorn/config.ru
|
99
|
+
- prototypes/server/shared_unicorn/Gemfile
|
100
|
+
- prototypes/server/shared_unicorn/log/README
|
101
|
+
- prototypes/server/shared_unicorn/Rakefile
|
102
|
+
- prototypes/server/shared_unicorn/script/console
|
103
|
+
- prototypes/server/shared_unicorn/tmp/pids/README
|
104
|
+
- prototypes/server/shared_unicorn/tmp/README
|
105
|
+
- prototypes/server/shared_unicorn/unicorn.ru
|
93
106
|
- prototypes/server/unicorn/app/application.rb
|
94
|
-
- prototypes/server/unicorn/app/db.yml
|
95
107
|
- prototypes/server/unicorn/app/library.csv
|
96
|
-
- prototypes/server/unicorn/app/logging.rb
|
97
|
-
- prototypes/server/unicorn/app/README
|
98
|
-
- prototypes/server/unicorn/config.ru
|
99
|
-
- prototypes/server/unicorn/Gemfile
|
100
|
-
- prototypes/server/unicorn/log/README
|
101
|
-
- prototypes/server/unicorn/Rakefile
|
102
|
-
- prototypes/server/unicorn/script/console
|
103
|
-
- prototypes/server/unicorn/tmp/pids/README
|
104
|
-
- prototypes/server/unicorn/tmp/README
|
105
|
-
- prototypes/server/unicorn/unicorn.ru
|
106
108
|
- spec/lib/picky-generators/generators/base_spec.rb
|
107
109
|
- spec/lib/picky-generators/generators/client/sinatra_spec.rb
|
108
110
|
- spec/lib/picky-generators/generators/selector_spec.rb
|