dngg 0.0.1 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/Gemfile.lock +2 -2
- data/bin/dngg +12 -0
- data/lib/dngg.rb +80 -77
- data/lib/dngg/command/mr.rb +5 -4
- data/lib/dngg/hook/hooks.rb +0 -6
- data/lib/dngg/mr/email.rb +8 -5
- data/lib/dngg/version.rb +1 -1
- metadata +8 -11
- data/bin/console +0 -14
- data/bin/setup +0 -8
- data/lib/res/install_billow.sh +0 -33
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ed83c69c8ffd9f281d9bda6d8d0a2534f5f543b80052dc9b445c49a99144ce5d
|
4
|
+
data.tar.gz: 2406d79be38a740e8ed633c4c89efab8ba1036d524405cdb8972e9a1136a15db
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cc0258704a57f9703daf63be525ca98f7b8065c4c392cbcd8814972116b5d9542439b829579011c3436da2d273830ad4eda4e236a0eaa686e72450af35301d21
|
7
|
+
data.tar.gz: df102c00a4c7b29081032559a9797f6f03a75d4226af1f71841c082f3c3f9ce9da4ccd61d077864f8a9533bbb4eb5ea8e7a09561bfb068e0e0833e0c4e2616ce
|
data/.gitignore
CHANGED
data/Gemfile.lock
CHANGED
data/bin/dngg
ADDED
data/lib/dngg.rb
CHANGED
@@ -1,77 +1,80 @@
|
|
1
|
-
require 'thor'
|
2
|
-
require_relative 'dngg/version'
|
3
|
-
require_relative 'dngg/command/start'
|
4
|
-
require_relative 'dngg/command/sync'
|
5
|
-
require_relative 'dngg/command/switch'
|
6
|
-
require_relative 'dngg/command/delete'
|
7
|
-
require_relative 'dngg/command/foreach'
|
8
|
-
require_relative 'dngg/command/merge'
|
9
|
-
require_relative 'dngg/command/finish'
|
10
|
-
require_relative 'dngg/command/mr'
|
11
|
-
|
12
|
-
module DNGG
|
13
|
-
class Cli < Thor
|
14
|
-
include Start
|
15
|
-
include Sync
|
16
|
-
include Switch
|
17
|
-
include Delete
|
18
|
-
include Foreach
|
19
|
-
include Merge
|
20
|
-
include Finish
|
21
|
-
include MR
|
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
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
1
|
+
require 'thor'
|
2
|
+
require_relative 'dngg/version'
|
3
|
+
require_relative 'dngg/command/start'
|
4
|
+
require_relative 'dngg/command/sync'
|
5
|
+
require_relative 'dngg/command/switch'
|
6
|
+
require_relative 'dngg/command/delete'
|
7
|
+
require_relative 'dngg/command/foreach'
|
8
|
+
require_relative 'dngg/command/merge'
|
9
|
+
require_relative 'dngg/command/finish'
|
10
|
+
require_relative 'dngg/command/mr'
|
11
|
+
|
12
|
+
module DNGG
|
13
|
+
class Cli < Thor
|
14
|
+
include Start
|
15
|
+
include Sync
|
16
|
+
include Switch
|
17
|
+
include Delete
|
18
|
+
include Foreach
|
19
|
+
include Merge
|
20
|
+
include Finish
|
21
|
+
include MR
|
22
|
+
|
23
|
+
def self.exit_on_failure?
|
24
|
+
true
|
25
|
+
end
|
26
|
+
|
27
|
+
desc 'sync', '当前分支同步(拉取)远程代码'
|
28
|
+
def sync
|
29
|
+
sync_flow
|
30
|
+
end
|
31
|
+
|
32
|
+
desc 'start <branch> [<commit>] [<origin>]', '检出新分支,新功能、修bug务必使用该命令'
|
33
|
+
def start(branch, action='')
|
34
|
+
start_flow(branch, action)
|
35
|
+
end
|
36
|
+
|
37
|
+
desc 'merge <branch> [-r|--rebase]', 'Merge,开发完成后执行; -r:主工程强制rebase'
|
38
|
+
option :rebase, :default => false, :type => :boolean, aliases: '-r'
|
39
|
+
def merge(branch)
|
40
|
+
rebase = options[:rebase]
|
41
|
+
merge_flow(branch, rebase)
|
42
|
+
end
|
43
|
+
|
44
|
+
desc 'finish [-f|--force]', 'Merge后并解决冲突后执行; -f:主工程强制推送'
|
45
|
+
option :force, :default => false, :type => :boolean, aliases: '-f'
|
46
|
+
def finish
|
47
|
+
force = options[:force]
|
48
|
+
finish_flow(force)
|
49
|
+
end
|
50
|
+
|
51
|
+
desc 'mr <branch> <title>', '创建MR'
|
52
|
+
def mr(branch, title)
|
53
|
+
mr_flow(branch, title)
|
54
|
+
end
|
55
|
+
|
56
|
+
desc 'switch <branch>', '切换分支'
|
57
|
+
def switch(branch)
|
58
|
+
switch_flow(branch)
|
59
|
+
end
|
60
|
+
|
61
|
+
desc 'delete <branch> [-r|--remote] [-a|--all]', '删除指定分支'
|
62
|
+
option :remote, :default => false, :type => :boolean, aliases: '-r'
|
63
|
+
option :all, :default => false, :type => :boolean, aliases: '-a'
|
64
|
+
def delete(branch)
|
65
|
+
remote = options[:remote]
|
66
|
+
all = options[:all]
|
67
|
+
delete_flow(branch, remote, all)
|
68
|
+
end
|
69
|
+
|
70
|
+
desc 'foreach [<commands>...]', '所有模块执行git命令(foreach后跟git命令)'
|
71
|
+
def foreach(*commands)
|
72
|
+
foreach_flow(*commands)
|
73
|
+
end
|
74
|
+
|
75
|
+
desc 'v', '查看版本'
|
76
|
+
def version
|
77
|
+
puts VERSION
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
data/lib/dngg/command/mr.rb
CHANGED
@@ -80,8 +80,8 @@ module DNGG
|
|
80
80
|
|
81
81
|
if current_branch_head_commit!="origin/#{@@current_branch}" && # 判断远程分支是否存在
|
82
82
|
get_head_commit("origin/#{@@current_branch}") != get_head_commit("origin/#{@@target_branch}")
|
83
|
-
# origin git@
|
84
|
-
# origin
|
83
|
+
# origin git@gitlab.qima-inc.com:guang-mobile-shop/AiGuangMaxApp.git (push)
|
84
|
+
# origin https://gitlab.qima-inc.com/guang-mobile-shop/AiGuangMaxApp.git (push)
|
85
85
|
result = `git remote -v | grep push`
|
86
86
|
project_name = result.split('.com/')[1]
|
87
87
|
if project_name == nil || project_name.strip == ''
|
@@ -90,14 +90,13 @@ module DNGG
|
|
90
90
|
|
91
91
|
if project_name != nil
|
92
92
|
project_name = project_name.split('.git')[0].gsub('/', '%2F')
|
93
|
-
|
94
93
|
begin
|
95
94
|
params = {}
|
96
95
|
params['source_branch'] = @@current_branch
|
97
96
|
params['target_branch'] = @@target_branch
|
98
97
|
params['title'] = @@msg
|
99
98
|
# params['remove_source_branch'] = true
|
100
|
-
uri = URI.parse("https://
|
99
|
+
uri = URI.parse("https://gitlab.qima-inc.com/api/v4/projects/#{project_name}/merge_requests?private_token=#{@@token}")
|
101
100
|
response = Net::HTTP.post_form(uri, params)
|
102
101
|
result = Oj.load(response.body)
|
103
102
|
|
@@ -121,6 +120,8 @@ module DNGG
|
|
121
120
|
@@token = init_check_token
|
122
121
|
create_mr(sub)
|
123
122
|
return
|
123
|
+
when Net::HTTPForbidden then
|
124
|
+
puts response.body.red
|
124
125
|
end
|
125
126
|
rescue => e
|
126
127
|
puts "error: #{e}".red
|
data/lib/dngg/hook/hooks.rb
CHANGED
@@ -2,7 +2,6 @@ module DNGG
|
|
2
2
|
module Hooks
|
3
3
|
def check_hooks
|
4
4
|
if update_hooks
|
5
|
-
install_billow
|
6
5
|
subs = get_submodule
|
7
6
|
subs.each do |sub|
|
8
7
|
cp_hooks(sub)
|
@@ -10,11 +9,6 @@ module DNGG
|
|
10
9
|
end
|
11
10
|
end
|
12
11
|
|
13
|
-
def install_billow
|
14
|
-
path = `gem which dngg`.split('/dngg.rb')[0]
|
15
|
-
`sudo sh #{path}/res/install_billow.sh`
|
16
|
-
end
|
17
|
-
|
18
12
|
def update_hooks
|
19
13
|
version = `dngg v`
|
20
14
|
ggsm_path = '.git/dngg'
|
data/lib/dngg/mr/email.rb
CHANGED
@@ -4,18 +4,21 @@ require 'net/smtp'
|
|
4
4
|
module DNGG
|
5
5
|
module Email
|
6
6
|
def send_email(user,title,msg)
|
7
|
+
user_mail = `git config user.email`
|
7
8
|
message = <<END_OF_MESSAGE
|
8
|
-
DNGG Merge Request <
|
9
|
+
DNGG Merge Request <team_android@aiguang.com>
|
10
|
+
From: #{user}
|
9
11
|
To: Guang Android Team
|
10
12
|
Subject: [#{user}] #{title}
|
11
13
|
|
12
14
|
#{msg}
|
15
|
+
|
13
16
|
END_OF_MESSAGE
|
14
17
|
|
15
|
-
Net::SMTP.start('smtp.exmail.qq.com',
|
16
|
-
|
17
|
-
smtp.send_message message,
|
18
|
-
|
18
|
+
Net::SMTP.start('smtp.exmail.qq.com',25,'zhuruixue',
|
19
|
+
'zhuruixue@aiguang.com','wwL9RS9cLeBxv7co', :plain) do |smtp|
|
20
|
+
smtp.send_message message, 'zhuruixue@aiguang.com',
|
21
|
+
'team_android@aiguang.com'
|
19
22
|
end
|
20
23
|
end
|
21
24
|
end
|
data/lib/dngg/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dngg
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- iSnow
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-07-
|
11
|
+
date: 2021-07-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -55,8 +55,7 @@ dependencies:
|
|
55
55
|
description: A submodule tools for Guang-Teams
|
56
56
|
email: schnee1109@163.com
|
57
57
|
executables:
|
58
|
-
-
|
59
|
-
- setup
|
58
|
+
- dngg
|
60
59
|
extensions: []
|
61
60
|
extra_rdoc_files: []
|
62
61
|
files:
|
@@ -65,8 +64,7 @@ files:
|
|
65
64
|
- Gemfile.lock
|
66
65
|
- README.md
|
67
66
|
- Rakefile
|
68
|
-
- bin/
|
69
|
-
- bin/setup
|
67
|
+
- bin/dngg
|
70
68
|
- dngg.gemspec
|
71
69
|
- lib/dngg.rb
|
72
70
|
- lib/dngg/command/delete.rb
|
@@ -85,12 +83,11 @@ files:
|
|
85
83
|
- lib/dngg/util/stash.rb
|
86
84
|
- lib/dngg/util/submodule.rb
|
87
85
|
- lib/dngg/version.rb
|
88
|
-
- lib/res/install_billow.sh
|
89
86
|
homepage: http://rubygems.org/gems/dngg
|
90
87
|
licenses:
|
91
88
|
- MIT
|
92
89
|
metadata: {}
|
93
|
-
post_install_message:
|
90
|
+
post_install_message:
|
94
91
|
rdoc_options: []
|
95
92
|
require_paths:
|
96
93
|
- lib
|
@@ -105,8 +102,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
105
102
|
- !ruby/object:Gem::Version
|
106
103
|
version: '0'
|
107
104
|
requirements: []
|
108
|
-
rubygems_version: 3.0.
|
109
|
-
signing_key:
|
105
|
+
rubygems_version: 3.0.9
|
106
|
+
signing_key:
|
110
107
|
specification_version: 4
|
111
108
|
summary: dngg
|
112
109
|
test_files: []
|
data/bin/console
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require "bundler/setup"
|
4
|
-
require "dngg"
|
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__)
|
data/bin/setup
DELETED
data/lib/res/install_billow.sh
DELETED
@@ -1,33 +0,0 @@
|
|
1
|
-
# # 下载
|
2
|
-
# curl -o ~/billow.zip http://7xq884.com1.z0.glb.clouddn.com/Billow.zip
|
3
|
-
|
4
|
-
# pushd ~/Library/Application\ Support
|
5
|
-
|
6
|
-
# # 解压到Application Support/AS
|
7
|
-
# for file in ./AndroidStudio*
|
8
|
-
# do
|
9
|
-
# if test -d $file
|
10
|
-
# then
|
11
|
-
# pushd ~/Library/Application\ Support/$file
|
12
|
-
# unzip -o ~/billow.zip
|
13
|
-
# popd
|
14
|
-
# fi
|
15
|
-
# done
|
16
|
-
|
17
|
-
# popd
|
18
|
-
|
19
|
-
# # 修改Preferences,开启插件
|
20
|
-
# for file in ~/Library/Preferences/AndroidStudio*
|
21
|
-
# do
|
22
|
-
# if test -d $file
|
23
|
-
# then
|
24
|
-
# sed '/^com.souche.plugin.billow/'d $file/disabled_plugins.txt > disabled_plugins_billow.txt
|
25
|
-
# cp disabled_plugins_billow.txt $file/disabled_plugins.txt
|
26
|
-
# rm -rf disabled_plugins_billow.txt
|
27
|
-
# fi
|
28
|
-
# done
|
29
|
-
|
30
|
-
# rm -rf ~/billow.zip
|
31
|
-
|
32
|
-
# echo Billow安装成功,请重新启动AndroidStudio
|
33
|
-
|