papa 0.1.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.
- checksums.yaml +7 -0
- data/.gitignore +12 -0
- data/.rspec +2 -0
- data/.travis.yml +5 -0
- data/CHANGELOG.md +0 -0
- data/Gemfile +6 -0
- data/LICENSE.txt +21 -0
- data/README.md +39 -0
- data/Rakefile +6 -0
- data/exe/papa +6 -0
- data/lib/papa.rb +11 -0
- data/lib/papa/cli.rb +17 -0
- data/lib/papa/command.rb +42 -0
- data/lib/papa/command_queue.rb +34 -0
- data/lib/papa/common.rb +4 -0
- data/lib/papa/common/add.rb +62 -0
- data/lib/papa/common/finish.rb +56 -0
- data/lib/papa/common/start.rb +30 -0
- data/lib/papa/git.rb +62 -0
- data/lib/papa/git/checkout.rb +14 -0
- data/lib/papa/git/merge.rb +27 -0
- data/lib/papa/git/rebase.rb +27 -0
- data/lib/papa/hotfix.rb +37 -0
- data/lib/papa/hotfix/add.rb +9 -0
- data/lib/papa/hotfix/finish.rb +11 -0
- data/lib/papa/hotfix/start.rb +9 -0
- data/lib/papa/output.rb +13 -0
- data/lib/papa/release.rb +47 -0
- data/lib/papa/release/add.rb +9 -0
- data/lib/papa/release/finish.rb +10 -0
- data/lib/papa/release/patch.rb +30 -0
- data/lib/papa/release/start.rb +9 -0
- data/lib/papa/sandbox.rb +12 -0
- data/lib/papa/sandbox/branches/bugfix/4-fix-charmeleon-spelling/Gemfile +24 -0
- data/lib/papa/sandbox/branches/bugfix/5-fix-gem-source/Gemfile +24 -0
- data/lib/papa/sandbox/branches/feature/1-add-butterfree-gem/Gemfile +25 -0
- data/lib/papa/sandbox/branches/feature/2-add-beedrill-gem/Gemfile +25 -0
- data/lib/papa/sandbox/branches/feature/6-add-pidgeotto-gem/Gemfile +26 -0
- data/lib/papa/sandbox/branches/feature/7-add-pidgeot-gem/Gemfile +26 -0
- data/lib/papa/sandbox/branches/master/Gemfile +24 -0
- data/lib/papa/sandbox/branches/patch/17.8.0/3-add-pidgey-gem/Gemfile +26 -0
- data/lib/papa/sandbox/generate.rb +177 -0
- data/lib/papa/thor.rb +5 -0
- data/lib/papa/version.rb +3 -0
- data/papa.gemspec +31 -0
- metadata +145 -0
@@ -0,0 +1,14 @@
|
|
1
|
+
module Papa
|
2
|
+
class Git::Checkout < Command
|
3
|
+
def initialize(branch_name)
|
4
|
+
@branch_name = branch_name
|
5
|
+
command = "git checkout #{@branch_name}"
|
6
|
+
super(command)
|
7
|
+
end
|
8
|
+
|
9
|
+
def failure_message
|
10
|
+
super
|
11
|
+
Output.stderr "ERROR: Branch #{@branch_name} doesn't exist."
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Papa
|
2
|
+
class Git::Merge < Command
|
3
|
+
def initialize(branch_name)
|
4
|
+
@branch_name = branch_name
|
5
|
+
command = "git merge #{@branch_name} --no-ff"
|
6
|
+
super(command)
|
7
|
+
end
|
8
|
+
|
9
|
+
def run
|
10
|
+
current_branch # Store current branch before executing command
|
11
|
+
super
|
12
|
+
end
|
13
|
+
|
14
|
+
def cleanup
|
15
|
+
super
|
16
|
+
queue = CommandQueue.new
|
17
|
+
queue.add Git.merge_abort
|
18
|
+
queue.add Git.checkout(branch_name: current_branch)
|
19
|
+
queue.run
|
20
|
+
end
|
21
|
+
|
22
|
+
def failure_message
|
23
|
+
super
|
24
|
+
Output.stderr "ERROR: A merge conflict occurred while merging #{@branch_name} into #{current_branch}"
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Papa
|
2
|
+
class Git::Rebase < Command
|
3
|
+
def initialize(base_branch_name)
|
4
|
+
@base_branch_name = base_branch_name
|
5
|
+
command = "git rebase #{@base_branch_name}"
|
6
|
+
super(command)
|
7
|
+
end
|
8
|
+
|
9
|
+
def run
|
10
|
+
current_branch # Store current branch before executing command
|
11
|
+
super
|
12
|
+
end
|
13
|
+
|
14
|
+
def cleanup
|
15
|
+
super
|
16
|
+
queue = CommandQueue.new
|
17
|
+
queue.add Git.rebase_abort
|
18
|
+
queue.add Git.checkout(branch_name: current_branch)
|
19
|
+
queue.run
|
20
|
+
end
|
21
|
+
|
22
|
+
def failure_message
|
23
|
+
super
|
24
|
+
Output.stderr "ERROR: There was a problem rebasing #{current_branch} from #{@base_branch_name}"
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
data/lib/papa/hotfix.rb
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
module Papa
|
2
|
+
class Hotfix < Thor
|
3
|
+
desc 'start', 'Start a new hotfix branch'
|
4
|
+
option :version, aliases: '-v', required: true
|
5
|
+
def start
|
6
|
+
version = options[:version]
|
7
|
+
|
8
|
+
require 'papa/common/start'
|
9
|
+
require 'papa/hotfix/start'
|
10
|
+
Hotfix::Start.new(version: version).run
|
11
|
+
end
|
12
|
+
|
13
|
+
desc 'add', 'Add bugfix branches to a hotfix branch'
|
14
|
+
option :version, aliases: '-v', required: true
|
15
|
+
option :bugfix_branches, aliases: '-b', type: :array, required: true
|
16
|
+
def add
|
17
|
+
version = options[:version]
|
18
|
+
bugfix_branches = options[:bugfix_branches]
|
19
|
+
|
20
|
+
require 'papa/common/add'
|
21
|
+
require 'papa/hotfix/add'
|
22
|
+
Hotfix::Add.new(version: version, bugfix_branches: bugfix_branches).run
|
23
|
+
end
|
24
|
+
|
25
|
+
desc 'finish', 'Merge the hotfix branch to the base branches'
|
26
|
+
option :version, aliases: '-v', required: true
|
27
|
+
option :additional_branches, aliases: '-b', type: :array
|
28
|
+
def finish
|
29
|
+
version = options[:version]
|
30
|
+
additional_branches = options[:additional_branches]
|
31
|
+
|
32
|
+
require 'papa/common/finish'
|
33
|
+
require 'papa/hotfix/finish'
|
34
|
+
Hotfix::Finish.new(version: version, additional_branches: additional_branches).run
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
module Papa
|
2
|
+
class Hotfix::Finish < Common::Finish
|
3
|
+
def initialize(version:, additional_branches:)
|
4
|
+
@build_type = 'hotfix'
|
5
|
+
@version = version
|
6
|
+
additional_branches ||= []
|
7
|
+
@tag_name = version
|
8
|
+
@base_branches = ['develop', 'master'] + additional_branches
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
data/lib/papa/output.rb
ADDED
data/lib/papa/release.rb
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
module Papa
|
2
|
+
class Release < Thor
|
3
|
+
desc 'start', 'Start a new release branch'
|
4
|
+
option :version, aliases: '-v', required: true
|
5
|
+
def start
|
6
|
+
version = options[:version]
|
7
|
+
|
8
|
+
require 'papa/common/start'
|
9
|
+
require 'papa/release/start'
|
10
|
+
Release::Start.new(version: version).run
|
11
|
+
end
|
12
|
+
|
13
|
+
desc 'add', 'Add feature branches to a release branch'
|
14
|
+
option :version, aliases: '-v', required: true
|
15
|
+
option :feature_branches, aliases: '-b', type: :array, required: true
|
16
|
+
def add
|
17
|
+
version = options[:version]
|
18
|
+
feature_branches = options[:feature_branches]
|
19
|
+
|
20
|
+
require 'papa/common/add'
|
21
|
+
require 'papa/release/add'
|
22
|
+
Release::Add.new(version: version, feature_branches: feature_branches).run
|
23
|
+
end
|
24
|
+
|
25
|
+
desc 'finish', 'Merge the release branch to master and develop'
|
26
|
+
option :version, aliases: '-v', required: true
|
27
|
+
def finish
|
28
|
+
version = options[:version]
|
29
|
+
|
30
|
+
require 'papa/common/finish'
|
31
|
+
require 'papa/release/finish'
|
32
|
+
Release::Finish.new(version: version).run
|
33
|
+
end
|
34
|
+
|
35
|
+
# desc 'patch', 'Add a patch to release branch'
|
36
|
+
# option :version, aliases: '-v', required: true
|
37
|
+
# option :patch_branch, aliases: '-b', required: true
|
38
|
+
# def patch
|
39
|
+
# version = options[:version]
|
40
|
+
# patch_branch = options[:patch_branch]
|
41
|
+
#
|
42
|
+
# require 'papa/common/add'
|
43
|
+
# require 'papa/release/patch'
|
44
|
+
# Release::Patch.new(version: version, patch_branch: patch_branch).run
|
45
|
+
# end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module Papa
|
2
|
+
class Release::Patch < Common::Add
|
3
|
+
def initialize(version:, patch_branch:)
|
4
|
+
@build_type = 'release'
|
5
|
+
@version = version
|
6
|
+
@branches = [patch_branch]
|
7
|
+
end
|
8
|
+
|
9
|
+
# def run
|
10
|
+
# @build_branch = "#{@build_type}/#{@version}"
|
11
|
+
#
|
12
|
+
# queue = CommandQueue.new
|
13
|
+
# queue.add Git.fetch(remote: 'origin')
|
14
|
+
# queue.add Git.checkout(branch_name: @build_branch)
|
15
|
+
# queue.add Git.checkout(branch_name: @patch_branch)
|
16
|
+
# queue.add Git.rebase(base_branch_name: @build_branch)
|
17
|
+
# queue.add Git.checkout(branch_name: @build_branch)
|
18
|
+
# queue.add Git.merge(branch_name: @patch_branch)
|
19
|
+
# queue.run
|
20
|
+
#
|
21
|
+
# cleanup
|
22
|
+
# end
|
23
|
+
|
24
|
+
# def cleanup
|
25
|
+
# queue = CommandQueue.new
|
26
|
+
# @branches.each { |branch| queue.add Git.delete_branch(branch_name: branch) }
|
27
|
+
# queue.run
|
28
|
+
# end
|
29
|
+
end
|
30
|
+
end
|
data/lib/papa/sandbox.rb
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
module Papa
|
2
|
+
class Sandbox < Thor
|
3
|
+
desc 'generate', 'Generate a sandbox environment'
|
4
|
+
option :override_origin, aliases: '-o'
|
5
|
+
def generate
|
6
|
+
override_origin = options[:override_origin]
|
7
|
+
|
8
|
+
require 'papa/sandbox/generate'
|
9
|
+
Sandbox::Generate.new(override_origin: override_origin).run
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
source "https://pokemon.org"
|
3
|
+
|
4
|
+
git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
|
5
|
+
|
6
|
+
gem "bulbasaur"
|
7
|
+
gem "ivysaur"
|
8
|
+
gem "venusaur"
|
9
|
+
gem "charmander"
|
10
|
+
gem "charmeleon"
|
11
|
+
gem "charizard"
|
12
|
+
gem "squirtle"
|
13
|
+
gem "wartortle"
|
14
|
+
gem "blastoise"
|
15
|
+
|
16
|
+
group :development, :test do
|
17
|
+
gem "caterpie"
|
18
|
+
gem "metapod"
|
19
|
+
end
|
20
|
+
|
21
|
+
group :test do
|
22
|
+
gem "weedle"
|
23
|
+
gem "kakuna"
|
24
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
source "https://pokemon.org/rubygems"
|
3
|
+
|
4
|
+
git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
|
5
|
+
|
6
|
+
gem "bulbasaur"
|
7
|
+
gem "ivysaur"
|
8
|
+
gem "venusaur"
|
9
|
+
gem "charmander"
|
10
|
+
gem "charmelon"
|
11
|
+
gem "charizard"
|
12
|
+
gem "squirtle"
|
13
|
+
gem "wartortle"
|
14
|
+
gem "blastoise"
|
15
|
+
|
16
|
+
group :development, :test do
|
17
|
+
gem "caterpie"
|
18
|
+
gem "metapod"
|
19
|
+
end
|
20
|
+
|
21
|
+
group :test do
|
22
|
+
gem "weedle"
|
23
|
+
gem "kakuna"
|
24
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
source "https://pokemon.org"
|
3
|
+
|
4
|
+
git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
|
5
|
+
|
6
|
+
gem "bulbasaur"
|
7
|
+
gem "ivysaur"
|
8
|
+
gem "venusaur"
|
9
|
+
gem "charmander"
|
10
|
+
gem "charmelon"
|
11
|
+
gem "charizard"
|
12
|
+
gem "squirtle"
|
13
|
+
gem "wartortle"
|
14
|
+
gem "blastoise"
|
15
|
+
|
16
|
+
group :development, :test do
|
17
|
+
gem "caterpie"
|
18
|
+
gem "metapod"
|
19
|
+
gem "butterfree"
|
20
|
+
end
|
21
|
+
|
22
|
+
group :test do
|
23
|
+
gem "weedle"
|
24
|
+
gem "kakuna"
|
25
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
source "https://pokemon.org"
|
3
|
+
|
4
|
+
git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
|
5
|
+
|
6
|
+
gem "bulbasaur"
|
7
|
+
gem "ivysaur"
|
8
|
+
gem "venusaur"
|
9
|
+
gem "charmander"
|
10
|
+
gem "charmelon"
|
11
|
+
gem "charizard"
|
12
|
+
gem "squirtle"
|
13
|
+
gem "wartortle"
|
14
|
+
gem "blastoise"
|
15
|
+
|
16
|
+
group :development, :test do
|
17
|
+
gem "caterpie"
|
18
|
+
gem "metapod"
|
19
|
+
end
|
20
|
+
|
21
|
+
group :test do
|
22
|
+
gem "weedle"
|
23
|
+
gem "kakuna"
|
24
|
+
gem "beedrill"
|
25
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
source "https://pokemon.org"
|
3
|
+
|
4
|
+
git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
|
5
|
+
|
6
|
+
gem "bulbasaur"
|
7
|
+
gem "ivysaur"
|
8
|
+
gem "venusaur"
|
9
|
+
gem "charmander"
|
10
|
+
gem "charmelon"
|
11
|
+
gem "charizard"
|
12
|
+
gem "squirtle"
|
13
|
+
gem "wartortle"
|
14
|
+
gem "blastoise"
|
15
|
+
|
16
|
+
group :development, :test do
|
17
|
+
gem "caterpie"
|
18
|
+
gem "metapod"
|
19
|
+
end
|
20
|
+
|
21
|
+
group :test do
|
22
|
+
gem "weedle"
|
23
|
+
gem "kakuna"
|
24
|
+
end
|
25
|
+
|
26
|
+
gem "pidgeotto"
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
source "https://pokemon.org"
|
3
|
+
|
4
|
+
git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
|
5
|
+
|
6
|
+
gem "bulbasaur"
|
7
|
+
gem "ivysaur"
|
8
|
+
gem "venusaur"
|
9
|
+
gem "charmander"
|
10
|
+
gem "charmelon"
|
11
|
+
gem "charizard"
|
12
|
+
gem "squirtle"
|
13
|
+
gem "wartortle"
|
14
|
+
gem "blastoise"
|
15
|
+
|
16
|
+
group :development, :test do
|
17
|
+
gem "caterpie"
|
18
|
+
gem "metapod"
|
19
|
+
end
|
20
|
+
|
21
|
+
group :test do
|
22
|
+
gem "weedle"
|
23
|
+
gem "kakuna"
|
24
|
+
end
|
25
|
+
|
26
|
+
gem "pidgeot"
|