flextures 3.1.3 → 4.0.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 +4 -4
 - data/Gemfile +6 -1
 - data/Gemfile.lock +17 -13
 - data/README.ja.md +15 -13
 - data/README.md +9 -8
 - data/Rakefile +5 -0
 - data/flextures.gemspec +3 -1
 - data/lib/flextures.rb +0 -3
 - data/lib/flextures/flextures.rake +1 -42
 - data/lib/flextures/flextures.rb +4 -7
 - data/lib/flextures/flextures_base_config.rb +17 -28
 - data/lib/flextures/flextures_command.rb +3 -5
 - data/lib/flextures/flextures_dumper.rb +27 -29
 - data/lib/flextures/flextures_extension_modules.rb +1 -14
 - data/lib/flextures/flextures_factory.rb +3 -5
 - data/lib/flextures/flextures_loader.rb +49 -51
 - data/lib/flextures/flextures_railtie.rb +0 -2
 - data/lib/flextures/rspec_flextures_support.rb +125 -71
 - data/lib/flextures/version.rb +1 -1
 - data/test/models/flextures_test.rb +8 -0
 - data/test/test_helper.rb +4 -3
 - data/test/unit/flextures_args_test.rb +178 -0
 - data/test/unit/flextures_dumper_test.rb +232 -0
 - data/test/unit/{test_flextures_extention_modules.rb → flextures_extention_modules_test.rb} +18 -13
 - data/test/unit/flextures_hooks_test.rb +111 -0
 - data/test/unit/flextures_loader_test.rb +313 -0
 - metadata +9 -18
 - data/lib/flextures/testunit_flextures_support.rb +0 -43
 - data/test/unit/test_flextures.rb +0 -8
 - data/test/unit/test_flextures_args.rb +0 -147
 - data/test/unit/test_flextures_dumper.rb +0 -187
 - data/test/unit/test_flextures_hooks.rb +0 -90
 - data/test/unit/test_flextures_loader.rb +0 -271
 - data/test/unit/test_simple.rb +0 -8
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: d86570ed0e33aace484782c2ec347b9050ec44e0
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 721141b2188c3276035375feb64d48f822950cf3
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: eaa221bf5422aa3e1b363419c4bb9e9e5a2e873304df89fca19c7a514459392243f6d57b53db8e445d544063d97a3c640205d6e8c04550b8996555d5ef9997c2
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: e57e6482831891e07f6596881f931bb7a0242249571211b67ed3889376b1de45c2d7378ba9b63786d1056bcaccda34822e180aeaabd3ecaa1d9e597a4dc8d6ca
         
     | 
    
        data/Gemfile
    CHANGED
    
    | 
         @@ -3,6 +3,11 @@ source 'https://rubygems.org' 
     | 
|
| 
       3 
3 
     | 
    
         
             
            # Specify your gem's dependencies in flextures.gemspec
         
     | 
| 
       4 
4 
     | 
    
         
             
            gemspec
         
     | 
| 
       5 
5 
     | 
    
         | 
| 
      
 6 
     | 
    
         
            +
            gem "minitest", "5.4.0"
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
       6 
8 
     | 
    
         
             
            group :test do
         
     | 
| 
       7 
     | 
    
         
            -
              gem " 
     | 
| 
      
 9 
     | 
    
         
            +
              gem "minitest-line", "0.6.2"
         
     | 
| 
      
 10 
     | 
    
         
            +
              gem "minitest-bang", "0.1.1"              # let文を使えるようにする
         
     | 
| 
      
 11 
     | 
    
         
            +
              gem "minitest-implicit-subject", "1.4.0"  # subject関数を追加する
         
     | 
| 
      
 12 
     | 
    
         
            +
              gem "minitest-power_assert", "0.0.3"      # power assertを有効にする
         
     | 
| 
       8 
13 
     | 
    
         
             
            end
         
     | 
    
        data/Gemfile.lock
    CHANGED
    
    | 
         @@ -1,23 +1,23 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            PATH
         
     | 
| 
       2 
2 
     | 
    
         
             
              remote: .
         
     | 
| 
       3 
3 
     | 
    
         
             
              specs:
         
     | 
| 
       4 
     | 
    
         
            -
                flextures ( 
     | 
| 
      
 4 
     | 
    
         
            +
                flextures (4.0.0)
         
     | 
| 
       5 
5 
     | 
    
         | 
| 
       6 
6 
     | 
    
         
             
            GEM
         
     | 
| 
       7 
7 
     | 
    
         
             
              remote: https://rubygems.org/
         
     | 
| 
       8 
8 
     | 
    
         
             
              specs:
         
     | 
| 
       9 
     | 
    
         
            -
                 
     | 
| 
       10 
     | 
    
         
            -
             
     | 
| 
       11 
     | 
    
         
            -
                   
     | 
| 
       12 
     | 
    
         
            -
                 
     | 
| 
       13 
     | 
    
         
            -
             
     | 
| 
      
 9 
     | 
    
         
            +
                minitest (5.4.0)
         
     | 
| 
      
 10 
     | 
    
         
            +
                minitest-bang (0.1.1)
         
     | 
| 
      
 11 
     | 
    
         
            +
                  minitest (>= 4.7.5, <= 5.4.0)
         
     | 
| 
      
 12 
     | 
    
         
            +
                minitest-implicit-subject (1.4.0)
         
     | 
| 
      
 13 
     | 
    
         
            +
                  minitest
         
     | 
| 
      
 14 
     | 
    
         
            +
                minitest-line (0.6.2)
         
     | 
| 
      
 15 
     | 
    
         
            +
                  minitest (~> 5.0)
         
     | 
| 
      
 16 
     | 
    
         
            +
                minitest-power_assert (0.0.3)
         
     | 
| 
      
 17 
     | 
    
         
            +
                  minitest
         
     | 
| 
      
 18 
     | 
    
         
            +
                  power_assert
         
     | 
| 
      
 19 
     | 
    
         
            +
                power_assert (0.2.2)
         
     | 
| 
       14 
20 
     | 
    
         
             
                rake (0.9.2.2)
         
     | 
| 
       15 
     | 
    
         
            -
                shoulda (3.1.1)
         
     | 
| 
       16 
     | 
    
         
            -
                  shoulda-context (~> 1.0)
         
     | 
| 
       17 
     | 
    
         
            -
                  shoulda-matchers (~> 1.2)
         
     | 
| 
       18 
     | 
    
         
            -
                shoulda-context (1.0.0)
         
     | 
| 
       19 
     | 
    
         
            -
                shoulda-matchers (1.2.0)
         
     | 
| 
       20 
     | 
    
         
            -
                  activesupport (>= 3.0.0)
         
     | 
| 
       21 
21 
     | 
    
         | 
| 
       22 
22 
     | 
    
         
             
            PLATFORMS
         
     | 
| 
       23 
23 
     | 
    
         
             
              ruby
         
     | 
| 
         @@ -25,8 +25,12 @@ PLATFORMS 
     | 
|
| 
       25 
25 
     | 
    
         
             
            DEPENDENCIES
         
     | 
| 
       26 
26 
     | 
    
         
             
              bundler (~> 1.6)
         
     | 
| 
       27 
27 
     | 
    
         
             
              flextures!
         
     | 
| 
      
 28 
     | 
    
         
            +
              minitest (= 5.4.0)
         
     | 
| 
      
 29 
     | 
    
         
            +
              minitest-bang (= 0.1.1)
         
     | 
| 
      
 30 
     | 
    
         
            +
              minitest-implicit-subject (= 1.4.0)
         
     | 
| 
      
 31 
     | 
    
         
            +
              minitest-line (= 0.6.2)
         
     | 
| 
      
 32 
     | 
    
         
            +
              minitest-power_assert (= 0.0.3)
         
     | 
| 
       28 
33 
     | 
    
         
             
              rake
         
     | 
| 
       29 
     | 
    
         
            -
              shoulda
         
     | 
| 
       30 
34 
     | 
    
         | 
| 
       31 
35 
     | 
    
         
             
            BUNDLED WITH
         
     | 
| 
       32 
36 
     | 
    
         
             
               1.10.6
         
     | 
    
        data/README.ja.md
    CHANGED
    
    | 
         @@ -1,6 +1,6 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            # flextures
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
       3 
     | 
    
         
            -
            * [ENGLISH DOCUMENT](https://github.com/baban/flextures/blob/master/README. 
     | 
| 
      
 3 
     | 
    
         
            +
            * [ENGLISH DOCUMENT](https://github.com/baban/flextures/blob/master/README.md)
         
     | 
| 
       4 
4 
     | 
    
         | 
| 
       5 
5 
     | 
    
         
             
            ## Abstruct
         
     | 
| 
       6 
6 
     | 
    
         | 
| 
         @@ -10,8 +10,8 @@ Rails標準のfixtureの不満点を解消するために作成しました 
     | 
|
| 
       10 
10 
     | 
    
         
             
            それぞれfixtureのロードとダンプを行います
         
     | 
| 
       11 
11 
     | 
    
         | 
| 
       12 
12 
     | 
    
         
             
            ```
         
     | 
| 
       13 
     | 
    
         
            -
             
     | 
| 
       14 
     | 
    
         
            -
             
     | 
| 
      
 13 
     | 
    
         
            +
            rake db:flextures:load
         
     | 
| 
      
 14 
     | 
    
         
            +
            rake db:flextures:dump
         
     | 
| 
       15 
15 
     | 
    
         
             
            ```
         
     | 
| 
       16 
16 
     | 
    
         | 
| 
       17 
17 
     | 
    
         
             
            通常のfixtureとの主な違いは次の4点です
         
     | 
| 
         @@ -28,7 +28,6 @@ gem化されているので、bundlerで次のように記述して、普通にb 
     | 
|
| 
       28 
28 
     | 
    
         | 
| 
       29 
29 
     | 
    
         
             
            ```
         
     | 
| 
       30 
30 
     | 
    
         
             
             gem "flextures"
         
     | 
| 
       31 
     | 
    
         
            -
             
     | 
| 
       32 
31 
     | 
    
         
             
            ```
         
     | 
| 
       33 
32 
     | 
    
         | 
| 
       34 
33 
     | 
    
         
             
            ちなみに開発環境はruby1.9以上のバージョン、rails3以上、もしくはPadrinoを想定しています
         
     | 
| 
         @@ -94,6 +93,7 @@ fixtureのロード機能を使えます 
     | 
|
| 
       94 
93 
     | 
    
         
             
            ```ruby
         
     | 
| 
       95 
94 
     | 
    
         
             
            describe ItemShopController do
         
     | 
| 
       96 
95 
     | 
    
         
             
              flextures :users, :items
         
     | 
| 
      
 96 
     | 
    
         
            +
            end
         
     | 
| 
       97 
97 
     | 
    
         
             
            ```
         
     | 
| 
       98 
98 
     | 
    
         | 
| 
       99 
99 
     | 
    
         
             
            基本的な違いは、yamlよりcsvを優先する、カラムの変更点を検知して警告を出しながらもロードを行う等ですが
         
     | 
| 
         @@ -103,6 +103,7 @@ describe ItemShopController do 
     | 
|
| 
       103 
103 
     | 
    
         
             
            ```ruby
         
     | 
| 
       104 
104 
     | 
    
         
             
            describe ItemShopController do
         
     | 
| 
       105 
105 
     | 
    
         
             
              flextures :items, :users => :users_for_itmshop # users_for_itemshop.csv をロードする
         
     | 
| 
      
 106 
     | 
    
         
            +
            end
         
     | 
| 
       106 
107 
     | 
    
         
             
            ```
         
     | 
| 
       107 
108 
     | 
    
         | 
| 
       108 
109 
     | 
    
         
             
            その他現在はShouldからの呼び出しや様々なオプションを載せていますが
         
     | 
| 
         @@ -112,8 +113,7 @@ describe ItemShopController do 
     | 
|
| 
       112 
113 
     | 
    
         | 
| 
       113 
114 
     | 
    
         
             
            #### load filer
         
     | 
| 
       114 
115 
     | 
    
         | 
| 
       115 
     | 
    
         
            -
            Railsのプロジェクトに config/flextures.factory.rb というファイルを作成して、そこにフィルタを記述することによって
         
     | 
| 
       116 
     | 
    
         
            -
            (Padrinoでも設置場所は同じです)
         
     | 
| 
      
 116 
     | 
    
         
            +
            Railsのプロジェクトに `config/flextures.factory.rb` というファイルを作成して、そこにフィルタを記述することによって
         
     | 
| 
       117 
117 
     | 
    
         
             
            フィクスチャの読み込み時に、値を加工して読み込む事が可能になっています
         
     | 
| 
       118 
118 
     | 
    
         
             
            例えば、次の様に記述するとusersテーブルのlast_login_dateの値を、常に現在の時間として設定できます
         
     | 
| 
       119 
119 
     | 
    
         | 
| 
         @@ -142,7 +142,8 @@ end 
     | 
|
| 
       142 
142 
     | 
    
         | 
| 
       143 
143 
     | 
    
         
             
            #### dump filer
         
     | 
| 
       144 
144 
     | 
    
         | 
| 
       145 
     | 
    
         
            -
            データのdump 
     | 
| 
      
 145 
     | 
    
         
            +
            データのdump時に加工が必要になった時には、同じく`config/flextures.factory.rb`に
         
     | 
| 
      
 146 
     | 
    
         
            +
            テーブル名と、加工したい値をキーに、処理をラムダで渡してやることで可能です
         
     | 
| 
       146 
147 
     | 
    
         | 
| 
       147 
148 
     | 
    
         
             
            ```ruby
         
     | 
| 
       148 
149 
     | 
    
         
             
            Flextures::DumpFilter.define :users, {
         
     | 
| 
         @@ -154,14 +155,15 @@ Flextures::DumpFilter.define :users, { 
     | 
|
| 
       154 
155 
     | 
    
         | 
| 
       155 
156 
     | 
    
         
             
            ### 設定ファイル
         
     | 
| 
       156 
157 
     | 
    
         | 
| 
       157 
     | 
    
         
            -
            config/flextures.config.rb で設定ファイルを作成すると、データをロード&ダンプするディレクトリなどの設定を変更できます
         
     | 
| 
      
 158 
     | 
    
         
            +
            `config/flextures.config.rb` で設定ファイルを作成すると、データをロード&ダンプするディレクトリなどの設定を変更できます
         
     | 
| 
      
 159 
     | 
    
         
            +
             
     | 
| 
      
 160 
     | 
    
         
            +
             
     | 
| 
       158 
161 
     | 
    
         | 
| 
       159 
162 
     | 
    
         
             
            ```ruby
         
     | 
| 
       160 
     | 
    
         
            -
             
     | 
| 
       161 
     | 
    
         
            -
             
     | 
| 
       162 
     | 
    
         
            -
               
     | 
| 
       163 
     | 
    
         
            -
               
     | 
| 
       164 
     | 
    
         
            -
              Config.fixture_dump_directory = "test/fixtures/"
         
     | 
| 
      
 163 
     | 
    
         
            +
            Flextures.configure do |config|
         
     | 
| 
      
 164 
     | 
    
         
            +
              # Load and dump directory change "spec/fixtures/" to "test/fixtures/"
         
     | 
| 
      
 165 
     | 
    
         
            +
              config.load_directory = "test/fixtures/"
         
     | 
| 
      
 166 
     | 
    
         
            +
              config.dump_directory = "test/fixtures/"
         
     | 
| 
       165 
167 
     | 
    
         
             
            end
         
     | 
| 
       166 
168 
     | 
    
         
             
            ```
         
     | 
| 
       167 
169 
     | 
    
         | 
    
        data/README.md
    CHANGED
    
    | 
         @@ -101,7 +101,8 @@ Please see [wiki](https://github.com/baban/flextures/wiki/Unittestsupport) ... 
     | 
|
| 
       101 
101 
     | 
    
         | 
| 
       102 
102 
     | 
    
         
             
            #### load filter
         
     | 
| 
       103 
103 
     | 
    
         | 
| 
       104 
     | 
    
         
            -
             
     | 
| 
      
 104 
     | 
    
         
            +
            In `config/flextures.factory.rb`
         
     | 
| 
      
 105 
     | 
    
         
            +
             
     | 
| 
       105 
106 
     | 
    
         
             
            Factory filter translate fixture data and set database.
         
     | 
| 
       106 
107 
     | 
    
         | 
| 
       107 
108 
     | 
    
         
             
            For example, this code set current time to last_login_date column.
         
     | 
| 
         @@ -129,7 +130,9 @@ end 
     | 
|
| 
       129 
130 
     | 
    
         
             
            if you need to convert table data into other data format, you use dump filter.
         
     | 
| 
       130 
131 
     | 
    
         
             
            (dump filter is same file as load filter)
         
     | 
| 
       131 
132 
     | 
    
         | 
| 
       132 
     | 
    
         
            -
            dump filter has hash  
     | 
| 
      
 133 
     | 
    
         
            +
            dump filter has hash arguments, it is formatted colum name key and convert method, proc, lambda value
         
     | 
| 
      
 134 
     | 
    
         
            +
             
     | 
| 
      
 135 
     | 
    
         
            +
            file is `config/flextures.factory.rb`
         
     | 
| 
       133 
136 
     | 
    
         | 
| 
       134 
137 
     | 
    
         
             
            ```ruby
         
     | 
| 
       135 
138 
     | 
    
         
             
            Flextures::DumpFilter.define :users, {
         
     | 
| 
         @@ -141,15 +144,13 @@ Other options please see [wiki](https://github.com/baban/flextures/wiki/Factoryf 
     | 
|
| 
       141 
144 
     | 
    
         | 
| 
       142 
145 
     | 
    
         
             
            ### Configuration file
         
     | 
| 
       143 
146 
     | 
    
         | 
| 
       144 
     | 
    
         
            -
             
     | 
| 
       145 
     | 
    
         
            -
            (file is config/flextures.config.rb)
         
     | 
| 
      
 147 
     | 
    
         
            +
            In `config/initializers/flextures.rb`, configuration file can change load and dump directory
         
     | 
| 
       146 
148 
     | 
    
         | 
| 
       147 
149 
     | 
    
         
             
            ```ruby
         
     | 
| 
       148 
     | 
    
         
            -
             
     | 
| 
       149 
     | 
    
         
            -
            module Flextures
         
     | 
| 
      
 150 
     | 
    
         
            +
            Flextures.configure do |config|
         
     | 
| 
       150 
151 
     | 
    
         
             
              # Load and dump directory change "spec/fixtures/" to "test/fixtures/"
         
     | 
| 
       151 
     | 
    
         
            -
               
     | 
| 
       152 
     | 
    
         
            -
               
     | 
| 
      
 152 
     | 
    
         
            +
              config.load_directory = "test/fixtures/"
         
     | 
| 
      
 153 
     | 
    
         
            +
              config.dump_directory = "test/fixtures/"
         
     | 
| 
       153 
154 
     | 
    
         
             
            end
         
     | 
| 
       154 
155 
     | 
    
         
             
            ```
         
     | 
| 
       155 
156 
     | 
    
         | 
    
        data/Rakefile
    CHANGED
    
    
    
        data/flextures.gemspec
    CHANGED
    
    | 
         @@ -15,9 +15,11 @@ Gem::Specification.new do |spec| 
     | 
|
| 
       15 
15 
     | 
    
         | 
| 
       16 
16 
     | 
    
         
             
              spec.files         = `git ls-files -z`.split("\x0")
         
     | 
| 
       17 
17 
     | 
    
         
             
              spec.executables   = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
         
     | 
| 
       18 
     | 
    
         
            -
              spec.test_files    = spec.files.grep(%r{^(test|spec|features)/})
         
     | 
| 
      
 18 
     | 
    
         
            +
              #spec.test_files    = spec.files.grep(%r{^(test|spec|features)/})
         
     | 
| 
      
 19 
     | 
    
         
            +
              spec.test_files    = ["test/unit/flextures_args_test.rb"]
         
     | 
| 
       19 
20 
     | 
    
         
             
              spec.require_paths = ["lib"]
         
     | 
| 
       20 
21 
     | 
    
         | 
| 
       21 
22 
     | 
    
         
             
              spec.add_development_dependency "bundler", "~> 1.6"
         
     | 
| 
       22 
23 
     | 
    
         
             
              spec.add_development_dependency "rake"
         
     | 
| 
      
 24 
     | 
    
         
            +
              #spec.add_development_dependency "minitest", "5.4.0"
         
     | 
| 
       23 
25 
     | 
    
         
             
            end
         
     | 
    
        data/lib/flextures.rb
    CHANGED
    
    | 
         @@ -1,5 +1,3 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            # encoding: utf-8
         
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
       3 
1 
     | 
    
         
             
            require 'flextures/version'
         
     | 
| 
       4 
2 
     | 
    
         
             
            require 'flextures/flextures_base_config'
         
     | 
| 
       5 
3 
     | 
    
         
             
            require 'flextures/flextures_extension_modules'
         
     | 
| 
         @@ -10,4 +8,3 @@ require 'flextures/flextures_dumper' 
     | 
|
| 
       10 
8 
     | 
    
         
             
            require 'flextures/flextures_command'
         
     | 
| 
       11 
9 
     | 
    
         
             
            require 'flextures/flextures_railtie' if defined? Rails
         
     | 
| 
       12 
10 
     | 
    
         
             
            require 'flextures/rspec_flextures_support' if defined? RSpec
         
     | 
| 
       13 
     | 
    
         
            -
            require 'flextures/testunit_flextures_support' if defined? Test::Unit::TestCase
         
     | 
| 
         @@ -1,5 +1,3 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            # encoding: utf-8
         
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
       3 
1 
     | 
    
         
             
            require 'flextures/flextures'
         
     | 
| 
       4 
2 
     | 
    
         | 
| 
       5 
3 
     | 
    
         
             
            namespace :db do
         
     | 
| 
         @@ -9,53 +7,14 @@ namespace :db do 
     | 
|
| 
       9 
7 
     | 
    
         
             
                  Flextures::Rake::Command::dump
         
     | 
| 
       10 
8 
     | 
    
         
             
                end
         
     | 
| 
       11 
9 
     | 
    
         | 
| 
       12 
     | 
    
         
            -
                desc "Dump data to prefer csv format"
         
     | 
| 
       13 
     | 
    
         
            -
                task :csvdump => :environment do
         
     | 
| 
       14 
     | 
    
         
            -
                  puts "This command is deprecated"
         
     | 
| 
       15 
     | 
    
         
            -
                  # TODO: deprecated message
         
     | 
| 
       16 
     | 
    
         
            -
                  # please use 'FOAMRT=csv' option
         
     | 
| 
       17 
     | 
    
         
            -
                  ENV["FORMAT"]="csv"
         
     | 
| 
       18 
     | 
    
         
            -
                  Flextures::Rake::Command::dump
         
     | 
| 
       19 
     | 
    
         
            -
                end
         
     | 
| 
       20 
     | 
    
         
            -
             
     | 
| 
       21 
     | 
    
         
            -
                desc "Dump data to yaml format"
         
     | 
| 
       22 
     | 
    
         
            -
                task :ymldump => :environment do
         
     | 
| 
       23 
     | 
    
         
            -
                  puts "This command is deprecated"
         
     | 
| 
       24 
     | 
    
         
            -
                  puts "please use 'rake db:flextures:dump FORMAT='yml''"
         
     | 
| 
       25 
     | 
    
         
            -
                  # TODO: deprecated message
         
     | 
| 
       26 
     | 
    
         
            -
                  # please use 'FOAMRT=yml' option
         
     | 
| 
       27 
     | 
    
         
            -
                  ENV["FORMAT"]="yml"
         
     | 
| 
       28 
     | 
    
         
            -
                  Flextures::Rake::Command::dump
         
     | 
| 
       29 
     | 
    
         
            -
                end
         
     | 
| 
       30 
     | 
    
         
            -
             
     | 
| 
       31 
10 
     | 
    
         
             
                desc "load fixture data csv format"
         
     | 
| 
       32 
11 
     | 
    
         
             
                task :load => :environment do
         
     | 
| 
       33 
12 
     | 
    
         
             
                  Flextures::Rake::Command::load
         
     | 
| 
       34 
13 
     | 
    
         
             
                end
         
     | 
| 
       35 
14 
     | 
    
         | 
| 
       36 
     | 
    
         
            -
                desc "load fixture data only csv format files"
         
     | 
| 
       37 
     | 
    
         
            -
                task :csvload => :environment do
         
     | 
| 
       38 
     | 
    
         
            -
                  puts "This command is deprecated"
         
     | 
| 
       39 
     | 
    
         
            -
                  puts "please use 'rake db:flextures:load FORMAT='csv''"
         
     | 
| 
       40 
     | 
    
         
            -
                  # TODO: deprecated message
         
     | 
| 
       41 
     | 
    
         
            -
                  # please use 'FOAMRT=csv' option
         
     | 
| 
       42 
     | 
    
         
            -
                  ENV["FORMAT"]="csv"
         
     | 
| 
       43 
     | 
    
         
            -
                  Flextures::Rake::Command::load
         
     | 
| 
       44 
     | 
    
         
            -
                end
         
     | 
| 
       45 
     | 
    
         
            -
             
     | 
| 
       46 
     | 
    
         
            -
                desc "load fixture files only yaml format"
         
     | 
| 
       47 
     | 
    
         
            -
                task :ymlload => :environment do
         
     | 
| 
       48 
     | 
    
         
            -
                  # TODO: deprecated message
         
     | 
| 
       49 
     | 
    
         
            -
                  # please use 'FOAMRT=yml' option
         
     | 
| 
       50 
     | 
    
         
            -
                  ENV["FORMAT"]="yml"
         
     | 
| 
       51 
     | 
    
         
            -
                  puts "This command is deprecated"
         
     | 
| 
       52 
     | 
    
         
            -
                  puts "please use 'rake db:flextures:load FORMAT='yml''"
         
     | 
| 
       53 
     | 
    
         
            -
                  Flextures::Rake::Command::load
         
     | 
| 
       54 
     | 
    
         
            -
                end
         
     | 
| 
       55 
     | 
    
         
            -
             
     | 
| 
       56 
15 
     | 
    
         
             
                desc "load and dump file (replace) new data file"
         
     | 
| 
       57 
16 
     | 
    
         
             
                task :generate => :environment do
         
     | 
| 
       58 
17 
     | 
    
         
             
                  Flextures::Rake::Command::generate
         
     | 
| 
       59 
     | 
    
         
            -
                end 
     | 
| 
      
 18 
     | 
    
         
            +
                end
         
     | 
| 
       60 
19 
     | 
    
         
             
              end
         
     | 
| 
       61 
20 
     | 
    
         
             
            end
         
     | 
    
        data/lib/flextures/flextures.rb
    CHANGED
    
    | 
         @@ -1,5 +1,3 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            # encoding: utf-8
         
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
       3 
1 
     | 
    
         
             
            require 'ostruct'
         
     | 
| 
       4 
2 
     | 
    
         
             
            require 'csv'
         
     | 
| 
       5 
3 
     | 
    
         
             
            require "flextures/flextures_base_config"
         
     | 
| 
         @@ -32,10 +30,9 @@ module Flextures 
     | 
|
| 
       32 
30 
     | 
    
         
             
              end
         
     | 
| 
       33 
31 
     | 
    
         | 
| 
       34 
32 
     | 
    
         
             
              # load configuration file, if file is exist
         
     | 
| 
       35 
     | 
    
         
            -
              def self. 
     | 
| 
      
 33 
     | 
    
         
            +
              def self.load_configurations
         
     | 
| 
       36 
34 
     | 
    
         
             
                if defined?(Rails) and Rails.root
         
     | 
| 
       37 
35 
     | 
    
         
             
                  [
         
     | 
| 
       38 
     | 
    
         
            -
                    File.join( Rails.root.to_path,"/config/flextures.config.rb" ),
         
     | 
| 
       39 
36 
     | 
    
         
             
                    File.join( Rails.root.to_path,"/config/flextures.factory.rb" ),
         
     | 
| 
       40 
37 
     | 
    
         
             
                  ].each { |fn| File.exist?(fn) && load(fn) }
         
     | 
| 
       41 
38 
     | 
    
         
             
                end
         
     | 
| 
         @@ -44,7 +41,7 @@ module Flextures 
     | 
|
| 
       44 
41 
     | 
    
         
             
              # @return [Array] flextures useable table names
         
     | 
| 
       45 
42 
     | 
    
         
             
              def self.deletable_tables
         
     | 
| 
       46 
43 
     | 
    
         
             
                tables = ActiveRecord::Base.connection.tables
         
     | 
| 
       47 
     | 
    
         
            -
                Flextures:: 
     | 
| 
      
 44 
     | 
    
         
            +
                Flextures::Configuration.ignore_tables.each { |name| tables.delete( name.to_s ) }
         
     | 
| 
       48 
45 
     | 
    
         
             
                tables
         
     | 
| 
       49 
46 
     | 
    
         
             
              end
         
     | 
| 
       50 
47 
     | 
    
         | 
| 
         @@ -133,8 +130,8 @@ module Flextures 
     | 
|
| 
       133 
130 
     | 
    
         | 
| 
       134 
131 
     | 
    
         
             
                # check exist filename block
         
     | 
| 
       135 
132 
     | 
    
         
             
                def self.exist
         
     | 
| 
       136 
     | 
    
         
            -
                  return->(name){ File.exists?( File.join( 
     | 
| 
       137 
     | 
    
         
            -
                                  File.exists?( File.join( 
     | 
| 
      
 133 
     | 
    
         
            +
                  return->(name){ File.exists?( File.join(Flextures::Configuration.load_directory, "#{name}.csv") ) or
         
     | 
| 
      
 134 
     | 
    
         
            +
                                  File.exists?( File.join(Flextures::Configuration.load_directory, "#{name}.yml") ) }
         
     | 
| 
       138 
135 
     | 
    
         
             
                end
         
     | 
| 
       139 
136 
     | 
    
         
             
              end
         
     | 
| 
       140 
137 
     | 
    
         
             
            end
         
     | 
| 
         @@ -1,33 +1,22 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            # encoding: utf-8
         
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
       3 
1 
     | 
    
         
             
            # base configurations
         
     | 
| 
       4 
     | 
    
         
            -
            # if you want to change setting, create 'config/flextures.config.rb', and overwrite setting
         
     | 
| 
       5 
     | 
    
         
            -
            #
         
     | 
| 
       6 
     | 
    
         
            -
            # example:
         
     | 
| 
       7 
     | 
    
         
            -
            # module Flextures
         
     | 
| 
       8 
     | 
    
         
            -
            #  # load and dump directroy setting change "spec/fixtures/" to "test/fixtures/"
         
     | 
| 
       9 
     | 
    
         
            -
            #  Config.fixture_load_directory = "test/fixtures/"
         
     | 
| 
       10 
     | 
    
         
            -
            #  Config.fixture_dump_directory = "test/fixtures/"
         
     | 
| 
       11 
     | 
    
         
            -
            # end
         
     | 
| 
       12 
     | 
    
         
            -
            #
         
     | 
| 
       13 
2 
     | 
    
         
             
            module Flextures
         
     | 
| 
       14 
     | 
    
         
            -
               
     | 
| 
       15 
     | 
    
         
            -
                 
     | 
| 
       16 
     | 
    
         
            -
             
     | 
| 
       17 
     | 
    
         
            -
             
     | 
| 
       18 
     | 
    
         
            -
                   
     | 
| 
       19 
     | 
    
         
            -
             
     | 
| 
       20 
     | 
    
         
            -
             
     | 
| 
       21 
     | 
    
         
            -
             
     | 
| 
       22 
     | 
    
         
            -
                   
     | 
| 
       23 
     | 
    
         
            -
             
     | 
| 
       24 
     | 
    
         
            -
             
     | 
| 
       25 
     | 
    
         
            -
                 
     | 
| 
       26 
     | 
    
         
            -
             
     | 
| 
       27 
     | 
    
         
            -
             
     | 
| 
       28 
     | 
    
         
            -
             
     | 
| 
       29 
     | 
    
         
            -
             
     | 
| 
       30 
     | 
    
         
            -
                   
     | 
| 
      
 3 
     | 
    
         
            +
              class Configuration
         
     | 
| 
      
 4 
     | 
    
         
            +
                include ActiveSupport::Configurable
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
                config_accessor :ignore_tables do
         
     | 
| 
      
 7 
     | 
    
         
            +
                  ["schema_migrations"]
         
     | 
| 
      
 8 
     | 
    
         
            +
                end
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
                config_accessor :load_directory do
         
     | 
| 
      
 11 
     | 
    
         
            +
                  "spec/fixtures/"
         
     | 
| 
      
 12 
     | 
    
         
            +
                end
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
                config_accessor :dump_directory do
         
     | 
| 
      
 15 
     | 
    
         
            +
                  "spec/fixtures/"
         
     | 
| 
      
 16 
     | 
    
         
            +
                end
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
                config_accessor :init_all_tables do
         
     | 
| 
      
 19 
     | 
    
         
            +
                  true
         
     | 
| 
       31 
20 
     | 
    
         
             
                end
         
     | 
| 
       32 
21 
     | 
    
         
             
              end
         
     | 
| 
       33 
22 
     | 
    
         
             
            end
         
     | 
| 
         @@ -1,5 +1,3 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            # encoding: utf-8
         
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
       3 
1 
     | 
    
         
             
            require 'ostruct'
         
     | 
| 
       4 
2 
     | 
    
         
             
            require 'csv'
         
     | 
| 
       5 
3 
     | 
    
         | 
| 
         @@ -12,7 +10,7 @@ module Flextures 
     | 
|
| 
       12 
10 
     | 
    
         
             
              module Rake
         
     | 
| 
       13 
11 
     | 
    
         
             
                module Command
         
     | 
| 
       14 
12 
     | 
    
         
             
                  def self.dump
         
     | 
| 
       15 
     | 
    
         
            -
                    Flextures:: 
     | 
| 
      
 13 
     | 
    
         
            +
                    Flextures::load_configurations
         
     | 
| 
       16 
14 
     | 
    
         
             
                    table_names = Flextures::ARGS.parse
         
     | 
| 
       17 
15 
     | 
    
         
             
                    puts "dumping..."
         
     | 
| 
       18 
16 
     | 
    
         
             
                    case ENV["FORMAT"].to_s.to_sym
         
     | 
| 
         @@ -26,7 +24,7 @@ module Flextures 
     | 
|
| 
       26 
24 
     | 
    
         
             
                  end
         
     | 
| 
       27 
25 
     | 
    
         | 
| 
       28 
26 
     | 
    
         
             
                  def self.load
         
     | 
| 
       29 
     | 
    
         
            -
                    Flextures:: 
     | 
| 
      
 27 
     | 
    
         
            +
                    Flextures::load_configurations
         
     | 
| 
       30 
28 
     | 
    
         
             
                    table_names = Flextures::ARGS.parse
         
     | 
| 
       31 
29 
     | 
    
         
             
                    Flextures::init_tables unless ENV["T"] or ENV["TABLE"] or ENV["M"] or ENV["MODEL"] or ENV["F"] or ENV["FIXTUES"]
         
     | 
| 
       32 
30 
     | 
    
         
             
                    file_format = ENV["FORMAT"]
         
     | 
| 
         @@ -43,7 +41,7 @@ module Flextures 
     | 
|
| 
       43 
41 
     | 
    
         | 
| 
       44 
42 
     | 
    
         
             
                  # load and dump data
         
     | 
| 
       45 
43 
     | 
    
         
             
                  def self.generate
         
     | 
| 
       46 
     | 
    
         
            -
                    Flextures:: 
     | 
| 
      
 44 
     | 
    
         
            +
                    Flextures::load_configurations
         
     | 
| 
       47 
45 
     | 
    
         
             
                    table_names = Flextures::ARGS.parse
         
     | 
| 
       48 
46 
     | 
    
         
             
                    Flextures::init_tables unless ENV["T"] or ENV["TABLE"] or ENV["M"] or ENV["MODEL"] or ENV["F"] or ENV["FIXTUES"]
         
     | 
| 
       49 
47 
     | 
    
         
             
                    file_format = ENV["FORMAT"]
         
     | 
| 
         @@ -1,30 +1,28 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            # encoding: utf-8
         
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
       3 
1 
     | 
    
         
             
            require "fileutils"
         
     | 
| 
       4 
2 
     | 
    
         | 
| 
       5 
3 
     | 
    
         
             
            module Flextures
         
     | 
| 
       6 
4 
     | 
    
         
             
              # defined data dump methods
         
     | 
| 
       7 
5 
     | 
    
         
             
              module Dumper
         
     | 
| 
       8 
     | 
    
         
            -
                 
     | 
| 
       9 
     | 
    
         
            -
             
     | 
| 
       10 
     | 
    
         
            -
             
     | 
| 
       11 
     | 
    
         
            -
             
     | 
| 
       12 
     | 
    
         
            -
             
     | 
| 
       13 
     | 
    
         
            -
             
     | 
| 
       14 
     | 
    
         
            -
             
     | 
| 
       15 
     | 
    
         
            -
             
     | 
| 
       16 
     | 
    
         
            -
             
     | 
| 
       17 
     | 
    
         
            -
             
     | 
| 
      
 6 
     | 
    
         
            +
                module ProcEx
         
     | 
| 
      
 7 
     | 
    
         
            +
                  refine Proc do
         
     | 
| 
      
 8 
     | 
    
         
            +
                    # compose function
         
     | 
| 
      
 9 
     | 
    
         
            +
                    def *(other)
         
     | 
| 
      
 10 
     | 
    
         
            +
                      if self.lambda? and other.lambda?
         
     | 
| 
      
 11 
     | 
    
         
            +
                        lambda { |*x| other.call(self.call(*x)) }
         
     | 
| 
      
 12 
     | 
    
         
            +
                      elsif not self.lambda? and not other.lambda?
         
     | 
| 
      
 13 
     | 
    
         
            +
                        Proc.new {|*x| other.call(self.call(*x)) }
         
     | 
| 
      
 14 
     | 
    
         
            +
                      else
         
     | 
| 
      
 15 
     | 
    
         
            +
                        raise ArgumentError, "lambda/Proc type mismatch"
         
     | 
| 
      
 16 
     | 
    
         
            +
                      end
         
     | 
| 
       18 
17 
     | 
    
         
             
                    end
         
     | 
| 
       19 
18 
     | 
    
         
             
                  end
         
     | 
| 
       20 
19 
     | 
    
         
             
                end
         
     | 
| 
      
 20 
     | 
    
         
            +
                using ProcEx
         
     | 
| 
       21 
21 
     | 
    
         | 
| 
       22 
     | 
    
         
            -
                 
     | 
| 
       23 
     | 
    
         
            -
                  Proc.new(&b)
         
     | 
| 
       24 
     | 
    
         
            -
                end
         
     | 
| 
      
 22 
     | 
    
         
            +
                PARENT = Flextures
         
     | 
| 
       25 
23 
     | 
    
         | 
| 
       26 
24 
     | 
    
         
             
                # create data translater
         
     | 
| 
       27 
     | 
    
         
            -
                def self.translate_creater( 
     | 
| 
      
 25 
     | 
    
         
            +
                def self.translate_creater(val, rules)
         
     | 
| 
       28 
26 
     | 
    
         
             
                  rule_map = {
         
     | 
| 
       29 
27 
     | 
    
         
             
                    nullstr: proc { |d|
         
     | 
| 
       30 
28 
     | 
    
         
             
                      return "null" if d.nil?
         
     | 
| 
         @@ -102,7 +100,7 @@ module Flextures 
     | 
|
| 
       102 
100 
     | 
    
         
             
                  },
         
     | 
| 
       103 
101 
     | 
    
         
             
                  datetime:->( d, format ){
         
     | 
| 
       104 
102 
     | 
    
         
             
                    procs = (format == :yml) ?
         
     | 
| 
       105 
     | 
    
         
            -
                      [:nullstr, :blank2null, :false2nullstr, proc { |d| d.to_s }] :
         
     | 
| 
      
 103 
     | 
    
         
            +
                      [:nullstr, :blank2null, :false2nullstr, proc { |d| d.try(:strftime,"%F %T").to_s }] :
         
     | 
| 
       106 
104 
     | 
    
         
             
                      [proc { |d| d.to_s }]
         
     | 
| 
       107 
105 
     | 
    
         
             
                    self.translate_creater d, procs
         
     | 
| 
       108 
106 
     | 
    
         
             
                  },
         
     | 
| 
         @@ -138,7 +136,7 @@ module Flextures 
     | 
|
| 
       138 
136 
     | 
    
         
             
                  },
         
     | 
| 
       139 
137 
     | 
    
         
             
                  time:->( d, format ){
         
     | 
| 
       140 
138 
     | 
    
         
             
                    procs = (format == :yml) ?
         
     | 
| 
       141 
     | 
    
         
            -
                      [:ymlnulltime, proc { |d| d.to_s }] :
         
     | 
| 
      
 139 
     | 
    
         
            +
                      [:ymlnulltime, proc { |d| d.try(:strftime,"%F %T").to_s }] :
         
     | 
| 
       142 
140 
     | 
    
         
             
                      [proc { |d| d.to_s }]
         
     | 
| 
       143 
141 
     | 
    
         
             
                    self.translate_creater d, procs
         
     | 
| 
       144 
142 
     | 
    
         
             
                  },
         
     | 
| 
         @@ -159,9 +157,9 @@ module Flextures 
     | 
|
| 
       159 
157 
     | 
    
         
             
                # @params [Symbol] type datatype
         
     | 
| 
       160 
158 
     | 
    
         
             
                # @params [Symbol] format data type (:yml or :csv)
         
     | 
| 
       161 
159 
     | 
    
         
             
                # @return translated value
         
     | 
| 
       162 
     | 
    
         
            -
                def self.trans( 
     | 
| 
      
 160 
     | 
    
         
            +
                def self.trans(v, type, format)
         
     | 
| 
       163 
161 
     | 
    
         
             
                  trans = TRANSLATER[type]
         
     | 
| 
       164 
     | 
    
         
            -
                  return trans.call( 
     | 
| 
      
 162 
     | 
    
         
            +
                  return trans.call(v, format) if trans
         
     | 
| 
       165 
163 
     | 
    
         
             
                  v
         
     | 
| 
       166 
164 
     | 
    
         
             
                end
         
     | 
| 
       167 
165 
     | 
    
         | 
| 
         @@ -169,7 +167,7 @@ module Flextures 
     | 
|
| 
       169 
167 
     | 
    
         
             
                # @params klass dump table Model
         
     | 
| 
       170 
168 
     | 
    
         
             
                # @params [Hash] options dump options
         
     | 
| 
       171 
169 
     | 
    
         
             
                # @return [Array] columns format information
         
     | 
| 
       172 
     | 
    
         
            -
                def self.dump_attributes( 
     | 
| 
      
 170 
     | 
    
         
            +
                def self.dump_attributes(klass, options)
         
     | 
| 
       173 
171 
     | 
    
         
             
                  columns = klass.columns.map { |column| { name: column.name, type: column.type } }
         
     | 
| 
       174 
172 
     | 
    
         
             
                  # option[:minus] colum is delete columns
         
     | 
| 
       175 
173 
     | 
    
         
             
                  columns.reject! { |column| options[:minus].include?(column[:name]) } if options[:minus]
         
     | 
| 
         @@ -185,7 +183,7 @@ module Flextures 
     | 
|
| 
       185 
183 
     | 
    
         
             
                # @params [Hash] options options
         
     | 
| 
       186 
184 
     | 
    
         
             
                # @params [Symbol] type format type (:yml or :csv)
         
     | 
| 
       187 
185 
     | 
    
         
             
                # @return [Proc] filter function
         
     | 
| 
       188 
     | 
    
         
            -
                def self.create_filter( 
     | 
| 
      
 186 
     | 
    
         
            +
                def self.create_filter(attr_type, format, type)
         
     | 
| 
       189 
187 
     | 
    
         
             
                  filter = DumpFilter[format[:table].to_s.to_sym] || {}
         
     | 
| 
       190 
188 
     | 
    
         
             
                  ->(row) {
         
     | 
| 
       191 
189 
     | 
    
         
             
                    attr_type.map do |h|
         
     | 
| 
         @@ -198,7 +196,7 @@ module Flextures 
     | 
|
| 
       198 
196 
     | 
    
         
             
                # data dump to csv format
         
     | 
| 
       199 
197 
     | 
    
         
             
                # @params [Hash] format file format data
         
     | 
| 
       200 
198 
     | 
    
         
             
                # @params [Hash] options dump format options
         
     | 
| 
       201 
     | 
    
         
            -
                def self.csv( 
     | 
| 
      
 199 
     | 
    
         
            +
                def self.csv(format)
         
     | 
| 
       202 
200 
     | 
    
         
             
                  klass = PARENT.create_model(format[:table])
         
     | 
| 
       203 
201 
     | 
    
         
             
                  attr_type = self.dump_attributes klass, format
         
     | 
| 
       204 
202 
     | 
    
         
             
                  filter = self.create_filter attr_type, format, :csv
         
     | 
| 
         @@ -206,10 +204,10 @@ module Flextures 
     | 
|
| 
       206 
204 
     | 
    
         
             
                end
         
     | 
| 
       207 
205 
     | 
    
         | 
| 
       208 
206 
     | 
    
         
             
                # dump csv format data
         
     | 
| 
       209 
     | 
    
         
            -
                def self.dump_csv( 
     | 
| 
      
 207 
     | 
    
         
            +
                def self.dump_csv(klass, attr_type, values_filter, format)
         
     | 
| 
       210 
208 
     | 
    
         
             
                  # TODO: 拡張子は指定してもしなくても良いようにする
         
     | 
| 
       211 
209 
     | 
    
         
             
                  file_name = format[:file] || format[:table]
         
     | 
| 
       212 
     | 
    
         
            -
                  dir_name = File.join( 
     | 
| 
      
 210 
     | 
    
         
            +
                  dir_name = File.join(Flextures::Configuration.dump_directory, format[:dir].to_s)
         
     | 
| 
       213 
211 
     | 
    
         
             
                  FileUtils.mkdir_p(dir_name)
         
     | 
| 
       214 
212 
     | 
    
         
             
                  outfile = File.join(dir_name, "#{file_name}.csv")
         
     | 
| 
       215 
213 
     | 
    
         
             
                  CSV.open(outfile,'w') do |csv|
         
     | 
| 
         @@ -226,19 +224,19 @@ module Flextures 
     | 
|
| 
       226 
224 
     | 
    
         
             
                # data dump to yaml format
         
     | 
| 
       227 
225 
     | 
    
         
             
                # @params [Hash] format file format data
         
     | 
| 
       228 
226 
     | 
    
         
             
                # @params [Hash] options dump format options
         
     | 
| 
       229 
     | 
    
         
            -
                def self.yml( 
     | 
| 
      
 227 
     | 
    
         
            +
                def self.yml(format)
         
     | 
| 
       230 
228 
     | 
    
         
             
                  klass = PARENT::create_model(format[:table])
         
     | 
| 
       231 
229 
     | 
    
         
             
                  attr_type = self.dump_attributes klass, format
         
     | 
| 
       232 
230 
     | 
    
         
             
                  filter = self.create_filter attr_type, format, :yml
         
     | 
| 
       233 
     | 
    
         
            -
                  self.dump_yml( 
     | 
| 
      
 231 
     | 
    
         
            +
                  self.dump_yml(klass, filter, format)
         
     | 
| 
       234 
232 
     | 
    
         
             
                end
         
     | 
| 
       235 
233 
     | 
    
         | 
| 
       236 
234 
     | 
    
         
             
                # dump yml format data
         
     | 
| 
       237 
     | 
    
         
            -
                def self.dump_yml( 
     | 
| 
      
 235 
     | 
    
         
            +
                def self.dump_yml(klass, values_filter, format)
         
     | 
| 
       238 
236 
     | 
    
         
             
                  # TODO: 拡張子は指定してもしなくても良いようにする
         
     | 
| 
       239 
237 
     | 
    
         
             
                  table_name = format[:table]
         
     | 
| 
       240 
238 
     | 
    
         
             
                  file_name = format[:file] || format[:table]
         
     | 
| 
       241 
     | 
    
         
            -
                  dir_name = File.join( 
     | 
| 
      
 239 
     | 
    
         
            +
                  dir_name = File.join(Flextures::Configuration.dump_directory, format[:dir].to_s)
         
     | 
| 
       242 
240 
     | 
    
         
             
                  FileUtils.mkdir_p(dir_name)
         
     | 
| 
       243 
241 
     | 
    
         
             
                  outfile = File.join(dir_name, "#{file_name}.yml")
         
     | 
| 
       244 
242 
     | 
    
         
             
                  File.open(outfile,"w") do |f|
         
     |