icfs 0.2.0 → 0.3.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/data/icfs.css +7 -1
- data/data/icfs.js +17 -19
- data/devel/run/base.rb +2 -1
- data/devel/run/case-backup.rb +24 -0
- data/devel/run/case-restore.rb +24 -0
- data/devel/run/copy-s3.rb +2 -0
- data/devel/run/init-icfs.rb +7 -37
- data/devel/run/init-template.rb +33 -0
- data/lib/icfs/api.rb +92 -48
- data/lib/icfs/cache_elastic.rb +10 -2
- data/lib/icfs/config.rb +4 -3
- data/lib/icfs/items.rb +21 -5
- data/lib/icfs/utils/backup.rb +22 -18
- data/lib/icfs/utils/check.rb +24 -22
- data/lib/icfs/web/client.rb +302 -160
- data/lib/icfs.rb +70 -1
- metadata +5 -3
- data/bin/icfs_demo_fcgi.rb +0 -53
    
        data/lib/icfs/items.rb
    CHANGED
    
    | @@ -499,9 +499,10 @@ module Items | |
| 499 499 | 
             
                  'template' => Validate::IsBoolean,
         | 
| 500 500 | 
             
                  'status' => Validate::IsBoolean,
         | 
| 501 501 | 
             
                  'title' => FieldTitle,
         | 
| 502 | 
            -
                  'access' => SubAccess
         | 
| 502 | 
            +
                  'access' => SubAccess,
         | 
| 503 503 | 
             
                }.freeze,
         | 
| 504 504 | 
             
                optional: {
         | 
| 505 | 
            +
                  'caseid' => FieldCaseid,
         | 
| 505 506 | 
             
                  'tags' => SubTags,
         | 
| 506 507 | 
             
                  'stats' => SubCaseStats,
         | 
| 507 508 | 
             
                }.freeze
         | 
| @@ -512,11 +513,11 @@ module Items | |
| 512 513 | 
             
              ItemEntryNew = {
         | 
| 513 514 | 
             
                method: :hash,
         | 
| 514 515 | 
             
                required: {
         | 
| 515 | 
            -
                  'caseid' => FieldCaseid,
         | 
| 516 516 | 
             
                  'title' => FieldTitle,
         | 
| 517 517 | 
             
                  'content' => FieldContent,
         | 
| 518 518 | 
             
                }.freeze,
         | 
| 519 519 | 
             
                optional: {
         | 
| 520 | 
            +
                  'caseid' => FieldCaseid,
         | 
| 520 521 | 
             
                  'time' => Validate::IsIntPos,
         | 
| 521 522 | 
             
                  'tags' => SubTagsNormal,
         | 
| 522 523 | 
             
                  'index' => SubIndexes,
         | 
| @@ -536,11 +537,11 @@ module Items | |
| 536 537 | 
             
              ItemEntryEdit = {
         | 
| 537 538 | 
             
                method: :hash,
         | 
| 538 539 | 
             
                required: {
         | 
| 539 | 
            -
                  'caseid' => FieldCaseid,
         | 
| 540 540 | 
             
                  'title' => FieldTitle,
         | 
| 541 541 | 
             
                  'content' => FieldContent,
         | 
| 542 542 | 
             
                }.freeze,
         | 
| 543 543 | 
             
                optional: {
         | 
| 544 | 
            +
                  'caseid' => FieldCaseid,
         | 
| 544 545 | 
             
                  'entry' => Validate::IsIntPos,
         | 
| 545 546 | 
             
                  'time' => Validate::IsIntPos,
         | 
| 546 547 | 
             
                  'tags' => SubTagsEntry,
         | 
| @@ -567,6 +568,7 @@ module Items | |
| 567 568 | 
             
                  'tasks' => SubTasksEdit
         | 
| 568 569 | 
             
                }.freeze,
         | 
| 569 570 | 
             
                optional: {
         | 
| 571 | 
            +
                  'caseid' => FieldCaseid,
         | 
| 570 572 | 
             
                  'action' => Validate::IsIntPos
         | 
| 571 573 | 
             
                }.freeze
         | 
| 572 574 | 
             
              }.freeze
         | 
| @@ -580,6 +582,7 @@ module Items | |
| 580 582 | 
             
                  'content' => FieldContent,
         | 
| 581 583 | 
             
                }.freeze,
         | 
| 582 584 | 
             
                optional: {
         | 
| 585 | 
            +
                  'caseid' => FieldCaseid,
         | 
| 583 586 | 
             
                  'index' => Validate::IsIntPos,
         | 
| 584 587 | 
             
                  'tags' => SubTags,
         | 
| 585 588 | 
             
                }.freeze
         | 
| @@ -605,6 +608,7 @@ module Items | |
| 605 608 | 
             
                }.freeze,
         | 
| 606 609 | 
             
                optional: {
         | 
| 607 610 | 
             
                  'stats' => SubCaseStats,
         | 
| 611 | 
            +
                  'entry' => Validate::IsIntPos,
         | 
| 608 612 | 
             
                }.freeze,
         | 
| 609 613 | 
             
              }.freeze
         | 
| 610 614 |  | 
| @@ -619,12 +623,18 @@ module Items | |
| 619 623 | 
             
                  'prev' => FieldHash,
         | 
| 620 624 | 
             
                  'time' => Validate::IsIntPos,
         | 
| 621 625 | 
             
                  'user' => FieldUsergrp,
         | 
| 622 | 
            -
                  'entry' => SubLogItem,
         | 
| 623 626 | 
             
                }.freeze,
         | 
| 624 627 | 
             
                optional: {
         | 
| 628 | 
            +
                  'entry' => SubLogItem,
         | 
| 625 629 | 
             
                  'index' => SubLogItem,
         | 
| 626 630 | 
             
                  'action' => SubLogItem,
         | 
| 627 | 
            -
                  ' | 
| 631 | 
            +
                  'case' => {
         | 
| 632 | 
            +
                    method: :hash,
         | 
| 633 | 
            +
                    required: {
         | 
| 634 | 
            +
                      'set' => Validate::IsBoolean,
         | 
| 635 | 
            +
                      'hash' => FieldHash,
         | 
| 636 | 
            +
                    }.freeze,
         | 
| 637 | 
            +
                  }.freeze,
         | 
| 628 638 | 
             
                  'files_hash' => {
         | 
| 629 639 | 
             
                    method: :array,
         | 
| 630 640 | 
             
                    min: 1,
         | 
| @@ -677,6 +687,9 @@ module Items | |
| 677 687 | 
             
                  'action' => Validate::IsIntPos,
         | 
| 678 688 | 
             
                  'log' => Validate::IsIntPos,
         | 
| 679 689 | 
             
                  'tasks' => SubTasks
         | 
| 690 | 
            +
                }.freeze,
         | 
| 691 | 
            +
                optional: {
         | 
| 692 | 
            +
                  'entry' => Validate::IsIntPos,
         | 
| 680 693 | 
             
                }.freeze
         | 
| 681 694 | 
             
              }.freeze
         | 
| 682 695 |  | 
| @@ -693,6 +706,9 @@ module Items | |
| 693 706 | 
             
                  'content' => FieldContent,
         | 
| 694 707 | 
             
                  'tags' => SubTags
         | 
| 695 708 | 
             
                }.freeze,
         | 
| 709 | 
            +
                optional: {
         | 
| 710 | 
            +
                  'entry' => Validate::IsIntPos,
         | 
| 711 | 
            +
                }.freeze
         | 
| 696 712 | 
             
              }.freeze
         | 
| 697 713 |  | 
| 698 714 |  | 
    
        data/lib/icfs/utils/backup.rb
    CHANGED
    
    | @@ -111,13 +111,15 @@ class Backup | |
| 111 111 | 
             
                  end
         | 
| 112 112 |  | 
| 113 113 | 
             
                  # entry
         | 
| 114 | 
            -
                   | 
| 115 | 
            -
             | 
| 116 | 
            -
                     | 
| 117 | 
            -
             | 
| 118 | 
            -
             | 
| 119 | 
            -
             | 
| 120 | 
            -
             | 
| 114 | 
            +
                  if log['entry']
         | 
| 115 | 
            +
                    enum = log['entry']['num']
         | 
| 116 | 
            +
                    _copy_item(dest,
         | 
| 117 | 
            +
                      'entry %d-%d' % [enum, lnum],
         | 
| 118 | 
            +
                      :entry_read,
         | 
| 119 | 
            +
                      :entry_write,
         | 
| 120 | 
            +
                      [cid, enum, lnum]
         | 
| 121 | 
            +
                    )
         | 
| 122 | 
            +
                  end
         | 
| 121 123 |  | 
| 122 124 | 
             
                  # index
         | 
| 123 125 | 
             
                  if log['index']
         | 
| @@ -142,7 +144,7 @@ class Backup | |
| 142 144 | 
             
                  end
         | 
| 143 145 |  | 
| 144 146 | 
             
                  # case
         | 
| 145 | 
            -
                  if log[' | 
| 147 | 
            +
                  if log['case']
         | 
| 146 148 | 
             
                    _copy_item(dest,
         | 
| 147 149 | 
             
                      'case %d' % lnum,
         | 
| 148 150 | 
             
                      :case_read,
         | 
| @@ -280,15 +282,17 @@ class Backup | |
| 280 282 | 
             
                    end
         | 
| 281 283 |  | 
| 282 284 | 
             
                    # entry
         | 
| 283 | 
            -
                     | 
| 284 | 
            -
             | 
| 285 | 
            -
                       | 
| 286 | 
            -
             | 
| 287 | 
            -
             | 
| 288 | 
            -
             | 
| 289 | 
            -
             | 
| 290 | 
            -
             | 
| 291 | 
            -
             | 
| 285 | 
            +
                    if log['entry']
         | 
| 286 | 
            +
                      enum = log['entry']['num']
         | 
| 287 | 
            +
                      _restore_item(src,
         | 
| 288 | 
            +
                        'entry %d-%d' % [enum, lnum],
         | 
| 289 | 
            +
                        :entry_read,
         | 
| 290 | 
            +
                        :entry_write,
         | 
| 291 | 
            +
                        [cid, enum, lnum],
         | 
| 292 | 
            +
                        [cid, enum]
         | 
| 293 | 
            +
                      )
         | 
| 294 | 
            +
                      emax = enum if enum > emax
         | 
| 295 | 
            +
                    end
         | 
| 292 296 |  | 
| 293 297 | 
             
                    # index
         | 
| 294 298 | 
             
                    if log['index']
         | 
| @@ -317,7 +321,7 @@ class Backup | |
| 317 321 | 
             
                    end
         | 
| 318 322 |  | 
| 319 323 | 
             
                    # case
         | 
| 320 | 
            -
                    if log[' | 
| 324 | 
            +
                    if log['case']
         | 
| 321 325 | 
             
                      _restore_item(src,
         | 
| 322 326 | 
             
                        'case %d' % lnum,
         | 
| 323 327 | 
             
                        :case_read,
         | 
    
        data/lib/icfs/utils/check.rb
    CHANGED
    
    | @@ -138,27 +138,29 @@ class Check | |
| 138 138 | 
             
                  end
         | 
| 139 139 |  | 
| 140 140 | 
             
                  # entry
         | 
| 141 | 
            -
                   | 
| 142 | 
            -
             | 
| 143 | 
            -
                     | 
| 144 | 
            -
             | 
| 145 | 
            -
             | 
| 146 | 
            -
             | 
| 147 | 
            -
             | 
| 148 | 
            -
             | 
| 149 | 
            -
             | 
| 150 | 
            -
                      [ | 
| 151 | 
            -
             | 
| 152 | 
            -
             | 
| 153 | 
            -
             | 
| 154 | 
            -
             | 
| 141 | 
            +
                  if log['entry']
         | 
| 142 | 
            +
                    enum = log['entry']['num']
         | 
| 143 | 
            +
                    ent = _item(
         | 
| 144 | 
            +
                      'entry %d-%d' % [enum, lnum],
         | 
| 145 | 
            +
                      :entry_read,
         | 
| 146 | 
            +
                      [cid, enum, lnum],
         | 
| 147 | 
            +
                      ent_cur.include?(enum),
         | 
| 148 | 
            +
                      log['entry']['hash'],
         | 
| 149 | 
            +
                      Items::ItemEntry,
         | 
| 150 | 
            +
                      [
         | 
| 151 | 
            +
                        ['caseid', 0].freeze,
         | 
| 152 | 
            +
                        ['entry', 1].freeze,
         | 
| 153 | 
            +
                        ['log', 2].freeze
         | 
| 154 | 
            +
                      ].freeze,
         | 
| 155 | 
            +
                    )
         | 
| 155 156 |  | 
| 156 | 
            -
             | 
| 157 | 
            -
             | 
| 158 | 
            -
             | 
| 159 | 
            -
             | 
| 160 | 
            -
             | 
| 161 | 
            -
             | 
| 157 | 
            +
                    # current entry
         | 
| 158 | 
            +
                    unless ent_cur.include?(enum)
         | 
| 159 | 
            +
                      ent_cur.add(enum)
         | 
| 160 | 
            +
                      if ent['files']
         | 
| 161 | 
            +
                        ent['files'].each do |fd|
         | 
| 162 | 
            +
                          file_cur.add( '%d-%d-%d' % [enum, fd['num'], fd['log']] )
         | 
| 163 | 
            +
                        end
         | 
| 162 164 | 
             
                      end
         | 
| 163 165 | 
             
                    end
         | 
| 164 166 | 
             
                  end
         | 
| @@ -202,13 +204,13 @@ class Check | |
| 202 204 | 
             
                  end
         | 
| 203 205 |  | 
| 204 206 | 
             
                  # case
         | 
| 205 | 
            -
                  if log[' | 
| 207 | 
            +
                  if log['case']
         | 
| 206 208 | 
             
                    cse = _item(
         | 
| 207 209 | 
             
                      'case %d' % lnum,
         | 
| 208 210 | 
             
                      :case_read,
         | 
| 209 211 | 
             
                      [cid, lnum],
         | 
| 210 212 | 
             
                      cse_cur,
         | 
| 211 | 
            -
                      log[' | 
| 213 | 
            +
                      log['case']['hash'],
         | 
| 212 214 | 
             
                      Items::ItemCase,
         | 
| 213 215 | 
             
                      [
         | 
| 214 216 | 
             
                        ['caseid', 0].freeze,
         |