gitee_pack 1.1.0 → 1.2.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/LICENSE.txt +1 -1
- data/README.md +7 -0
- data/bin/gitee_pack +9 -0
- data/{lib/gitee_pack/exe → exe}/update.sh +24 -2
- data/lib/gitee_pack/diff.rb +8 -5
- data/lib/gitee_pack/filer.rb +5 -1
- data/lib/gitee_pack/precompile.rb +1 -2
- data/lib/gitee_pack/version.rb +1 -1
- data/lib/gitee_pack/worker.rb +2 -1
- metadata +3 -5
- data/bin/console +0 -14
- data/bin/setup +0 -8
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b9ce148ff6e484fdb94e4aa8277d04cffb7f0eabb5898231d991c47448217cb4
|
|
4
|
+
data.tar.gz: aef311b7bec117c679374c73293b6b97f89485357013aaea24cabc5c721c2660
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6a282102f070862ae173c4717a8529fbf6aa5a1dfc561e3435f493bd276cdae265dc5daab4c5362143e079b599446743ac7e31e9a16c135ed6e82b2a68dc6b81
|
|
7
|
+
data.tar.gz: 72cf6760cc6549e0bca93e23cf910de8e784a0b0991bbd14c3cb8d7de984afee8e5d0b89ae80ca540000c86f23039c869da39104ba9a6911dc8ae426d0ecad80
|
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
data/bin/gitee_pack
CHANGED
|
@@ -2,6 +2,15 @@
|
|
|
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
|
+
|
|
5
14
|
base, head = ARGV[0], ARGV[1]
|
|
6
15
|
|
|
7
16
|
start_at = Time.now
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
#!/bin/bash
|
|
2
2
|
|
|
3
|
+
# Check parameter
|
|
3
4
|
GITEE_PATH=$1
|
|
4
5
|
if [ ! $GITEE_PATH ]; then
|
|
5
6
|
printf "\033[31mERROR: gitee-path cannot not be empty.\033[0m\n"
|
|
@@ -11,6 +12,7 @@ if [ $FINAL = '/' ]; then
|
|
|
11
12
|
GITEE_PATH=${GITEE_PATH%?}
|
|
12
13
|
fi
|
|
13
14
|
|
|
15
|
+
# Check path
|
|
14
16
|
APP_PATH=$GITEE_PATH/app
|
|
15
17
|
CONFIG_APTH=$GITEE_PATH/config
|
|
16
18
|
DB_APTH=$GITEE_PATH/db
|
|
@@ -19,9 +21,25 @@ if [ ! -d $APP_PATH ] || [ ! -d $CONFIG_PATH ] || [ ! -d $DB_PATH ]; then
|
|
|
19
21
|
exit 1
|
|
20
22
|
fi
|
|
21
23
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
+
# Backup
|
|
25
|
+
BACKUP_DIR="$(dirname $GITEE_PATH)/backup/`date "+%Y%m%d%H%M%S"`"
|
|
26
|
+
echo mkdir -p $BACKUP_DIR
|
|
27
|
+
mkdir -p $BACKUP_DIR
|
|
28
|
+
echo cp -r $GITEE_PATH $BACKUP_DIR
|
|
29
|
+
cp -r $GITEE_PATH $BACKUP_DIR
|
|
30
|
+
if [ $? -ne 0 ]; then
|
|
31
|
+
printf "\033[31mERROR: Gitee backup failed.\033[0m\n"
|
|
32
|
+
exit 1
|
|
33
|
+
fi
|
|
24
34
|
|
|
35
|
+
# Delete webpacks dir
|
|
36
|
+
WEBPACK_PATH=$GITEE_PATH/public/webpacks
|
|
37
|
+
if [ -d files/public/webpacks ] && [ -d $WEBPACK_PATH ]; then
|
|
38
|
+
rm -rf $WEBPACK_PATH
|
|
39
|
+
echo rm -rf $WEBPACK_PATH
|
|
40
|
+
fi
|
|
41
|
+
|
|
42
|
+
# Delete files with delete.txt
|
|
25
43
|
DELETE_FILE=delete.txt
|
|
26
44
|
if [ -f $DELETE_FILE ]; then
|
|
27
45
|
while read LINE
|
|
@@ -31,5 +49,9 @@ if [ -f $DELETE_FILE ]; then
|
|
|
31
49
|
done < $DELETE_FILE
|
|
32
50
|
fi
|
|
33
51
|
|
|
52
|
+
# Update files
|
|
53
|
+
cp -rf files/* $GITEE_PATH
|
|
54
|
+
echo cp -rf files/\* $GITEE_PATH
|
|
55
|
+
|
|
34
56
|
exit 0
|
|
35
57
|
|
data/lib/gitee_pack/diff.rb
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
module GiteePack
|
|
2
2
|
class Diff
|
|
3
|
-
attr_reader :empty_folders, :delete_files, :cp_files
|
|
3
|
+
attr_reader :empty_folders, :delete_files, :cp_files, :webpack_files
|
|
4
4
|
|
|
5
5
|
IGNORE_FILES = [
|
|
6
6
|
'config/gitee.yml',
|
|
7
|
+
'config/gitee.yml.example',
|
|
7
8
|
'config/database.yml',
|
|
8
9
|
'config/startup.yml',
|
|
9
10
|
'app/assets/javascripts/webpack/webide'
|
|
@@ -12,10 +13,10 @@ module GiteePack
|
|
|
12
13
|
def initialize(base, head)
|
|
13
14
|
@base = base
|
|
14
15
|
@head = head
|
|
15
|
-
@precompile = false
|
|
16
16
|
@empty_folders = []
|
|
17
17
|
@delete_files = []
|
|
18
18
|
@cp_files = []
|
|
19
|
+
@webpack_files = []
|
|
19
20
|
|
|
20
21
|
init_list_by_files
|
|
21
22
|
end
|
|
@@ -34,8 +35,8 @@ module GiteePack
|
|
|
34
35
|
result.split("\n")
|
|
35
36
|
end
|
|
36
37
|
|
|
37
|
-
def
|
|
38
|
-
|
|
38
|
+
def has_webpack_file?
|
|
39
|
+
!webpack_files.empty?
|
|
39
40
|
end
|
|
40
41
|
|
|
41
42
|
private
|
|
@@ -55,7 +56,9 @@ module GiteePack
|
|
|
55
56
|
diff_files.each do |file|
|
|
56
57
|
next if IGNORE_FILES.include?(file)
|
|
57
58
|
|
|
58
|
-
file.start_with?('app/assets/javascripts/webpack')
|
|
59
|
+
if file.start_with?('app/assets/javascripts/webpack')
|
|
60
|
+
@webpack_files << file
|
|
61
|
+
end
|
|
59
62
|
|
|
60
63
|
if Dir.exist?(file)
|
|
61
64
|
@empty_folders << file
|
data/lib/gitee_pack/filer.rb
CHANGED
|
@@ -18,7 +18,7 @@ module GiteePack
|
|
|
18
18
|
end
|
|
19
19
|
|
|
20
20
|
def cp_update_file
|
|
21
|
-
filepath = File.join(File.
|
|
21
|
+
filepath = File.join(File.expand_path('../../../', __FILE__), 'exe/update.sh')
|
|
22
22
|
FileUtils.cp filepath, Folder.upgrade_dir
|
|
23
23
|
GiteePack.logger.debug "cp #{filepath} #{Folder.upgrade_dir}"
|
|
24
24
|
end
|
|
@@ -36,6 +36,10 @@ module GiteePack
|
|
|
36
36
|
def g_diff_file(content = [])
|
|
37
37
|
g_file(File.join(Folder.upgrade_dir, 'diff.txt'), content)
|
|
38
38
|
end
|
|
39
|
+
|
|
40
|
+
def g_commit_file(content = [])
|
|
41
|
+
g_file(File.join(Folder.upgrade_dir, 'commit.txt'), content)
|
|
42
|
+
end
|
|
39
43
|
end
|
|
40
44
|
end
|
|
41
45
|
end
|
data/lib/gitee_pack/version.rb
CHANGED
data/lib/gitee_pack/worker.rb
CHANGED
|
@@ -10,13 +10,14 @@ module GiteePack
|
|
|
10
10
|
Folder.mkdir_upgrade
|
|
11
11
|
Filer.cp_diff_files(@diff.cp_files)
|
|
12
12
|
|
|
13
|
-
if @diff.
|
|
13
|
+
if @diff.has_webpack_file?
|
|
14
14
|
Precompile.with_webpack
|
|
15
15
|
Filer.cp_webpack_files
|
|
16
16
|
end
|
|
17
17
|
|
|
18
18
|
Filer.g_diff_file(@diff.diff_files_with_status)
|
|
19
19
|
Filer.g_delete_file(@diff.delete_files)
|
|
20
|
+
Filer.g_commit_file(["old: #{@base}", "new: #{@head}"])
|
|
20
21
|
Filer.cp_update_file
|
|
21
22
|
|
|
22
23
|
puts_empty_folders
|
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
|
+
version: 1.2.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-
|
|
11
|
+
date: 2020-08-18 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description:
|
|
14
14
|
email:
|
|
@@ -23,13 +23,11 @@ files:
|
|
|
23
23
|
- LICENSE.txt
|
|
24
24
|
- README.md
|
|
25
25
|
- Rakefile
|
|
26
|
-
- bin/console
|
|
27
26
|
- bin/gitee_pack
|
|
28
|
-
-
|
|
27
|
+
- exe/update.sh
|
|
29
28
|
- gitee_pack.gemspec
|
|
30
29
|
- lib/gitee_pack.rb
|
|
31
30
|
- lib/gitee_pack/diff.rb
|
|
32
|
-
- lib/gitee_pack/exe/update.sh
|
|
33
31
|
- lib/gitee_pack/filer.rb
|
|
34
32
|
- lib/gitee_pack/folder.rb
|
|
35
33
|
- lib/gitee_pack/logger.rb
|
data/bin/console
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env ruby
|
|
2
|
-
|
|
3
|
-
require "bundler/setup"
|
|
4
|
-
require "gitee_pack"
|
|
5
|
-
|
|
6
|
-
# You can add fixtures and/or initialization code here to make experimenting
|
|
7
|
-
# with your gem easier. You can also use a different console, if you like.
|
|
8
|
-
|
|
9
|
-
# (If you use this, don't forget to add pry to your Gemfile!)
|
|
10
|
-
# require "pry"
|
|
11
|
-
# Pry.start
|
|
12
|
-
|
|
13
|
-
require "irb"
|
|
14
|
-
IRB.start(__FILE__)
|