Class: Build::Push
Instance Attribute Summary collapse
-
#repo_module ⇒ Object
Returns the value of attribute repo_module.
-
#repo_xcode_shell ⇒ Object
Returns the value of attribute repo_xcode_shell.
-
#sender ⇒ Object
Returns the value of attribute sender.
Instance Method Summary collapse
- #create_push_content(summary = nil) ⇒ Object
- #push(title, summary = nil) ⇒ Object
- #setup(sender = nil, repo_module = nil, repo_xcode_shell = nil) ⇒ Object
Instance Attribute Details
#repo_module ⇒ Object
Returns the value of attribute repo_module.
11 12 13 |
# File 'lib/core_blur/push.rb', line 11 def repo_module @repo_module end |
#repo_xcode_shell ⇒ Object
Returns the value of attribute repo_xcode_shell.
12 13 14 |
# File 'lib/core_blur/push.rb', line 12 def repo_xcode_shell @repo_xcode_shell end |
#sender ⇒ Object
Returns the value of attribute sender.
10 11 12 |
# File 'lib/core_blur/push.rb', line 10 def sender @sender end |
Instance Method Details
#create_push_content(summary = nil) ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/core_blur/push.rb', line 37 def create_push_content(summary = nil) shell_http_url = repo_xcode_shell ? repo_xcode_shell.http_url : "null" shell_branch = repo_xcode_shell ? repo_xcode_shell.branch : "null" jenkins_url = Build::Config.instance.jenkins_url content = "" content += "🔹组件: #{repo_module.pod_name}\n" content += "🔹版本: #{repo_module.pod_version_final}\n" content += "🔹分支: #{repo_module.branch}\n" content += "🔹提交: #{repo_module.last_commit.commit_msg}\n" content += "🔹组件 地址: #{repo_module.http_url}\n" content += "🔹壳工程地址: #{shell_http_url}\n" content += "🔹壳工程分支: #{shell_branch}\n" content += "🔹打包地址: #{jenkins_url}\n" content += summary ? "🔸摘要: #{summary}\n\n" : "\n" content += "🔹#{Time.new.strftime("%Y-%m-%d %H:%M:%S")}\n" end |
#push(title, summary = nil) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/core_blur/push.rb', line 18 def push(title, summary = nil) if not repo_module or not repo_module.last_commit.committer puts "\n⛔️未获取到仓库信息或提交者信息,不推送以下内容:" puts title puts "-> #{summary}" return end to = repo_module.last_commit.committer content = create_push_content(summary) puts "\n⏩ 开始推送通知流程" log_content = "#{title}\n#{content}\n" puts "即将推送给#{to}如下内容:\n#{log_content}" if @sender @sender.send_msg(to.upcase, title, content.to_s) puts "推送通知完毕流程" else puts "⛔未提供推送配置,不进行推送" end end |
#setup(sender = nil, repo_module = nil, repo_xcode_shell = nil) ⇒ Object
13 14 15 16 17 |
# File 'lib/core_blur/push.rb', line 13 def setup(sender = nil, repo_module = nil, repo_xcode_shell = nil) @sender = sender @repo_module = repo_module @repo_xcode_shell = repo_xcode_shell end |