abak-flow 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/README.md +2 -2
- data/lib/abak-flow/request.rb +1 -3
- data/lib/abak-flow/version.rb +1 -1
- metadata +1 -3
- data/lib/abak-flow/branches.rb +0 -68
- data/lib/abak-flow/messages.rb +0 -86
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MDFkNDI2YTZiMTk4Y2Q4YTQxNzlmMzc3MGMzOGNmOTk5ODg3ZWM3Nw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
YjMxMzFkNjQ1MWNlMTZkZjMxMmY5ZDZkMGYwYzk2NmYyNzZjNTQ2Zg==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZWI2OTM3ZTlmY2I4NWE0NTUxMDYzODY2OTBjMDZmZDQ4Yzk5NjFjZmM4Y2U3
|
10
|
+
YmM0NjE2MDFkM2M2NjRjNzE5MTg3MmU1ODJiZjI4OGE3ZDAzNjAxMzNhYzMx
|
11
|
+
NWRhYmU0YmVhZTRmMTY0YmZiNDRiOTQyYjY3YTk1OGY0Y2EzZDA=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ODEwY2Y3YWQyNzc5NzYzMmJjMzE4MDI5MTYxNjJhMDY3MTM5NGIyM2E4NmMz
|
14
|
+
MmZiMzhkYTdlOWQwN2QxOGIyN2MwNDMyNWJmN2NjZWJhNDRjNzE5NWExNzUx
|
15
|
+
NWEzZTdiMGNkMzI3ZDc4Yjg0ZDhhNTUyOGNkMTdkMjdiODBiNTc=
|
data/README.md
CHANGED
@@ -34,7 +34,7 @@ Github-flow же наоборот ведет основную разработк
|
|
34
34
|
$ git remote add upstream git://github.com/GITHUB_PROJECT_USER/GITHUB_PROJECT_NAME.git
|
35
35
|
|
36
36
|
### А если я использую прокси, как быть?
|
37
|
-
$ git config --global abak.proxy http://my-proxy.com:3129
|
37
|
+
$ git config --global abak-flow.http-proxy http://my-proxy.com:3129
|
38
38
|
|
39
39
|
Далее по приоритету идут переменные окружения. Сначала **http_proxy**, затем **HTTP_PROXY**
|
40
40
|
|
@@ -92,7 +92,7 @@ Github-flow же наоборот ведет основную разработк
|
|
92
92
|
## А помощь?
|
93
93
|
Многие команды имеют какие-то дополнительные опции. Но они нужны только в экзотических случаях. Но при любом раскладе подсказку и тонкий намек всегда можно получить воспользовавших такой командой:
|
94
94
|
|
95
|
-
$ git request
|
95
|
+
$ git request publish --help
|
96
96
|
|
97
97
|
# В заключении
|
98
98
|
Данный репозиторий и изложенные в нем идеи ни в коем случае не претендуют на идеал и совершенство. Это всего лишь узко заточенная комбинация гемов
|
data/lib/abak-flow/request.rb
CHANGED
@@ -110,9 +110,7 @@ module Abak::Flow
|
|
110
110
|
|
111
111
|
v = Visitor.new(p, call: :publish, look_for: :errors)
|
112
112
|
if v.ready?
|
113
|
-
say ANSI.green {
|
114
|
-
I18n.t("commands.publish.success",
|
115
|
-
link: ANSI.bold { p.link }) }
|
113
|
+
say ANSI.green { I18n.t("commands.publish.success", link: p.link) }
|
116
114
|
else
|
117
115
|
say ANSI.red { I18n.t("commands.publish.fail") }
|
118
116
|
say ANSI.yellow { v.output }
|
data/lib/abak-flow/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: abak-flow
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Strech (aka Sergey Fedorov)
|
@@ -113,12 +113,10 @@ files:
|
|
113
113
|
- bin/request
|
114
114
|
- lib/abak-flow.rb
|
115
115
|
- lib/abak-flow/branch.rb
|
116
|
-
- lib/abak-flow/branches.rb
|
117
116
|
- lib/abak-flow/configuration.rb
|
118
117
|
- lib/abak-flow/locales/en.yml
|
119
118
|
- lib/abak-flow/locales/ru.yml
|
120
119
|
- lib/abak-flow/manager.rb
|
121
|
-
- lib/abak-flow/messages.rb
|
122
120
|
- lib/abak-flow/pull_request.rb
|
123
121
|
- lib/abak-flow/repository.rb
|
124
122
|
- lib/abak-flow/request.rb
|
data/lib/abak-flow/branches.rb
DELETED
@@ -1,68 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
#
|
3
|
-
# Wrapper class for git branches.
|
4
|
-
# Provides access to git branches and also defines current_branch
|
5
|
-
module Abak::Flow
|
6
|
-
module Branches
|
7
|
-
extend Forwardable
|
8
|
-
|
9
|
-
def_delegator "Abak::Flow::Git.instance", :git
|
10
|
-
|
11
|
-
def self.current_branch
|
12
|
-
Branch.new git.branches[git.current_branch]
|
13
|
-
end
|
14
|
-
|
15
|
-
# ==========================================================================
|
16
|
-
# TODO : Refactor
|
17
|
-
# 3. Statistics & Cleaning
|
18
|
-
#
|
19
|
-
# => PullRequest.garbage
|
20
|
-
# => PullRequest.clean
|
21
|
-
# => PullRequest.clean(hard: true)
|
22
|
-
def self.garbage
|
23
|
-
Project.init
|
24
|
-
[Project.upstream.repo, Project.origin.repo].map(&:fetch)
|
25
|
-
|
26
|
-
branches = GithubClient.connection.branches(Project.origin.to_s)
|
27
|
-
.reject { |branch| %w(master develop).include? branch.name }
|
28
|
-
|
29
|
-
messages = Messages.new "pull_request.garbage"
|
30
|
-
messages << [:collected_branches, {count: branches.count}]
|
31
|
-
|
32
|
-
branches.each_with_index do |branch, index|
|
33
|
-
|
34
|
-
# WRONG PREFIX
|
35
|
-
upstream_branch = Git.command_lines("branch", ["-r", "--contain", branch.commit.sha])
|
36
|
-
.select { |branches| branches.include? "upstream/#{branch.prefix}" }
|
37
|
-
|
38
|
-
local_sha = git.branches[branch.name] ? git.branches[branch.name].gcommit.sha : ""
|
39
|
-
|
40
|
-
statuses = {
|
41
|
-
branch_unused: upstream_branch.empty?,
|
42
|
-
branch_differ: !local_sha.empty? && local_sha != branch.commit.sha,
|
43
|
-
branch_missing: local_sha.empty?
|
44
|
-
}
|
45
|
-
|
46
|
-
unless statuses.values.inject &:|
|
47
|
-
messages << [:deletion_allowed, {index: index, branch_name: branch.name}]
|
48
|
-
next
|
49
|
-
end
|
50
|
-
|
51
|
-
diagnoses = statuses.select { |_, bool| bool }.
|
52
|
-
map { |name, _| messages.t name }.
|
53
|
-
map { |msg| " ↪ #{msg}" }.
|
54
|
-
join("\n")
|
55
|
-
|
56
|
-
if statuses.select { |_, bool| bool }.keys == [:missing]
|
57
|
-
messages << [:deletion_possibly, {index: index, branch_name: branch.name, diagnoses: diagnoses}]
|
58
|
-
else
|
59
|
-
messages << [:deletion_restricted, {index: index, branch_name: branch.name, diagnoses: diagnoses}]
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
messages
|
64
|
-
end
|
65
|
-
|
66
|
-
|
67
|
-
end
|
68
|
-
end
|
data/lib/abak-flow/messages.rb
DELETED
@@ -1,86 +0,0 @@
|
|
1
|
-
# coding : utf-8
|
2
|
-
require "i18n"
|
3
|
-
|
4
|
-
# TODO : Нужен простой метод, для перевода без скоупа
|
5
|
-
module Abak::Flow
|
6
|
-
class Messages
|
7
|
-
extend Forwardable
|
8
|
-
|
9
|
-
attr_reader :scope, :elements
|
10
|
-
|
11
|
-
def initialize(scope)
|
12
|
-
Configuration.instance
|
13
|
-
|
14
|
-
@scope = scope
|
15
|
-
@elements = []
|
16
|
-
end
|
17
|
-
|
18
|
-
# Iterate elements from locale scope (translating online)
|
19
|
-
#
|
20
|
-
# Returns nothing
|
21
|
-
def each
|
22
|
-
raise ArgumentError, "No block given" unless block_given?
|
23
|
-
|
24
|
-
elements.each do |key|
|
25
|
-
yield translate(key)
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
# Put item to elements
|
30
|
-
#
|
31
|
-
# Returns Symbol
|
32
|
-
def push(element)
|
33
|
-
@elements << element
|
34
|
-
end
|
35
|
-
alias :<< :push
|
36
|
-
|
37
|
-
# section header from locale scope
|
38
|
-
#
|
39
|
-
# Returns String
|
40
|
-
def header
|
41
|
-
translate :header
|
42
|
-
end
|
43
|
-
|
44
|
-
# Print all elements from locale scope without header
|
45
|
-
#
|
46
|
-
# Returns Symbol
|
47
|
-
def to_s
|
48
|
-
return "" if elements.empty?
|
49
|
-
|
50
|
-
elements.collect { |element| translate *element } * "\n"
|
51
|
-
end
|
52
|
-
|
53
|
-
def print
|
54
|
-
return "" if elements.empty?
|
55
|
-
|
56
|
-
all_elements = []
|
57
|
-
elements.each_with_index do |element, index|
|
58
|
-
all_elements << "#{index + 1}. #{translate(*element)}"
|
59
|
-
end
|
60
|
-
|
61
|
-
all_elements * "\n"
|
62
|
-
end
|
63
|
-
|
64
|
-
# Print section header from locale scope and all elements from scope
|
65
|
-
#
|
66
|
-
# Returns String
|
67
|
-
def pretty_print
|
68
|
-
return "" if elements.empty?
|
69
|
-
|
70
|
-
[header, print] * "\n\n"
|
71
|
-
end
|
72
|
-
alias :pp :pretty_print
|
73
|
-
|
74
|
-
def translate(key, options = {})
|
75
|
-
I18n.t key, {scope: scope}.merge!(options)
|
76
|
-
end
|
77
|
-
alias :t :translate
|
78
|
-
|
79
|
-
def purge!
|
80
|
-
@elements = []
|
81
|
-
end
|
82
|
-
|
83
|
-
private
|
84
|
-
def_delegator :elements, :empty?
|
85
|
-
end
|
86
|
-
end
|