flextures 3.0.1 → 3.1.0
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.
- checksums.yaml +7 -0
- data/.gitignore +48 -0
- data/Gemfile +8 -13
- data/Gemfile.lock +9 -12
- data/{README.ja.rdoc → README.ja.md} +81 -56
- data/README.md +156 -0
- data/Rakefile +1 -57
- data/flextures.gemspec +19 -71
- data/lib/flextures/flextures.rb +22 -24
- data/lib/flextures/flextures_base_config.rb +1 -2
- data/lib/flextures/flextures_command.rb +0 -1
- data/lib/flextures/flextures_dumper.rb +14 -15
- data/lib/flextures/flextures_extension_modules.rb +3 -5
- data/lib/flextures/flextures_factory.rb +5 -6
- data/lib/flextures/flextures_loader.rb +117 -85
- data/lib/flextures/rspec_flextures_support.rb +49 -13
- data/lib/flextures/testunit_flextures_support.rb +16 -8
- data/lib/flextures/version.rb +1 -2
- metadata +41 -35
- data/History.txt +0 -9
- data/README.rdoc +0 -133
- data/VERSION +0 -1
data/lib/flextures/version.rb
CHANGED
metadata
CHANGED
@@ -1,57 +1,59 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: flextures
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0
|
5
|
-
prerelease:
|
4
|
+
version: 3.1.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- baban
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2014-06-27 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: bundler
|
16
|
-
requirement:
|
17
|
-
none: false
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - ~>
|
20
18
|
- !ruby/object:Gem::Version
|
21
|
-
version: 1.
|
19
|
+
version: '1.6'
|
22
20
|
type: :development
|
23
21
|
prerelease: false
|
24
|
-
version_requirements:
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.6'
|
25
27
|
- !ruby/object:Gem::Dependency
|
26
|
-
name:
|
27
|
-
requirement:
|
28
|
-
none: false
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
29
30
|
requirements:
|
30
|
-
- -
|
31
|
+
- - '>='
|
31
32
|
- !ruby/object:Gem::Version
|
32
|
-
version:
|
33
|
+
version: '0'
|
33
34
|
type: :development
|
34
35
|
prerelease: false
|
35
|
-
version_requirements:
|
36
|
-
|
37
|
-
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
description: load and dump fixtures.
|
42
|
+
email:
|
43
|
+
- babanba.n@gmail.com
|
38
44
|
executables: []
|
39
45
|
extensions: []
|
40
|
-
extra_rdoc_files:
|
41
|
-
- LICENSE.txt
|
42
|
-
- README.ja.rdoc
|
43
|
-
- README.rdoc
|
46
|
+
extra_rdoc_files: []
|
44
47
|
files:
|
45
48
|
- .document
|
49
|
+
- .gitignore
|
46
50
|
- CHANGELOG
|
47
51
|
- Gemfile
|
48
52
|
- Gemfile.lock
|
49
|
-
- History.txt
|
50
53
|
- LICENSE.txt
|
51
|
-
- README.ja.
|
52
|
-
- README.
|
54
|
+
- README.ja.md
|
55
|
+
- README.md
|
53
56
|
- Rakefile
|
54
|
-
- VERSION
|
55
57
|
- flextures.gemspec
|
56
58
|
- lib/flextures.rb
|
57
59
|
- lib/flextures/flextures.rake
|
@@ -77,29 +79,33 @@ files:
|
|
77
79
|
homepage: http://github.com/baban/flextures
|
78
80
|
licenses:
|
79
81
|
- MIT
|
82
|
+
metadata: {}
|
80
83
|
post_install_message:
|
81
84
|
rdoc_options: []
|
82
85
|
require_paths:
|
83
86
|
- lib
|
84
87
|
required_ruby_version: !ruby/object:Gem::Requirement
|
85
|
-
none: false
|
86
88
|
requirements:
|
87
|
-
- -
|
89
|
+
- - '>='
|
88
90
|
- !ruby/object:Gem::Version
|
89
91
|
version: '0'
|
90
|
-
segments:
|
91
|
-
- 0
|
92
|
-
hash: -140287376495517345
|
93
92
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
94
|
-
none: false
|
95
93
|
requirements:
|
96
|
-
- -
|
94
|
+
- - '>='
|
97
95
|
- !ruby/object:Gem::Version
|
98
96
|
version: '0'
|
99
97
|
requirements: []
|
100
98
|
rubyforge_project:
|
101
|
-
rubygems_version: 1.
|
99
|
+
rubygems_version: 2.1.11
|
102
100
|
signing_key:
|
103
|
-
specification_version:
|
104
|
-
summary: load and dump fixtures
|
105
|
-
test_files:
|
101
|
+
specification_version: 4
|
102
|
+
summary: load and dump fixtures.
|
103
|
+
test_files:
|
104
|
+
- test/test_helper.rb
|
105
|
+
- test/unit/test_flextures.rb
|
106
|
+
- test/unit/test_flextures_args.rb
|
107
|
+
- test/unit/test_flextures_dumper.rb
|
108
|
+
- test/unit/test_flextures_extention_modules.rb
|
109
|
+
- test/unit/test_flextures_hooks.rb
|
110
|
+
- test/unit/test_flextures_loader.rb
|
111
|
+
- test/unit/test_simple.rb
|
data/History.txt
DELETED
@@ -1,9 +0,0 @@
|
|
1
|
-
2011/10/05 Release
|
2
|
-
2011/10/08 モデル名を指定しても吐き出せる様に修正
|
3
|
-
2011/10/09 yaml形式でdump出来る様にした
|
4
|
-
2011/10/10 yaml,csvで指定したテーブルのデータをロードする機能を追加
|
5
|
-
2011/11/03 rubygem化
|
6
|
-
2011/11/22 ver1.0 にする。英語版マニュアルを作成
|
7
|
-
2011/12/28 ver 1.0.5 プライマリキーの名前がid以外でも動くように修正
|
8
|
-
2012/01/22 ver 1.0.6 フィルタの反映されてないバグを修正
|
9
|
-
|
data/README.rdoc
DELETED
@@ -1,133 +0,0 @@
|
|
1
|
-
= flextures
|
2
|
-
|
3
|
-
* {日本語版ドキュメント(Japanese Document)}[https://github.com/baban/flextures/blob/master/README.ja.rdoc]
|
4
|
-
|
5
|
-
== Abstruct
|
6
|
-
|
7
|
-
This plug-in aim to resolve many problems, durling rails developping about fixtures.
|
8
|
-
Basic commands is simple.
|
9
|
-
Each commands load or dump fixtures.
|
10
|
-
|
11
|
-
rake db:flextures:load
|
12
|
-
rake db:flextures:dump
|
13
|
-
|
14
|
-
Major different point is four.
|
15
|
-
|
16
|
-
1. Fixture file prefered CSV to YAML.
|
17
|
-
2. loading don't stop, if table columns are not match fixture file's column
|
18
|
-
3. Fixture file name can change, if file name is not equal table name.
|
19
|
-
4. Fixture data can translate to use filter, like factory girl.
|
20
|
-
|
21
|
-
== How to install
|
22
|
-
|
23
|
-
This program is implemented Rails Plug-in.
|
24
|
-
You want to install this plug-in.
|
25
|
-
Please use bundler.
|
26
|
-
|
27
|
-
gem "flextures"
|
28
|
-
|
29
|
-
(Development emnvoriment must be ruby1.9 higer and rails3 higher)
|
30
|
-
|
31
|
-
== How to use
|
32
|
-
|
33
|
-
=== rake command
|
34
|
-
|
35
|
-
load command input fixtures file under "spec/fixtures/".
|
36
|
-
(Loading directory can change configuration file)
|
37
|
-
|
38
|
-
rake db:flextures:load
|
39
|
-
rake db:flextures:dump
|
40
|
-
|
41
|
-
rake command can set options.
|
42
|
-
For example, this option set dump file name.
|
43
|
-
(Option dump only "users.csv")
|
44
|
-
|
45
|
-
rake db:flextures:dump TABLE=users
|
46
|
-
|
47
|
-
Other options...
|
48
|
-
|
49
|
-
TABLE : set table name
|
50
|
-
MODEL : set model name
|
51
|
-
DIR : set directory name
|
52
|
-
FILE : set fixture file name
|
53
|
-
FORMAT:change dump file format(csv or yml)
|
54
|
-
OPTION:other options
|
55
|
-
T : alias TABLE option
|
56
|
-
D : alias DIR option
|
57
|
-
F : alias FIXTURES option
|
58
|
-
|
59
|
-
if you change table colum information
|
60
|
-
next comannd regenerate (load fixture and dump) fixtures
|
61
|
-
|
62
|
-
rake db:flextures:generate T=users
|
63
|
-
|
64
|
-
Other information please see {wiki}[https://github.com/baban/flextures/wiki/Rake-command-option] ...
|
65
|
-
|
66
|
-
=== Unit test flexture support
|
67
|
-
|
68
|
-
Fixture load function implemented for Unittes Tools (for example, RSpec, Shoulda).
|
69
|
-
|
70
|
-
describe ItemShopController do
|
71
|
-
flextures :users, :items
|
72
|
-
|
73
|
-
flexture function can write like a "fixture" function, implemented in RSpec.
|
74
|
-
But, "flexture" function ignore columns change.
|
75
|
-
|
76
|
-
Flextures function can change load file name.
|
77
|
-
|
78
|
-
describe ItemShopController do
|
79
|
-
flextures :items, :users => :users_for_itmshop # load "users_for_itemshop.csv"
|
80
|
-
|
81
|
-
Other option information
|
82
|
-
Please see {wiki}[https://github.com/baban/flextures/wiki/Unittestsupport] ...
|
83
|
-
|
84
|
-
=== Flextures load & dump filter
|
85
|
-
|
86
|
-
==== load filter
|
87
|
-
|
88
|
-
If you create filter file.(File name is "config/flextures.factory.rb")
|
89
|
-
Factory filter translate fixture data and set database.
|
90
|
-
|
91
|
-
For example, this code set current time to last_login_date column.
|
92
|
-
|
93
|
-
Flextures::Factory.define :users do |f|
|
94
|
-
f.last_login_date = DateTime.now
|
95
|
-
end
|
96
|
-
|
97
|
-
This sample, generate name and sex automatically, and other tables data generate
|
98
|
-
|
99
|
-
require 'faker'
|
100
|
-
Flextures::Factory.define :users do |f|
|
101
|
-
f.name= Faker::Name.name if !f.name # gemerate name
|
102
|
-
f.sex= [0,1].shuffle.first if !f.sex # generate sex
|
103
|
-
# factory filter can generate data, use has_many association
|
104
|
-
f.items<< [ Item.new( master_item_id: 1, count: 5 ), Item.new( master_item_id: 2, count: 3 ) ]
|
105
|
-
end
|
106
|
-
|
107
|
-
==== dump filter
|
108
|
-
|
109
|
-
if you need to convert table data into other data format, you use dump filter.
|
110
|
-
(dump filter is same file as load filter)
|
111
|
-
|
112
|
-
dump filter has hash argumtne, it is formatted colum name key and convert method, proc, lambda value
|
113
|
-
|
114
|
-
Flextures::DumpFilter.define :users, {
|
115
|
-
:encrypted_password => lambda { |v| Base64.encode64(v) }
|
116
|
-
}
|
117
|
-
|
118
|
-
Other options please see {wiki}[https://github.com/baban/flextures/wiki/Factoryfilter] ...
|
119
|
-
|
120
|
-
=== Configuration file
|
121
|
-
|
122
|
-
Configuration file can change load and dump directory
|
123
|
-
(file is config/flextures.config.rb)
|
124
|
-
|
125
|
-
# config/flextures.config.rb
|
126
|
-
module Flextures
|
127
|
-
# Load and dump directory change "spec/fixtures/" to "test/fixtures/"
|
128
|
-
Config.fixture_load_directory = "test/fixtures/"
|
129
|
-
Config.fixture_dump_directory = "test/fixtures/"
|
130
|
-
end
|
131
|
-
|
132
|
-
Other options please see {wiki}[https://github.com/baban/flextures/wiki/Configuration-file] ...
|
133
|
-
|
data/VERSION
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
3.0.1
|