webbynode-blueprint 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION.yml +1 -1
- data/lib/blueprint/blueprint.rb +9 -3
- data/lib/blueprint.rb +5 -0
- data/test/blueprint_test.rb +2 -2
- metadata +1 -1
data/VERSION.yml
CHANGED
data/lib/blueprint/blueprint.rb
CHANGED
@@ -6,8 +6,12 @@ class Blueprint
|
|
6
6
|
include Utils
|
7
7
|
include BlueprintComponents
|
8
8
|
|
9
|
-
def initialize(
|
10
|
-
|
9
|
+
def initialize(s)
|
10
|
+
if s.is_a?(Hash)
|
11
|
+
@def = s
|
12
|
+
else
|
13
|
+
@def[:label] = s
|
14
|
+
end
|
11
15
|
end
|
12
16
|
|
13
17
|
def provides(*args)
|
@@ -18,12 +22,14 @@ class Blueprint
|
|
18
22
|
@def.merge!(opts)
|
19
23
|
|
20
24
|
else
|
25
|
+
@def[:name] ||= s
|
21
26
|
@def[:script] = "#{s}.sh"
|
22
27
|
@def[:email] = "#{s}.markdown"
|
23
28
|
|
24
29
|
end
|
25
30
|
|
26
|
-
(errors ||= []) << "provides requires
|
31
|
+
(errors ||= []) << "provides requires the blueprint name" if @def.empty?
|
32
|
+
(errors ||= []) << "no blueprint name found for #{@def[:content]}" unless @def.has_key?(:name)
|
27
33
|
(errors ||= []) << "no email template found for #{@def[:content]}" unless @def.has_key?(:email)
|
28
34
|
(errors ||= []) << "no script found for #{@def[:content]}" unless @def.has_key?(:script)
|
29
35
|
|
data/lib/blueprint.rb
CHANGED
data/test/blueprint_test.rb
CHANGED
@@ -2,7 +2,7 @@ require 'test_helper'
|
|
2
2
|
|
3
3
|
class BlueprintTest < Test::Unit::TestCase
|
4
4
|
def rails_blueprint
|
5
|
-
blueprint
|
5
|
+
blueprint "Rails" do |f|
|
6
6
|
f.provides "rails"
|
7
7
|
|
8
8
|
f.parameter "version", :label => "Rails Version", :render_as => "combobox" do |p|
|
@@ -42,7 +42,7 @@ class BlueprintTest < Test::Unit::TestCase
|
|
42
42
|
end
|
43
43
|
|
44
44
|
def rails_readystack_blueprint
|
45
|
-
blueprint(:
|
45
|
+
blueprint(:label => "Rails", :type => "readystack") do |f|
|
46
46
|
# this blueprint delivers "rs.rails"
|
47
47
|
f.provides "rs.rails"
|
48
48
|
|