blueprints 0.4.1 → 0.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.1
1
+ 0.4.2
data/blueprints.gemspec CHANGED
@@ -1,15 +1,15 @@
1
1
  # Generated by jeweler
2
- # DO NOT EDIT THIS FILE
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run `rake gemspec`
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
4
  # -*- encoding: utf-8 -*-
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{blueprints}
8
- s.version = "0.4.1"
8
+ s.version = "0.4.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Andrius Chamentauskas"]
12
- s.date = %q{2009-12-29}
12
+ s.date = %q{2010-01-02}
13
13
  s.description = %q{Another replacement for factories and fixtures. The library that lazy typists will love}
14
14
  s.email = %q{sinsiliux@gmail.com}
15
15
  s.extra_rdoc_files = [
@@ -62,16 +62,16 @@ Gem::Specification.new do |s|
62
62
  s.rubygems_version = %q{1.3.5}
63
63
  s.summary = %q{Another replacement for factories and fixtures}
64
64
  s.test_files = [
65
- "spec/active_record/blueprints_spec.rb",
66
- "spec/active_record/fixtures/fruit.rb",
65
+ "spec/no_db/fixtures/fruit.rb",
66
+ "spec/no_db/blueprint.rb",
67
+ "spec/no_db/blueprints_spec.rb",
68
+ "spec/no_db/spec_helper.rb",
67
69
  "spec/active_record/fixtures/tree.rb",
70
+ "spec/active_record/fixtures/fruit.rb",
68
71
  "spec/active_record/fixtures/schema.rb",
69
72
  "spec/active_record/blueprint.rb",
73
+ "spec/active_record/blueprints_spec.rb",
70
74
  "spec/active_record/spec_helper.rb",
71
- "spec/no_db/blueprints_spec.rb",
72
- "spec/no_db/fixtures/fruit.rb",
73
- "spec/no_db/blueprint.rb",
74
- "spec/no_db/spec_helper.rb",
75
75
  "test/test_helper.rb",
76
76
  "test/blueprints_test.rb"
77
77
  ]
@@ -86,3 +86,4 @@ Gem::Specification.new do |s|
86
86
  else
87
87
  end
88
88
  end
89
+
data/lib/blueprints.rb CHANGED
@@ -1,4 +1,4 @@
1
- require 'activesupport'
1
+ require 'active_support'
2
2
  files = %w{
3
3
  context buildable namespace root_namespace plan file_context helper errors
4
4
  database_backends/abstract database_backends/active_record database_backends/none
@@ -20,7 +20,7 @@ module Blueprints
20
20
 
21
21
  # Returns a list of supported ORMs. For now it supports ActiveRecord and None.
22
22
  def self.supported_orms
23
- (DatabaseBackends.constants - ['Abstract']).collect {|class_name| class_name.underscore.to_sym }
23
+ DatabaseBackends.constants.collect {|class_name| class_name.to_s.underscore.to_sym } - [:abstract]
24
24
  end
25
25
 
26
26
  # Returns root of project blueprints is used in. Automatically detected for rails and merb. Can be overwritten by using
@@ -15,12 +15,13 @@ module Blueprints
15
15
  @parents = (@parents || []) + scenarios.map{|s| s.to_sym}
16
16
  end
17
17
 
18
- # Builds dependencies of blueprint and then blueprint itself.
19
- def build
18
+ # Builds dependencies of blueprint and then blueprint itself.
19
+ def build(options = {})
20
20
  namespace = self
21
21
  namespace.build_parent_plans while namespace = namespace.namespace
22
22
  build_parent_plans
23
- build_plan
23
+ Namespace.root.context.options = options
24
+ build_plan.tap { Namespace.root.context.options = {} }
24
25
  end
25
26
 
26
27
  protected
@@ -38,8 +38,8 @@ module Blueprints
38
38
 
39
39
  # Builds blueprints that are passed against current context.
40
40
  def build(*names)
41
- @context.options = names.extract_options!
42
- names.map {|name| self[name].build}
41
+ options = names.extract_options!
42
+ names.map {|name| self[name].build(options) }
43
43
  end
44
44
 
45
45
  # Sets instance variable in current context to passed value.
@@ -284,7 +284,7 @@ describe Blueprints do
284
284
  @pitted_peach.should_not be_nil
285
285
  @pitted_acorn.should_not be_nil
286
286
  @pitted_red_apple.should_not be_nil
287
- @pitted.sort_by(&:id).should == [@pitted_peach_tree, @pitted_peach, @pitted_acorn, [@pitted_red_apple]].sort_by(&:id)
287
+ @pitted.should =~ [@pitted_peach_tree, @pitted_peach, @pitted_acorn, [@pitted_red_apple]]
288
288
  end
289
289
 
290
290
  describe "with red namespace" do
@@ -319,6 +319,11 @@ describe Blueprints do
319
319
  @apple_with_params.average_diameter.should == nil
320
320
  @apple_with_params.species.should == 'apple'
321
321
  end
322
+
323
+ it "should use extra params only on blueprints specified" do
324
+ build :acorn, :average_diameter => 5
325
+ @acorn.average_diameter.should == 5
326
+ end
322
327
  end
323
328
  end
324
329
 
@@ -1,5 +1,6 @@
1
+ require 'rubygems'
1
2
  require 'fileutils'
2
- require 'activerecord'
3
+ require 'active_record'
3
4
  begin
4
5
  require 'mysqlplus'
5
6
  rescue LoadError
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blueprints
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrius Chamentauskas
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-12-29 00:00:00 +02:00
12
+ date: 2010-01-02 00:00:00 +02:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -90,15 +90,15 @@ signing_key:
90
90
  specification_version: 3
91
91
  summary: Another replacement for factories and fixtures
92
92
  test_files:
93
- - spec/active_record/blueprints_spec.rb
94
- - spec/active_record/fixtures/fruit.rb
93
+ - spec/no_db/fixtures/fruit.rb
94
+ - spec/no_db/blueprint.rb
95
+ - spec/no_db/blueprints_spec.rb
96
+ - spec/no_db/spec_helper.rb
95
97
  - spec/active_record/fixtures/tree.rb
98
+ - spec/active_record/fixtures/fruit.rb
96
99
  - spec/active_record/fixtures/schema.rb
97
100
  - spec/active_record/blueprint.rb
101
+ - spec/active_record/blueprints_spec.rb
98
102
  - spec/active_record/spec_helper.rb
99
- - spec/no_db/blueprints_spec.rb
100
- - spec/no_db/fixtures/fruit.rb
101
- - spec/no_db/blueprint.rb
102
- - spec/no_db/spec_helper.rb
103
103
  - test/test_helper.rb
104
104
  - test/blueprints_test.rb