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 +4 -4
- data/.github/workflows/main.yml +31 -0
- data/.rubocop.yml +3 -0
- data/.rubocop_todo.yml +68 -49
- data/Gemfile +1 -0
- data/Rakefile +30 -2
- data/bin/setup +2 -0
- data/config/config.yml +14 -0
- data/config/config_sample.yml +15 -0
- data/config/config_yml.sample +15 -0
- data/config/dbsetup.rb +46 -45
- data/db/migrate/010_create_countdatetime.rb +1 -3
- data/db/migrate/020_create_flistz.rb +12 -14
- data/db/migrate/030_create_invalidflistz.rb +3 -4
- data/db/migrate/040_create_currentflistz.rb +4 -6
- data/db/migrate/050_create_dirz.rb +2 -4
- data/db/migrate/060_create_invaliddirz.rb +3 -4
- data/db/migrate/070_create_currentdirz.rb +4 -6
- data/exe/flist +72 -28
- data/lib/dbacrecord.rb +26 -27
- data/lib/flist/cli.rb +24 -5
- data/lib/flist/config.rb +16 -0
- data/lib/flist/csvx.rb +3 -0
- data/lib/flist/dbutil/dbmgr.rb +8 -0
- data/lib/flist/dbutil/dirzmgr.rb +21 -9
- data/lib/flist/dbutil/flistzmgr.rb +13 -1
- data/lib/flist/flist/filelist.rb +47 -45
- data/lib/flist/flist.rb +106 -66
- data/lib/flist/version.rb +1 -1
- data/lib/flist.rb +37 -2
- data/lib/template/config_yml.erb +15 -0
- metadata +8 -7
- data/db/migrate/020_create_dirz.rb +0 -12
- data/db/migrate/030_create_flistz.rb +0 -22
- data/db/migrate/040_create_invalidflistz.rb +0 -12
- data/db/migrate/050_create_currentflistz.rb +0 -15
- data/lib/flist/flist/store.rb +0 -75
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d39ef08e21cea0fdd6d2ad26d2a23e6f8d711507486a92e70152fb02925f5b91
|
4
|
+
data.tar.gz: dca998382f32a359f9b42453927d65f646b3384e72e2f75ab794b5cb7ecfb412
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
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-
|
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
|
-
|
19
|
+
# This cop supports safe autocorrection (--autocorrect).
|
20
|
+
Layout/HeredocIndentation:
|
11
21
|
Exclude:
|
12
|
-
- '
|
13
|
-
- '
|
22
|
+
- 'db/migrate/040_create_currentflistz.rb'
|
23
|
+
- 'db/migrate/070_create_currentdirz.rb'
|
14
24
|
|
15
25
|
# Offense count: 1
|
16
|
-
|
26
|
+
# This cop supports safe autocorrection (--autocorrect).
|
27
|
+
# Configuration parameters: Width, AllowedPatterns, IgnoredPatterns.
|
28
|
+
Layout/IndentationWidth:
|
17
29
|
Exclude:
|
18
|
-
|
30
|
+
- 'lib/dbacrecord.rb'
|
19
31
|
|
20
|
-
# Offense count:
|
21
|
-
Lint/
|
32
|
+
# Offense count: 2
|
33
|
+
Lint/HashCompareByIdentity:
|
22
34
|
Exclude:
|
23
|
-
|
24
|
-
|
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:
|
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:
|
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:
|
59
|
+
# Offense count: 17
|
50
60
|
# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, AllowedMethods, AllowedPatterns, IgnoredMethods.
|
51
61
|
Metrics/MethodLength:
|
52
|
-
Max:
|
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:
|
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
|
-
|
67
|
-
|
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
|
-
|
82
|
-
# - 'lib/flist/flist/filelist.rb'
|
83
|
-
# - 'lib/flist/flist/store.rb'
|
79
|
+
- 'config/dbsetup.rb'
|
84
80
|
|
85
|
-
# Offense count:
|
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
|
-
# - '
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
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
|
-
|
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
|
-
|
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:
|
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
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 :
|
19
|
-
sh
|
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
data/config/config.yml
ADDED
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
|
-
|
13
|
-
#
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
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,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
|
7
|
-
t.column :level, :integer, null
|
8
|
-
t.column :kind, :string, null
|
9
|
-
t.column :repo, :string, null
|
10
|
-
t.column :path, :string, null
|
11
|
-
t.column :project, :string, null
|
12
|
-
t.column :desc, :string, null
|
13
|
-
t.column :comment, :string, null
|
14
|
-
t.column :atime, :datetime, null
|
15
|
-
t.column :ctime, :datetime, null
|
16
|
-
t.column :mtime, :datetime, null
|
17
|
-
t.column :start_datetime, :datetime, null
|
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
|
7
|
-
t.column :count_id, :int, null
|
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
|
6
|
-
|
7
|
-
|
8
|
-
|
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
|
7
|
-
t.column :start_datetime, :datetime, null
|
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
|
7
|
-
t.column :count_id, :int, null
|
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
|
6
|
-
|
7
|
-
|
8
|
-
|
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
|
-
|
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
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
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
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
puts '=
|
27
|
-
# listup_x('
|
28
|
-
fi.
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
fi.
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
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
|