abak-flow 0.2.3 → 0.3.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.
data/README.md CHANGED
@@ -2,6 +2,8 @@ Abak-flow
2
2
  =========
3
3
  Нет, это не новая идеология ведения проекта, это всего лишь набор утилит которые помогают связать использование [git-flow](https://github.com/nvie/gitflow) и [github flow](http://scottchacon.com/2011/08/31/github-flow.html)
4
4
 
5
+ **Начиная с версии v0.2.1 используется авторизация OAuth2. [Как ей пользоваться](https://github.com/Strech/abak-flow/wiki/How-start-work-with-new-abak-flow)**
6
+
5
7
  # Концепция
6
8
  Идеология git-flow использует следующий набор веток:
7
9
 
@@ -25,9 +27,9 @@ Github-flow же наоборот ведет основную разработк
25
27
 
26
28
  $ gem install abak-flow
27
29
  $ git config --global alias.request '!request'
28
- $ git config --global abak.apiuser your_github_mail@gmail.com
29
- $ git config --global abak.apitoken 0123456789yourf0123456789token
30
- $ git remote add upstream git://github.com/github_user_name/project.git
30
+ $ git config --global abak.apiuser YOUR_GITHUB_MAIL@gmail.com
31
+ $ git config --global abak.apitoken 0123456789YOUR_GITHUB_API_TOKEN
32
+ $ git remote add upstream git://github.com/GITHUB_PROJECT_USER/GITHUB_PROJECT_NAME.git
31
33
 
32
34
  ### А если я использую прокси, как быть?
33
35
  $ git config --global abak.proxy http://my-proxy.com:3129
@@ -46,7 +48,7 @@ Github-flow же наоборот ведет основную разработк
46
48
 
47
49
  $ git request readycheck
48
50
 
49
- или
51
+ или
50
52
 
51
53
  $ git request help
52
54
 
@@ -61,6 +63,8 @@ Github-flow же наоборот ведет основную разработк
61
63
  $ git commit -a -m 'Hello world commit'
62
64
  $ git request publish
63
65
 
66
+ **Внимание:** Не нужно называться ветку TASK. Используйте префикс задачь из jira
67
+
64
68
  Теперь то же самое, только словами:
65
69
 
66
70
  * Переключимся в ветку develop
@@ -86,17 +90,17 @@ Github-flow же наоборот ведет основную разработк
86
90
  ### Завершение текущей задачи:
87
91
  Вообще, завершать задачу лучше только после того, как ваш pull request был принят. Почему? На самом деле по ряду причин. По умолчанию эта команда удаляет как вашу текущую ветку с задачей в локальном репозитории и в добавок ко всему - на вашем удаленном репозитории (форке)
88
92
 
89
- $ git co feature/TASK-001
93
+ $ git checkout feature/TASK-001
90
94
  $ git request done
91
95
 
92
96
  Чтобы оставить какую либо ветку в живых возможно напрямую указать, какую копию ветки **удалить**, локальную или же удаленную (на origin)
93
97
 
94
- $ git co feature/TASK-001
98
+ $ git checkout feature/TASK-001
95
99
  $ git request done --origin
96
100
 
97
101
  Или же так
98
102
 
99
- $ git co feature/TASK-001
103
+ $ git checkout feature/TASK-001
100
104
  $ git request done --local
101
105
 
102
106
  ## Маленькие хитрости
@@ -108,4 +112,4 @@ Github-flow же наоборот ведет основную разработк
108
112
  $ git request done --help
109
113
 
110
114
  # В заключении
111
- Данный репозиторий и изложенные в нем идеи ни в коем случае не претендуют на идеал и совершенство. Это всего лишь узко заточенная комбинация гемов
115
+ Данный репозиторий и изложенные в нем идеи ни в коем случае не претендуют на идеал и совершенство. Это всего лишь узко заточенная комбинация гемов
@@ -0,0 +1,20 @@
1
+ # -*- encoding: utf-8 -*-
2
+ module Abak::Flow
3
+ class Config < Struct.new(:api_user, :api_token, :proxy)
4
+ [:api_user, :api_token, :proxy].each {|attribute| define_method("#{attribute}?") { !send(attribute).to_s.empty? } }
5
+
6
+ def self.current
7
+ return @current_config unless @current_config.nil?
8
+
9
+ HighLine.color_scheme = HighLine::SampleColorScheme.new
10
+ git_reader = Hub::Commands.send(:git_reader)
11
+
12
+ api_user = git_reader.read_config('abak.apiuser')
13
+ api_token = git_reader.read_config('abak.apitoken')
14
+ proxy = git_reader.read_config('abak.proxy')
15
+ env_proxy = ENV['http_proxy'] || ENV['HTTP_PROXY']
16
+
17
+ @current_config = new(api_user, api_token, proxy || env_proxy)
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,13 @@
1
+ # -*- encoding: utf-8 -*-
2
+ module Abak::Flow
3
+ class GithubClient
4
+ def self.connect(config)
5
+ return @github_connect unless @github_connect.nil?
6
+
7
+ github_options = {:login => config.api_user, :oauth_token => config.api_token}
8
+ github_options[:proxy] = config.proxy if config.proxy?
9
+
10
+ @github_connect = Octokit::Client.new(github_options)
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,211 @@
1
+ # -*- encoding: utf-8 -*-
2
+ module Abak::Flow
3
+ class PullRequest
4
+ extend Forwardable
5
+
6
+ attr_reader :repository, :request_params
7
+ attr_reader :config, :validator
8
+
9
+ def initialize(config, options)
10
+ strategy = options.delete(:strategy) || :publish
11
+
12
+ @repository = Hub::Commands.send(:local_repo)
13
+ @request_params = OpenStruct.new(options)
14
+ @config = config
15
+
16
+ @validator = Validator.new(strategy, self)
17
+ end
18
+
19
+ delegate [:validate!, :valid?] => :validator
20
+ delegate [:base=, :head=, :title=, :body=] => :request_params
21
+
22
+ def default_task
23
+ @default_task ||= current_branch.split('/').push(nil)[1].to_s
24
+ end
25
+
26
+ def branch_prefix
27
+ @branch_prefix ||= current_branch.include?('/') ? current_branch.split('/').first : ''
28
+ end
29
+
30
+ def current_branch
31
+ @current_branch ||= repository.current_branch.short_name
32
+ end
33
+
34
+ def from_repo
35
+ @from_repo ||= begin
36
+ upstream_project = repository.remote_by_name('upstream').project
37
+ "#{upstream_project.owner}/#{upstream_project.name}"
38
+ end
39
+ end
40
+
41
+ def origin_repo
42
+ @origin_repo ||= repository.main_project.remote.name
43
+ end
44
+
45
+ def base
46
+ exit unless validator.valid?
47
+
48
+ branch = Abak::Flow::PullRequest.branch_by_prefix(branch_prefix)
49
+
50
+ request_params.body || "#{repository.remote_by_name('upstream').project.owner}:#{branch}"
51
+ end
52
+
53
+ def head
54
+ exit unless validator.valid?
55
+
56
+ request_params.head || "#{repository.repo_owner}:#{current_branch}"
57
+ end
58
+
59
+ def title
60
+ exit unless validator.valid?
61
+
62
+ request_params.title
63
+ end
64
+
65
+ def body
66
+ exit unless validator.valid?
67
+
68
+ request_params.body
69
+ end
70
+
71
+ def self.branch_by_prefix(prefix)
72
+ {:feature => :develop, :hotfix => :master}.fetch(prefix.to_sym, '')
73
+ end
74
+
75
+ # TODO Вынести
76
+ class Validator
77
+ attr_reader :strategy, :target_object
78
+ attr_reader :errors, :executed
79
+
80
+ def initialize(strategy_name, target_object)
81
+ @strategy = Abak::Flow::PullRequest.const_get("Strategy#{strategy_name.capitalize}".to_sym)
82
+ @target_object = target_object
83
+ @errors = []
84
+ end
85
+
86
+ def valid?
87
+ return errors.empty? if executed
88
+
89
+ validate!
90
+ errors.empty?
91
+ end
92
+
93
+ protected
94
+ def validate!
95
+ @executed = true
96
+
97
+ strategy.attributes.each do |attribute|
98
+ send("validate_#{attribute}")
99
+ end
100
+
101
+ print_errors
102
+ end
103
+
104
+ def print_errors
105
+ errors.each do |error|
106
+ say color(error[:message], :error).to_s
107
+ say color(error[:tip], :info).to_s
108
+ end
109
+ end
110
+
111
+ def validate_api_user
112
+ return if target_object.config.api_user?
113
+
114
+ @errors << {
115
+ :message => 'Необходимо указать своего пользователя API github',
116
+ :tip => '=> https://github.com/Strech/abak-flow/blob/master/README.md'
117
+ }
118
+ end
119
+
120
+ def validate_api_token
121
+ return if target_object.config.api_token?
122
+
123
+ @errors << {
124
+ :message => 'Необходимо указать токен своего пользователя API github',
125
+ :tip => '=> https://github.com/Strech/abak-flow/blob/master/README.md'
126
+ }
127
+ end
128
+
129
+ def validate_origin
130
+ return unless target_object.repository.remote_by_name('origin').nil?
131
+
132
+ @errors << {
133
+ :message => 'Необходимо настроить репозиторий origin (форк) для текущего пользователя',
134
+ :tip => '=> git remote add origin https://Developer@github.com/abak-press/sample.git'
135
+ }
136
+ end
137
+
138
+ def validate_upstream
139
+ return unless target_object.repository.remote_by_name('upstream').nil?
140
+
141
+ @errors << {
142
+ :message => 'Необходимо настроить репозиторий upstream (главный) для текущего пользователя',
143
+ :tip => '=> git remote add upstream https://Developer@github.com/abak-press/sample.git'
144
+ }
145
+ end
146
+
147
+ def validate_title
148
+ return unless target_object.request_params.title.empty?
149
+
150
+ @errors << {
151
+ :message => 'Пожалуйста, укажите что-нибудь для заголовка pull request, например номер вашей задачи вот так:',
152
+ :tip => '=> git request publish "PC-001"'
153
+ }
154
+ end
155
+
156
+ def validate_branch
157
+ return if [:master, :develop].include?(target_object.current_branch.to_sym)
158
+
159
+ @errors << {
160
+ :message => 'Нельзя делать pull request из меток master или develop, попробуйде переключиться, например так:',
161
+ :tip => '=> git checkout master'
162
+ }
163
+ end
164
+
165
+ def validate_deleted_branch
166
+ return unless [:master, :develop].include?(target_object.current_branch.to_sym)
167
+
168
+ @errors << {
169
+ :message => 'Извините, но нельзя удалить ветку develop или master',
170
+ :tip => '=> git checkout feature/TASK-0001'
171
+ }
172
+ end
173
+ end
174
+
175
+ class Strategy
176
+ def self.attributes
177
+ raise NotImplementedError
178
+ end
179
+ end
180
+
181
+ class StrategyFeature < Strategy
182
+ def self.attributes
183
+ StrategyReadycheck.attributes | [:title, :branch]
184
+ end
185
+ end
186
+
187
+ class StrategyPublish < Strategy
188
+ def self.attributes
189
+ StrategyReadycheck.attributes | [:title]
190
+ end
191
+ end
192
+
193
+ class StrategyUpdate < Strategy
194
+ def self.attributes
195
+ StrategyReadycheck.attributes
196
+ end
197
+ end
198
+
199
+ class StrategyDone < Strategy
200
+ def self.attributes
201
+ StrategyReadycheck.attributes | [:deleted_branch]
202
+ end
203
+ end
204
+
205
+ class StrategyReadycheck < Strategy
206
+ def self.attributes
207
+ [:origin, :upstream, :api_user, :api_token]
208
+ end
209
+ end
210
+ end
211
+ end
@@ -1,7 +1,5 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
  module Abak::Flow
3
- # @TODO Сделать класс, в котором собрать общие куски из задач
4
-
5
3
  program :name, 'Утилита для оформления pull request на github.com'
6
4
  program :version, Abak::Flow::VERSION
7
5
  program :description, 'Утилита, заточенная под git-flow но с использованием github.com'
@@ -11,94 +9,44 @@ module Abak::Flow
11
9
  c.syntax = 'git request publish <Заголовок>'
12
10
  c.description = 'Оформить pull request из текущей ветки (feature -> develop, hotfix -> master)'
13
11
 
14
- # Опции нужны, если человек хочет запушить ветку, с именем отличным от стандарта
12
+ # Опции нужны, если человек хочет запушить `` ветку, с именем отличным от стандарта
15
13
  c.option '--head STRING', String, 'Имя ветки, которую нужно принять в качестве изменений'
16
14
  c.option '--base STRING', String, 'Имя ветки, в которую нужно принять изменения'
17
15
 
18
16
  c.action do |args, options|
19
- HighLine.color_scheme = HighLine::SampleColorScheme.new
20
-
21
- request_rules = {:feature => :develop, :hotfix => :master}
22
17
  jira_browse_url = 'http://jira.dev.apress.ru/browse/'
23
18
 
24
- repository = Hub::Commands.send :local_repo
25
- current_branch = repository.current_branch.short_name
26
- remote_branch, task = current_branch.split('/').push(nil).map(&:to_s)
19
+ config = Abak::Flow::Config.current
20
+ github_client = Abak::Flow::GithubClient.connect(config)
21
+ request = Abak::Flow::PullRequest.new(config, :head => options.head, :base => options.base)
27
22
 
28
23
  title = args.first.to_s.strip
29
- title = task if task =~ /^\w+\-\d{1,}$/ && title.empty?
30
-
31
- api_user = Hub::Commands.send(:git_reader).read_config('abak.apiuser')
32
- api_token = Hub::Commands.send(:git_reader).read_config('abak.apitoken')
33
- config_proxy = Hub::Commands.send(:git_reader).read_config('abak.proxy')
34
- env_proxy = ENV['http_proxy'] || ENV['HTTP_PROXY']
35
-
36
- client_opts = {:proxy => config_proxy || env_proxy} if config_proxy || env_proxy
37
- client_opts ||= {}
38
-
39
- api_client = Octokit::Client.new({:login => api_user, :oauth_token => api_token}.merge(client_opts))
40
-
41
- # Проверим, что мы не в мастере или девелопе
42
- if [:master, :develop].include? current_branch.to_sym
43
- say color('Нельзя делать pull request из меток master или develop', :error).to_s
44
- exit
45
- end
46
-
47
- # Проверим, что у нас настроен origin
48
- if repository.remote_by_name('origin').nil?
49
- say color('Необходимо настроить репозиторий origin (форк) для текущего пользователя', :error).to_s
50
- say color('=> git remote add origin https://Developer@github.com/abak-press/sample.git', :info).to_s
51
- exit
52
- end
24
+ body = забыл какая это задача :('
53
25
 
54
- # Проверим, что у нас настроен upstream
55
- if repository.remote_by_name('upstream').nil?
56
- say color('Необходимо настроить репозиторий upstream (главный) для текущего пользователя', :error).to_s
57
- say color('=> git remote add upstream https://Developer@github.com/abak-press/sample.git', :info).to_s
58
- exit
59
- end
60
-
61
- if title.empty?
62
- say color('Пожалуйста, укажите что-нибудь для заголовка pull request, например номер вашей задачи вот так:', :error).to_s
63
- say color('=> git request publish "PC-001"', :info).to_s
64
- exit
65
- end
66
-
67
- # Проверим, что у нас указан апи юзер
68
- if api_user.empty?
69
- say color('Необходимо указать своего пользователя API github', :error).to_s
70
- say color('=> https://github.com/Strech/abak-flow/blob/master/README.md', :info).to_s
71
- exit
72
- end
73
-
74
- # Проверим, что у нас указан токен
75
- if api_token.empty?
76
- say color('Необходимо указать токен своего пользователя API github', :error).to_s
77
- say color('=> https://github.com/Strech/abak-flow/blob/master/README.md', :info).to_s
78
- exit
26
+ if request.default_task =~ /^\w+\-\d{1,}$/
27
+ title = request.default_task if title.empty?
28
+ body = jira_browse_url + request.default_task
79
29
  end
80
30
 
81
- upstream_project = repository.remote_by_name('upstream').project
31
+ request.title = title
32
+ request.body = body
82
33
 
83
- # Расставим ветки согласно правилам
84
- head = "#{repository.repo_owner}:#{current_branch}"
85
- base = "#{repository.remote_by_name('upstream').project.owner}:#{request_rules.fetch(remote_branch.to_sym, '')}"
86
-
87
- head = options.head unless options.head.nil?
88
- base = options.base unless options.base.nil?
34
+ exit unless request.valid?
89
35
 
90
36
  # Запушим текущую ветку на origin
91
- # TODO Может быть лучше достать дерективу конфига origin?
92
- say "=> Обновляю ветку #{current_branch} на origin"
93
- Hub::Runner.execute('push', 'origin', current_branch)
37
+ say "=> Обновляю ветку #{request.current_branch} на origin"
38
+ Hub::Runner.execute('push', 'origin', request.current_branch)
94
39
 
95
40
  # Запостим pull request на upstream
96
- body = jira_browse_url + task if task =~ /^\w+\-\d{1,}$/
97
- body ||= 'Я забыл какая это задача :('
98
-
99
41
  say '=> Делаю pull request на upstream'
100
- result = api_client.create_pull_request("#{upstream_project.owner}/#{upstream_project.name}", base, head, title, body)
101
- say result._links.html.href
42
+ begin
43
+ result = github_client.create_pull_request(request.from_repo, request.base, request.head, request.title, request.body)
44
+ say color(result._links.html.href, :green).to_s
45
+ rescue => e
46
+ say color(e.message, :error).to_s
47
+ say "\nПроблемы? Попробуйте заглянуть сюда:"
48
+ say color('=> cписок кодов статуса ответа http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html', :info).to_s
49
+ end
102
50
  end
103
51
  end
104
52
 
@@ -109,20 +57,13 @@ module Abak::Flow
109
57
  c.option '--branch STRING', String, 'Имя ветки, которую нужно обновить'
110
58
 
111
59
  c.action do |args, options|
112
- HighLine.color_scheme = HighLine::SampleColorScheme.new
60
+ config = Abak::Flow::Config.current
61
+ request = Abak::Flow::PullRequest.new(config, :strategy => :update)
113
62
 
114
- repository = Hub::Commands.send :local_repo
115
- current_branch = repository.current_branch.short_name
116
-
117
- # Проверим, что у нас настроен origin
118
- if repository.remote_by_name('origin').nil?
119
- say color('Необходимо настроить репозиторий origin (форк) для текущего пользователя', :error).to_s
120
- say color('=> git remote add origin https://Developer@github.com/abak-press/sample.git', :info).to_s
121
- exit
122
- end
63
+ exit unless request.valid?
123
64
 
124
65
  # Запушим текущую ветку на origin
125
- branch = options.branch || current_branch
66
+ branch = options.branch || request.current_branch
126
67
  say "=> Обновляю ветку #{branch} на origin"
127
68
  Hub::Runner.execute('push', 'origin', branch)
128
69
  end
@@ -133,7 +74,7 @@ module Abak::Flow
133
74
  c.description = 'Создать ветку для выполнения задачи. Лучше всего, если название задачи, будет ее номером из jira'
134
75
 
135
76
  c.action do |args, options|
136
- HighLine.color_scheme = HighLine::SampleColorScheme.new
77
+ config = Abak::Flow::Config.current
137
78
 
138
79
  task = args.shift.to_s
139
80
 
@@ -155,7 +96,7 @@ module Abak::Flow
155
96
  c.description = 'Создать ветку для выполнения bugfix задачи. Лучше всего, если название задачи, будет ее номером из jira'
156
97
 
157
98
  c.action do |args, options|
158
- HighLine.color_scheme = HighLine::SampleColorScheme.new
99
+ config = Abak::Flow::Config.current
159
100
 
160
101
  task = args.shift.to_s
161
102
 
@@ -182,36 +123,30 @@ module Abak::Flow
182
123
  c.option '--origin', 'Удаляет ветку в удаленном репозитории (origin)'
183
124
 
184
125
  c.action do |args, options|
185
- HighLine.color_scheme = HighLine::SampleColorScheme.new
126
+ config = Abak::Flow::Config.current
127
+ request = Abak::Flow::PullRequest.new(config, :strategy => :done)
128
+ branch = options.branch || request.current_branch
186
129
 
187
- repository = Hub::Commands.send :local_repo
188
- current_branch = repository.current_branch.short_name
189
- branch = options.branch || current_branch
130
+ exit unless request.valid?
190
131
 
191
132
  type = :all
192
133
  if [options.local, options.origin].compact.count == 1
193
134
  type = options.local ? :local : :origin
194
135
  end
195
136
 
196
- if [:master, :develop].include? branch.to_sym
197
- say color('Извините, но нельзя удалить ветку develop или master', :error).to_s
198
- exit
199
- end
200
-
201
- warning = "Внимание! Alarm! Danger! Achtung\nЕсли вы удалите ветку на удаленном репозитории, а ваш pull request еще не приняли, вы рискуете потерять проделанную работу.\nВы уверены, что хотите продолжить?"
137
+ warning = color('Внимание! Alarm! Danger! Achtung!', :error).to_s +
138
+ "\nЕсли вы удалите ветку на удаленном (remote) репозитории, а ваш pull request еще не приняли, вы рискуете потерять проделанную работу.\nВы уверены, что хотите продолжить?"
202
139
  if [:all, :origin].include?(type)
203
140
  say '=> Вы приняли верное решение :)' && exit unless agree("#{warning} [y/n]:")
204
141
  end
205
142
 
206
- # @TODO Проверку на наличие ветки на origin
207
- if [:all, :origin].include? type
143
+ # TODO Проверку на наличие ветки на origin
144
+ if [:all, :origin].include?(type)
208
145
  say "=> Удаляю ветку #{branch} на origin"
209
- Hub::Runner.execute('push', repository.main_project.remote.name, ':' + branch)
146
+ Hub::Runner.execute('push', request.origin_repo, ':' + branch)
210
147
  end
211
148
 
212
- if [:all, :local].include? type
213
- remote_branch, task = current_branch.split('/').push(nil).map(&:to_s)
214
-
149
+ if [:all, :local].include?(type)
215
150
  say "=> Удаляю локальную ветку #{branch}"
216
151
  Hub::Runner.execute('checkout', 'develop')
217
152
  Hub::Runner.execute('branch', '-D', branch)
@@ -225,61 +160,17 @@ module Abak::Flow
225
160
  c.description = 'Проверить все ли настроено для работы с github и удаленным (origin) репозиторием'
226
161
 
227
162
  c.action do |args, options|
228
- HighLine.color_scheme = HighLine::SampleColorScheme.new
229
- repository = Hub::Commands.send :local_repo
230
- current_branch = repository.current_branch.short_name
231
-
232
- api_user = Hub::Commands.send(:git_reader).read_config('abak.apiuser').to_s
233
- api_token = Hub::Commands.send(:git_reader).read_config('abak.apitoken').to_s
234
- config_proxy = Hub::Commands.send(:git_reader).read_config('abak.proxy')
235
- env_proxy = ENV['http_proxy'] || ENV['HTTP_PROXY']
236
-
237
- errors = []
238
-
239
- # Проверим, что у нас настроен origin
240
- if repository.remote_by_name('origin').nil?
241
- errors << [
242
- 'Необходимо настроить репозиторий origin (форк) для текущего пользователя',
243
- '=> git remote add origin https://Developer@github.com/abak-press/sample.git'
244
- ]
245
- end
246
-
247
- # Проверим, что у нас настроен upstream
248
- if repository.remote_by_name('upstream').nil?
249
- errors << [
250
- 'Необходимо настроить репозиторий upstream (главный) для текущего пользователя',
251
- '=> git remote add upstream https://Developer@github.com/abak-press/sample.git'
252
- ]
253
- end
254
-
255
- # Проверим, что у нас указан апи юзер
256
- if api_user.empty?
257
- errors << [
258
- 'Необходимо указать своего пользователя API github',
259
- '=> https://github.com/Strech/abak-flow/blob/master/README.md'
260
- ]
261
- end
262
-
263
- # Проверим, что у нас указан токен
264
- if api_token.empty?
265
- errors << [
266
- 'Необходимо указать токен своего пользователя API github',
267
- '=> https://github.com/Strech/abak-flow/blob/master/README.md'
268
- ]
269
- end
163
+ config = Abak::Flow::Config.current
164
+ request = Abak::Flow::PullRequest.new(config, :strategy => :readycheck)
270
165
 
271
- if config_proxy || env_proxy
272
- message = "== В качестве прокси будет установлено значение #{config_proxy || env_proxy} =="
166
+ if config.proxy?
167
+ message = "== В качестве прокси будет установлено значение #{config.proxy} =="
273
168
  say color('=' * message.length, :info).to_s
274
169
  say color(message, :info).to_s
275
170
  say color('=' * message.length + "\n", :info).to_s
276
171
  end
277
172
 
278
- errors.each do |error|
279
- say "#{color(error.first, :error)}\n#{color(error.last, :info)}"
280
- end
281
-
282
- say color('Хм ... кажется у вас все готово к работе', :debug).to_s if errors.count.zero?
173
+ say color('Хм ... кажется у вас все готово к работе', :debug).to_s if request.valid?
283
174
  end
284
175
  end
285
176
  end
@@ -1,5 +1,5 @@
1
1
  module Abak
2
2
  module Flow
3
- VERSION = '0.2.3'
3
+ VERSION = '0.3.0'
4
4
  end
5
5
  end
data/lib/abak-flow.rb CHANGED
@@ -3,9 +3,17 @@ module Abak
3
3
  end
4
4
  end
5
5
 
6
+ require 'ostruct'
7
+ require 'forwardable'
8
+
6
9
  require 'hub'
7
10
  require 'highline'
8
11
  require 'octokit'
12
+
9
13
  require 'abak-flow/hub_extensions'
14
+ require 'abak-flow/config'
15
+ require 'abak-flow/github_client'
16
+ require 'abak-flow/pull_request'
10
17
  require 'abak-flow/version'
11
- require "commander/import"
18
+
19
+ require 'commander/import'
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: 0.2.3
4
+ version: 0.3.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-06-16 00:00:00.000000000 Z
12
+ date: 2012-09-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: hub
@@ -76,7 +76,10 @@ files:
76
76
  - abak-flow.gemspec
77
77
  - bin/request
78
78
  - lib/abak-flow.rb
79
+ - lib/abak-flow/config.rb
80
+ - lib/abak-flow/github_client.rb
79
81
  - lib/abak-flow/hub_extensions.rb
82
+ - lib/abak-flow/pull_request.rb
80
83
  - lib/abak-flow/request.rb
81
84
  - lib/abak-flow/version.rb
82
85
  homepage: https://github.com/Strech/abak-flow