librails 0.1.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/librails.rb +1 -0
- data/lib/librails/model_utils.rb +108 -0
- data/lib/librails/version.rb +1 -1
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/log/development.log +35 -0
- data/test/dummy/log/test.log +279 -0
- data/test/fixtures/books.yml +1 -1
- data/test/{librails_test.rb → lib/librails_test.rb} +0 -0
- data/test/lib/misc_utils_test.rb +8 -0
- data/test/lib/model_utils_test.rb +62 -0
- data/test/models/book_test.rb +8 -0
- metadata +22 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7277bb7e704d7bafe62739abd7a89d944672615b
|
4
|
+
data.tar.gz: 832563e9d0fb0eb8b13bb2d41b6965da843e3a3c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d22684b43a390bca7a8b40f32fec9d7198437acd14a4e2aca4be4d8dba25ea23f857583f80f73486886daa342d35880c95eaf7ae86e6521b26d0d477bb3ed7df
|
7
|
+
data.tar.gz: b9d3b554f73ba12e467cbeadb365d5532ba6cb4786505575a12c931fe4a7112fe4cc155a747fa2d7162c2e2750164263b585f7cc465f36341102d03ef6b4facb
|
data/lib/librails.rb
CHANGED
@@ -0,0 +1,108 @@
|
|
1
|
+
module Librails
|
2
|
+
# Model related utilities
|
3
|
+
class SortItem
|
4
|
+
attr_accessor :item
|
5
|
+
attr_accessor :id, :array_index
|
6
|
+
end
|
7
|
+
|
8
|
+
class ModelUtils
|
9
|
+
def self.set_array_index(item, attr_name, index)
|
10
|
+
set_disp_order(item, attr_name, index + 1)
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.get_array_index(item, attr_name)
|
14
|
+
get_disp_order(item, attr_name) - 1
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.set_disp_order(item, attr_name, value)
|
18
|
+
item.send("#{attr_name}=", value)
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.get_disp_order(item, attr_name)
|
22
|
+
item.send(attr_name)
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.reorder(items, hash, attr_name = 'disp_order', hash_key = 'disp_order')
|
26
|
+
#items: ソート対象のオブジェクト(attr_nameで指定された属性で並び替えられている)
|
27
|
+
#hash: idと順番のハッシュ(hash_keyで指定された属性に新しい順番が指定されている)
|
28
|
+
# hash = {
|
29
|
+
# '10' => {'disp_order' => '1'},
|
30
|
+
# '20' => {'disp_order' => '2'},
|
31
|
+
# '30' => {'disp_order' => '2'},
|
32
|
+
# '40' => {'disp_order' => '1'},
|
33
|
+
#}
|
34
|
+
|
35
|
+
# 最初に1からインデックスを振り直す
|
36
|
+
items.each_with_index do |item, index|
|
37
|
+
set_array_index(item, attr_name, index)
|
38
|
+
end
|
39
|
+
|
40
|
+
# 前準備、ソート対象になるオブジェクトをまとめる
|
41
|
+
sort_items = []
|
42
|
+
hash.keys.each do |idstr|
|
43
|
+
disp_order = hash[idstr][hash_key]
|
44
|
+
next unless disp_order
|
45
|
+
new_index = disp_order.to_i - 1
|
46
|
+
|
47
|
+
# 範囲内に補正
|
48
|
+
if new_index < 0
|
49
|
+
new_index = 0
|
50
|
+
end
|
51
|
+
if new_index >= items.size - 1
|
52
|
+
new_index = items.size - 1
|
53
|
+
end
|
54
|
+
|
55
|
+
# IDでオブジェクトを検索
|
56
|
+
id = idstr.to_i
|
57
|
+
item = items.find{|s| s.id == id}
|
58
|
+
next if get_array_index(item, attr_name) == new_index #変化が無い場合は次へ
|
59
|
+
|
60
|
+
# index=順番に変更があるものはsorted_itemsに記憶
|
61
|
+
sort_item = SortItem.new
|
62
|
+
sort_item.item = item
|
63
|
+
sort_item.id = id
|
64
|
+
sort_item.array_index = new_index
|
65
|
+
sort_items << sort_item
|
66
|
+
end
|
67
|
+
|
68
|
+
# 入れ替える前にソートしておく。ただしい順で番号を入れ直すために必要。
|
69
|
+
# 例えば以下のような指定を考える
|
70
|
+
# 10
|
71
|
+
# 20
|
72
|
+
# 30
|
73
|
+
# 40 - 2
|
74
|
+
# 50 - 1
|
75
|
+
# a)2,1の順で入れると以下のようになる
|
76
|
+
# 50 - 1
|
77
|
+
# 10
|
78
|
+
# 40 - 2(3番目になってしまっている)
|
79
|
+
# 20
|
80
|
+
# 30
|
81
|
+
# b)1,2の順で入れると正しい
|
82
|
+
# 50 - 1
|
83
|
+
# 40 - 2
|
84
|
+
# 10
|
85
|
+
# 20
|
86
|
+
# 30
|
87
|
+
|
88
|
+
sort_items.sort!{|a, b|
|
89
|
+
r = a.array_index <=> b.array_index
|
90
|
+
if r == 0
|
91
|
+
r = a.id <=> b.id
|
92
|
+
end
|
93
|
+
r
|
94
|
+
}
|
95
|
+
# 新しい位置に挿入
|
96
|
+
sort_items.each do |sort_item|
|
97
|
+
item = sort_item.item
|
98
|
+
items.delete_at(items.index(item)) #ソートの途中で順番が変わっている可能性があるのでその都度検索する必要あり。deleteはdbが削除されるので使えない
|
99
|
+
items[sort_item.array_index, 0] = item
|
100
|
+
end
|
101
|
+
items.each_with_index do |item, index|
|
102
|
+
set_array_index(item, attr_name, index)
|
103
|
+
# item.child_index = index + 1
|
104
|
+
# print "after #{index} title=#{item.title} #{item.child_index}\n"
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
data/lib/librails/version.rb
CHANGED
data/test/dummy/db/test.sqlite3
CHANGED
Binary file
|
@@ -88,3 +88,38 @@ Started GET "/assets/books.self-19a187bec6cdb96d6de80a61c16c857c613536adf9138476
|
|
88
88
|
|
89
89
|
|
90
90
|
Started GET "/assets/application.self-8f06a73c35179188914ab50e057157639fce1401c1cdca640ac9cec33746fc5b.js?body=1" for ::1 at 2016-10-25 14:29:38 +0900
|
91
|
+
|
92
|
+
|
93
|
+
Started GET "/" for 127.0.0.1 at 2017-03-15 15:21:27 +0900
|
94
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.4ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
95
|
+
Processing by Rails::WelcomeController#index as HTML
|
96
|
+
Rendered /Users/sora/work/librails/vendor/bundle/ruby/2.4.0/gems/railties-4.2.8/lib/rails/templates/rails/welcome/index.html.erb (1.8ms)
|
97
|
+
Completed 200 OK in 11ms (Views: 11.2ms | ActiveRecord: 0.0ms)
|
98
|
+
|
99
|
+
|
100
|
+
Started GET "/books" for 127.0.0.1 at 2017-03-15 15:21:34 +0900
|
101
|
+
Processing by BooksController#index as HTML
|
102
|
+
[1m[35mBook Load (0.5ms)[0m SELECT "books".* FROM "books"
|
103
|
+
Rendered books/index.html.erb within layouts/application (11.5ms)
|
104
|
+
Completed 200 OK in 217ms (Views: 212.7ms | ActiveRecord: 0.6ms)
|
105
|
+
|
106
|
+
|
107
|
+
Started GET "/assets/books.self-b60acab5af8d245ed2b3012f77d11d8d207d8eada27756badaf4ef05770d60f6.css?body=1" for 127.0.0.1 at 2017-03-15 15:21:34 +0900
|
108
|
+
|
109
|
+
|
110
|
+
Started GET "/assets/scaffold.self-83b741db49389dc7cfdf85bf7537a0219cce48e085c4116afc83d55c9af47c78.css?body=1" for 127.0.0.1 at 2017-03-15 15:21:34 +0900
|
111
|
+
|
112
|
+
|
113
|
+
Started GET "/assets/books.self-19a187bec6cdb96d6de80a61c16c857c613536adf9138476bd367db38d282635.js?body=1" for 127.0.0.1 at 2017-03-15 15:21:34 +0900
|
114
|
+
|
115
|
+
|
116
|
+
Started GET "/assets/application.self-e80e8f2318043e8af94dddc2adad5a4f09739a8ebb323b3ab31cd71d45fd9113.css?body=1" for 127.0.0.1 at 2017-03-15 15:21:34 +0900
|
117
|
+
|
118
|
+
|
119
|
+
Started GET "/assets/application.self-8f06a73c35179188914ab50e057157639fce1401c1cdca640ac9cec33746fc5b.js?body=1" for 127.0.0.1 at 2017-03-15 15:21:34 +0900
|
120
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.1ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
121
|
+
[1m[35mActiveRecord::SchemaMigration Load (0.1ms)[0m SELECT "schema_migrations".* FROM "schema_migrations"
|
122
|
+
[1m[36m (0.1ms)[0m [1mSELECT "schema_migrations"."version" FROM "schema_migrations"[0m
|
123
|
+
[1m[36m (0.1ms)[0m [1mSELECT "schema_migrations"."version" FROM "schema_migrations"[0m
|
124
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.1ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
125
|
+
[1m[35mActiveRecord::SchemaMigration Load (0.1ms)[0m SELECT "schema_migrations".* FROM "schema_migrations"
|
data/test/dummy/log/test.log
CHANGED
@@ -648,3 +648,282 @@ Processing by BooksController#index as HTML
|
|
648
648
|
Rendered books/index.html.erb within layouts/application (2.8ms)
|
649
649
|
Completed 200 OK in 146ms (Views: 145.8ms | ActiveRecord: 0.1ms)
|
650
650
|
[1m[35m (0.1ms)[0m rollback transaction
|
651
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.6ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
652
|
+
[1m[35m (0.1ms)[0m begin transaction
|
653
|
+
[1m[36mFixture Delete (0.8ms)[0m [1mDELETE FROM "books"[0m
|
654
|
+
[1m[35mFixture Insert (0.6ms)[0m INSERT INTO "books" ("title", "author", "summary", "created_at", "updated_at", "id") VALUES ('MyString', 'MyString', 'MyText', '2017-03-15 06:31:14', '2017-03-15 06:31:14', 980190962)
|
655
|
+
[1m[36mFixture Insert (0.1ms)[0m [1mINSERT INTO "books" ("title", "author", "summary", "created_at", "updated_at", "id") VALUES ('MyString', 'MyString', 'MyText', '2017-03-15 06:31:14', '2017-03-15 06:31:14', 298486374)[0m
|
656
|
+
[1m[35m (1.0ms)[0m commit transaction
|
657
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
658
|
+
---------------------------------------
|
659
|
+
MiscUtilsTest: test_rescue_mysql2_error
|
660
|
+
---------------------------------------
|
661
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
662
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.3ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
663
|
+
[1m[35m (0.2ms)[0m begin transaction
|
664
|
+
[1m[36mFixture Delete (0.4ms)[0m [1mDELETE FROM "books"[0m
|
665
|
+
[1m[35mFixture Insert (0.3ms)[0m INSERT INTO "books" ("title", "author", "summary", "created_at", "updated_at", "id") VALUES ('MyString', 'MyString', 'MyText', '2017-03-15 06:31:47', '2017-03-15 06:31:47', 980190962)
|
666
|
+
[1m[36mFixture Insert (0.1ms)[0m [1mINSERT INTO "books" ("title", "author", "summary", "created_at", "updated_at", "id") VALUES ('MyString', 'MyString', 'MyText', '2017-03-15 06:31:47', '2017-03-15 06:31:47', 298486374)[0m
|
667
|
+
[1m[35m (8.4ms)[0m commit transaction
|
668
|
+
[1m[36m (0.2ms)[0m [1mbegin transaction[0m
|
669
|
+
---------------------------------------
|
670
|
+
MiscUtilsTest: test_rescue_mysql2_error
|
671
|
+
---------------------------------------
|
672
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.2ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
673
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.2ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
674
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.2ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
675
|
+
[1m[35m (0.2ms)[0m begin transaction
|
676
|
+
[1m[36mFixture Delete (0.4ms)[0m [1mDELETE FROM "books"[0m
|
677
|
+
[1m[35mFixture Insert (0.2ms)[0m INSERT INTO "books" ("title", "author", "summary", "created_at", "updated_at", "id") VALUES ('One', 'MyString', 'MyText', '2017-03-15 07:10:10', '2017-03-15 07:10:10', 980190962)
|
678
|
+
[1m[36mFixture Insert (0.1ms)[0m [1mINSERT INTO "books" ("title", "author", "summary", "created_at", "updated_at", "id") VALUES ('MyString', 'MyString', 'MyText', '2017-03-15 07:10:10', '2017-03-15 07:10:10', 298486374)[0m
|
679
|
+
[1m[35m (0.9ms)[0m commit transaction
|
680
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
681
|
+
-------------------
|
682
|
+
BookTest: test_book
|
683
|
+
-------------------
|
684
|
+
[1m[35mBook Load (0.4ms)[0m SELECT "books".* FROM "books" WHERE "books"."id" = ? LIMIT 1 [["id", 980190962]]
|
685
|
+
[1m[36m (0.4ms)[0m [1mrollback transaction[0m
|
686
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.2ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
687
|
+
[1m[35m (0.2ms)[0m begin transaction
|
688
|
+
[1m[36mFixture Delete (0.5ms)[0m [1mDELETE FROM "books"[0m
|
689
|
+
[1m[35mFixture Insert (0.3ms)[0m INSERT INTO "books" ("title", "author", "summary", "created_at", "updated_at", "id") VALUES ('One', 'MyString', 'MyText', '2017-03-15 07:10:37', '2017-03-15 07:10:37', 980190962)
|
690
|
+
[1m[36mFixture Insert (0.1ms)[0m [1mINSERT INTO "books" ("title", "author", "summary", "created_at", "updated_at", "id") VALUES ('MyString', 'MyString', 'MyText', '2017-03-15 07:10:37', '2017-03-15 07:10:37', 298486374)[0m
|
691
|
+
[1m[35m (1.0ms)[0m commit transaction
|
692
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
693
|
+
-------------------
|
694
|
+
BookTest: test_book
|
695
|
+
-------------------
|
696
|
+
[1m[35mBook Load (0.4ms)[0m SELECT "books".* FROM "books" WHERE "books"."id" = ? LIMIT 1 [["id", 980190962]]
|
697
|
+
[1m[36m (0.2ms)[0m [1mrollback transaction[0m
|
698
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.1ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
699
|
+
[1m[35m (0.2ms)[0m begin transaction
|
700
|
+
[1m[36mFixture Delete (0.4ms)[0m [1mDELETE FROM "books"[0m
|
701
|
+
[1m[35mFixture Insert (0.1ms)[0m INSERT INTO "books" ("title", "author", "summary", "created_at", "updated_at", "id") VALUES ('One', 'MyString', 'MyText', '2017-03-15 09:15:29', '2017-03-15 09:15:29', 980190962)
|
702
|
+
[1m[36mFixture Insert (0.1ms)[0m [1mINSERT INTO "books" ("title", "author", "summary", "created_at", "updated_at", "id") VALUES ('MyString', 'MyString', 'MyText', '2017-03-15 09:15:29', '2017-03-15 09:15:29', 298486374)[0m
|
703
|
+
[1m[35m (0.8ms)[0m commit transaction
|
704
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
705
|
+
------------------------------------
|
706
|
+
ModelUtilsTest: test_reorder_forward
|
707
|
+
------------------------------------
|
708
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
709
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.1ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
710
|
+
[1m[35m (0.1ms)[0m begin transaction
|
711
|
+
[1m[36mFixture Delete (0.5ms)[0m [1mDELETE FROM "books"[0m
|
712
|
+
[1m[35mFixture Insert (0.2ms)[0m INSERT INTO "books" ("title", "author", "summary", "created_at", "updated_at", "id") VALUES ('One', 'MyString', 'MyText', '2017-03-15 09:16:36', '2017-03-15 09:16:36', 980190962)
|
713
|
+
[1m[36mFixture Insert (0.1ms)[0m [1mINSERT INTO "books" ("title", "author", "summary", "created_at", "updated_at", "id") VALUES ('MyString', 'MyString', 'MyText', '2017-03-15 09:16:36', '2017-03-15 09:16:36', 298486374)[0m
|
714
|
+
[1m[35m (8.3ms)[0m commit transaction
|
715
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
716
|
+
------------------------------------
|
717
|
+
ModelUtilsTest: test_reorder_forward
|
718
|
+
------------------------------------
|
719
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
720
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.1ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
721
|
+
[1m[35m (0.2ms)[0m begin transaction
|
722
|
+
[1m[36mFixture Delete (0.8ms)[0m [1mDELETE FROM "books"[0m
|
723
|
+
[1m[35mFixture Insert (0.2ms)[0m INSERT INTO "books" ("title", "author", "summary", "created_at", "updated_at", "id") VALUES ('One', 'MyString', 'MyText', '2017-03-15 09:17:12', '2017-03-15 09:17:12', 980190962)
|
724
|
+
[1m[36mFixture Insert (0.1ms)[0m [1mINSERT INTO "books" ("title", "author", "summary", "created_at", "updated_at", "id") VALUES ('MyString', 'MyString', 'MyText', '2017-03-15 09:17:12', '2017-03-15 09:17:12', 298486374)[0m
|
725
|
+
[1m[35m (8.5ms)[0m commit transaction
|
726
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
727
|
+
---------------------------------------
|
728
|
+
MiscUtilsTest: test_rescue_mysql2_error
|
729
|
+
---------------------------------------
|
730
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
731
|
+
[1m[35m (0.6ms)[0m rollback transaction
|
732
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.2ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
733
|
+
[1m[35m (0.1ms)[0m begin transaction
|
734
|
+
[1m[36mFixture Delete (0.5ms)[0m [1mDELETE FROM "books"[0m
|
735
|
+
[1m[35mFixture Insert (0.3ms)[0m INSERT INTO "books" ("title", "author", "summary", "created_at", "updated_at", "id") VALUES ('One', 'MyString', 'MyText', '2017-03-15 09:18:15', '2017-03-15 09:18:15', 980190962)
|
736
|
+
[1m[36mFixture Insert (0.1ms)[0m [1mINSERT INTO "books" ("title", "author", "summary", "created_at", "updated_at", "id") VALUES ('MyString', 'MyString', 'MyText', '2017-03-15 09:18:15', '2017-03-15 09:18:15', 298486374)[0m
|
737
|
+
[1m[35m (8.3ms)[0m commit transaction
|
738
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
739
|
+
------------------------------------
|
740
|
+
ModelUtilsTest: test_reorder_forward
|
741
|
+
------------------------------------
|
742
|
+
[1m[35m (0.2ms)[0m rollback transaction
|
743
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.1ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
744
|
+
[1m[35m (0.1ms)[0m begin transaction
|
745
|
+
[1m[36mFixture Delete (0.9ms)[0m [1mDELETE FROM "books"[0m
|
746
|
+
[1m[35mFixture Insert (0.2ms)[0m INSERT INTO "books" ("title", "author", "summary", "created_at", "updated_at", "id") VALUES ('One', 'MyString', 'MyText', '2017-03-15 09:18:59', '2017-03-15 09:18:59', 980190962)
|
747
|
+
[1m[36mFixture Insert (0.1ms)[0m [1mINSERT INTO "books" ("title", "author", "summary", "created_at", "updated_at", "id") VALUES ('MyString', 'MyString', 'MyText', '2017-03-15 09:18:59', '2017-03-15 09:18:59', 298486374)[0m
|
748
|
+
[1m[35m (8.3ms)[0m commit transaction
|
749
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
750
|
+
------------------------------------
|
751
|
+
ModelUtilsTest: test_reorder_forward
|
752
|
+
------------------------------------
|
753
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
754
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.1ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
755
|
+
[1m[35m (0.1ms)[0m begin transaction
|
756
|
+
[1m[36mFixture Delete (0.5ms)[0m [1mDELETE FROM "books"[0m
|
757
|
+
[1m[35mFixture Insert (0.2ms)[0m INSERT INTO "books" ("title", "author", "summary", "created_at", "updated_at", "id") VALUES ('One', 'MyString', 'MyText', '2017-03-15 09:20:07', '2017-03-15 09:20:07', 980190962)
|
758
|
+
[1m[36mFixture Insert (0.1ms)[0m [1mINSERT INTO "books" ("title", "author", "summary", "created_at", "updated_at", "id") VALUES ('MyString', 'MyString', 'MyText', '2017-03-15 09:20:07', '2017-03-15 09:20:07', 298486374)[0m
|
759
|
+
[1m[35m (8.4ms)[0m commit transaction
|
760
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
761
|
+
------------------------------------
|
762
|
+
ModelUtilsTest: test_reorder_forward
|
763
|
+
------------------------------------
|
764
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
765
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.1ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
766
|
+
[1m[35m (0.1ms)[0m begin transaction
|
767
|
+
[1m[36mFixture Delete (0.5ms)[0m [1mDELETE FROM "books"[0m
|
768
|
+
[1m[35mFixture Insert (0.2ms)[0m INSERT INTO "books" ("title", "author", "summary", "created_at", "updated_at", "id") VALUES ('One', 'MyString', 'MyText', '2017-03-15 09:21:32', '2017-03-15 09:21:32', 980190962)
|
769
|
+
[1m[36mFixture Insert (0.1ms)[0m [1mINSERT INTO "books" ("title", "author", "summary", "created_at", "updated_at", "id") VALUES ('MyString', 'MyString', 'MyText', '2017-03-15 09:21:32', '2017-03-15 09:21:32', 298486374)[0m
|
770
|
+
[1m[35m (8.3ms)[0m commit transaction
|
771
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
772
|
+
------------------------------------
|
773
|
+
ModelUtilsTest: test_reorder_forward
|
774
|
+
------------------------------------
|
775
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
776
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.2ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
777
|
+
[1m[35m (0.2ms)[0m begin transaction
|
778
|
+
[1m[36mFixture Delete (0.6ms)[0m [1mDELETE FROM "books"[0m
|
779
|
+
[1m[35mFixture Insert (0.2ms)[0m INSERT INTO "books" ("title", "author", "summary", "created_at", "updated_at", "id") VALUES ('One', 'MyString', 'MyText', '2017-03-15 09:22:06', '2017-03-15 09:22:06', 980190962)
|
780
|
+
[1m[36mFixture Insert (0.1ms)[0m [1mINSERT INTO "books" ("title", "author", "summary", "created_at", "updated_at", "id") VALUES ('MyString', 'MyString', 'MyText', '2017-03-15 09:22:06', '2017-03-15 09:22:06', 298486374)[0m
|
781
|
+
[1m[35m (0.8ms)[0m commit transaction
|
782
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
783
|
+
------------------------------------
|
784
|
+
ModelUtilsTest: test_reorder_forward
|
785
|
+
------------------------------------
|
786
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
787
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.2ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
788
|
+
[1m[35m (0.1ms)[0m begin transaction
|
789
|
+
[1m[36mFixture Delete (0.7ms)[0m [1mDELETE FROM "books"[0m
|
790
|
+
[1m[35mFixture Insert (0.2ms)[0m INSERT INTO "books" ("title", "author", "summary", "created_at", "updated_at", "id") VALUES ('One', 'MyString', 'MyText', '2017-03-15 09:22:42', '2017-03-15 09:22:42', 980190962)
|
791
|
+
[1m[36mFixture Insert (0.1ms)[0m [1mINSERT INTO "books" ("title", "author", "summary", "created_at", "updated_at", "id") VALUES ('MyString', 'MyString', 'MyText', '2017-03-15 09:22:42', '2017-03-15 09:22:42', 298486374)[0m
|
792
|
+
[1m[35m (8.3ms)[0m commit transaction
|
793
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
794
|
+
------------------------------------
|
795
|
+
ModelUtilsTest: test_reorder_forward
|
796
|
+
------------------------------------
|
797
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
798
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.1ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
799
|
+
[1m[35m (0.1ms)[0m begin transaction
|
800
|
+
[1m[36mFixture Delete (0.3ms)[0m [1mDELETE FROM "books"[0m
|
801
|
+
[1m[35mFixture Insert (0.1ms)[0m INSERT INTO "books" ("title", "author", "summary", "created_at", "updated_at", "id") VALUES ('One', 'MyString', 'MyText', '2017-03-15 09:23:39', '2017-03-15 09:23:39', 980190962)
|
802
|
+
[1m[36mFixture Insert (0.1ms)[0m [1mINSERT INTO "books" ("title", "author", "summary", "created_at", "updated_at", "id") VALUES ('MyString', 'MyString', 'MyText', '2017-03-15 09:23:39', '2017-03-15 09:23:39', 298486374)[0m
|
803
|
+
[1m[35m (8.4ms)[0m commit transaction
|
804
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
805
|
+
------------------------------------
|
806
|
+
ModelUtilsTest: test_reorder_forward
|
807
|
+
------------------------------------
|
808
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
809
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.1ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
810
|
+
[1m[35m (0.2ms)[0m begin transaction
|
811
|
+
[1m[36mFixture Delete (0.7ms)[0m [1mDELETE FROM "books"[0m
|
812
|
+
[1m[35mFixture Insert (0.2ms)[0m INSERT INTO "books" ("title", "author", "summary", "created_at", "updated_at", "id") VALUES ('One', 'MyString', 'MyText', '2017-03-15 09:24:22', '2017-03-15 09:24:22', 980190962)
|
813
|
+
[1m[36mFixture Insert (0.1ms)[0m [1mINSERT INTO "books" ("title", "author", "summary", "created_at", "updated_at", "id") VALUES ('MyString', 'MyString', 'MyText', '2017-03-15 09:24:22', '2017-03-15 09:24:22', 298486374)[0m
|
814
|
+
[1m[35m (8.6ms)[0m commit transaction
|
815
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
816
|
+
------------------------------------
|
817
|
+
ModelUtilsTest: test_reorder_forward
|
818
|
+
------------------------------------
|
819
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
820
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.4ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
821
|
+
[1m[35m (0.2ms)[0m begin transaction
|
822
|
+
[1m[36mFixture Delete (1.2ms)[0m [1mDELETE FROM "books"[0m
|
823
|
+
[1m[35mFixture Insert (0.6ms)[0m INSERT INTO "books" ("title", "author", "summary", "created_at", "updated_at", "id") VALUES ('One', 'MyString', 'MyText', '2017-03-15 10:08:42', '2017-03-15 10:08:42', 980190962)
|
824
|
+
[1m[36mFixture Insert (0.1ms)[0m [1mINSERT INTO "books" ("title", "author", "summary", "created_at", "updated_at", "id") VALUES ('MyString', 'MyString', 'MyText', '2017-03-15 10:08:42', '2017-03-15 10:08:42', 298486374)[0m
|
825
|
+
[1m[35m (0.8ms)[0m commit transaction
|
826
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
827
|
+
------------------------------------
|
828
|
+
ModelUtilsTest: test_reorder_forward
|
829
|
+
------------------------------------
|
830
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
831
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.1ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
832
|
+
[1m[35m (0.1ms)[0m begin transaction
|
833
|
+
[1m[36mFixture Delete (0.8ms)[0m [1mDELETE FROM "books"[0m
|
834
|
+
[1m[35mFixture Insert (0.3ms)[0m INSERT INTO "books" ("title", "author", "summary", "created_at", "updated_at", "id") VALUES ('One', 'MyString', 'MyText', '2017-03-15 10:09:32', '2017-03-15 10:09:32', 980190962)
|
835
|
+
[1m[36mFixture Insert (0.1ms)[0m [1mINSERT INTO "books" ("title", "author", "summary", "created_at", "updated_at", "id") VALUES ('MyString', 'MyString', 'MyText', '2017-03-15 10:09:32', '2017-03-15 10:09:32', 298486374)[0m
|
836
|
+
[1m[35m (0.7ms)[0m commit transaction
|
837
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
838
|
+
------------------------------------
|
839
|
+
ModelUtilsTest: test_reorder_forward
|
840
|
+
------------------------------------
|
841
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
842
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.1ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
843
|
+
[1m[35m (0.1ms)[0m begin transaction
|
844
|
+
[1m[36mFixture Delete (0.4ms)[0m [1mDELETE FROM "books"[0m
|
845
|
+
[1m[35mFixture Insert (0.2ms)[0m INSERT INTO "books" ("title", "author", "summary", "created_at", "updated_at", "id") VALUES ('One', 'MyString', 'MyText', '2017-03-15 10:11:23', '2017-03-15 10:11:23', 980190962)
|
846
|
+
[1m[36mFixture Insert (0.1ms)[0m [1mINSERT INTO "books" ("title", "author", "summary", "created_at", "updated_at", "id") VALUES ('MyString', 'MyString', 'MyText', '2017-03-15 10:11:23', '2017-03-15 10:11:23', 298486374)[0m
|
847
|
+
[1m[35m (0.7ms)[0m commit transaction
|
848
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
849
|
+
------------------------------------
|
850
|
+
ModelUtilsTest: test_reorder_forward
|
851
|
+
------------------------------------
|
852
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
853
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.1ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
854
|
+
[1m[35m (0.1ms)[0m begin transaction
|
855
|
+
[1m[36mFixture Delete (0.4ms)[0m [1mDELETE FROM "books"[0m
|
856
|
+
[1m[35mFixture Insert (0.2ms)[0m INSERT INTO "books" ("title", "author", "summary", "created_at", "updated_at", "id") VALUES ('One', 'MyString', 'MyText', '2017-03-15 10:11:28', '2017-03-15 10:11:28', 980190962)
|
857
|
+
[1m[36mFixture Insert (0.1ms)[0m [1mINSERT INTO "books" ("title", "author", "summary", "created_at", "updated_at", "id") VALUES ('MyString', 'MyString', 'MyText', '2017-03-15 10:11:28', '2017-03-15 10:11:28', 298486374)[0m
|
858
|
+
[1m[35m (0.8ms)[0m commit transaction
|
859
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
860
|
+
-------------------------------------
|
861
|
+
ModelUtilsTest: test_reorder_backward
|
862
|
+
-------------------------------------
|
863
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
864
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.6ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
865
|
+
[1m[35m (0.3ms)[0m begin transaction
|
866
|
+
[1m[36mFixture Delete (1.1ms)[0m [1mDELETE FROM "books"[0m
|
867
|
+
[1m[35mFixture Insert (0.7ms)[0m INSERT INTO "books" ("title", "author", "summary", "created_at", "updated_at", "id") VALUES ('One', 'MyString', 'MyText', '2017-03-15 10:18:26', '2017-03-15 10:18:26', 980190962)
|
868
|
+
[1m[36mFixture Insert (0.3ms)[0m [1mINSERT INTO "books" ("title", "author", "summary", "created_at", "updated_at", "id") VALUES ('MyString', 'MyString', 'MyText', '2017-03-15 10:18:26', '2017-03-15 10:18:26', 298486374)[0m
|
869
|
+
[1m[35m (1.5ms)[0m commit transaction
|
870
|
+
[1m[36m (0.2ms)[0m [1mbegin transaction[0m
|
871
|
+
-------------------------------------
|
872
|
+
ModelUtilsTest: test_reorder_backward
|
873
|
+
-------------------------------------
|
874
|
+
[1m[35m (0.4ms)[0m rollback transaction
|
875
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.5ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
876
|
+
[1m[35m (0.3ms)[0m begin transaction
|
877
|
+
[1m[36mFixture Delete (0.8ms)[0m [1mDELETE FROM "books"[0m
|
878
|
+
[1m[35mFixture Insert (0.5ms)[0m INSERT INTO "books" ("title", "author", "summary", "created_at", "updated_at", "id") VALUES ('One', 'MyString', 'MyText', '2017-03-15 10:18:52', '2017-03-15 10:18:52', 980190962)
|
879
|
+
[1m[36mFixture Insert (0.3ms)[0m [1mINSERT INTO "books" ("title", "author", "summary", "created_at", "updated_at", "id") VALUES ('MyString', 'MyString', 'MyText', '2017-03-15 10:18:52', '2017-03-15 10:18:52', 298486374)[0m
|
880
|
+
[1m[35m (1.2ms)[0m commit transaction
|
881
|
+
[1m[36m (0.4ms)[0m [1mbegin transaction[0m
|
882
|
+
-------------------------------------
|
883
|
+
ModelUtilsTest: test_reorder_backward
|
884
|
+
-------------------------------------
|
885
|
+
[1m[35m (0.2ms)[0m rollback transaction
|
886
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.7ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
887
|
+
[1m[35m (0.3ms)[0m begin transaction
|
888
|
+
[1m[36mFixture Delete (0.7ms)[0m [1mDELETE FROM "books"[0m
|
889
|
+
[1m[35mFixture Insert (0.4ms)[0m INSERT INTO "books" ("title", "author", "summary", "created_at", "updated_at", "id") VALUES ('One', 'MyString', 'MyText', '2017-03-15 10:19:54', '2017-03-15 10:19:54', 980190962)
|
890
|
+
[1m[36mFixture Insert (0.3ms)[0m [1mINSERT INTO "books" ("title", "author", "summary", "created_at", "updated_at", "id") VALUES ('MyString', 'MyString', 'MyText', '2017-03-15 10:19:54', '2017-03-15 10:19:54', 298486374)[0m
|
891
|
+
[1m[35m (1.1ms)[0m commit transaction
|
892
|
+
[1m[36m (0.3ms)[0m [1mbegin transaction[0m
|
893
|
+
-------------------------------------
|
894
|
+
ModelUtilsTest: test_reorder_backward
|
895
|
+
-------------------------------------
|
896
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
897
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.6ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
898
|
+
[1m[35m (0.1ms)[0m begin transaction
|
899
|
+
[1m[36mFixture Delete (0.7ms)[0m [1mDELETE FROM "books"[0m
|
900
|
+
[1m[35mFixture Insert (0.4ms)[0m INSERT INTO "books" ("title", "author", "summary", "created_at", "updated_at", "id") VALUES ('One', 'MyString', 'MyText', '2017-03-15 10:25:50', '2017-03-15 10:25:50', 980190962)
|
901
|
+
[1m[36mFixture Insert (0.1ms)[0m [1mINSERT INTO "books" ("title", "author", "summary", "created_at", "updated_at", "id") VALUES ('MyString', 'MyString', 'MyText', '2017-03-15 10:25:50', '2017-03-15 10:25:50', 298486374)[0m
|
902
|
+
[1m[35m (0.9ms)[0m commit transaction
|
903
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
904
|
+
----------------------------------------
|
905
|
+
ModelUtilsTest: test_reorder_forward_two
|
906
|
+
----------------------------------------
|
907
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
908
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.1ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
909
|
+
[1m[35m (0.1ms)[0m begin transaction
|
910
|
+
[1m[36mFixture Delete (0.9ms)[0m [1mDELETE FROM "books"[0m
|
911
|
+
[1m[35mFixture Insert (0.3ms)[0m INSERT INTO "books" ("title", "author", "summary", "created_at", "updated_at", "id") VALUES ('One', 'MyString', 'MyText', '2017-03-15 10:26:03', '2017-03-15 10:26:03', 980190962)
|
912
|
+
[1m[36mFixture Insert (0.1ms)[0m [1mINSERT INTO "books" ("title", "author", "summary", "created_at", "updated_at", "id") VALUES ('MyString', 'MyString', 'MyText', '2017-03-15 10:26:03', '2017-03-15 10:26:03', 298486374)[0m
|
913
|
+
[1m[35m (8.5ms)[0m commit transaction
|
914
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
915
|
+
----------------------------------------
|
916
|
+
ModelUtilsTest: test_reorder_forward_two
|
917
|
+
----------------------------------------
|
918
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
919
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.1ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
920
|
+
[1m[35m (0.2ms)[0m begin transaction
|
921
|
+
[1m[36mFixture Delete (0.7ms)[0m [1mDELETE FROM "books"[0m
|
922
|
+
[1m[35mFixture Insert (0.3ms)[0m INSERT INTO "books" ("title", "author", "summary", "created_at", "updated_at", "id") VALUES ('One', 'MyString', 'MyText', '2017-03-15 10:26:17', '2017-03-15 10:26:17', 980190962)
|
923
|
+
[1m[36mFixture Insert (0.1ms)[0m [1mINSERT INTO "books" ("title", "author", "summary", "created_at", "updated_at", "id") VALUES ('MyString', 'MyString', 'MyText', '2017-03-15 10:26:17', '2017-03-15 10:26:17', 298486374)[0m
|
924
|
+
[1m[35m (8.5ms)[0m commit transaction
|
925
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
926
|
+
----------------------------------------
|
927
|
+
ModelUtilsTest: test_reorder_forward_two
|
928
|
+
----------------------------------------
|
929
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
data/test/fixtures/books.yml
CHANGED
File without changes
|
@@ -0,0 +1,62 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class ModelUtilsTest < ActiveSupport::TestCase
|
4
|
+
class DummyItem
|
5
|
+
attr_accessor :id, :disp_order
|
6
|
+
end
|
7
|
+
|
8
|
+
def create_dummy_items
|
9
|
+
i1 = DummyItem.new
|
10
|
+
i1.id = 10
|
11
|
+
i2 = DummyItem.new
|
12
|
+
i2.id = 20
|
13
|
+
i3 = DummyItem.new
|
14
|
+
i3.id = 30
|
15
|
+
i4 = DummyItem.new
|
16
|
+
i4.id = 40
|
17
|
+
[i1, i2, i3, i4]
|
18
|
+
end
|
19
|
+
|
20
|
+
def dummy_items_to_s(items)
|
21
|
+
items.collect{|item| item.id.to_s + '-' + item.disp_order.to_s}.join(',')
|
22
|
+
end
|
23
|
+
|
24
|
+
def test_reorder_forward
|
25
|
+
# 前方へ入れ替え
|
26
|
+
hash = {
|
27
|
+
'10' => {'disp_order' => '1'},
|
28
|
+
'20' => {'disp_order' => '2'},
|
29
|
+
'30' => {'disp_order' => '1'},
|
30
|
+
'40' => {'disp_order' => '4'},
|
31
|
+
}
|
32
|
+
items = create_dummy_items
|
33
|
+
Librails::ModelUtils.reorder(items, hash)
|
34
|
+
assert_equal('30-1,10-2,20-3,40-4', dummy_items_to_s(items))
|
35
|
+
end
|
36
|
+
|
37
|
+
def test_reorder_backward
|
38
|
+
# 後方へ入れ替え
|
39
|
+
hash = {
|
40
|
+
'10' => {'disp_order' => '2'},
|
41
|
+
'20' => {'disp_order' => '2'},
|
42
|
+
'30' => {'disp_order' => '3'},
|
43
|
+
'40' => {'disp_order' => '4'},
|
44
|
+
}
|
45
|
+
items = create_dummy_items
|
46
|
+
Librails::ModelUtils.reorder(items, hash)
|
47
|
+
assert_equal('20-1,10-2,30-3,40-4', dummy_items_to_s(items))
|
48
|
+
end
|
49
|
+
|
50
|
+
def test_reorder_forward_two
|
51
|
+
# 前方へ2つ入れ替え
|
52
|
+
hash = {
|
53
|
+
'10' => {'disp_order' => '1'},
|
54
|
+
'20' => {'disp_order' => '2'},
|
55
|
+
'30' => {'disp_order' => '2'},
|
56
|
+
'40' => {'disp_order' => '1'},
|
57
|
+
}
|
58
|
+
items = create_dummy_items
|
59
|
+
Librails::ModelUtils.reorder(items, hash)
|
60
|
+
assert_equal('40-1,30-2,10-3,20-4', dummy_items_to_s(items))
|
61
|
+
end
|
62
|
+
end
|
metadata
CHANGED
@@ -1,29 +1,35 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: librails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- src
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-03-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '4.0'
|
20
|
+
- - "<"
|
18
21
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
22
|
+
version: '6'
|
20
23
|
type: :runtime
|
21
24
|
prerelease: false
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
23
26
|
requirements:
|
24
|
-
- - "
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '4.0'
|
30
|
+
- - "<"
|
25
31
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
32
|
+
version: '6'
|
27
33
|
- !ruby/object:Gem::Dependency
|
28
34
|
name: sqlite3
|
29
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -59,6 +65,7 @@ files:
|
|
59
65
|
- lib/librails.rb
|
60
66
|
- lib/librails/engine.rb
|
61
67
|
- lib/librails/misc_utils.rb
|
68
|
+
- lib/librails/model_utils.rb
|
62
69
|
- lib/librails/version.rb
|
63
70
|
- lib/librails/view_helper.rb
|
64
71
|
- lib/tasks/librails_tasks.rake
|
@@ -188,7 +195,10 @@ files:
|
|
188
195
|
- test/fixtures/books.yml
|
189
196
|
- test/integration/books_controller_test.rb
|
190
197
|
- test/integration/navigation_test.rb
|
191
|
-
- test/librails_test.rb
|
198
|
+
- test/lib/librails_test.rb
|
199
|
+
- test/lib/misc_utils_test.rb
|
200
|
+
- test/lib/model_utils_test.rb
|
201
|
+
- test/models/book_test.rb
|
192
202
|
- test/test_helper.rb
|
193
203
|
homepage: ''
|
194
204
|
licenses:
|
@@ -210,7 +220,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
210
220
|
version: '0'
|
211
221
|
requirements: []
|
212
222
|
rubyforge_project:
|
213
|
-
rubygems_version: 2.
|
223
|
+
rubygems_version: 2.6.8
|
214
224
|
signing_key:
|
215
225
|
specification_version: 4
|
216
226
|
summary: My Rails Plugin
|
@@ -341,5 +351,8 @@ test_files:
|
|
341
351
|
- test/fixtures/books.yml
|
342
352
|
- test/integration/books_controller_test.rb
|
343
353
|
- test/integration/navigation_test.rb
|
344
|
-
- test/librails_test.rb
|
354
|
+
- test/lib/librails_test.rb
|
355
|
+
- test/lib/misc_utils_test.rb
|
356
|
+
- test/lib/model_utils_test.rb
|
357
|
+
- test/models/book_test.rb
|
345
358
|
- test/test_helper.rb
|