yaddl 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,5 @@
1
+ require 'yaddl'
2
+
1
3
  namespace :yaddl do
2
4
  desc "Print generated yaml ddl to console"
3
5
  task :review do
data/lib/yaddl/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Yaddl
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -0,0 +1,60 @@
1
+  (0.3ms) begin transaction
2
+ ---------------------------------
3
+ YaddlTest: test_create_test_model
4
+ ---------------------------------
5
+  (0.1ms) rollback transaction
6
+  (0.1ms) begin transaction
7
+ -----------------------
8
+ YaddlTest: test_defined
9
+ -----------------------
10
+  (0.1ms) rollback transaction
11
+  (0.5ms) begin transaction
12
+ ---------------------------------
13
+ YaddlTest: test_create_test_model
14
+ ---------------------------------
15
+  (0.2ms) rollback transaction
16
+  (0.1ms) begin transaction
17
+ -----------------------
18
+ YaddlTest: test_defined
19
+ -----------------------
20
+  (0.1ms) rollback transaction
21
+  (0.3ms) begin transaction
22
+ ---------------------------------
23
+ YaddlTest: test_create_test_model
24
+ ---------------------------------
25
+  (0.2ms) rollback transaction
26
+  (0.1ms) begin transaction
27
+ -----------------------
28
+ YaddlTest: test_defined
29
+ -----------------------
30
+  (0.1ms) rollback transaction
31
+  (0.3ms) begin transaction
32
+ ---------------------------------
33
+ YaddlTest: test_create_test_model
34
+ ---------------------------------
35
+  (0.1ms) rollback transaction
36
+  (0.1ms) begin transaction
37
+ -----------------------
38
+ YaddlTest: test_defined
39
+ -----------------------
40
+  (0.0ms) rollback transaction
41
+  (0.3ms) begin transaction
42
+ ---------------------------------
43
+ YaddlTest: test_create_test_model
44
+ ---------------------------------
45
+  (0.2ms) rollback transaction
46
+  (0.1ms) begin transaction
47
+ -----------------------
48
+ YaddlTest: test_defined
49
+ -----------------------
50
+  (0.1ms) rollback transaction
51
+  (0.2ms) begin transaction
52
+ ---------------------------------
53
+ YaddlTest: test_create_test_model
54
+ ---------------------------------
55
+  (0.1ms) rollback transaction
56
+  (0.1ms) begin transaction
57
+ -----------------------
58
+ YaddlTest: test_defined
59
+ -----------------------
60
+  (0.0ms) rollback transaction
data/test/yaddl_test.rb CHANGED
@@ -6,14 +6,50 @@ class YaddlTest < ActiveSupport::TestCase
6
6
  end
7
7
  test "create test model" do
8
8
  y = Yaddl::Yaddl.new
9
- y.markup = "TestModel"
9
+ y.markup = "TestModel(name:string)
10
+ =to_s{name}
11
+ *RelatedModel"
10
12
  y.generate("--no-scaffolds --quiet")
11
13
  assert_file "app/models/test_model.rb", "class TestModel < ActiveRecord::Base
14
+ has_many :related_models, dependent: :destroy
12
15
 
16
+ attr_accessible :name
17
+
18
+ accepts_nested_attributes_for :related_models
19
+
20
+ # returns: string
21
+ def to_s
22
+ name
23
+ end
24
+ end
25
+ "
26
+ assert_file "app/models/related_model.rb", "class RelatedModel < ActiveRecord::Base
27
+ belongs_to :test_model
28
+
29
+ attr_accessible :test_model_id
13
30
  end
14
31
  "
15
32
  assert_file "db/schema.yaml", "---
16
- TestModel: {}
33
+ TestModel:
34
+ attributes:
35
+ name:
36
+ type: string
37
+ primary_ref:
38
+ -
39
+ methods:
40
+ to_s:
41
+ returns: string
42
+ getter: name
43
+ has_many:
44
+ related_models:
45
+ dependent: destroy
46
+ class_names:
47
+ - RelatedModel
48
+ RelatedModel:
49
+ belongs_to:
50
+ test_model:
51
+ class_names:
52
+ - TestModel
17
53
  "
18
54
  end
19
55
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yaddl
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -56,7 +56,6 @@ files:
56
56
  - lib/yaddl.rb
57
57
  - MIT-LICENSE
58
58
  - Rakefile
59
- - README.rdoc
60
59
  - test/dummy/app/assets/javascripts/application.js
61
60
  - test/dummy/app/assets/stylesheets/application.css
62
61
  - test/dummy/app/controllers/application_controller.rb
@@ -83,6 +82,7 @@ files:
83
82
  - test/dummy/config/routes.rb
84
83
  - test/dummy/config.ru
85
84
  - test/dummy/db/test.sqlite3
85
+ - test/dummy/log/test.log
86
86
  - test/dummy/public/404.html
87
87
  - test/dummy/public/422.html
88
88
  - test/dummy/public/500.html
@@ -142,6 +142,7 @@ test_files:
142
142
  - test/dummy/config/routes.rb
143
143
  - test/dummy/config.ru
144
144
  - test/dummy/db/test.sqlite3
145
+ - test/dummy/log/test.log
145
146
  - test/dummy/public/404.html
146
147
  - test/dummy/public/422.html
147
148
  - test/dummy/public/500.html
data/README.rdoc DELETED
@@ -1,3 +0,0 @@
1
- = Yaddl
2
-
3
- This project rocks and uses MIT-LICENSE.