gitee_pack 1.4.0 → 1.5.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8dc9ed0c8ed8560299b51e8792849c5477af73ce272bb8fdf5e27d74d43d255b
4
- data.tar.gz: 1b5032fc834a56aa302171135abc5ab12c72e92a066b31f702c3867b6b18b9d0
3
+ metadata.gz: c9adbed7bd55f10620212932db594690e1bd2b7c4629abaa53dcd24a0f180c9a
4
+ data.tar.gz: 6de7ad9b25d042db6dde002a8ec8030cae8632ab5c82d765c9e5ec7a8cb54d21
5
5
  SHA512:
6
- metadata.gz: e013edb21e086b032ff9749882480deea8ae1b208ee942e5ba5afeb40e4f9ab7097edb25371972b2b684ba3162fb6a9e3d67ab101ac6d6371a191441275d07b5
7
- data.tar.gz: dccd5c9885eefa3200459f772721d4c63174d5107b3a16e07ba937b5a832db85673e402f39ee5153e0c57fa92c1b5a4956c745a188e316bec404c55f7a85218e
6
+ metadata.gz: 995bd5a5b776510047cc125aedda46c17778b28fcd1832e838ea227eb6d2c1e4995df8d2d078f8dd7c336c6d2deb09737918deac87d1238ca80e0f7429bb8705
7
+ data.tar.gz: ffb05ca566555eca10fc14321dcadc64d4091541d3875cc899b44bb78cdba85a8454cb9df86fa057c456595286fee45c6984022b3acc668e404ea994fc43971b
data/.gitignore CHANGED
@@ -6,3 +6,4 @@
6
6
  /pkg/
7
7
  /spec/reports/
8
8
  /tmp/
9
+ Gemfile.lock
data/README.md CHANGED
@@ -1,6 +1,7 @@
1
1
  # GiteePack
2
2
 
3
- 一个GiteePremium增量打包工具
3
+ 一个 GiteePremium 增量打包工具
4
+
4
5
 
5
6
  ## 安装
6
7
 
@@ -8,19 +9,20 @@
8
9
  $ gem install gitee_pack
9
10
  ```
10
11
 
12
+
11
13
  ## 使用
12
14
 
13
15
  ### 打包
14
16
 
15
- 在gitee-premium目录执行:
17
+ gitee-premium 目录执行:
16
18
 
17
19
  ```shell
18
- $ gitee_pack [base] [head]
20
+ $ gitee_pack BASE HEAD
19
21
  ```
20
22
 
21
- base: Commit提交的SHA值作为对比起点
23
+ BASE: Commit提交的SHA值作为对比起点
22
24
 
23
- head: Commit提交的SHA值作为对比终点
25
+ HEAD: Commit提交的SHA值作为对比终点
24
26
 
25
27
  示例:
26
28
 
@@ -30,25 +32,99 @@ $ gitee_pack a9b6296 6ac0f97
30
32
 
31
33
  执行后会在当前目录下生成一个增量文件的升级包,例如 upgrade-20200430
32
34
 
33
- ### 部署
35
+ 升级包目录结构说明:
34
36
 
35
- 先备份原有文件
37
+ ```
38
+ upgrade-20200430
39
+ ├── commit.txt // 记录 base、head 的 CommitID
40
+ ├── diff.txt // 记录 base 和 head 之间的所有改动文件名称
41
+ ├── delete.txt // 记录 base 和 head 之间被删除的文件名称
42
+ ├── run.log // 打包时的运行日志
43
+ ├── files // 用于存放代码文件的目录
44
+ └── update.sh // 部署脚本,更新代码时使用
45
+ ```
46
+
47
+ ### 更多选项
48
+
49
+ ```
50
+ $ gitee_pack --help
51
+ Usage: gitee_pack BASE HEAD [options]
52
+
53
+ Specific options:
54
+ --skip-compile-asset Skip compile asset.
55
+ --skip-compile-webpack Skip compile webpack.
56
+ --skip-package-gem Skip package gem.
57
+ -h, --help Show this message.
58
+ -v, --version Show version info.
59
+ ```
60
+
61
+ `--skip-compile-asset` 当有 asset 文件改动时,跳过 asset 资源文件编译
62
+
63
+ `--skip-compile-webpack` 当有 vue 文件改动时,跳过 npm 资源文件编译
64
+
65
+ `--skip-package-gem` 当有 gem 改动时,跳过 gem 打包
66
+
67
+ ### 错误值
68
+
69
+ 执行 gitee_pack 命令,错误值解释如下
70
+
71
+ - `100` vue 资源文件编译失败
72
+ - `101` asset 资源文件编译失败
73
+ - `102` gem 打包失败
74
+ - `200` 升级包不完整
75
+
76
+ ### 部署
36
77
 
37
- 在升级包中执行update.sh脚本,一键自动部署
78
+ 在升级包中执行 update.sh 脚本,一键自动部署
38
79
 
39
80
  ```shell
40
81
  $ cd upgrade-20200430
41
- $ ./update.sh [gitee-path]
82
+ $ ./update.sh GITEE_PATH
42
83
  ```
43
84
 
44
- gitee-path: gitee-premium的绝对路径
85
+ GITEE_PATH: gitee-premium 的绝对路径
45
86
 
46
87
  示例
47
88
 
48
89
  ```shell
49
- $ ./update.sh /home/gite/gitee-premium/gitee
90
+ $ ./update.sh /home/git/gitee-premium/gitee
50
91
  ```
51
92
 
93
+
94
+ ## 版本变更
95
+
96
+ ### v1.5.0
97
+
98
+ - feat: 支持打包完成后,检测包的完整性
99
+ - feat: 支持跳过编译流程打包
100
+ - feat: 支持新增、修改、删除 Gem 时自动打包
101
+ - feat: 支持记录打包日志到升级包中
102
+ - fix: 修复打包过程中失败,以非 0 值推出程序
103
+
104
+ ### v1.4.0
105
+
106
+ - feat: 支持部署备份代码时过滤 tmp 目录(感谢@彭超越大佬)
107
+
108
+ ### v1.3.0
109
+
110
+ - feat: 支持检测 asset 文件改动并自动编译及打包
111
+
112
+ ### v1.2.0
113
+
114
+ - feat: 支持部署时代码备份功能
115
+ - feat: 打包时记录 Commit 信息
116
+ - fix: 修复部署脚本 Bug
117
+
118
+ ### v1.1.0
119
+
120
+ - feat: 支持通过脚本自动化部署改动文件
121
+
122
+ ### v1.0.0
123
+
124
+ - feat: 支持代码文件打包
125
+ - feat: 支持检测 webpack 文件改动并自动编译及打包
126
+
127
+
52
128
  ## 常见问题
53
129
 
54
130
  1. 执行 `git status`、`git diff` 等命令,中文名文件显示为乱码,导致中文名文件无法打包成功。
@@ -56,14 +132,3 @@ $ ./update.sh /home/gite/gitee-premium/gitee
56
132
  ```shell
57
133
  $ git config --global core.quotepath false
58
134
  ```
59
-
60
- ## TODO
61
-
62
- - 支持gem打包
63
- - 源码中记录版本信息功能
64
- - ~~支持代码文件打包~~
65
- - ~~支持webpacks打包~~
66
- - ~~支持部署备份功能~~
67
- - ~~支持assets打包~~
68
- - ~~支持中文文件名打包~~
69
- - ~~支持备份代码过滤tmp目录~~
@@ -2,19 +2,10 @@
2
2
 
3
3
  require 'gitee_pack'
4
4
 
5
- HELP_CMD = ['-v', '-h', '--help'].freeze
6
-
7
- if HELP_CMD.include?(ARGV[0])
8
- GiteePack.logger.debug "Usage: #{File.basename($0)} [base] [head]"
9
- GiteePack.logger.debug "Version: #{GiteePack::VERSION}"
10
- exit 0
11
- end
12
-
13
-
14
5
  base, head = ARGV[0], ARGV[1]
15
6
 
16
7
  start_at = Time.now
17
- GiteePack.execute(base, head)
8
+ GiteePack.execute(base, head, { ARGV: ARGV })
18
9
  end_at = Time.now
19
10
 
20
11
  GiteePack.logger.success "Complete! cost time: #{end_at - start_at} seconds."
@@ -14,15 +14,6 @@ if [ $FINAL = '/' ]; then
14
14
  GITEE_PATH=${GITEE_PATH%?}
15
15
  fi
16
16
 
17
- # Check path
18
- APP_PATH=$GITEE_PATH/app
19
- CONFIG_APTH=$GITEE_PATH/config
20
- DB_APTH=$GITEE_PATH/db
21
- if [ ! -d $APP_PATH ] || [ ! -d $CONFIG_PATH ] || [ ! -d $DB_PATH ]; then
22
- printf "\033[31mERROR: $GITEE_PATH is not the gitee-path.\033[0m\n"
23
- exit 1
24
- fi
25
-
26
17
  # Backup
27
18
  BACKUP_DIR="$(dirname $GITEE_PATH)/backup/`date "+%Y%m%d%H%M%S"`/$(basename $GITEE_PATH)"
28
19
  echo mkdir -p $BACKUP_DIR
@@ -51,6 +42,13 @@ if [ -d files/public/assets ] && [ -d $ASSET_PATH ]; then
51
42
  echo rm -rf $ASSET_PATH
52
43
  fi
53
44
 
45
+ # Delete bundle cache dir
46
+ BUNDLE_CACHE_PATH=$GITEE_PATH/vendor/cache
47
+ if [ -d files/vendor/cache ] && [ -d $BUNDLE_CACHE_PATH ]; then
48
+ rm -rf $BUNDLE_CACHE_PATH
49
+ echo rm -rf $BUNDLE_CACHE_PATH
50
+ fi
51
+
54
52
  # Delete files with delete.txt
55
53
  DELETE_FILE=delete.txt
56
54
  if [ -f $DELETE_FILE ]; then
@@ -6,13 +6,16 @@ require 'gitee_pack/folder'
6
6
  require 'gitee_pack/filer'
7
7
  require 'gitee_pack/precompile'
8
8
  require 'gitee_pack/logger'
9
+ require 'gitee_pack/verifier'
10
+ require 'gitee_pack/status'
11
+ require 'gitee_pack/parser'
9
12
  require 'gitee_pack/worker'
10
13
 
11
14
  module GiteePack
12
15
  class CmdError < StandardError; end
13
16
 
14
17
  def self.execute(base, head, options = {})
15
- Worker.new(base, head).execute
18
+ Worker.new(base, head, options).execute
16
19
  end
17
20
 
18
21
  def self.logger
@@ -1,10 +1,10 @@
1
1
  module GiteePack
2
2
  class Diff
3
- attr_reader :empty_folders, :delete_files, :cp_files, :webpack_files, :asset_files
3
+ attr_reader :empty_folders, :delete_files, :cp_files,
4
+ :webpack_files, :asset_files, :gem_files
4
5
 
5
6
  IGNORE_FILES = [
6
7
  'config/gitee.yml',
7
- 'config/gitee.yml.example',
8
8
  'config/database.yml',
9
9
  'config/startup.yml',
10
10
  'app/assets/javascripts/webpack/webide'
@@ -18,6 +18,7 @@ module GiteePack
18
18
  @cp_files = []
19
19
  @webpack_files = []
20
20
  @asset_files = []
21
+ @gem_files = []
21
22
 
22
23
  init_list_by_files
23
24
  end
@@ -44,6 +45,10 @@ module GiteePack
44
45
  !asset_files.empty?
45
46
  end
46
47
 
48
+ def has_gem_file?
49
+ !gem_files.empty?
50
+ end
51
+
47
52
  private
48
53
 
49
54
  def init_list_by_files
@@ -65,6 +70,8 @@ module GiteePack
65
70
  @webpack_files << file
66
71
  elsif file.start_with?('app/assets')
67
72
  @asset_files << file
73
+ elsif file.start_with?('Gemfile')
74
+ @gem_files << file
68
75
  end
69
76
 
70
77
  if Dir.exist?(file)
@@ -3,31 +3,40 @@ module GiteePack
3
3
  class << self
4
4
  def cp_diff_files(files)
5
5
  files.each do |file|
6
- dirname = File.join(Folder.upgrade_files_dir, File.dirname(file))
7
- FileUtils.mkdir_p dirname
8
- FileUtils.cp file, dirname
9
- GiteePack.logger.debug "cp #{file} #{dirname}"
6
+ from = file
7
+ to = File.join(Folder.upgrade_files_dir, File.dirname(file))
8
+ cp_file from, to
10
9
  end
11
10
  end
12
11
 
13
12
  def cp_webpack_files
14
- dirname = File.join(Folder.upgrade_files_dir, 'public/webpacks')
15
- FileUtils.mkdir_p dirname
16
- FileUtils.cp_r 'public/webpacks/.', dirname
17
- GiteePack.logger.debug "cp -r public/webpacks/. #{dirname}"
13
+ from = File.join(Folder.webpacks_dir, '.')
14
+ to = File.join(Folder.upgrade_files_dir, Folder.webpacks_dir)
15
+ cp_file from, to
18
16
  end
19
17
 
20
18
  def cp_asset_files
21
- dirname = File.join(Folder.upgrade_files_dir, 'public/assets')
22
- FileUtils.mkdir_p dirname
23
- FileUtils.cp_r 'public/assets/.', dirname
24
- GiteePack.logger.debug "cp -r public/assets/. #{dirname}"
19
+ from = File.join(Folder.assets_dir, '.')
20
+ to = File.join(Folder.upgrade_files_dir, Folder.assets_dir)
21
+ cp_file from, to
22
+ end
23
+
24
+ def cp_gems
25
+ from = File.join(Folder.bundle_cache_dir, '.')
26
+ to = File.join(Folder.upgrade_files_dir, Folder.bundle_cache_dir)
27
+ cp_file from, to
25
28
  end
26
29
 
27
30
  def cp_update_file
28
- filepath = File.join(File.expand_path('../../../', __FILE__), 'exe/update.sh')
29
- FileUtils.cp filepath, Folder.upgrade_dir
30
- GiteePack.logger.debug "cp #{filepath} #{Folder.upgrade_dir}"
31
+ from = File.join(File.expand_path('../../../', __FILE__), 'exe/update.sh')
32
+ to = Folder.upgrade_dir
33
+ cp_file from, to
34
+ end
35
+
36
+ def cp_file(from, to)
37
+ FileUtils.mkdir_p to
38
+ GiteePack.logger.debug "cp -r #{from} #{to}"
39
+ FileUtils.cp_r from, to
31
40
  end
32
41
 
33
42
  def g_file(path, content = [])
@@ -47,6 +56,10 @@ module GiteePack
47
56
  def g_commit_file(content = [])
48
57
  g_file(File.join(Folder.upgrade_dir, 'commit.txt'), content)
49
58
  end
59
+
60
+ def g_log_file(content= [])
61
+ g_file(File.join(Folder.upgrade_dir, 'run.log'), content)
62
+ end
50
63
  end
51
64
  end
52
65
  end
@@ -24,6 +24,18 @@ module GiteePack
24
24
  GiteePack.logger.debug "rm -rf #{dir}"
25
25
  end
26
26
  end
27
+
28
+ def webpacks_dir
29
+ 'public/webpacks/'
30
+ end
31
+
32
+ def assets_dir
33
+ 'public/assets/'
34
+ end
35
+
36
+ def bundle_cache_dir
37
+ 'vendor/cache/'
38
+ end
27
39
  end
28
40
  end
29
41
  end
@@ -1,23 +1,40 @@
1
1
  module GiteePack
2
2
  class Logger
3
+ attr_accessor :history
4
+
5
+ def initialize
6
+ @history = []
7
+ end
8
+
3
9
  def debug(content)
4
- puts content
10
+ logging content
5
11
  end
6
12
 
7
13
  def info(content)
8
- puts "\033[36m#{content}\033[0m"
14
+ logging "\033[36m#{content}\033[0m"
9
15
  end
10
16
 
11
17
  def warn(content)
12
- puts "\033[33m#{content}\033[0m"
18
+ logging "\033[33m#{content}\033[0m"
13
19
  end
14
20
 
15
21
  def error(content)
16
- puts "\033[31m#{content}\033[0m"
22
+ logging "\033[31m#{content}\033[0m"
17
23
  end
18
24
 
19
25
  def success(content)
20
- puts "\033[32m#{content}\033[0m"
26
+ logging "\033[32m#{content}\033[0m"
27
+ end
28
+
29
+ private
30
+
31
+ def logging(content)
32
+ set_history content
33
+ puts content
34
+ end
35
+
36
+ def set_history(content)
37
+ @history << content
21
38
  end
22
39
  end
23
40
  end
@@ -0,0 +1,49 @@
1
+ require 'optparse'
2
+
3
+ module GiteePack
4
+ class Parser
5
+ def execute(args)
6
+ options = default_options
7
+ OptionParser.new do |opts|
8
+ opts.banner = 'Usage: gitee_pack BASE HEAD [options]'
9
+
10
+ opts.separator ''
11
+ opts.separator 'Specific options:'
12
+
13
+ opts.on('--skip-compile-asset', 'Skip compile asset.') do
14
+ options[:skip_asset_compile] = true
15
+ end
16
+
17
+ opts.on('--skip-compile-webpack', 'Skip compile webpack.') do
18
+ options[:skip_webpack_compile] = true
19
+ end
20
+
21
+ opts.on('--skip-package-gem', 'Skip package gem.') do
22
+ options[:skip_gem_compile] = true
23
+ end
24
+
25
+ opts.on_tail('-h', '--help', 'Show this message.') do
26
+ GiteePack.logger.debug opts
27
+ exit
28
+ end
29
+
30
+ opts.on_tail('-v', '--version', 'Show version info.') do
31
+ GiteePack.logger.debug "Version: #{GiteePack::VERSION}"
32
+ exit
33
+ end
34
+ end.parse!(args)
35
+
36
+ options
37
+ end
38
+
39
+ private
40
+
41
+ def default_options
42
+ {
43
+ skip_asset_compile: false,
44
+ skip_webpack_compile: false,
45
+ skip_gem_compile: false
46
+ }
47
+ end
48
+ end
49
+ end
@@ -2,15 +2,27 @@ module GiteePack
2
2
  class Precompile
3
3
  class << self
4
4
  def with_webpack
5
- Folder.rm_dir('public/webpacks')
6
- GiteePack.logger.info 'webpack files is compiling, please wait ...'
7
- `npm run build-vendor && npm run f-build`
5
+ GiteePack.logger.info '[Compiling] webpack files is compiling, please wait ...'
6
+ Folder.rm_dir(Folder.webpacks_dir)
7
+ cmd = 'npm run build-vendor && npm run f-build'
8
+ GiteePack.logger.debug cmd
9
+ `#{cmd}`
8
10
  end
9
11
 
10
12
  def with_asset
11
- Folder.rm_dir('public/assets')
12
- GiteePack.logger.info 'asset files is compiling, please wait ...'
13
- `bundle exec rake assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets`
13
+ GiteePack.logger.info '[Compiling] asset files is compiling, please wait ...'
14
+ Folder.rm_dir(Folder.assets_dir)
15
+ cmd = 'RAILS_ENV=production bundle exec rake assets:precompile'
16
+ GiteePack.logger.debug cmd
17
+ `#{cmd}`
18
+ end
19
+
20
+ def with_gem
21
+ GiteePack.logger.info '[Compiling] gems is compiling, please wait ...'
22
+ Folder.rm_dir(Folder.bundle_cache_dir)
23
+ cmd = 'bundle package --all'
24
+ GiteePack.logger.debug cmd
25
+ `#{cmd}`
14
26
  end
15
27
  end
16
28
  end
@@ -0,0 +1,14 @@
1
+ module GiteePack
2
+ class Status
3
+ ERR_COMPILE_WEBPACK = 100
4
+ ERR_COMPILE_ASSET = 101
5
+ ERR_COMPILE_GEM = 102
6
+ ERR_VERIFY_PACKAGE = 200
7
+
8
+ class << self
9
+ def success?(status_code)
10
+ (!status_code.nil?) && (status_code.to_i.eql? 0)
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,21 @@
1
+ module GiteePack
2
+ class Verifier
3
+ def execute(from, to)
4
+ result = system "diff -r #{from} #{to} > /dev/null 2>&1"
5
+ message = get_message(result, from)
6
+ [result, message]
7
+ end
8
+
9
+ private
10
+
11
+ def get_message(result, file_path)
12
+ msg = if result
13
+ "\033[32m[OK]\033[0m"
14
+ else
15
+ "\033[31m[FAILED]\033[0m"
16
+ end
17
+
18
+ "#{file_path}\t#{msg}"
19
+ end
20
+ end
21
+ end
@@ -1,3 +1,3 @@
1
1
  module GiteePack
2
- VERSION = "1.4.0"
2
+ VERSION = "1.5.0"
3
3
  end
@@ -1,37 +1,141 @@
1
1
  module GiteePack
2
2
  class Worker
3
- def initialize(base, head)
4
- @base = base
5
- @head = head
6
- @diff = Diff.new(@base, @head)
3
+ def initialize(base, head, options = {})
4
+ @options = Parser.new.execute(options[:ARGV])
5
+ @base = base
6
+ @head = head
7
+ @diff = Diff.new(@base, @head)
8
+ @errors = []
7
9
  end
8
10
 
9
11
  def execute
10
12
  Folder.mkdir_upgrade
11
13
  Filer.cp_diff_files(@diff.cp_files)
12
14
 
13
- if @diff.has_webpack_file?
15
+ compile_webpack_files_and_cp
16
+ compile_asset_files_and_cp
17
+ compile_gems_and_cp
18
+
19
+ Filer.g_diff_file(@diff.diff_files_with_status)
20
+ Filer.g_delete_file(@diff.delete_files)
21
+ Filer.g_commit_file(["old: #{@base}", "new: #{@head}"])
22
+ Filer.cp_update_file
23
+
24
+ puts_empty_folders
25
+ puts_deleted_files
26
+
27
+ verify_upgrade_package
28
+
29
+ Filer.g_log_file GiteePack.logger.history
30
+ end
31
+
32
+ private
33
+
34
+ def compile_webpack_files_and_cp
35
+ if process_webpack?
14
36
  Precompile.with_webpack
37
+ unless Status.success?($?)
38
+ Filer.g_log_file GiteePack.logger.history
39
+ exit Status::ERR_COMPILE_WEBPACK
40
+ end
41
+
15
42
  Filer.cp_webpack_files
16
43
  end
44
+ end
17
45
 
18
- if @diff.has_asset_file?
46
+ def compile_asset_files_and_cp
47
+ if process_asset?
19
48
  Precompile.with_asset
49
+ unless Status.success?($?)
50
+ Filer.g_log_file GiteePack.logger.history
51
+ exit Status::ERR_COMPILE_ASSET
52
+ end
53
+
20
54
  Filer.cp_asset_files
21
55
  end
56
+ end
22
57
 
23
- Filer.g_diff_file(@diff.diff_files_with_status)
24
- Filer.g_delete_file(@diff.delete_files)
25
- Filer.g_commit_file(["old: #{@base}", "new: #{@head}"])
26
- Filer.cp_update_file
58
+ def compile_gems_and_cp
59
+ if process_gem?
60
+ Precompile.with_gem
61
+ unless Status.success?($?)
62
+ Filer.g_log_file GiteePack.logger.history
63
+ exit Status::ERR_COMPILE_GEM
64
+ end
27
65
 
28
- puts_empty_folders
29
- puts_delete_files
66
+ Filer.cp_gems
67
+ end
30
68
  end
31
69
 
32
- private
70
+ def verify_upgrade_package
71
+ GiteePack.logger.info '[Verifying] package is verifying, please wait ...'
72
+
73
+ verify_digest_with_cp_files
74
+ verify_digest_with_webpacks_dir
75
+ verify_digest_with_assets_dir
76
+ verify_digest_with_gems_dir
77
+
78
+ unless @errors.empty?
79
+ Filer.g_log_file GiteePack.logger.history
80
+ exit Status::ERR_VERIFY_PACKAGE
81
+ end
82
+ end
83
+
84
+ def verify_digest_with_cp_files
85
+ @diff.cp_files.each do |file|
86
+ from = File.join(Folder.upgrade_files_dir, file)
87
+ to = file
88
+ verify_files from, to
89
+ end
90
+ end
91
+
92
+ def verify_digest_with_webpacks_dir
93
+ if process_webpack?
94
+ from = File.join(Folder.upgrade_files_dir, Folder.webpacks_dir)
95
+ to = Folder.webpacks_dir
96
+ verify_files from, to
97
+ end
98
+ end
99
+
100
+ def verify_digest_with_assets_dir
101
+ if process_asset?
102
+ from = File.join(Folder.upgrade_files_dir, Folder.assets_dir)
103
+ to = Folder.assets_dir
104
+ verify_files from, to
105
+ end
106
+ end
107
+
108
+ def verify_digest_with_gems_dir
109
+ if process_gem?
110
+ from = File.join(Folder.upgrade_files_dir, Folder.bundle_cache_dir)
111
+ to = Folder.bundle_cache_dir
112
+ verify_files from, to
113
+ end
114
+ end
115
+
116
+ def verify_files(from, to)
117
+ result, message = Verifier.new.execute(from, to)
118
+ GiteePack.logger.debug message
119
+ set_errors(result, message) unless result
120
+ end
121
+
122
+ def process_webpack?
123
+ !@options[:skip_webpack_compile] && @diff.has_webpack_file?
124
+ end
125
+
126
+ def process_asset?
127
+ !@options[:skip_asset_compile] && @diff.has_asset_file?
128
+ end
129
+
130
+ def process_gem?
131
+ !@options[:skip_gem_compile] && @diff.has_gem_file?
132
+ end
133
+
134
+ def set_errors(result, message)
135
+ @errors << { result: result, message: message }
136
+ end
33
137
 
34
- def puts_delete_files
138
+ def puts_deleted_files
35
139
  unless @diff.delete_files.empty?
36
140
  GiteePack.logger.warn "\nDelete Files:"
37
141
  GiteePack.logger.warn "#{@diff.delete_files.join("\n")}"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gitee_pack
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.0
4
+ version: 1.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - jk-sun
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-12-07 00:00:00.000000000 Z
11
+ date: 2021-01-03 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email:
@@ -31,7 +31,10 @@ files:
31
31
  - lib/gitee_pack/filer.rb
32
32
  - lib/gitee_pack/folder.rb
33
33
  - lib/gitee_pack/logger.rb
34
+ - lib/gitee_pack/parser.rb
34
35
  - lib/gitee_pack/precompile.rb
36
+ - lib/gitee_pack/status.rb
37
+ - lib/gitee_pack/verifier.rb
35
38
  - lib/gitee_pack/version.rb
36
39
  - lib/gitee_pack/worker.rb
37
40
  homepage: https://github.com/JK-Sun/gitee_pack