zenflow 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +6 -0
- data/.rspec +2 -0
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/.zenflow +10 -0
- data/CHANGELOG.md +0 -0
- data/Gemfile +3 -0
- data/Gemfile.lock +95 -0
- data/Guardfile +6 -0
- data/LICENSE.md +22 -0
- data/README.markdown +92 -0
- data/VERSION.yml +5 -0
- data/bin/zenflow +17 -0
- data/lib/zenflow.rb +35 -0
- data/lib/zenflow/cli.rb +130 -0
- data/lib/zenflow/commands/deploy.rb +33 -0
- data/lib/zenflow/commands/feature.rb +10 -0
- data/lib/zenflow/commands/hotfix.rb +15 -0
- data/lib/zenflow/commands/release.rb +16 -0
- data/lib/zenflow/commands/reviews.rb +12 -0
- data/lib/zenflow/helpers/ask.rb +66 -0
- data/lib/zenflow/helpers/branch.rb +80 -0
- data/lib/zenflow/helpers/branch_command.rb +95 -0
- data/lib/zenflow/helpers/branch_commands/abort.rb +21 -0
- data/lib/zenflow/helpers/branch_commands/branches.rb +21 -0
- data/lib/zenflow/helpers/branch_commands/compare.rb +20 -0
- data/lib/zenflow/helpers/branch_commands/deploy.rb +29 -0
- data/lib/zenflow/helpers/branch_commands/diff.rb +19 -0
- data/lib/zenflow/helpers/branch_commands/finish.rb +68 -0
- data/lib/zenflow/helpers/branch_commands/review.rb +58 -0
- data/lib/zenflow/helpers/branch_commands/start.rb +39 -0
- data/lib/zenflow/helpers/branch_commands/update.rb +22 -0
- data/lib/zenflow/helpers/changelog.rb +100 -0
- data/lib/zenflow/helpers/config.rb +36 -0
- data/lib/zenflow/helpers/github.rb +40 -0
- data/lib/zenflow/helpers/help.rb +37 -0
- data/lib/zenflow/helpers/log.rb +21 -0
- data/lib/zenflow/helpers/pull_request.rb +68 -0
- data/lib/zenflow/helpers/repo.rb +13 -0
- data/lib/zenflow/helpers/shell.rb +89 -0
- data/lib/zenflow/helpers/version.rb +87 -0
- data/lib/zenflow/version.rb +3 -0
- data/spec/fixtures/VERSION.yml +5 -0
- data/spec/fixtures/cassettes/create_bad_pull_request.yml +57 -0
- data/spec/fixtures/cassettes/create_pull_request.yml +68 -0
- data/spec/fixtures/cassettes/existing_pull_request.yml +145 -0
- data/spec/fixtures/cassettes/pull_request_by_ref.yml +145 -0
- data/spec/fixtures/cassettes/pull_request_find.yml +70 -0
- data/spec/fixtures/cassettes/pull_request_for_non-existent_ref.yml +145 -0
- data/spec/fixtures/cassettes/pull_request_list.yml +74 -0
- data/spec/fixtures/cassettes/unexisting_pull_request.yml +145 -0
- data/spec/spec_helper.rb +36 -0
- data/spec/support/shared_examples_for_version_number.rb +19 -0
- data/spec/zenflow/commands/deploy_spec.rb +48 -0
- data/spec/zenflow/commands/feature_spec.rb +11 -0
- data/spec/zenflow/commands/hotfix_spec.rb +14 -0
- data/spec/zenflow/commands/release_spec.rb +15 -0
- data/spec/zenflow/commands/reviews_spec.rb +15 -0
- data/spec/zenflow/helpers/ask_spec.rb +115 -0
- data/spec/zenflow/helpers/branch_command_spec.rb +310 -0
- data/spec/zenflow/helpers/branch_spec.rb +300 -0
- data/spec/zenflow/helpers/changelog_spec.rb +188 -0
- data/spec/zenflow/helpers/cli_spec.rb +277 -0
- data/spec/zenflow/helpers/github_spec.rb +45 -0
- data/spec/zenflow/helpers/help_spec.rb +36 -0
- data/spec/zenflow/helpers/log_spec.rb +31 -0
- data/spec/zenflow/helpers/pull_request_spec.rb +108 -0
- data/spec/zenflow/helpers/shell_spec.rb +135 -0
- data/spec/zenflow/helpers/version_spec.rb +111 -0
- data/zenflow.gemspec +33 -0
- metadata +273 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 0a0a86e94828d1a8dc8cf6d84367463efcfd4a6c
|
4
|
+
data.tar.gz: b3544bd8cb5bc89fc525ce06a72bf4853e7c36e2
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 70da301341826b7fb54e659722e231bbbf7656ce1291c699dc3ed973e20b2cdf8492a13b423f50bd5af00142dcb670bfca6c9ac3520b40f3018d83d8c93137a1
|
7
|
+
data.tar.gz: b8e6fa22c96321a2b56ee1140e0ac4413472959844fba16f17c01d60597f7b944af50d5707e153c8f540b38464933e4ddbe517493780c6bde72dc24c4ae65e2b
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.ruby-gemset
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
zenflow
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.0.0
|
data/.zenflow
ADDED
data/CHANGELOG.md
ADDED
File without changes
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,95 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
zenflow (0.8.0)
|
5
|
+
colored (~> 1.2)
|
6
|
+
httparty (~> 0.11.0)
|
7
|
+
terminal-table (~> 1.4.5)
|
8
|
+
thor (~> 0.18.1)
|
9
|
+
|
10
|
+
GEM
|
11
|
+
remote: http://rubygems.org/
|
12
|
+
specs:
|
13
|
+
addressable (2.3.5)
|
14
|
+
coderay (1.0.9)
|
15
|
+
colored (1.2)
|
16
|
+
columnize (0.3.6)
|
17
|
+
crack (0.4.0)
|
18
|
+
safe_yaml (~> 0.9.0)
|
19
|
+
debugger (1.6.1)
|
20
|
+
columnize (>= 0.3.1)
|
21
|
+
debugger-linecache (~> 1.2.0)
|
22
|
+
debugger-ruby_core_source (~> 1.2.3)
|
23
|
+
debugger-linecache (1.2.0)
|
24
|
+
debugger-ruby_core_source (1.2.3)
|
25
|
+
diff-lcs (1.2.4)
|
26
|
+
ffi (1.9.0)
|
27
|
+
formatador (0.2.4)
|
28
|
+
fuubar (1.1.1)
|
29
|
+
rspec (~> 2.0)
|
30
|
+
rspec-instafail (~> 0.2.0)
|
31
|
+
ruby-progressbar (~> 1.0)
|
32
|
+
guard (1.8.1)
|
33
|
+
formatador (>= 0.2.4)
|
34
|
+
listen (>= 1.0.0)
|
35
|
+
lumberjack (>= 1.0.2)
|
36
|
+
pry (>= 0.9.10)
|
37
|
+
thor (>= 0.14.6)
|
38
|
+
guard-rspec (3.0.2)
|
39
|
+
guard (>= 1.8)
|
40
|
+
rspec (~> 2.13)
|
41
|
+
httparty (0.11.0)
|
42
|
+
multi_json (~> 1.0)
|
43
|
+
multi_xml (>= 0.5.2)
|
44
|
+
listen (1.2.2)
|
45
|
+
rb-fsevent (>= 0.9.3)
|
46
|
+
rb-inotify (>= 0.9)
|
47
|
+
rb-kqueue (>= 0.2)
|
48
|
+
lumberjack (1.0.4)
|
49
|
+
method_source (0.8.1)
|
50
|
+
multi_json (1.7.7)
|
51
|
+
multi_xml (0.5.4)
|
52
|
+
pry (0.9.12.2)
|
53
|
+
coderay (~> 1.0.5)
|
54
|
+
method_source (~> 0.8)
|
55
|
+
slop (~> 3.4)
|
56
|
+
rb-fsevent (0.9.3)
|
57
|
+
rb-inotify (0.9.0)
|
58
|
+
ffi (>= 0.5.0)
|
59
|
+
rb-kqueue (0.2.0)
|
60
|
+
ffi (>= 0.5.0)
|
61
|
+
rspec (2.14.0)
|
62
|
+
rspec-core (~> 2.14.0)
|
63
|
+
rspec-expectations (~> 2.14.0)
|
64
|
+
rspec-mocks (~> 2.14.0)
|
65
|
+
rspec-core (2.14.0)
|
66
|
+
rspec-expectations (2.14.0)
|
67
|
+
diff-lcs (>= 1.1.3, < 2.0)
|
68
|
+
rspec-instafail (0.2.4)
|
69
|
+
rspec-mocks (2.14.1)
|
70
|
+
ruby-progressbar (1.1.1)
|
71
|
+
safe_yaml (0.9.4)
|
72
|
+
simplecov (0.7.1)
|
73
|
+
multi_json (~> 1.0)
|
74
|
+
simplecov-html (~> 0.7.1)
|
75
|
+
simplecov-html (0.7.1)
|
76
|
+
slop (3.4.5)
|
77
|
+
terminal-table (1.4.5)
|
78
|
+
thor (0.18.1)
|
79
|
+
vcr (2.5.0)
|
80
|
+
webmock (1.13.0)
|
81
|
+
addressable (>= 2.2.7)
|
82
|
+
crack (>= 0.3.2)
|
83
|
+
|
84
|
+
PLATFORMS
|
85
|
+
ruby
|
86
|
+
|
87
|
+
DEPENDENCIES
|
88
|
+
debugger (~> 1.6.1)
|
89
|
+
fuubar (~> 1.1.1)
|
90
|
+
guard-rspec (~> 3.0.2)
|
91
|
+
rspec (~> 2.14)
|
92
|
+
simplecov (~> 0.7.1)
|
93
|
+
vcr (~> 2.5.0)
|
94
|
+
webmock (~> 1.13.0)
|
95
|
+
zenflow!
|
data/Guardfile
ADDED
data/LICENSE.md
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Zencoder
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.markdown
ADDED
@@ -0,0 +1,92 @@
|
|
1
|
+
# Zenflow
|
2
|
+
|
3
|
+
[![Code Climate](https://codeclimate.com/repos/51bf6e3b7e00a411ad00f6c3/badges/111fbe3664cebffa8e23/gpa.png)](https://codeclimate.com/repos/51bf6e3b7e00a411ad00f6c3/feed)
|
4
|
+
![CircleCI](https://circleci.com/gh/zencoder/zenflow.png?circle-token=992f1e59d778a8f6eef0fb9f2888e80cf60d7226)
|
5
|
+
-------
|
6
|
+
|
7
|
+
[Getting Started](#getting-started)
|
8
|
+
[Usage](#usage)
|
9
|
+
[Commands Quick Reference](#commands)
|
10
|
+
[Requirements](#requirements)
|
11
|
+
|
12
|
+
### What is this?
|
13
|
+
|
14
|
+
Zenflow is a Ruby implimentation of the [GitFlow process](http://nvie.com/posts/a-successful-git-branching-model/) for managing development in Git. It's been used at [Zencoder](http://zencoder.com) since 2010 and we've benefitted greatly from the structure it helps enforce, so we wanted to share it with the world.
|
15
|
+
|
16
|
+
### <a name="getting-started"></a> Getting Started
|
17
|
+
|
18
|
+
Start off by installing the gem.
|
19
|
+
|
20
|
+
gem install zenflow
|
21
|
+
|
22
|
+
Once you've installed the gem there are a few questions to answer so that Zenflow knows what sort of branches you want to track and what your qa/staging/production setup looks like.
|
23
|
+
|
24
|
+
To get started make sure you're in the root directory of the repository you want to work with, then run
|
25
|
+
|
26
|
+
zenflow init
|
27
|
+
|
28
|
+
and answer the questions, then you're ready to start using Zenflow!
|
29
|
+
|
30
|
+
### <a name="usage"></a> Usage
|
31
|
+
|
32
|
+
#### Features
|
33
|
+
|
34
|
+
In Zenflow a feature branch is used to isolate the development of a new feature or refactoring of existing code.
|
35
|
+
|
36
|
+
To start a feature in Zenflow run `zenflow feature start`.
|
37
|
+
|
38
|
+
You'll be asked for the name of the feature - make it something descriptive - and a new branch will be creaated from master called feature/FEATURE-NAME.
|
39
|
+
|
40
|
+
Now you can work and commit normally. If you have Capistrano set up with a QA server, you can deploy the feature at any time by running `zenflow feature deploy`. This will merge the current feature branch in to the qa branch, deploy to the QA server if you have one configured with Capistrano, then go back to the feature branch.
|
41
|
+
|
42
|
+
If master has been updated and you want the latest code brought to your feature, you can run `zenflow feature update` to merge the latest code from master.
|
43
|
+
|
44
|
+
When you're ready for code review run `zenflow feature review` to create a pull request on GitHub, comparing the master branch and the feature branch. Work with any feedback from the rest of the team as necessary until the code is ready for production.
|
45
|
+
|
46
|
+
Once development of the feature is completed run `zenflow feature finish` to merge the feature branch in to master and delete the local and remote branches. If Zenflow is set up to confirm review and testing you'll be asked if you've tested this code on QA and had it code reviewed. Don't lie to Zenflow.
|
47
|
+
|
48
|
+
#### Releases
|
49
|
+
|
50
|
+
As features are finished they accumulate in the `master` branch. To get them to production we create a release.
|
51
|
+
|
52
|
+
To start a release in Zenflow run `zenflow release start` and provide a release name. Themed release names are fun - robots, spaceships, football players, flowers. Something there's a lot of.
|
53
|
+
|
54
|
+
There's typically not much that should be done within a new release - active development isn't supposed to happen at this stage. If code review turns up a bug fix it here, but anything more should be done in a feature or hotfix branch.
|
55
|
+
|
56
|
+
Once the release is made, typing `zenflow release deploy` will merge the release in to the staging branch, deploy to staging if you have a staging server configured with Capistano, then switch back to the release branch.
|
57
|
+
|
58
|
+
After confirming that things are running properly on Staging a release can be reviewed on GitHub by typing `zenflow release review`, which creates a pull request from the release to the production branch.
|
59
|
+
|
60
|
+
Once review is completed, type `zenflow release finish` to merge the release branch in to production and delete the local and remote release branches.
|
61
|
+
|
62
|
+
To deploy to production, type `zenflow deploy production`.
|
63
|
+
|
64
|
+
#### Hotfixes
|
65
|
+
|
66
|
+
Hotfixes are used for code updates that need to be deployed outside of a release, usually to address a breaking issue in production.
|
67
|
+
|
68
|
+
To start a hotfix type `zenflow hotfix start`. This creates a new hotfix branch off of the production branch.
|
69
|
+
|
70
|
+
After the hotfix branch is created you can work and commit as normally. Running `zenflow hotfix deploy` deploys to the staging and qa servers.
|
71
|
+
|
72
|
+
When you're ready for code review run `zenflow hotfix review` to create a pull request on GitHub, comparing the production branch and the hotfix branch. Work with any feedback from the rest of the team as necessary until the code is ready for production.
|
73
|
+
|
74
|
+
Once development of the feature is completed run `zenflow hotfix finish` to merge the feature branch in to production and master, plus delete the local and remote branches. If Zenflow is set up to confirm review and testing you'll be asked if you've tested this code on QA and had it code reviewed. Don't lie to Zenflow.
|
75
|
+
|
76
|
+
To deploy to production, type `zenflow deploy production`. Hotfixes are not automatically deployed to production when they are finished.
|
77
|
+
|
78
|
+
#### <a name="commands"></a> Commands Quick Ref
|
79
|
+
|
80
|
+
zenflow init
|
81
|
+
zenflow (feature|hotfix|release) start
|
82
|
+
zenflow (feature|hotfix|release) deploy
|
83
|
+
zenflow (feature|hotfix|release) review
|
84
|
+
zenflow (feature|hotfix|release) finish
|
85
|
+
zenflow deploy (qa|staging|production)
|
86
|
+
|
87
|
+
### <a name="requirements"></a> Requirements/Assumptions
|
88
|
+
|
89
|
+
* Git > 1.8
|
90
|
+
* Ruby > 1.9.3
|
91
|
+
* Capistrano and cap-ext
|
92
|
+
* A repository on GitHub
|
data/bin/zenflow
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
$: << File.expand_path("#{File.dirname(__FILE__)}/../lib")
|
3
|
+
require 'rubygems'
|
4
|
+
require 'zenflow'
|
5
|
+
|
6
|
+
Zenflow::LogToFile("====== Zenflow #{Zenflow::VERSION}/#{Time.now.strftime('%c')} ======")
|
7
|
+
Zenflow::LogToFile("$ zenflow #{ARGV.join(' ')}\n")
|
8
|
+
|
9
|
+
if ARGV.first != "init" && !Zenflow::Config.configured?
|
10
|
+
Zenflow::Log("This project has not been configured. Please run `zenflow init`.", :color => :red)
|
11
|
+
exit(1)
|
12
|
+
end
|
13
|
+
|
14
|
+
Zenflow::CLI.start(ARGV)
|
15
|
+
|
16
|
+
Zenflow::LogToFile("\n")
|
17
|
+
exit(Zenflow::Shell.status)
|
data/lib/zenflow.rb
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'thor'
|
2
|
+
require 'yaml'
|
3
|
+
require 'colored'
|
4
|
+
require 'terminal-table'
|
5
|
+
require 'httparty'
|
6
|
+
require 'json'
|
7
|
+
|
8
|
+
require 'zenflow/helpers/version'
|
9
|
+
require 'zenflow/version'
|
10
|
+
require 'zenflow/helpers/log'
|
11
|
+
require 'zenflow/helpers/config'
|
12
|
+
require 'zenflow/helpers/help'
|
13
|
+
require 'zenflow/helpers/shell'
|
14
|
+
require 'zenflow/helpers/ask'
|
15
|
+
require 'zenflow/helpers/branch'
|
16
|
+
require 'zenflow/helpers/repo'
|
17
|
+
require 'zenflow/helpers/changelog'
|
18
|
+
require 'zenflow/helpers/github'
|
19
|
+
require 'zenflow/helpers/pull_request'
|
20
|
+
require 'zenflow/helpers/branch_commands/abort'
|
21
|
+
require 'zenflow/helpers/branch_commands/branches'
|
22
|
+
require 'zenflow/helpers/branch_commands/compare'
|
23
|
+
require 'zenflow/helpers/branch_commands/deploy'
|
24
|
+
require 'zenflow/helpers/branch_commands/diff'
|
25
|
+
require 'zenflow/helpers/branch_commands/finish'
|
26
|
+
require 'zenflow/helpers/branch_commands/review'
|
27
|
+
require 'zenflow/helpers/branch_commands/start'
|
28
|
+
require 'zenflow/helpers/branch_commands/update'
|
29
|
+
require 'zenflow/helpers/branch_command'
|
30
|
+
require 'zenflow/commands/feature'
|
31
|
+
require 'zenflow/commands/hotfix'
|
32
|
+
require 'zenflow/commands/release'
|
33
|
+
require 'zenflow/commands/deploy'
|
34
|
+
require 'zenflow/commands/reviews'
|
35
|
+
require 'zenflow/cli'
|
data/lib/zenflow/cli.rb
ADDED
@@ -0,0 +1,130 @@
|
|
1
|
+
module Zenflow
|
2
|
+
class CLI < Thor
|
3
|
+
|
4
|
+
map "-v" => "version", "--version" => "version"
|
5
|
+
map "-h" => "help", "--help" => "help"
|
6
|
+
|
7
|
+
desc "version", "Show zenflow version.", :hide => true
|
8
|
+
def version
|
9
|
+
puts "Zenflow #{Zenflow::VERSION}"
|
10
|
+
end
|
11
|
+
|
12
|
+
desc "help", "Show zenflow help.", :hide => true
|
13
|
+
def help
|
14
|
+
version
|
15
|
+
puts
|
16
|
+
puts "Options:"
|
17
|
+
puts " -h, --help # Prints help"
|
18
|
+
puts " -v, --version # Prints Zenflow version"
|
19
|
+
puts
|
20
|
+
super
|
21
|
+
end
|
22
|
+
|
23
|
+
desc "feature SUBCOMMAND", "Manage feature branches."
|
24
|
+
subcommand "feature", Zenflow::Feature
|
25
|
+
|
26
|
+
desc "hotfix SUBCOMMAND", "Manage hotfix branches."
|
27
|
+
subcommand "hotfix", Zenflow::Hotfix
|
28
|
+
|
29
|
+
desc "release SUBCOMMAND", "Manage release branches."
|
30
|
+
subcommand "release", Zenflow::Release
|
31
|
+
|
32
|
+
desc "reviews SUBCOMMAND", "Works with code reviews."
|
33
|
+
subcommand "reviews", Zenflow::Reviews
|
34
|
+
|
35
|
+
desc "deploy ENV", "Deploy to an environment."
|
36
|
+
subcommand "deploy", Zenflow::Deploy
|
37
|
+
|
38
|
+
desc "init", "Write the zenflow config file."
|
39
|
+
def init(force=false)
|
40
|
+
already_configured if Zenflow::Config.configured? && !force
|
41
|
+
set_up_github
|
42
|
+
authorize_github
|
43
|
+
configure_project
|
44
|
+
configure_branches
|
45
|
+
configure_remotes
|
46
|
+
confirm_some_stuff
|
47
|
+
set_up_changelog
|
48
|
+
Zenflow::Config.save!
|
49
|
+
end
|
50
|
+
|
51
|
+
desc "set_up_github", "Set up GitHub user information"
|
52
|
+
def set_up_github
|
53
|
+
if user = Zenflow::Github.user != ''
|
54
|
+
if Zenflow::Ask("Your GitHub user is currently #{Zenflow::Github.user}. Do you want to use that?", :options => ["y", "N"], :default => "Y") == "n"
|
55
|
+
Zenflow::Github.set_user
|
56
|
+
end
|
57
|
+
else
|
58
|
+
Zenflow::Github.set_user
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
desc "authorize_github", "Get an auth token from GitHub"
|
63
|
+
def authorize_github
|
64
|
+
if Zenflow::Github.zenflow_token
|
65
|
+
if Zenflow::Ask("You already have a token from GitHub. Do you want to set a new one?", :options => ["Y", "n"], :default => "Y") == "y"
|
66
|
+
Zenflow::Github.authorize
|
67
|
+
end
|
68
|
+
else
|
69
|
+
Zenflow::Github.authorize
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
no_commands do
|
74
|
+
|
75
|
+
def already_configured
|
76
|
+
Zenflow::Log("Warning", :color => :red)
|
77
|
+
if Zenflow::Ask("There is an existing config file. Overwrite it?", :options => ["y", "N"], :default => "N") == "y"
|
78
|
+
init(true)
|
79
|
+
else
|
80
|
+
Zenflow::Log("Aborting...", :color => :red)
|
81
|
+
exit(1)
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
def configure_project
|
86
|
+
Zenflow::Log("Project")
|
87
|
+
Zenflow::Config[:project] = Zenflow::Ask("What is the name of this project?", :required => true)
|
88
|
+
end
|
89
|
+
|
90
|
+
def configure_branches
|
91
|
+
Zenflow::Log("Branches")
|
92
|
+
Zenflow::Config[:development_branch] = Zenflow::Ask("What is the name of the main development branch?", :default => "master")
|
93
|
+
configure_branch(:staging_branch, "Use a branch for staging releases and hotfixes?", "staging")
|
94
|
+
configure_branch(:qa_branch, "Use a branch for testing features?", "qa")
|
95
|
+
configure_branch(:release_branch, "Use a release branch?", "production")
|
96
|
+
end
|
97
|
+
|
98
|
+
def configure_branch(branch, question, default)
|
99
|
+
if Zenflow::Ask(question, :options => ["Y", "n"], :default => "Y") == "y"
|
100
|
+
Zenflow::Config[branch] = Zenflow::Ask("What is the name of that branch?", :default => default)
|
101
|
+
else
|
102
|
+
Zenflow::Config[branch] = false
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
def configure_remotes
|
107
|
+
Zenflow::Config[:remote] = Zenflow::Ask("What is the name of your primary remote?", :default => "origin")
|
108
|
+
if Zenflow::Ask("Use a backup remote?", :options => ["Y", "n"], :default => "n") == "y"
|
109
|
+
Zenflow::Config[:backup_remote] = Zenflow::Ask("What is the name of your backup remote?", :default => "backup")
|
110
|
+
else
|
111
|
+
Zenflow::Config[:backup_remote] = false
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
def set_up_changelog
|
116
|
+
return if File.exist?("CHANGELOG.md")
|
117
|
+
Zenflow::Log("Changelog Management")
|
118
|
+
Zenflow::Changelog.create if Zenflow::Ask("Set up a changelog?", :options => ["Y", "n"], :default => "Y") == "y"
|
119
|
+
end
|
120
|
+
|
121
|
+
def confirm_some_stuff
|
122
|
+
Zenflow::Log("Confirmations")
|
123
|
+
Zenflow::Config[:confirm_staging] = Zenflow::Ask("Require deployment to a staging environment?", :options => ["Y", "n"], :default => "Y") == "y"
|
124
|
+
Zenflow::Config[:confirm_review] = Zenflow::Ask("Require code reviews?", :options => ["Y", "n"], :default => "Y") == "y"
|
125
|
+
end
|
126
|
+
|
127
|
+
end
|
128
|
+
|
129
|
+
end
|
130
|
+
end
|