webbynode-blueprint 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
2
  :minor: 0
3
- :patch: 3
3
+ :patch: 4
4
4
  :major: 0
@@ -25,16 +25,20 @@ class Blueprint
25
25
  else
26
26
  @def[:content] ||= s
27
27
  @def[:script] = "#{s}.sh"
28
- @def[:email] = "#{s}.markdown" if @def["item_type"] == "readystack"
28
+ @def[:email] = "#{s}.markdown" if @def[:item_type] == "readystack"
29
29
  @def[:item_type] ||= "stack"
30
30
 
31
31
  end
32
32
 
33
33
  (errors ||= []) << "provides requires the blueprint name" if @def.empty?
34
34
  (errors ||= []) << "no blueprint name found" unless @def.has_key?(:content)
35
- # (errors ||= []) << "no email template found for #{@def[:content]}" unless @def.has_key?(:email)
36
35
  (errors ||= []) << "no script found for #{@def[:content]}" unless @def.has_key?(:script)
37
36
 
37
+ if @def[:item_type] == "readystack" and not @def[:email]
38
+ (warnings ||= []) << "no email template found for #{@def[:content]}"
39
+ end
40
+
41
+ puts "Warning: #{warnings * ", "}" if warnings
38
42
  raise "Errors: #{errors * ", "}" if errors
39
43
  end
40
44
 
@@ -1,111 +1,25 @@
1
1
  require 'test_helper'
2
2
 
3
- class BlueprintTest < Test::Unit::TestCase
4
- def rails_blueprint
5
- blueprint "Rails" do |f|
6
- f.provides "rails"
7
-
8
- f.parameter "version", :label => "Rails Version", :render_as => "combobox",
9
- :values => ["2.3.2", "2.2.2", "2.1.2"]
10
-
11
- f.parameter "doc_rdoc", :label => "Install rdoc", :render_as => "checkbox"
12
- f.parameter "doc_ri", :label => "Install ri", :render_as => "checkbox"
13
-
14
- f.parameter "create-dummyapp",
15
- :label => "Create dummy app?",
16
- :render_as => "checkbox",
17
- :attributes => {:default => "y"}
18
-
19
- f.parameter "dummyapp-path",
20
- :label => "Path for dummy app",
21
- :render_as => "text",
22
- :attributes => {
23
- "required" => "y",
24
- "default" => "/var/rails",
25
- "validation" => "^((?:\/[a-zA-Z0-9]+(?:_[a-zA-Z0-9]+)*(?:\-[a-zA-Z0-9]+)*)+)$",
26
- "validation_error" => "Use a valid path without an ending slash (ie, <code>/var/www</code>)"
27
- }
28
-
29
- f.parameter "dummyapp-database",
30
- :label => "Database for dummy app",
31
- :render_as => "combobox" do |p|
32
-
33
- p.value "sqlite3", :label => "SQLite 3"
34
- p.value "mysql", :label => "MySQL"
35
- p.value "sqlite2", :label => "SQLite 2"
36
- p.value "postgresql", :label => "PostgreSQL"
37
-
38
- end
39
- end
3
+ module Kernel
4
+
5
+ def capture_stdout
6
+ out = StringIO.new
7
+ $stdout = out
8
+ yield
9
+ $stdout = STDOUT
10
+ return out
40
11
  end
41
-
42
- def rails_readystack_blueprint
43
- blueprint(:label => "Rails", :type => "readystack") do |f|
44
- # this blueprint delivers "rs.rails"
45
- f.provides "rs.rails"
46
-
47
- # dependencies and order of execution -- top => bottom
48
- # apache2/ngnix, mysql/postgre, passenger/mongrel
49
- f.requires :group => "webservers",
50
- :with => ["apache2", "nginx"]
51
- f.requires :group => "database",
52
- :with => ["mysql-server", "postgresqlserver"]
53
- f.requires "rails"
54
- f.requires :group => "proxy",
55
- :with => ["passenger", "mongrel_cluster"]
56
-
57
- # attributes
58
- f.attributes :required => 'y'
59
- f.outputs :installed_gems => "^Installed following gems: (.*)",
60
- :success_indicator => "^SUCCESS: (.*)"
61
-
62
- # always installs rails
63
- f.dependency "rails", :render_as => "hidden"
64
-
65
- # gives two webserver/proxy combo options:
66
- # apache2 + passenger or nginx + mongrel
67
- f.parameter "webserver-proxy", :label => "WebServer and Proxy" do |p|
68
- p.attributes :required => "y"
69
-
70
- p.aggregate "Apache2 and Passenger", :render_as => "radio" do |agr|
71
- agr.dependency "apache2"
72
- agr.dependency "passenger"
73
- end
74
-
75
- p.aggregate "Nginx and Mongrel Cluster", :render_as => "radio" do |agr|
76
- agr.dependency "nginx"
77
- agr.dependency "mongrel_cluster"
78
- end
79
-
80
- # doesn't install webserver/proxy
81
- p.aggregate "No webserver & proxy", :render_as => "radio" do |agr|
82
- agr.parameter "-"
83
- end
84
- end
85
-
86
- # database options: mysql or postgresql
87
- f.parameter "database-server", :label => "Database Server" do |p|
88
- p.attributes :required => "y"
89
-
90
- p.dependency "mysql-server", :label => "MySQL", :render_as => "radio"
91
- p.dependency "postgresqlserver", :label => "PostgreSQL", :render_as => "radio"
92
- p.no_op "No database server", :render_as => "radio"
93
- end
94
-
95
- # list of gems
96
- f.aggregate "Additional Gems" do |agr|
97
- %w{will_paginate thoughtbot-paperclip
98
- rspec authlogic hpricot capistrano}.each do |gem|
99
-
100
- agr.parameter "gem_#{gem}", :label => gem, :render_as => "checkbox"
12
+
13
+ end
101
14
 
102
- end
15
+ class BlueprintTest < Test::Unit::TestCase
16
+ def test_missing_email
17
+ out = capture_stdout do
18
+ b = blueprint "Test", :item_type => "readystack" do |f|
19
+ f.provides "rails", :script => "script.sh"
103
20
  end
104
21
  end
105
- end
106
-
107
- should "probably rename this file and start testing for real" do
108
- puts rails_blueprint.to_yaml
109
- puts rails_readystack_blueprint.to_yaml
22
+
23
+ assert out.string.include?("no email template found for rails")
110
24
  end
111
25
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: webbynode-blueprint
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Felipe Coury
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-04-01 00:00:00 -07:00
12
+ date: 2009-04-06 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies: []
15
15