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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d89252c4d511fbf2c7d1430f96f988258fd30e01f472b0752d25ecafc4605314
4
- data.tar.gz: 0d3e6baa8f093d8fd35a79e80ceb691cddec7f07e1a4ae55ab6b2bd51994ee5e
3
+ metadata.gz: ed83c69c8ffd9f281d9bda6d8d0a2534f5f543b80052dc9b445c49a99144ce5d
4
+ data.tar.gz: 2406d79be38a740e8ed633c4c89efab8ba1036d524405cdb8972e9a1136a15db
5
5
  SHA512:
6
- metadata.gz: f9061d9ee4d13281d26b8c0cbed1d3be5838b3dd97545168e415d7fe85fa532dcdbbbe44a93a7bbd3eb01d3bd568552f93ec33ad1bf95d16ac45dc9711bc30c6
7
- data.tar.gz: 45a01ba0259eef2ccf01e6db69f2a0c5d3c1de35e51d21dfa2236bbffb588a052e04308c0947eac91fa85e7c7418e7ad08ccd4341344651edd2d1fd0f2a534c2
6
+ metadata.gz: cc0258704a57f9703daf63be525ca98f7b8065c4c392cbcd8814972116b5d9542439b829579011c3436da2d273830ad4eda4e236a0eaa686e72450af35301d21
7
+ data.tar.gz: df102c00a4c7b29081032559a9797f6f03a75d4226af1f71841c082f3c3f9ce9da4ccd61d077864f8a9533bbb4eb5ea8e7a09561bfb068e0e0833e0c4e2616ce
data/.gitignore CHANGED
@@ -6,3 +6,4 @@
6
6
  /pkg/
7
7
  /spec/reports/
8
8
  /tmp/
9
+ *.gem
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- dngg (0.0.1)
4
+ dngg (0.0.5)
5
5
  colorize (= 0.8.1)
6
6
  oj (= 3.8.0)
7
7
  thor (= 1.0.0)
@@ -22,4 +22,4 @@ DEPENDENCIES
22
22
  rake (~> 13.0)
23
23
 
24
24
  BUNDLED WITH
25
- 2.2.23
25
+ 2.2.24
data/bin/dngg ADDED
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # set -euo pipefail
4
+ require_relative '../lib/dngg'
5
+
6
+ # IFS=$'\n\t'
7
+ # set -vx
8
+ DNGG::Cli.start(ARGV)
9
+
10
+ # bundle install
11
+
12
+ # Do any other automated setup that you need to do here
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
- desc 'sync', '当前分支同步(拉取)远程代码'
24
- def sync
25
- sync_flow
26
- end
27
-
28
- desc 'start <branch> [<commit>] [<origin>]', '检出新分支,新功能、修bug务必使用该命令'
29
- def start(branch, action='')
30
- start_flow(branch, action)
31
- end
32
-
33
- desc 'merge <branch> [-r|--rebase]', 'Merge,开发完成后执行; -r:主工程强制rebase'
34
- option :rebase, :default => false, :type => :boolean, aliases: '-r'
35
- def merge(branch)
36
- rebase = options[:rebase]
37
- merge_flow(branch, rebase)
38
- end
39
-
40
- desc 'finish [-f|--force]', 'Merge后并解决冲突后执行; -f:主工程强制推送'
41
- option :force, :default => false, :type => :boolean, aliases: '-f'
42
- def finish
43
- force = options[:force]
44
- finish_flow(force)
45
- end
46
-
47
- desc 'mr <branch> <title>', '创建MR'
48
- def mr(branch, title)
49
- mr_flow(branch, title)
50
- end
51
-
52
- desc 'switch <branch>', '切换分支'
53
- def switch(branch)
54
- switch_flow(branch)
55
- end
56
-
57
- desc 'delete <branch> [-r|--remote] [-a|--all]', '删除指定分支'
58
- option :remote, :default => false, :type => :boolean, aliases: '-r'
59
- option :all, :default => false, :type => :boolean, aliases: '-a'
60
- def delete(branch)
61
- remote = options[:remote]
62
- all = options[:all]
63
- delete_flow(branch, remote, all)
64
- end
65
-
66
- desc 'foreach [<commands>...]', '所有模块执行git命令(foreach后跟git命令)'
67
- def foreach(*commands)
68
- foreach_flow(*commands)
69
- end
70
-
71
- desc 'v', '查看版本'
72
- def version
73
- puts VERSION
74
- end
75
- end
76
- # Cli.start(ARGV)
77
- end
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
@@ -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@git.souche.com:Destiny_Android/Destiny_Android.git (push)
84
- # origin http://git.souche.com/Destiny_Android/Mine.git (push)
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://git.souche-inc.com/api/v4/projects/#{project_name}/merge_requests?private_token=#{@@token}")
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
@@ -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 <android.dev@guang.com>
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', 25, 'iSnow',
16
- 'zhuruixue@aiguang.com', 'wwL9RS9cLeBxv7co') do |smtp|
17
- smtp.send_message message,
18
- 'android.dev@guang.com'
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
@@ -1,3 +1,3 @@
1
1
  module DNGG
2
- VERSION = '0.0.1'
2
+ VERSION = '0.0.5'
3
3
  end
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.1
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-17 00:00:00.000000000 Z
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
- - console
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/console
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.3
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
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
4
- set -vx
5
-
6
- bundle install
7
-
8
- # Do any other automated setup that you need to do here
@@ -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
-