flist 0.1.32 → 0.1.33

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 80e7ec0fbf6850f7f3b9b5b3ceca1c4c4a11b2c8b74a423c2f8c1b3f49a59b0e
4
- data.tar.gz: '093504b47a1c64d03c614824c5de93a2ad65b3bda0259b9d17ea8dfe30260820'
3
+ metadata.gz: d39ef08e21cea0fdd6d2ad26d2a23e6f8d711507486a92e70152fb02925f5b91
4
+ data.tar.gz: dca998382f32a359f9b42453927d65f646b3384e72e2f75ab794b5cb7ecfb412
5
5
  SHA512:
6
- metadata.gz: 3e8316a22176851509c7efb0e819847df4e17bcdb1e925a760962d8eb1a54245f19023d9908d2bda10c4791c3aee1e03201fb968b2d8a8adf5752b5da742ecc8
7
- data.tar.gz: bbbbb98cb399d2025db71b4a4e4f3bf7d8615fe88d491865367fa56cb6225c52be5dada3047c9ac108b10ae4358a41484f6c9fa8835b644e21c98eaf1b93d05a
6
+ metadata.gz: 817da79ec789360c3a9294475a411d916920b3a3de6019fb847de25436ba1a664fe0373d856df8f807d460b39a0c9c62bddab0dcaade6eaae3f4799a6276c426
7
+ data.tar.gz: 185d888808486747ff851570dc2b47493479ef61fc32e1bcf8fe8e8621bad468c4831ef50b3dcb9fbd0ce7ff075d9af67e94ea346eede60a4bc6d7167bcde486
@@ -0,0 +1,31 @@
1
+ name: Ruby
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - master
7
+
8
+ pull_request:
9
+
10
+ jobs:
11
+ build:
12
+ runs-on: ubuntu-latest
13
+
14
+ strategy:
15
+ matrix:
16
+ ruby:
17
+ - 2.7
18
+
19
+ steps:
20
+ - uses: actions/checkout@v2
21
+ - name: Set up Ruby
22
+ uses: ruby/setup-ruby@v1
23
+ with:
24
+ ruby-version: ${{ matrix.ruby }}
25
+ bundler-cache: true
26
+ - name: Run the arx task
27
+ run: bundle exec rake arx:arxutils_sqlite3
28
+ - name: Run the flists task
29
+ run: bundle exec rake flists
30
+ - name: Run the default task
31
+ run: bundle exec rake
data/.rubocop.yml CHANGED
@@ -7,3 +7,6 @@ AllCops:
7
7
  require:
8
8
  - rubocop-rake
9
9
  - rubocop-rspec
10
+
11
+
12
+
data/.rubocop_todo.yml CHANGED
@@ -1,31 +1,41 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2022-09-28 00:57:30 UTC using RuboCop version 1.36.0.
3
+ # on 2022-09-30 22:38:11 UTC using RuboCop version 1.36.0.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
7
7
  # versions of RuboCop, may require this file to be generated again.
8
8
 
9
+
10
+ # Offense count: 1
11
+ # This cop supports safe autocorrection (--autocorrect).
12
+ # Configuration parameters: EnforcedStyle.
13
+ # SupportedStyles: empty_lines, empty_lines_except_namespace, empty_lines_special, no_empty_lines
14
+ Layout/EmptyLinesAroundModuleBody:
15
+ Exclude:
16
+ - 'lib/dbacrecord.rb'
17
+
9
18
  # Offense count: 2
10
- Lint/HashCompareByIdentity:
19
+ # This cop supports safe autocorrection (--autocorrect).
20
+ Layout/HeredocIndentation:
11
21
  Exclude:
12
- - 'lib/flist/dbutil/dirzmgr.rb'
13
- - 'lib/flist/dbutil/flistzmgr.rb'
22
+ - 'db/migrate/040_create_currentflistz.rb'
23
+ - 'db/migrate/070_create_currentdirz.rb'
14
24
 
15
25
  # Offense count: 1
16
- Lint/UnreachableCode:
26
+ # This cop supports safe autocorrection (--autocorrect).
27
+ # Configuration parameters: Width, AllowedPatterns, IgnoredPatterns.
28
+ Layout/IndentationWidth:
17
29
  Exclude:
18
- # - 'lib/flist/flist/filelist.rb'
30
+ - 'lib/dbacrecord.rb'
19
31
 
20
- # Offense count: 8
21
- Lint/UselessAssignment:
32
+ # Offense count: 2
33
+ Lint/HashCompareByIdentity:
22
34
  Exclude:
23
- # - 'exe/flist'
24
- # - 'lib/flist/dbutil/flistzmgr.rb'
25
- # - 'lib/flist/flist.rb'
26
- # - 'lib/flist/flist/filelist.rb'
35
+ - 'lib/flist/dbutil/dirzmgr.rb'
36
+ - 'lib/flist/dbutil/flistzmgr.rb'
27
37
 
28
- # Offense count: 14
38
+ # Offense count: 12
29
39
  # Configuration parameters: AllowedMethods, AllowedPatterns, IgnoredMethods, CountRepeatedAttributes.
30
40
  Metrics/AbcSize:
31
41
  Max: 61
@@ -39,17 +49,17 @@ Metrics/BlockLength:
39
49
  # Offense count: 2
40
50
  # Configuration parameters: CountComments, CountAsOne.
41
51
  Metrics/ClassLength:
42
- Max: 258
52
+ Max: 270
43
53
 
44
54
  # Offense count: 2
45
55
  # Configuration parameters: AllowedMethods, AllowedPatterns, IgnoredMethods.
46
56
  Metrics/CyclomaticComplexity:
47
57
  Max: 10
48
58
 
49
- # Offense count: 19
59
+ # Offense count: 17
50
60
  # Configuration parameters: CountComments, CountAsOne, ExcludedMethods, AllowedMethods, AllowedPatterns, IgnoredMethods.
51
61
  Metrics/MethodLength:
52
- Max: 47
62
+ Max: 48
53
63
 
54
64
  # Offense count: 7
55
65
  # Configuration parameters: CountKeywordArgs.
@@ -57,52 +67,61 @@ Metrics/ParameterLists:
57
67
  Max: 11
58
68
  MaxOptionalParameters: 11
59
69
 
60
- # Offense count: 2
70
+ # Offense count: 3
61
71
  # Configuration parameters: AllowedMethods, AllowedPatterns, IgnoredMethods.
62
72
  Metrics/PerceivedComplexity:
63
73
  Max: 10
64
74
 
65
75
  # Offense count: 1
66
- Naming/AccessorMethodName:
67
- Exclude:
68
- # - 'lib/flist/flist/filelist.rb'
69
-
70
- # Offense count: 1
71
- # Configuration parameters: EnforcedStyle, AllowedPatterns, IgnoredPatterns.
72
- # SupportedStyles: snake_case, camelCase
73
- Naming/MethodName:
74
- Exclude: # - 'lib/_arx_flistz.rb'
75
-
76
- # Offense count: 5
77
- # Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames.
78
- # AllowedNames: as, at, by, db, id, in, io, ip, of, on, os, pp, to
79
- Naming/MethodParameterName:
76
+ # This cop supports safe autocorrection (--autocorrect).
77
+ Style/BlockComments:
80
78
  Exclude:
81
- # - 'lib/flist/flist.rb'
82
- # - 'lib/flist/flist/filelist.rb'
83
- # - 'lib/flist/flist/store.rb'
79
+ - 'config/dbsetup.rb'
84
80
 
85
- # Offense count: 17
81
+ # Offense count: 7
86
82
  # Configuration parameters: AllowedConstants.
87
83
  Style/Documentation:
88
- Enabled: false
89
-
90
- # Offense count: 4
91
- # Configuration parameters: MinBodyLength, AllowConsecutiveConditionals.
92
- Style/GuardClause:
93
84
  Exclude:
94
- # - 'flist.gemspec'
95
- # - 'lib/flist/csvx.rb'
96
- # - 'lib/flist/dbutil/flistzmgr.rb'
97
- # - 'lib/flist/flist/filelist.rb'
98
-
99
- # Offense count: 1
85
+ # - 'spec/**/*'
86
+ - 'test/**/*'
87
+ - 'db/migrate/010_create_countdatetime.rb'
88
+ - 'db/migrate/020_create_flistz.rb'
89
+ - 'db/migrate/030_create_invalidflistz.rb'
90
+ - 'db/migrate/040_create_currentflistz.rb'
91
+ - 'db/migrate/050_create_dirz.rb'
92
+ - 'db/migrate/060_create_invaliddirz.rb'
93
+ - 'db/migrate/070_create_currentdirz.rb'
94
+
95
+ # Offense count: 9
96
+ # This cop supports unsafe autocorrection (--autocorrect-all).
97
+ # Configuration parameters: EnforcedStyle.
98
+ # SupportedStyles: always, always_true, never
99
+ Style/FrozenStringLiteralComment:
100
+ Exclude:
101
+ - 'config/dbsetup.rb'
102
+ - 'db/migrate/010_create_countdatetime.rb'
103
+ - 'db/migrate/020_create_flistz.rb'
104
+ - 'db/migrate/030_create_invalidflistz.rb'
105
+ - 'db/migrate/040_create_currentflistz.rb'
106
+ - 'db/migrate/050_create_dirz.rb'
107
+ - 'db/migrate/060_create_invaliddirz.rb'
108
+ - 'db/migrate/070_create_currentdirz.rb'
109
+ - 'lib/dbacrecord.rb'
110
+
111
+ # Offense count: 21
100
112
  # This cop supports safe autocorrection (--autocorrect).
101
- Style/IfUnlessModifier:
113
+ # Configuration parameters: EnforcedStyle, EnforcedShorthandSyntax, UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols.
114
+ # SupportedStyles: ruby19, hash_rockets, no_mixed_keys, ruby19_no_mixed_keys
115
+ # SupportedShorthandSyntax: always, never, either, consistent
116
+ Style/HashSyntax:
102
117
  Exclude:
103
- # - 'lib/flist/flist/filelist.rb'
118
+ - 'db/migrate/010_create_countdatetime.rb'
119
+ - 'db/migrate/020_create_flistz.rb'
120
+ - 'db/migrate/030_create_invalidflistz.rb'
121
+ - 'db/migrate/050_create_dirz.rb'
122
+ - 'db/migrate/060_create_invaliddirz.rb'
104
123
 
105
- # Offense count: 1
124
+ # Offense count: 2
106
125
  # This cop supports safe autocorrection (--autocorrect).
107
126
  # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns, IgnoredPatterns.
108
127
  # URISchemes: http, https
data/Gemfile CHANGED
@@ -14,6 +14,7 @@ gem 'evernote_oauth'
14
14
  gem 'ykxutils'
15
15
 
16
16
  gem 'ykutils', '> 0.1.3'
17
+ # gem 'ykutils', '> 0.1.3', path: '../ykutils'
17
18
 
18
19
  gem 'rake', '~> 13.0'
19
20
  gem 'rspec', '~> 3.0'
data/Rakefile CHANGED
@@ -14,12 +14,40 @@ require 'rubocop/rake_task'
14
14
  RuboCop::RakeTask.new
15
15
 
16
16
  # task :default => :spec
17
+ efname = 'env-a1.yaml'
18
+ # efname = "env-a2.yaml"
19
+ # efname = "env-a3.yaml"
20
+ cfname = 'config/config.yml'
21
+
22
+ desc 'Flist related operation'
23
+ task :flists do
24
+ sh "bundle exec exe/flist --cmd=s --env=#{efname} --config=#{cfname}"
25
+ end
26
+
27
+ desc 'Flist related operation'
28
+ task :flistfs1 do
29
+ sh "bundle exec exe/flist --cmd=fs1 --env=#{efname} --config=#{cfname}"
30
+ end
31
+
17
32
  desc 'Flist related operation'
18
- task :flist do
19
- sh 'bundle exec exe/flist'
33
+ task :flistfs2 do
34
+ sh "bundle exec exe/flist --cmd=fs2 --env=#{efname} --config=#{cfname}"
20
35
  end
21
36
 
22
37
  desc 'Flist related operation'
38
+ task :flistfs3 do
39
+ sh "bundle exec exe/flist --cmd=fs3 --env=#{efname} --config=#{cfname}"
40
+ end
41
+
42
+ desc 'Flist related operation'
43
+ task :flistfr do
44
+ sh "bundle exec exe/flist --cmd=fr --env=#{efname} --config=#{cfname}"
45
+ end
46
+
47
+ desc 'Flist related operation'
48
+ task flistall: %i[flistfs1 flistfs2 flistfs3 flistfr]
49
+
50
+ desc 'Flist spec rubocop'
23
51
  task default: %i[spec rubocop]
24
52
 
25
53
  # task :default => :spec
data/bin/setup CHANGED
@@ -2,6 +2,8 @@
2
2
  set -euo pipefail
3
3
  IFS=$'\n\t'
4
4
 
5
+ bundle config path --local vendor/bundle
5
6
  bundle install
7
+ bundle exec ruby exe/flist --cmd="s"
6
8
 
7
9
  # Do any other automated setup that you need to do here
data/config/config.yml ADDED
@@ -0,0 +1,14 @@
1
+ ---
2
+ - # home: '/home/ykominami'
3
+ home: '/mnt/z/BACKUP/ykomi-202008'
4
+ c: '/mnt/c'
5
+ e: '/mnt/e'
6
+ v: '/mnt/e/V'
7
+ x: '/mnt/e/X'
8
+ z: '/mnt/z'
9
+ - home: '/home/ykominami'
10
+ c: 'C:'
11
+ e: 'E:'
12
+ v: 'E:\V'
13
+ x: 'E:\X'
14
+ z: 'Z:'
@@ -0,0 +1,15 @@
1
+ ---
2
+ -
3
+ home: '/home/ykominami'
4
+ c: '/mnt/c'
5
+ e: '/mnt/e'
6
+ v: '/mnt/e/V'
7
+ x: '/mnt/e/X'
8
+ z: '/mnt/z'
9
+ -
10
+ home: '/home/ykominami'
11
+ c: 'C:'
12
+ e: 'E:'
13
+ v: 'E:\V'
14
+ x: 'E:\X'
15
+ z: 'Z:'
@@ -0,0 +1,15 @@
1
+ ---
2
+ -
3
+ home: '/home/ykominami'
4
+ c: '/mnt/c'
5
+ e: '/mnt/e'
6
+ v: '/mnt/e/V'
7
+ x: '/mnt/e/X'
8
+ z: '/mnt/z'
9
+ -
10
+ home: '/home/ykominami'
11
+ c: 'C:'
12
+ e: 'E:'
13
+ v: 'E:\V'
14
+ x: 'E:\X'
15
+ z: 'Z:'
data/config/dbsetup.rb CHANGED
@@ -1,7 +1,6 @@
1
- # frozen_string_literal: true
2
-
3
1
  require_relative '../lib/dbacrecord'
4
2
 
3
+ # テスト用クラス
5
4
  class Dbsetup
6
5
  def initialize(connect_time)
7
6
  @connect_time = connect_time
@@ -9,47 +8,49 @@ class Dbsetup
9
8
  @hs_by_notebook = {}
10
9
  @hs_by_id = {}
11
10
  end
12
- # # 指定stack(文字列)にノートブック(文字列)、ノートブック数、タグ数を追加
13
- # def add( stack , notebook, count, tag_count )
14
- # ennblist = @hs_by_notebook[notebook]
15
- # unless ennblist
16
- # cur_ennblist = Currentennblist.where( notebook: notebook ).limit(1)
17
- # if cur_ennblist.size == 0
18
- # begin
19
- # ennblist = Ennblist.create( stack: stack, notebook: notebook ,
20
- # count: count, tag_count: tag_count ,
21
- # start_datetime: @register_time )
22
- # evnb = Evnb.create( time_id: @ct.id , ennb_id: ennblist.id )
23
- # rescue => ex
24
- # p ex.class
25
- # p ex.message
26
- # pp ex.backtrace
27
- #
28
- # ennblist = nil
29
- # evnb = nil
30
- # end
31
- # else
32
- # current_ennblist = cur_ennblist.first.ennblist
33
- # hs = {:stack => stack, :count => count , :tag_count => tag_count }
34
- # value_hs = hs.reduce({}){ |hsx,item|
35
- # if current_ennblist[ item[0] ] != item[1]
36
- # hsx[ item[0] ] = item[1]
37
- # end
38
- # hsx
39
- # }
40
- # if value_hs.size > 0
41
- # if value_hs.all? { |item| item[1] != nil }
42
- # current_ennblist.update(value_hs)
43
- # end
44
- # end
45
- # end
46
- # else
47
- # # ignore this case.
48
- # end
49
- # if ennblist
50
- # @hs_by_notebook[notebook] = ennblist
51
- # @hs_by_id[ennblist.id] = ennblist
52
- # end
53
- # ennblist
54
- # end
11
+ =begin
12
+ # 指定stack(文字列)にノートブック(文字列)、ノートブック数、タグ数を追加
13
+ def add( stack , notebook, count, tag_count )
14
+ ennblist = @hs_by_notebook[notebook]
15
+ unless ennblist
16
+ cur_ennblist = Currentennblist.where( notebook: notebook ).limit(1)
17
+ if cur_ennblist.size == 0
18
+ begin
19
+ ennblist = Ennblist.create( stack: stack, notebook: notebook ,
20
+ count: count, tag_count: tag_count ,
21
+ start_datetime: @register_time )
22
+ evnb = Evnb.create( time_id: @ct.id , ennb_id: ennblist.id )
23
+ rescue => ex
24
+ p ex.class
25
+ p ex.message
26
+ pp ex.backtrace
27
+
28
+ ennblist = nil
29
+ evnb = nil
30
+ end
31
+ else
32
+ current_ennblist = cur_ennblist.first.ennblist
33
+ hs = {:stack => stack, :count => count , :tag_count => tag_count }
34
+ value_hs = hs.reduce({}){ |hsx,item|
35
+ if current_ennblist[ item[0] ] != item[1]
36
+ hsx[ item[0] ] = item[1]
37
+ end
38
+ hsx
39
+ }
40
+ if value_hs.size > 0
41
+ if value_hs.all? { |item| item[1] != nil }
42
+ current_ennblist.update(value_hs)
43
+ end
44
+ end
45
+ end
46
+ else
47
+ # ignore this case.
48
+ end
49
+ if ennblist
50
+ @hs_by_notebook[notebook] = ennblist
51
+ @hs_by_id[ennblist.id] = ennblist
52
+ end
53
+ ennblist
54
+ end
55
+ =end
55
56
  end
@@ -1,9 +1,7 @@
1
- # frozen_string_literal: true
2
-
3
1
  class CreateCountdatetime < ActiveRecord::Migration[6.0]
4
2
  def self.up
5
3
  create_table :countdatetimes do |t|
6
- t.column :countdatetime, :datetime, null: false
4
+ t.column :countdatetime, :datetime, :null => false
7
5
  end
8
6
  end
9
7
 
@@ -1,20 +1,18 @@
1
- # frozen_string_literal: true
2
-
3
1
  class CreateFlistz < ActiveRecord::Migration[6.0]
4
2
  def self.up
5
3
  create_table :Flistzs do |t|
6
- t.column :dir_id, :integer, null: false
7
- t.column :level, :integer, null: false
8
- t.column :kind, :string, null: false
9
- t.column :repo, :string, null: false
10
- t.column :path, :string, null: false
11
- t.column :project, :string, null: false
12
- t.column :desc, :string, null: true
13
- t.column :comment, :string, null: true
14
- t.column :atime, :datetime, null: false
15
- t.column :ctime, :datetime, null: false
16
- t.column :mtime, :datetime, null: false
17
- t.column :start_datetime, :datetime, null: false
4
+ t.column :dir_id, :integer, :null => false
5
+ t.column :level, :integer, :null => false
6
+ t.column :kind, :string, :null => false
7
+ t.column :repo, :string, :null => false
8
+ t.column :path, :string, :null => false
9
+ t.column :project, :string, :null => false
10
+ t.column :desc, :string, :null => true
11
+ t.column :comment, :string, :null => true
12
+ t.column :atime, :datetime, :null => false
13
+ t.column :ctime, :datetime, :null => false
14
+ t.column :mtime, :datetime, :null => false
15
+ t.column :start_datetime, :datetime, :null => false
18
16
  end
19
17
  end
20
18
 
@@ -1,10 +1,9 @@
1
- # frozen_string_literal: true
2
-
3
1
  class CreateInvalidflistz < ActiveRecord::Migration[6.0]
4
2
  def self.up
5
3
  create_table :invalidFlistzs do |t|
6
- t.column :org_id, :int, null: false
7
- t.column :count_id, :int, null: true
4
+ t.column :org_id, :int, :null => false
5
+ t.column :count_id, :int, :null => true
6
+ t.column :end_datetime, :datetime, :null => false
8
7
  end
9
8
  end
10
9
 
@@ -1,11 +1,9 @@
1
- # frozen_string_literal: true
2
-
3
1
  class CreateCurrentflistz < ActiveRecord::Migration[6.0]
4
2
  def self.up
5
- execute <<~SQL
6
- CREATE VIEW currentFlistzs AS SELECT id as org_id,
7
- dir_id , level , kind , repo , path , project , desc , comment , atime , ctime , mtime , start_datetime
8
- FROM Flistzs where not exists (select * from invalidFlistzs where invalidFlistzs.org_id = Flistzs.id )
3
+ execute <<-SQL
4
+ CREATE VIEW currentFlistzs AS SELECT id as org_id,
5
+ dir_id , level , kind , repo , path , project , desc , comment , atime , ctime , mtime , start_datetime
6
+ FROM Flistzs where not exists (select * from invalidFlistzs where invalidFlistzs.org_id = Flistzs.id )
9
7
  SQL
10
8
  end
11
9
 
@@ -1,10 +1,8 @@
1
- # frozen_string_literal: true
2
-
3
1
  class CreateDirz < ActiveRecord::Migration[6.0]
4
2
  def self.up
5
3
  create_table :Dirzs do |t|
6
- t.column :path, :string, null: false
7
- t.column :start_datetime, :datetime, null: false
4
+ t.column :path, :string, :null => false
5
+ t.column :start_datetime, :datetime, :null => false
8
6
  end
9
7
  end
10
8
 
@@ -1,10 +1,9 @@
1
- # frozen_string_literal: true
2
-
3
1
  class CreateInvaliddirz < ActiveRecord::Migration[6.0]
4
2
  def self.up
5
3
  create_table :invalidDirzs do |t|
6
- t.column :org_id, :int, null: false
7
- t.column :count_id, :int, null: true
4
+ t.column :org_id, :int, :null => false
5
+ t.column :count_id, :int, :null => true
6
+ t.column :end_datetime, :datetime, :null => false
8
7
  end
9
8
  end
10
9
 
@@ -1,11 +1,9 @@
1
- # frozen_string_literal: true
2
-
3
1
  class CreateCurrentdirz < ActiveRecord::Migration[6.0]
4
2
  def self.up
5
- execute <<~SQL
6
- CREATE VIEW currentDirzs AS SELECT id as org_id,
7
- path , start_datetime
8
- FROM Dirzs where not exists (select * from invalidDirzs where invalidDirzs.org_id = Dirzs.id )
3
+ execute <<-SQL
4
+ CREATE VIEW currentDirzs AS SELECT id as org_id,
5
+ path , start_datetime
6
+ FROM Dirzs where not exists (select * from invalidDirzs where invalidDirzs.org_id = Dirzs.id )
9
7
  SQL
10
8
  end
11
9
 
data/exe/flist CHANGED
@@ -4,34 +4,78 @@
4
4
  require 'flist'
5
5
  require 'simpleoptparse'
6
6
 
7
- cli = Flist::Cli.new
8
- hash, opts = cli.setup
7
+ banner = 'Usage: bundle exec ruby exe/flist --cmd=[s|fs1|fs2|fs3|fr] --config config-yaml --env env-yaml --verbose'
9
8
 
10
- banner = 'Usage: bundle exec ruby exe/flist --cmd=(x)]'
11
-
12
- Simpleoptparse::Simpleoptparse.parse(ARGV, opts, banner, Flist::VERSION, nil) do |parser|
13
- parser.on('--cmd X', %w[x]) { |x| opts['cmd'] = x }
9
+ opts = {}
10
+ opts['verbose'] = false
11
+ begin
12
+ Simpleoptparse::Simpleoptparse.parse(ARGV, opts, banner, Flist::VERSION, nil) do |parser|
13
+ parser.on('--cmd=X', %w[s fs1 fs2 fs3 fr]) { |x| opts['cmd'] = x }
14
+ parser.on('--config=config-yaml') { |x| opts['config'] = x }
15
+ parser.on('--env=env-yaml') { |x| opts['env'] = x }
16
+ parser.on('--verbose') { |_x| opts['verbose'] = true }
17
+ end
18
+ rescue OptionParser::InvalidArgument => e
19
+ puts e.message
20
+ puts banner
21
+ exit Flist::EXIT_CODE_INVALID_CODE
14
22
  end
23
+ cli = Flist::Cli.new(opts['verbose'])
24
+ hash = cli.setup
25
+
26
+ # puts "hash=#{hash}"
27
+
28
+ # opts['env'] = "env-a1.yaml"
29
+ # opts["config"] = "config/config.yml"
30
+ cmd = opts['cmd']
31
+ # p cmd
32
+ # p opts
33
+ case cmd
34
+ when 's'
35
+ cli.setup_config
36
+ when 'fs1'
37
+ fi = Flist::Flist.new(
38
+ hash,
39
+ opts
40
+ )
41
+ # fl.list_a
42
+ puts '= simple'
43
+ # listup_x('simple')
44
+ fi.listup_simple
45
+
46
+ fi.post_process
47
+ when 'fs2'
48
+ fi = Flist::Flist.new(
49
+ hash,
50
+ opts
51
+ )
15
52
 
16
- fi = Flist::Flist.new(
17
- :DB,
18
- hash,
19
- opts
20
- )
21
- # fl.list_a
22
- puts '= simple'
23
- # listup_x('simple')
24
- fi.listup_simple
25
-
26
- puts '= simple2'
27
- # listup_x('simple2')
28
- fi.listup_simple2
29
-
30
- puts '= simple3'
31
- # listup_x('simple3')
32
- fi.listup_simple3
33
- puts '= repo'
34
- # listup_x('repo')
35
- fi.listup_repo
36
-
37
- fi.finish
53
+ puts '= simple2'
54
+ # listup_x('simple2')
55
+ fi.listup_simple2
56
+
57
+ fi.post_process
58
+ when 'fs3'
59
+ fi = Flist::Flist.new(
60
+ hash,
61
+ opts
62
+ )
63
+ puts '= simple3'
64
+ # listup_x('simple3')
65
+ fi.listup_simple3
66
+
67
+ fi.post_process
68
+ when 'fr'
69
+ fi = Flist::Flist.new(
70
+ hash,
71
+ opts
72
+ )
73
+ puts '= repo'
74
+ # listup_x('repo')
75
+ fi.listup_repo
76
+
77
+ fi.post_process
78
+ else
79
+ puts 'Invalid command 2'
80
+ puts banner
81
+ end