flextures 1.9.16 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. data/README.ja.rdoc +11 -1
  2. data/README.rdoc +15 -2
  3. data/VERSION +1 -1
  4. data/flextures.gemspec +2 -2
  5. metadata +3 -3
@@ -86,7 +86,9 @@ RSpec中でfixtures関数の代わりにfixtureのロード機能を使えます
86
86
  describe ItemShopController do
87
87
  flextures :items, :users => :users_for_itmshop # users_for_itemshop.csv をロードする
88
88
 
89
- === Flextures factory filter
89
+ === Flextures load and dump filter
90
+
91
+ ==== load filer
90
92
 
91
93
  Railsのプロジェクトに config/flextures.factory.rb というファイルを作成して、そこにフィルタを記述することによって
92
94
  フィクスチャの読み込み時に、値を加工して読み込む事が可能になっています
@@ -111,6 +113,14 @@ Railsのプロジェクトに config/flextures.factory.rb というファイル
111
113
 
112
114
  * {wiki:has_manyな感じのデータの精製法}[https://github.com/baban/flextures/wiki/Has-many%E3%81%AA%E6%84%9F%E3%81%98%E3%81%AE%E3%83%87%E3%83%BC%E3%82%BF%E3%81%AE%E7%B2%BE%E8%A3%BD%E6%96%B9%E6%B3%95]
113
115
 
116
+ ==== dump filer
117
+
118
+ データのdump時に加工が必要になった時には、ダンプフィルターにテーブル名と、加工したい値をキーに、処理をラムダで渡してやることで可能です
119
+
120
+ Flextures::DumpFilter.define :users, {
121
+ :encrypted_password => lambda { |v| Base64.encode64(v) }
122
+ }
123
+
114
124
  === 設定ファイル
115
125
 
116
126
  config/flextures.config.rb で設定ファイルを作成すると、データをロード&ダンプするディレクトリなどの設定を変更できます
@@ -84,7 +84,9 @@ Flextures function can change load file name.
84
84
  describe ItemShopController do
85
85
  flextures :items, :users => :users_for_itmshop # load "users_for_itemshop.csv"
86
86
 
87
- === Flextures factory filter
87
+ === Flextures load & dump filter
88
+
89
+ ==== load filter
88
90
 
89
91
  If you create filter file.(File name is "config/flextures.factory.rb")
90
92
  Factory filter translate fixture data and set database.
@@ -105,10 +107,21 @@ This sample, generate name and sex automatically, and other tables data generate
105
107
  f.items<< [ Item.new( master_item_id: 1, count: 5 ), Item.new( master_item_id: 2, count: 3 ) ]
106
108
  end
107
109
 
110
+ ==== dump filter
111
+
112
+ if you need to convert table data into other data format, you use dump filter.
113
+ (dump filter is same file as load filter)
114
+
115
+ dump filter has hash argumtne, it is formatted colum name key and convert method, proc, lambda value
116
+
117
+ Flextures::DumpFilter.define :users, {
118
+ :encrypted_password => lambda { |v| Base64.encode64(v) }
119
+ }
120
+
108
121
  === Configuration file
109
122
 
110
123
  Configuration file can change load and dump directory
111
- (file is confi/flextures.config.rb)
124
+ (file is config/flextures.config.rb)
112
125
 
113
126
  # config/flextures.config.rb
114
127
  module Flextures
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.9.16
1
+ 2.0.0
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "flextures"
8
- s.version = "1.9.16"
8
+ s.version = "2.0.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["baban"]
12
- s.date = "2012-08-06"
12
+ s.date = "2012-08-16"
13
13
  s.description = "load and dump fixtures"
14
14
  s.email = "babanba.n@gmail.com"
15
15
  s.extra_rdoc_files = [
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flextures
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.9.16
4
+ version: 2.0.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-08-06 00:00:00.000000000 Z
12
+ date: 2012-08-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -90,7 +90,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
90
90
  version: '0'
91
91
  segments:
92
92
  - 0
93
- hash: -217812831
93
+ hash: 454224659
94
94
  required_rubygems_version: !ruby/object:Gem::Requirement
95
95
  none: false
96
96
  requirements: