abak-flow 1.0.3 → 1.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +3 -4
- data/Rakefile +2 -10
- data/abak-flow.gemspec +5 -1
- data/bin/request +1 -0
- data/lib/abak-flow/branch.rb +47 -40
- data/lib/abak-flow/manager.rb +2 -2
- data/lib/abak-flow/request.rb +12 -12
- data/lib/abak-flow/version.rb +1 -1
- data/lib/abak-flow.rb +0 -5
- data/spec/lib/abak-flow/branch_spec.rb +230 -0
- data/spec/spec_helper.rb +5 -6
- metadata +52 -20
- data/spec/abak-flow/branch_spec.rb +0 -55
- data/spec/abak-flow/branches_spec.rb +0 -20
- data/spec/abak-flow/configuration_spec.rb +0 -73
- data/spec/abak-flow/git_spec.rb +0 -12
- data/spec/abak-flow/github_client_spec.rb +0 -15
- data/spec/abak-flow/messages_spec.rb +0 -146
- data/spec/abak-flow/project_spec.rb +0 -52
- data/spec/abak-flow/pull_request_spec.rb +0 -353
- data/spec/abak-flow/system_spec.rb +0 -97
data/.travis.yml
CHANGED
data/Rakefile
CHANGED
@@ -1,15 +1,12 @@
|
|
1
1
|
require "bundler/gem_tasks"
|
2
|
-
|
3
|
-
require "yard"
|
4
|
-
require "yard-tomdoc"
|
5
2
|
require "cane/rake_task"
|
6
3
|
require "rspec/core/rake_task"
|
7
4
|
|
8
5
|
desc "Ready check"
|
9
|
-
task default: [:quality, :coverage
|
6
|
+
task default: [:quality, :coverage]
|
10
7
|
|
11
8
|
RSpec::Core::RakeTask.new(:coverage) do |rspec|
|
12
|
-
ENV["
|
9
|
+
ENV["C"] = "true"
|
13
10
|
end
|
14
11
|
|
15
12
|
Cane::RakeTask.new(:quality) do |cane|
|
@@ -18,9 +15,4 @@ Cane::RakeTask.new(:quality) do |cane|
|
|
18
15
|
cane.style_exclude = %w({lib}/abak-flow/request.rb)
|
19
16
|
cane.style_measure = 120
|
20
17
|
cane.parallel = false
|
21
|
-
end
|
22
|
-
|
23
|
-
YARD::Rake::YardocTask.new(:doc) do |yard|
|
24
|
-
yard.files = %w({apps,models,lib}/**/*.rb)
|
25
|
-
yard.options = %w(--embed-mixins --protected --plugin tomdoc)
|
26
18
|
end
|
data/abak-flow.gemspec
CHANGED
@@ -21,10 +21,14 @@ Gem::Specification.new do |gem|
|
|
21
21
|
gem.require_paths = ["lib"]
|
22
22
|
|
23
23
|
gem.add_runtime_dependency "octokit", "~> 1.19.0"
|
24
|
-
gem.
|
24
|
+
gem.add_runtime_dependency "faraday", "= 0.8.9" # TODO : remove after octokit upgrade
|
25
25
|
gem.add_runtime_dependency "git", "~> 1.2.5"
|
26
26
|
gem.add_runtime_dependency "commander", ">= 4.1.3"
|
27
27
|
gem.add_runtime_dependency "ruler", ">= 1.4.2"
|
28
28
|
gem.add_runtime_dependency "i18n", ">= 0.6.1"
|
29
29
|
gem.add_runtime_dependency "ansi", ">= 1.4.3"
|
30
|
+
|
31
|
+
gem.add_development_dependency "cane"
|
32
|
+
gem.add_development_dependency "simplecov"
|
33
|
+
gem.add_development_dependency "rspec", "~> 2.14"
|
30
34
|
end
|
data/bin/request
CHANGED
data/lib/abak-flow/branch.rb
CHANGED
@@ -4,7 +4,9 @@ module Abak::Flow
|
|
4
4
|
class Branch
|
5
5
|
FOLDER_HOTFIX = "hotfix".freeze
|
6
6
|
FOLDER_FEATURE = "feature".freeze
|
7
|
-
TASK_FORMAT =
|
7
|
+
TASK_FORMAT = '\w+\-\d{1,}'.freeze
|
8
|
+
MAGICK_WORDS = %w{close closes closed fix fixes fixed
|
9
|
+
resolve resolves resolved}.freeze
|
8
10
|
|
9
11
|
DEVELOPMENT = "develop".freeze
|
10
12
|
MASTER = "master".freeze
|
@@ -14,27 +16,30 @@ module Abak::Flow
|
|
14
16
|
FOLDER_FEATURE => DEVELOPMENT
|
15
17
|
}.freeze
|
16
18
|
|
17
|
-
|
18
|
-
|
19
|
+
attr_reader :folder
|
20
|
+
attr_reader :task
|
21
|
+
|
22
|
+
def initialize(branch)
|
23
|
+
@manager = Manager.instance
|
19
24
|
@branch = branch.is_a?(Git::Branch) ? branch
|
20
|
-
: manager.git.branch(branch)
|
25
|
+
: @manager.git.branch(branch)
|
26
|
+
|
27
|
+
parse_branch_name
|
21
28
|
end
|
22
29
|
|
23
30
|
def name
|
24
31
|
@branch.full
|
25
32
|
end
|
26
33
|
|
27
|
-
# TODO : Брать коммит мессадж до перевода строки
|
28
34
|
def message
|
29
|
-
@branch.gcommit.message
|
30
|
-
|
35
|
+
content = @branch.gcommit.message.split("\n", 2).first
|
36
|
+
return content if content.length < 72
|
31
37
|
|
32
|
-
|
33
|
-
split_prefix_and_task.first
|
38
|
+
content[0...72] << "..."
|
34
39
|
end
|
35
40
|
|
36
|
-
def
|
37
|
-
|
41
|
+
def to_s
|
42
|
+
@branch.to_s
|
38
43
|
end
|
39
44
|
|
40
45
|
def compare_link(branch)
|
@@ -47,6 +52,25 @@ module Abak::Flow
|
|
47
52
|
]
|
48
53
|
end
|
49
54
|
|
55
|
+
def extract_base_name(options = Hash.new)
|
56
|
+
mappable? ? MAPPING[folder]
|
57
|
+
: options.fetch(:if_undef, name)
|
58
|
+
end
|
59
|
+
|
60
|
+
def extract_title
|
61
|
+
tracker_task? ? task
|
62
|
+
: message
|
63
|
+
end
|
64
|
+
|
65
|
+
# TODO : Сделать настраевыемым трекер и формат задачи
|
66
|
+
def extract_body
|
67
|
+
return I18n.t("commands.publish.nothing") if
|
68
|
+
tasks_from_commit_message.empty? && !tracker_task?
|
69
|
+
|
70
|
+
[tasks_from_commit_message, task].flatten
|
71
|
+
.map { |x| "http://jira.railsc.ru/browse/#{x}" } * "\n"
|
72
|
+
end
|
73
|
+
|
50
74
|
def update
|
51
75
|
origin = @manager.repository.origin.repo
|
52
76
|
@manager.git.push(origin, @branch)
|
@@ -61,30 +85,12 @@ module Abak::Flow
|
|
61
85
|
@branch.delete
|
62
86
|
end
|
63
87
|
|
64
|
-
def pick_up_base_name(options = Hash.new)
|
65
|
-
mappable? ? MAPPING[folder]
|
66
|
-
: options.fetch(:or_use, name)
|
67
|
-
end
|
68
|
-
|
69
|
-
def pick_up_title
|
70
|
-
tracker_task? ? task
|
71
|
-
: message
|
72
|
-
end
|
73
|
-
|
74
|
-
# TODO : Сделать настраевыемым трекер и формат задачи
|
75
|
-
# TODO : Смотреть в коммит мессадж и искать там Fixes/Closes/Close/Fix
|
76
|
-
def pick_up_body
|
77
|
-
head.mappable? &&
|
78
|
-
head.tracker_task? ? "http://jira.railsc.ru/browse/#{task}"
|
79
|
-
: I18n.t("commands.publish.nothing")
|
80
|
-
end
|
81
|
-
|
82
88
|
def develop?
|
83
|
-
|
89
|
+
name == DEVELOPMENT
|
84
90
|
end
|
85
91
|
|
86
92
|
def master?
|
87
|
-
|
93
|
+
name == MASTER
|
88
94
|
end
|
89
95
|
|
90
96
|
def hotfix?
|
@@ -96,7 +102,7 @@ module Abak::Flow
|
|
96
102
|
end
|
97
103
|
|
98
104
|
def tracker_task?
|
99
|
-
!(task =~ TASK_FORMAT).nil?
|
105
|
+
!(task =~ /^#{TASK_FORMAT}$/).nil?
|
100
106
|
end
|
101
107
|
|
102
108
|
def mappable?
|
@@ -111,18 +117,19 @@ module Abak::Flow
|
|
111
117
|
!@branch.name.empty?
|
112
118
|
end
|
113
119
|
|
114
|
-
def to_s
|
115
|
-
@branch.to_s
|
116
|
-
end
|
117
|
-
|
118
120
|
private
|
119
|
-
def
|
120
|
-
|
121
|
+
def tasks_from_commit_message
|
122
|
+
@parsed_tasks ||=
|
123
|
+
@branch.gcommit.message
|
124
|
+
.scan(/(?:#{MAGICK_WORDS * "|"})\s+(#{TASK_FORMAT})/i)
|
125
|
+
.reject { |x| x == task.to_s }
|
126
|
+
end
|
121
127
|
|
128
|
+
def parse_branch_name
|
122
129
|
matches = name.match(/^(?<prefix>.+)\/(?<task>.+)$/)
|
123
130
|
|
124
|
-
@
|
125
|
-
|
131
|
+
@folder, @task = matches.nil? ? [nil, nil]
|
132
|
+
: [matches[:prefix], matches[:task]]
|
126
133
|
end
|
127
134
|
end
|
128
135
|
end
|
data/lib/abak-flow/manager.rb
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
require "git"
|
3
3
|
require "octokit"
|
4
|
+
require "singleton"
|
4
5
|
|
5
6
|
module Abak::Flow
|
6
7
|
class Manager
|
8
|
+
include Singleton
|
7
9
|
|
8
10
|
def initialize
|
9
11
|
# preload dependencies
|
10
12
|
configuration
|
11
13
|
repository
|
12
|
-
|
13
|
-
yield self if block_given?
|
14
14
|
end
|
15
15
|
|
16
16
|
def configuration
|
data/lib/abak-flow/request.rb
CHANGED
@@ -15,7 +15,7 @@ module Abak::Flow
|
|
15
15
|
c.description = "Проверить все ли настроено для работы с github и удаленными репозиториями"
|
16
16
|
|
17
17
|
c.action do |args, options|
|
18
|
-
m = Manager.
|
18
|
+
m = Manager.instance
|
19
19
|
v = Visitor.new(m.configuration, m.repository, call: :ready?, inspect: :errors)
|
20
20
|
v.exit_on_fail(:checkup, 1)
|
21
21
|
|
@@ -31,13 +31,13 @@ module Abak::Flow
|
|
31
31
|
c.option "--head STRING", String, "Имя ветки которую нужно сравнить"
|
32
32
|
|
33
33
|
c.action do |args, options|
|
34
|
-
m = Manager.
|
34
|
+
m = Manager.instance
|
35
35
|
v = Visitor.new(m.configuration, m.repository, call: :ready?, inspect: :errors)
|
36
36
|
v.exit_on_fail(:compare, 1)
|
37
37
|
|
38
38
|
current = m.git.current_branch
|
39
|
-
head = Branch.new(options.head || current
|
40
|
-
base = Branch.new(options.base || head.
|
39
|
+
head = Branch.new(options.head || current)
|
40
|
+
base = Branch.new(options.base || head.extract_base_name)
|
41
41
|
|
42
42
|
if head.current?
|
43
43
|
say ANSI.white {
|
@@ -65,13 +65,13 @@ module Abak::Flow
|
|
65
65
|
c.option "--base STRING", String, "Имя ветки, в которую нужно принять изменения"
|
66
66
|
|
67
67
|
c.action do |args, options|
|
68
|
-
m = Manager.
|
68
|
+
m = Manager.instance
|
69
69
|
|
70
|
-
head = Branch.new(m.git.current_branch
|
71
|
-
base = Branch.new(options.base || head.
|
70
|
+
head = Branch.new(m.git.current_branch)
|
71
|
+
base = Branch.new(options.base || head.extract_base_name)
|
72
72
|
|
73
|
-
title = options.title || head.
|
74
|
-
body = options.body || head.
|
73
|
+
title = options.title || head.extract_title
|
74
|
+
body = options.body || head.extract_body
|
75
75
|
|
76
76
|
p = PullRequest.new({base: base, head: head, title: title, body: body}, m)
|
77
77
|
|
@@ -102,11 +102,11 @@ module Abak::Flow
|
|
102
102
|
c.description = "Удалить ветки (local и origin) в которых велась работа"
|
103
103
|
|
104
104
|
c.action do |args, options|
|
105
|
-
m = Manager.
|
105
|
+
m = Manager.instance
|
106
106
|
v = Visitor.new(m.configuration, m.repository, call: :ready?, inspect: :errors)
|
107
107
|
v.exit_on_fail(:done, 1)
|
108
108
|
|
109
|
-
branch = Branch.new(m.git.current_branch
|
109
|
+
branch = Branch.new(m.git.current_branch)
|
110
110
|
|
111
111
|
if branch.develop? || branch.master?
|
112
112
|
say ANSI.red {
|
@@ -137,7 +137,7 @@ module Abak::Flow
|
|
137
137
|
# и позволить выбирать, куда отправлять
|
138
138
|
# при удалении ветки, а по умолчанию использовать master
|
139
139
|
m.git.checkout(
|
140
|
-
branch.
|
140
|
+
branch.extract_base_name(if_undef: Branch::DEVELOPMENT))
|
141
141
|
branch.delete_on_local
|
142
142
|
end
|
143
143
|
end # command :done
|
data/lib/abak-flow/version.rb
CHANGED
data/lib/abak-flow.rb
CHANGED
@@ -1,14 +1,9 @@
|
|
1
|
-
module Abak
|
2
|
-
module Flow; end
|
3
|
-
end
|
4
|
-
|
5
1
|
require "abak-flow/version" # ✔
|
6
2
|
require "abak-flow/manager" # ✔
|
7
3
|
require "abak-flow/configuration" # ✔
|
8
4
|
require "abak-flow/repository" # ✔
|
9
5
|
require "abak-flow/branch" # ?
|
10
6
|
require "abak-flow/pull_request" # ?
|
11
|
-
require "abak-flow/request" # ?
|
12
7
|
require "abak-flow/visitor" # ✔
|
13
8
|
|
14
9
|
|
@@ -0,0 +1,230 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
require "spec_helper"
|
3
|
+
|
4
|
+
describe Abak::Flow::Branch do
|
5
|
+
let(:git_develop) { double("Develop", name: "develop", full: "develop") }
|
6
|
+
let(:git_master) { double("Master", name: "master", full: "master") }
|
7
|
+
let(:git_hotfix) { double("Hotfix", name: "hotfix/PR-2011", full: "hotfix/PR-2011") }
|
8
|
+
let(:git_feature) { double("Feature", name: "feature/JP-515", full: "feature/JP-515") }
|
9
|
+
let(:git_noname) { double("Noname", name: "my/own/name", full: "my/own/name") }
|
10
|
+
|
11
|
+
let(:develop) { described_class.new git_develop }
|
12
|
+
let(:master) { described_class.new git_master }
|
13
|
+
let(:hotfix) { described_class.new git_hotfix }
|
14
|
+
let(:feature) { described_class.new git_feature }
|
15
|
+
let(:noname) { described_class.new git_noname }
|
16
|
+
|
17
|
+
let(:manager) { double("Manager", git: git) }
|
18
|
+
let(:git) { double("Git") }
|
19
|
+
|
20
|
+
before do
|
21
|
+
Abak::Flow::Manager.stub(:instance).and_return manager
|
22
|
+
|
23
|
+
git.stub(:branch) { |x| x }
|
24
|
+
end
|
25
|
+
|
26
|
+
describe "#name" do
|
27
|
+
it { expect(feature.name).to eq "feature/JP-515" }
|
28
|
+
it { expect(develop.name).to eq "develop" }
|
29
|
+
it { expect(noname.name).to eq "my/own/name" }
|
30
|
+
end
|
31
|
+
|
32
|
+
describe "#folder" do
|
33
|
+
it { expect(develop.folder).to be_nil }
|
34
|
+
it { expect(hotfix.folder).to eq "hotfix" }
|
35
|
+
it { expect(feature.folder).to eq "feature" }
|
36
|
+
it { expect(noname.folder).to eq "my/own" }
|
37
|
+
end
|
38
|
+
|
39
|
+
describe "#task" do
|
40
|
+
it { expect(develop.task).to be_nil }
|
41
|
+
it { expect(feature.task).to eq "JP-515" }
|
42
|
+
it { expect(noname.task).to eq "name" }
|
43
|
+
end
|
44
|
+
|
45
|
+
describe "#hotfix?" do
|
46
|
+
it { expect(develop.hotfix?).to be_false }
|
47
|
+
it { expect(noname.hotfix?).to be_false }
|
48
|
+
it { expect(feature.hotfix?).to be_false }
|
49
|
+
it { expect(hotfix.hotfix?).to be_true }
|
50
|
+
end
|
51
|
+
|
52
|
+
describe "#feature?" do
|
53
|
+
it { expect(master.feature?).to be_false }
|
54
|
+
it { expect(noname.feature?).to be_false }
|
55
|
+
it { expect(hotfix.feature?).to be_false }
|
56
|
+
it { expect(feature.feature?).to be_true }
|
57
|
+
end
|
58
|
+
|
59
|
+
describe "#master?" do
|
60
|
+
it { expect(master.master?).to be_true }
|
61
|
+
it { expect(noname.master?).to be_false }
|
62
|
+
it { expect(develop.master?).to be_false }
|
63
|
+
end
|
64
|
+
|
65
|
+
describe "#develop?" do
|
66
|
+
it { expect(develop.develop?).to be_true }
|
67
|
+
it { expect(noname.develop?).to be_false }
|
68
|
+
it { expect(master.develop?).to be_false }
|
69
|
+
end
|
70
|
+
|
71
|
+
describe "#tracker_task?" do
|
72
|
+
it { expect(develop.tracker_task?).to be_false }
|
73
|
+
it { expect(noname.tracker_task?).to be_false }
|
74
|
+
it { expect(hotfix.tracker_task?).to be_true }
|
75
|
+
it { expect(feature.tracker_task?).to be_true }
|
76
|
+
end
|
77
|
+
|
78
|
+
describe "#mappable?" do
|
79
|
+
it { expect(develop.mappable?).to be_false }
|
80
|
+
it { expect(noname.mappable?).to be_false }
|
81
|
+
it { expect(hotfix.mappable?).to be_true }
|
82
|
+
it { expect(feature.mappable?).to be_true }
|
83
|
+
end
|
84
|
+
|
85
|
+
describe "#valid?" do
|
86
|
+
it { expect(develop.valid?).to be_true }
|
87
|
+
it { expect(noname.valid?).to be_true }
|
88
|
+
it do
|
89
|
+
branch = double("Branch", name: "", full: "")
|
90
|
+
expect(described_class.new(branch).valid?).to be_false
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
describe "#current?" do
|
95
|
+
before do
|
96
|
+
git_develop.stub(:current).and_return true
|
97
|
+
git_master.stub(:current).and_return false
|
98
|
+
end
|
99
|
+
|
100
|
+
it { expect(develop.current?).to be_true }
|
101
|
+
it { expect(master.current?).to be_false }
|
102
|
+
end
|
103
|
+
|
104
|
+
describe "#to_s" do
|
105
|
+
before { git_develop.stub(:to_s).and_return "Yap!" }
|
106
|
+
it { expect(develop.to_s).to eq "Yap!" }
|
107
|
+
end
|
108
|
+
|
109
|
+
describe "#message" do
|
110
|
+
before { git_noname.stub(:gcommit).and_return gcommit }
|
111
|
+
|
112
|
+
context "when git commit is a short single line" do
|
113
|
+
let(:gcommit) { double("Git commit", message: "Hello commit message") }
|
114
|
+
|
115
|
+
it { expect(noname.message).to eq "Hello commit message" }
|
116
|
+
end
|
117
|
+
|
118
|
+
context "when git commit is a very long single line" do
|
119
|
+
let(:gcommit) { double("Git commit", message: "X" * 200) }
|
120
|
+
|
121
|
+
it { expect(noname.message.length).to eq 75 }
|
122
|
+
it { expect(noname.message).to include "..." }
|
123
|
+
end
|
124
|
+
|
125
|
+
context "when git commit is a short multi line" do
|
126
|
+
let(:message) { "Hello commit message\n\nFixes PC4-100" }
|
127
|
+
let(:gcommit) { double("Git commit", message: message) }
|
128
|
+
|
129
|
+
it { expect(noname.message).to eq "Hello commit message" }
|
130
|
+
end
|
131
|
+
|
132
|
+
context "when git commit is a very long multi line" do
|
133
|
+
let(:message) { "#{'X' * 200}\n\nFixes PC4-100" }
|
134
|
+
let(:gcommit) { double("Git commit", message: message) }
|
135
|
+
|
136
|
+
it { expect(noname.message.length).to eq 75 }
|
137
|
+
it { expect(noname.message).to include "..." }
|
138
|
+
end
|
139
|
+
end
|
140
|
+
|
141
|
+
describe "#extract_title" do
|
142
|
+
let(:message) { "Hello world!\n\nFixes PC4-100" }
|
143
|
+
let(:gcommit) { double("Git commit", message: message) }
|
144
|
+
|
145
|
+
context "when branch named not like tracker task" do
|
146
|
+
before { git_noname.stub(:gcommit).and_return gcommit }
|
147
|
+
|
148
|
+
it { expect(noname.extract_title).to eq "Hello world!" }
|
149
|
+
end
|
150
|
+
|
151
|
+
context "when branch named not like tracker task" do
|
152
|
+
before { git_feature.stub(:gcommit).and_return gcommit }
|
153
|
+
|
154
|
+
it { expect(feature.extract_title).to eq "JP-515" }
|
155
|
+
end
|
156
|
+
end
|
157
|
+
|
158
|
+
describe "#extract_base_name" do
|
159
|
+
context "when no options are given" do
|
160
|
+
it { expect(master.extract_base_name).to eq "master" }
|
161
|
+
it { expect(develop.extract_base_name).to eq "develop" }
|
162
|
+
it { expect(hotfix.extract_base_name).to eq "master" }
|
163
|
+
it { expect(feature.extract_base_name).to eq "develop" }
|
164
|
+
it { expect(noname.extract_base_name).to eq "my/own/name" }
|
165
|
+
end
|
166
|
+
|
167
|
+
context "when if_undef option is given" do
|
168
|
+
it { expect(hotfix.extract_base_name(if_undef: "foo")).to eq "master" }
|
169
|
+
it { expect(master.extract_base_name(if_undef: "foo")).to eq "foo" }
|
170
|
+
it { expect(noname.extract_base_name(if_undef: "foo")).to eq "foo" }
|
171
|
+
end
|
172
|
+
end
|
173
|
+
|
174
|
+
describe "#extract_body" do
|
175
|
+
before { I18n.stub(:t).with("commands.publish.nothing").and_return "Empty!" }
|
176
|
+
|
177
|
+
context "when commit message has no magick words" do
|
178
|
+
let(:gcommit) { double("Git commit", message: "Hello world") }
|
179
|
+
|
180
|
+
before do
|
181
|
+
git_feature.stub(:gcommit).and_return gcommit
|
182
|
+
git_hotfix.stub(:gcommit).and_return gcommit
|
183
|
+
git_master.stub(:gcommit).and_return gcommit
|
184
|
+
git_develop.stub(:gcommit).and_return gcommit
|
185
|
+
git_noname.stub(:gcommit).and_return gcommit
|
186
|
+
end
|
187
|
+
|
188
|
+
it { expect(feature.extract_body).to eq "http://jira.railsc.ru/browse/JP-515" }
|
189
|
+
it { expect(hotfix.extract_body).to eq "http://jira.railsc.ru/browse/PR-2011" }
|
190
|
+
it { expect(master.extract_body).to eq "Empty!" }
|
191
|
+
it { expect(develop.extract_body).to eq "Empty!" }
|
192
|
+
it { expect(noname.extract_body).to eq "Empty!" }
|
193
|
+
|
194
|
+
it do
|
195
|
+
branch = double("Branch", name: "feature/ho-ho-ho", full: "feature/ho-ho-ho")
|
196
|
+
branch.stub(:gcommit).and_return gcommit
|
197
|
+
|
198
|
+
expect(described_class.new(branch).extract_body).to eq "Empty!"
|
199
|
+
end
|
200
|
+
|
201
|
+
it do
|
202
|
+
branch = double("Branch", name: "ho-ho-ho/PC4-10202", full: "ho-ho-ho/PC4-10202")
|
203
|
+
branch.stub(:gcommit).and_return gcommit
|
204
|
+
|
205
|
+
expect(described_class.new(branch).extract_body).to eq "http://jira.railsc.ru/browse/PC4-10202"
|
206
|
+
end
|
207
|
+
end
|
208
|
+
|
209
|
+
context "when commit message has magick word" do
|
210
|
+
context "when branch is task" do
|
211
|
+
let(:gcommit) { double("Git commit", message: "Fix PC4-200") }
|
212
|
+
|
213
|
+
before { git_feature.stub(:gcommit).and_return gcommit }
|
214
|
+
|
215
|
+
it { expect(feature.extract_body).to include "http://jira.railsc.ru/browse/JP-515" }
|
216
|
+
it { expect(feature.extract_body).to include "http://jira.railsc.ru/browse/PC4-200" }
|
217
|
+
end
|
218
|
+
|
219
|
+
context "when branch is not task" do
|
220
|
+
let(:gcommit) { double("Git commit", message: "Fix PC4-200, PC5-111\n\nCloses PC2-1122") }
|
221
|
+
|
222
|
+
before { git_master.stub(:gcommit).and_return gcommit }
|
223
|
+
|
224
|
+
it { expect(master.extract_body).to include "http://jira.railsc.ru/browse/PC4-200" }
|
225
|
+
it { expect(master.extract_body).to include "http://jira.railsc.ru/browse/PC2-1122" }
|
226
|
+
it { expect(master.extract_body).not_to include "PC5-111" }
|
227
|
+
end
|
228
|
+
end
|
229
|
+
end
|
230
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,17 +1,16 @@
|
|
1
1
|
# coding: utf-8
|
2
|
-
if ENV["
|
2
|
+
if ENV["C"]
|
3
3
|
require "simplecov"
|
4
4
|
|
5
|
-
SimpleCov.
|
6
|
-
SimpleCov.start :test_frameworks do
|
5
|
+
SimpleCov.start do
|
7
6
|
add_filter "/spec/"
|
8
7
|
end
|
9
8
|
end
|
10
9
|
|
11
10
|
require "abak-flow"
|
12
11
|
|
13
|
-
Dir["spec/support/**/*.rb"].sort.each { |f| require f }
|
14
|
-
|
15
12
|
RSpec.configure do |config|
|
16
|
-
|
13
|
+
config.formatter = :progress
|
14
|
+
config.order = :random
|
15
|
+
config.color = true
|
17
16
|
end
|
metadata
CHANGED
@@ -2,14 +2,14 @@
|
|
2
2
|
name: abak-flow
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 1.0.
|
5
|
+
version: 1.0.4
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Strech (aka Sergey Fedorov)
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-02-
|
12
|
+
date: 2014-02-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: octokit
|
@@ -123,6 +123,54 @@ dependencies:
|
|
123
123
|
version: 1.4.3
|
124
124
|
type: :runtime
|
125
125
|
prerelease: false
|
126
|
+
- !ruby/object:Gem::Dependency
|
127
|
+
name: cane
|
128
|
+
version_requirements: !ruby/object:Gem::Requirement
|
129
|
+
none: false
|
130
|
+
requirements:
|
131
|
+
- - ! '>='
|
132
|
+
- !ruby/object:Gem::Version
|
133
|
+
version: '0'
|
134
|
+
requirement: !ruby/object:Gem::Requirement
|
135
|
+
none: false
|
136
|
+
requirements:
|
137
|
+
- - ! '>='
|
138
|
+
- !ruby/object:Gem::Version
|
139
|
+
version: '0'
|
140
|
+
type: :development
|
141
|
+
prerelease: false
|
142
|
+
- !ruby/object:Gem::Dependency
|
143
|
+
name: simplecov
|
144
|
+
version_requirements: !ruby/object:Gem::Requirement
|
145
|
+
none: false
|
146
|
+
requirements:
|
147
|
+
- - ! '>='
|
148
|
+
- !ruby/object:Gem::Version
|
149
|
+
version: '0'
|
150
|
+
requirement: !ruby/object:Gem::Requirement
|
151
|
+
none: false
|
152
|
+
requirements:
|
153
|
+
- - ! '>='
|
154
|
+
- !ruby/object:Gem::Version
|
155
|
+
version: '0'
|
156
|
+
type: :development
|
157
|
+
prerelease: false
|
158
|
+
- !ruby/object:Gem::Dependency
|
159
|
+
name: rspec
|
160
|
+
version_requirements: !ruby/object:Gem::Requirement
|
161
|
+
none: false
|
162
|
+
requirements:
|
163
|
+
- - ~>
|
164
|
+
- !ruby/object:Gem::Version
|
165
|
+
version: '2.14'
|
166
|
+
requirement: !ruby/object:Gem::Requirement
|
167
|
+
none: false
|
168
|
+
requirements:
|
169
|
+
- - ~>
|
170
|
+
- !ruby/object:Gem::Version
|
171
|
+
version: '2.14'
|
172
|
+
type: :development
|
173
|
+
prerelease: false
|
126
174
|
description: Простой набор правил и комманд, заточеных для работы в git-flow с использование
|
127
175
|
в качестве удаленного репозитория github
|
128
176
|
email:
|
@@ -150,15 +198,7 @@ files:
|
|
150
198
|
- lib/abak-flow/request.rb
|
151
199
|
- lib/abak-flow/version.rb
|
152
200
|
- lib/abak-flow/visitor.rb
|
153
|
-
- spec/abak-flow/branch_spec.rb
|
154
|
-
- spec/abak-flow/branches_spec.rb
|
155
|
-
- spec/abak-flow/configuration_spec.rb
|
156
|
-
- spec/abak-flow/git_spec.rb
|
157
|
-
- spec/abak-flow/github_client_spec.rb
|
158
|
-
- spec/abak-flow/messages_spec.rb
|
159
|
-
- spec/abak-flow/project_spec.rb
|
160
|
-
- spec/abak-flow/pull_request_spec.rb
|
161
|
-
- spec/abak-flow/system_spec.rb
|
201
|
+
- spec/lib/abak-flow/branch_spec.rb
|
162
202
|
- spec/spec_helper.rb
|
163
203
|
homepage: https://github.com/Strech/abak-flow
|
164
204
|
licenses:
|
@@ -186,13 +226,5 @@ signing_key:
|
|
186
226
|
specification_version: 3
|
187
227
|
summary: Совмещение 2-х подходов разработки Git-flow & Github-flow
|
188
228
|
test_files:
|
189
|
-
- spec/abak-flow/branch_spec.rb
|
190
|
-
- spec/abak-flow/branches_spec.rb
|
191
|
-
- spec/abak-flow/configuration_spec.rb
|
192
|
-
- spec/abak-flow/git_spec.rb
|
193
|
-
- spec/abak-flow/github_client_spec.rb
|
194
|
-
- spec/abak-flow/messages_spec.rb
|
195
|
-
- spec/abak-flow/project_spec.rb
|
196
|
-
- spec/abak-flow/pull_request_spec.rb
|
197
|
-
- spec/abak-flow/system_spec.rb
|
229
|
+
- spec/lib/abak-flow/branch_spec.rb
|
198
230
|
- spec/spec_helper.rb
|