brightpearl-cli 1.4.0 → 1.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/assets/phpunit/IntegrationTestCase.php +512 -0
- data/assets/phpunit/JournalEntries.php +246 -0
- data/assets/phpunit/Message.php +101 -0
- data/assets/phpunit/Providers.php +404 -0
- data/assets/phpunit/RedirectException.php +20 -0
- data/assets/phpunit/ReservedContactIds.php +27 -0
- data/assets/phpunit/Values.php +30 -0
- data/assets/phpunit/bootstrap.php +85 -0
- data/assets/phpunit/jenkins-bootstrap.php +60 -0
- data/lib/brightpearl_cli.rb +26 -9
- data/lib/core/config.rb +1 -1
- data/lib/core/ebay.rb +11 -0
- data/lib/core/ebay_factory.rb +34 -0
- data/lib/core/enums.rb +8 -0
- data/lib/core/git.rb +44 -2
- data/lib/core/git_delete.rb +57 -15
- data/lib/core/mysql.rb +13 -13
- data/lib/core/pom.rb +44 -21
- data/lib/core/sql_update.rb +24 -0
- data/lib/core/terminal.rb +5 -4
- data/lib/core/utils_files.rb +0 -8
- data/lib/core/vm.rb +62 -0
- data/lib/routes/dummy_order.rb +0 -1
- data/lib/routes/fix.rb +30 -5
- data/lib/routes/git_checkout.rb +7 -2
- data/lib/routes/git_delete.rb +9 -3
- data/lib/routes/git_merge.rb +22 -6
- data/lib/routes/git_update.rb +1 -1
- data/lib/routes/production_logs.rb +4 -4
- data/lib/routes/review.rb +8 -2
- data/lib/routes/scripts_sonar.rb +6 -2
- data/lib/routes/scripts_sql_update.rb +33 -0
- data/lib/routes/test.rb +23 -8
- data/lib/version.rb +1 -0
- data/vm-scripts/sql-updates.sh +9 -0
- metadata +18 -2
@@ -0,0 +1,20 @@
|
|
1
|
+
<?php
|
2
|
+
/**
|
3
|
+
* Class to handle redirects, used to simulate behaviour of a redirect, as we want the code to stop executing but also need to continue the test
|
4
|
+
* @since 16/04/14
|
5
|
+
* @package UnitTests
|
6
|
+
* @subpackage TestHelpers
|
7
|
+
*/
|
8
|
+
|
9
|
+
/**
|
10
|
+
* Class to handle redirects, used to simulate behaviour of a redirect, as we want the code to stop executing but also need to continue the test
|
11
|
+
* @since 16/04/14
|
12
|
+
* @package Lib
|
13
|
+
* @subpackage
|
14
|
+
*/
|
15
|
+
|
16
|
+
class RedirectException
|
17
|
+
extends Exception
|
18
|
+
{
|
19
|
+
|
20
|
+
}
|
@@ -0,0 +1,27 @@
|
|
1
|
+
<?php
|
2
|
+
namespace testHelpers\Contacts;
|
3
|
+
|
4
|
+
use Lib_Model_Contact_Type;
|
5
|
+
|
6
|
+
/**
|
7
|
+
* Data provider for reserved contact ids for unit tests
|
8
|
+
*
|
9
|
+
* @since 20/01/2014
|
10
|
+
* @package UnitTests
|
11
|
+
* @subpackage TestHelpers
|
12
|
+
*/
|
13
|
+
class ReservedContactIds
|
14
|
+
{
|
15
|
+
/**
|
16
|
+
* @return array of integer
|
17
|
+
*/
|
18
|
+
public static function reservedContactIds()
|
19
|
+
{
|
20
|
+
return array(
|
21
|
+
array(Lib_Model_Contact_Type::DEFAULT_CHANNEL_BRAND_CONTACT_ID),
|
22
|
+
array(Lib_Model_Contact_Type::SUPER_ADMIN_CONTACT_ID),
|
23
|
+
array(Lib_Model_Contact_Type::ACCOUNTANT_CONTACT_ID),
|
24
|
+
array(Lib_Model_Contact_Type::PRIMARY_ADMIN_CONTACT_ID)
|
25
|
+
);
|
26
|
+
}
|
27
|
+
}
|
@@ -0,0 +1,30 @@
|
|
1
|
+
<?php
|
2
|
+
/**
|
3
|
+
* Test values for unit tests
|
4
|
+
*
|
5
|
+
* @since 31/01/2013
|
6
|
+
* @package UnitTests
|
7
|
+
* @subpackage TestHelpers
|
8
|
+
*/
|
9
|
+
class TestHelpers_Values
|
10
|
+
{
|
11
|
+
/**
|
12
|
+
* Provider of a random single digit (0-9) integer
|
13
|
+
*
|
14
|
+
* @return array
|
15
|
+
*/
|
16
|
+
public static function randomSingleDigitInteger()
|
17
|
+
{
|
18
|
+
return rand(0,9);
|
19
|
+
}
|
20
|
+
|
21
|
+
/**
|
22
|
+
* Provider of a random single digit (1-9) integer
|
23
|
+
*
|
24
|
+
* @return array
|
25
|
+
*/
|
26
|
+
public static function randomSingleDigitIntegerNotZero()
|
27
|
+
{
|
28
|
+
return rand(1,9);
|
29
|
+
}
|
30
|
+
}
|
@@ -0,0 +1,85 @@
|
|
1
|
+
<?php
|
2
|
+
|
3
|
+
defined('ENVIRONMENT') || define('ENVIRONMENT', 'testing');
|
4
|
+
ini_set('memory_limit', '1024M');
|
5
|
+
ini_set('error_log', '/tmp/phpunit.error.log');
|
6
|
+
|
7
|
+
/** @todo Make this dynamic! **/
|
8
|
+
$scriptMount = '/Users/Albert/Repos/shared/brightpearl-static/';
|
9
|
+
if ($scriptMount === false) {
|
10
|
+
$scriptMount = '';
|
11
|
+
}
|
12
|
+
|
13
|
+
// Set application path (contextually consistent with library use within app)
|
14
|
+
if (!defined('APPLICATION_PATH')) {
|
15
|
+
define('APPLICATION_PATH', $scriptMount . '/php-public/admindev');
|
16
|
+
}
|
17
|
+
|
18
|
+
$libraryPath = $scriptMount . '/php-private';
|
19
|
+
$paths = array(
|
20
|
+
"{$libraryPath}/dev/lib-lib",
|
21
|
+
"{$libraryPath}/static",
|
22
|
+
"{$libraryPath}/static/ZendFramework-1.11.1",
|
23
|
+
"{$libraryPath}/static/SymfonyDi",
|
24
|
+
"{$libraryPath}/static/SymfonyYaml",
|
25
|
+
"{$libraryPath}/static/Spreadsheet",
|
26
|
+
"{$libraryPath}/static/Auth"
|
27
|
+
);
|
28
|
+
|
29
|
+
set_include_path(
|
30
|
+
implode($paths, PATH_SEPARATOR) . PATH_SEPARATOR . get_include_path()
|
31
|
+
);
|
32
|
+
unset($paths, $libraryPath);
|
33
|
+
|
34
|
+
include_once 'Zend/Loader/Autoloader.php';
|
35
|
+
$autoloader = Zend_Loader_Autoloader::getInstance();
|
36
|
+
|
37
|
+
$composerLoader = null;
|
38
|
+
$requireVendor = function() use (&$composerLoader)
|
39
|
+
{
|
40
|
+
$parent = '../';
|
41
|
+
$limiter = 0;
|
42
|
+
$target = 'vendor/';
|
43
|
+
$path = $parent . $target;
|
44
|
+
|
45
|
+
while (false === realpath($path)) {
|
46
|
+
$parent = $parent . $parent;
|
47
|
+
$path = $parent . $target;
|
48
|
+
$limiter++;
|
49
|
+
if ($limiter > 20) {
|
50
|
+
throw new Exception('Cannot find vendor folder to load "autoloader.php"');
|
51
|
+
}
|
52
|
+
}
|
53
|
+
$composerLoader = require_once $path . '/autoload.php';
|
54
|
+
};
|
55
|
+
$requireVendor();
|
56
|
+
unset($requireVendor);
|
57
|
+
|
58
|
+
// Add the namespaces
|
59
|
+
$autoloader->registerNamespace('Zend_');
|
60
|
+
$autoloader->registerNamespace('Lib_');
|
61
|
+
$autoloader->setFallbackAutoloader(true);
|
62
|
+
|
63
|
+
$isIntegrationTest = (bool)getenv('PHP_INTEGRATION_TEST');
|
64
|
+
|
65
|
+
if (!$isIntegrationTest) {
|
66
|
+
include_once 'Zend/Loader/Autoloader/Interface.php';
|
67
|
+
include_once 'Lib/Loader/Autoloader.php';
|
68
|
+
$backOfficeAutoloader = new Lib_Loader_Autoloader();
|
69
|
+
$backOfficeAutoloader->setApplicationPath(APPLICATION_PATH);
|
70
|
+
$autoloader->unshiftAutoloader($backOfficeAutoloader);
|
71
|
+
$autoloader->unshiftAutoloader($composerLoader);
|
72
|
+
}
|
73
|
+
|
74
|
+
// Include the test helpers
|
75
|
+
$testHelpersPath = realpath(dirname(__FILE__));
|
76
|
+
|
77
|
+
require_once $testHelpersPath . '/Providers.php';
|
78
|
+
require_once $testHelpersPath . '/Message.php';
|
79
|
+
require_once $testHelpersPath . '/Values.php';
|
80
|
+
require_once $testHelpersPath . '/RedirectException.php';
|
81
|
+
require_once $testHelpersPath . '/JournalEntries.php';
|
82
|
+
require_once $testHelpersPath . '/IntegrationTestCase.php';
|
83
|
+
|
84
|
+
// Set timezone
|
85
|
+
date_default_timezone_set('Europe/London');
|
@@ -0,0 +1,60 @@
|
|
1
|
+
<?php
|
2
|
+
/**
|
3
|
+
* PHPUnit bootstrap file, sets up includes paths and other required details
|
4
|
+
* - This is used by Lib and App unit tests also
|
5
|
+
*
|
6
|
+
* @since 17/05/2010
|
7
|
+
* @package Tests
|
8
|
+
*/
|
9
|
+
|
10
|
+
define('ENVIRONMENT', 'testing');
|
11
|
+
ini_set('memory_limit', '1024M');
|
12
|
+
|
13
|
+
// Set appication path (contextually consistent with library use within app)
|
14
|
+
if (!defined('APPLICATION_PATH')) {
|
15
|
+
define(
|
16
|
+
'APPLICATION_PATH',
|
17
|
+
realpath(dirname(__FILE__) . '/../../../public/brightpearl')
|
18
|
+
);
|
19
|
+
}
|
20
|
+
|
21
|
+
|
22
|
+
$libraryPath = realpath(dirname(__FILE__) . '/../../../../static');
|
23
|
+
$paths = array(
|
24
|
+
"{$libraryPath}/dev/lib-lib",
|
25
|
+
"{$libraryPath}/static",
|
26
|
+
"{$libraryPath}/static/ZendFramework-1.11.1",
|
27
|
+
"{$libraryPath}/static/SymfonyDi",
|
28
|
+
"{$libraryPath}/static/SymfonyYaml",
|
29
|
+
"{$libraryPath}/static/Spreadsheet",
|
30
|
+
"{$libraryPath}/static/Auth"
|
31
|
+
);
|
32
|
+
|
33
|
+
set_include_path(
|
34
|
+
implode($paths, PATH_SEPARATOR) . PATH_SEPARATOR . get_include_path()
|
35
|
+
);
|
36
|
+
unset($paths, $libraryPath);
|
37
|
+
|
38
|
+
// Setup the libraries to autoload
|
39
|
+
include_once 'Zend/Loader/Autoloader.php';
|
40
|
+
$autoloader = Zend_Loader_Autoloader::getInstance();
|
41
|
+
// Add the namespaces
|
42
|
+
$autoloader->registerNamespace('Zend_');
|
43
|
+
$autoloader->registerNamespace('Lib_');
|
44
|
+
$autoloader->setFallbackAutoloader(true);
|
45
|
+
|
46
|
+
/*
|
47
|
+
* Set error reporting to the level to which code must comply.
|
48
|
+
*/
|
49
|
+
error_reporting(E_ALL | E_STRICT);
|
50
|
+
|
51
|
+
// Include the test helpers
|
52
|
+
$testHelpersPath = realpath(dirname(__FILE__));
|
53
|
+
|
54
|
+
require_once $testHelpersPath . '/Providers.php';
|
55
|
+
require_once $testHelpersPath . '/Message.php';
|
56
|
+
require_once $testHelpersPath . '/Values.php';
|
57
|
+
require_once $testHelpersPath . '/Accounts/AllocatePayments/JournalEntries.php';
|
58
|
+
|
59
|
+
// Set timezone
|
60
|
+
date_default_timezone_set('Europe/London');
|
data/lib/brightpearl_cli.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'convoy'
|
2
2
|
require 'yaml'
|
3
3
|
|
4
|
+
require 'version'
|
4
5
|
require 'core/api'
|
5
6
|
require 'core/config_unique'
|
6
7
|
require 'core/enums'
|
@@ -9,13 +10,10 @@ require 'core/git_delete'
|
|
9
10
|
require 'core/jira'
|
10
11
|
require 'core/mysql'
|
11
12
|
require 'core/pom'
|
13
|
+
require 'core/sql_update'
|
12
14
|
require 'core/tools'
|
13
15
|
require 'core/validate'
|
14
|
-
|
15
|
-
require 'core/config'
|
16
|
-
require 'core/encrypter'
|
17
|
-
require 'core/terminal'
|
18
|
-
|
16
|
+
require 'core/vm'
|
19
17
|
require 'routes/build'
|
20
18
|
require 'routes/dummy_order'
|
21
19
|
require 'routes/fix'
|
@@ -33,14 +31,23 @@ require 'routes/reset'
|
|
33
31
|
require 'routes/review'
|
34
32
|
require 'routes/scripts_api_docs'
|
35
33
|
require 'routes/scripts_branch_cleaner'
|
36
|
-
require 'routes/scripts_sonar'
|
37
34
|
require 'routes/scripts_color'
|
38
35
|
require 'routes/scripts_pom_fixer'
|
39
|
-
require 'routes/
|
36
|
+
require 'routes/scripts_sonar'
|
37
|
+
require 'routes/scripts_sql_update'
|
40
38
|
require 'routes/update'
|
41
39
|
require 'routes/tail'
|
42
40
|
require 'routes/test'
|
43
41
|
|
42
|
+
# SHARED
|
43
|
+
require 'core/config'
|
44
|
+
require 'core/encrypter'
|
45
|
+
require 'core/terminal'
|
46
|
+
require 'core/utils_files'
|
47
|
+
require 'core/utils_routes'
|
48
|
+
require 'core/utils_strings'
|
49
|
+
require 'routes/setup'
|
50
|
+
|
44
51
|
module App
|
45
52
|
|
46
53
|
def self.execute
|
@@ -56,7 +63,7 @@ module App
|
|
56
63
|
# COLOR OF TITLE TEXT
|
57
64
|
title_color = 255
|
58
65
|
|
59
|
-
brightpearl.version
|
66
|
+
brightpearl.version VERSION
|
60
67
|
brightpearl.summary "\x1B[38;5;166mBRIGHTPEARL-CLI\x1B[0m \x1B[38;5;240m\xe2\x80\x94 BETA\x1B[0m"
|
61
68
|
brightpearl.description "\x1B[38;5;#{title_color}mA command line utility for Brightpearl developers and QAs.\nUsed for automating daily work flows & completing repetitive tasks quicker with less errors.\nDesigned to work from anywhere on your workstation.\n\nUse #{App::Terminal::format_command('brightpearl')}\x1B[38;5;#{title_color}m or #{App::Terminal::format_command('bp')}\x1B[38;5;#{title_color}m to run.\x1B[0m"
|
62
69
|
|
@@ -105,7 +112,8 @@ module App
|
|
105
112
|
brightpearl.command :fix, :aliases => [:f] do |fix|
|
106
113
|
fix.summary 'Quick fixes for common problems'
|
107
114
|
fix.options do |opts|
|
108
|
-
opts.opt :
|
115
|
+
opts.opt :login_sessions, 'LOGIN - Clear sessions to fix login problem(s)', :short => '-l', :long => '--login-sessions', :type => :boolean
|
116
|
+
opts.opt :sql_updates, 'SQL UPDATE(S) - Run SQL updates from a specific update (specified as 1st argument).', :short => '-s', :long => '--sql-updates', :type => :boolean
|
109
117
|
end
|
110
118
|
fix.action do |opts, args|
|
111
119
|
AppCommand::Fix.new(opts, args).execute
|
@@ -336,6 +344,14 @@ module App
|
|
336
344
|
end
|
337
345
|
end
|
338
346
|
|
347
|
+
# SCRIPTS SQL-UPDATE
|
348
|
+
scripts.command :sql_update, :aliases => [:S] do |scripts_sql_update|
|
349
|
+
scripts_sql_update.summary 'Finish off a SQL Update'
|
350
|
+
scripts_sql_update.action do |opts, args|
|
351
|
+
AppCommand::ScriptsSqlUpdate.new(opts, args).execute
|
352
|
+
end
|
353
|
+
end
|
354
|
+
|
339
355
|
# SCRIPTS COLOR
|
340
356
|
scripts.command :color, :aliases => [:c] do |scripts_color|
|
341
357
|
scripts_color.summary 'Shows a list of bash/ruby color codes (256-bit)'
|
@@ -377,6 +393,7 @@ module App
|
|
377
393
|
opts.opt :cucumber, 'Run Cucumber tests', :short => '-c', :long => '--cucumber', :type => :boolean
|
378
394
|
opts.opt :fitnesse, 'Run FitNesse tests', :short => '-f', :long => '--fitnesse', :type => :boolean
|
379
395
|
opts.opt :php, 'Run PHPUnit tests (default)', :short => '-p', :long => '--php-unit', :type => :boolean
|
396
|
+
opts.opt :php_local, 'Run PHPUnit tests locally', :short => '-P', :long => '--php-unit-local', :type => :boolean
|
380
397
|
opts.opt :ruby, 'Run Ruby UI tests', :short => '-r', :long => '--ruby-ui', :type => :boolean
|
381
398
|
end
|
382
399
|
test.action do |opts, args|
|
data/lib/core/config.rb
CHANGED
data/lib/core/ebay.rb
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
module App
|
2
|
+
|
3
|
+
class EbayFactory
|
4
|
+
|
5
|
+
DEFAULT_CREDENTIALS = 'nimzo_seller'
|
6
|
+
|
7
|
+
@credentials = {}
|
8
|
+
|
9
|
+
def self.get(credentials = DEFAULT_CREDENTIALS)
|
10
|
+
|
11
|
+
if @credentials[credentials].nil?
|
12
|
+
|
13
|
+
# encrypter = Encrypter.new
|
14
|
+
# host = App::Config.param(App::Config::EC2_HOST)
|
15
|
+
# user = App::Config.param(App::Config::EC2_USER)
|
16
|
+
# pass = App::Config.param(App::Config::EC2_PASS)
|
17
|
+
# if host.nil? || user.nil? || pass.nil? || host == '' || user == '' || pass == ''
|
18
|
+
# App::Terminal::error('EC2 access data not found', ["The command you're trying to run requires access to an EC2 database.", "In order for this to work you will need valid #{App::Terminal::format_highlight('access data')}.", "Please speak to #{App::Terminal::format_highlight('Albert')} (or team Raptor) for more info."], true)
|
19
|
+
# end
|
20
|
+
# @ec2_connection = Mysql2::Client.new(
|
21
|
+
# :host => encrypter.decrypt(host),
|
22
|
+
# :username => encrypter.decrypt(user),
|
23
|
+
# :password => encrypter.decrypt(pass),
|
24
|
+
# :database => schema
|
25
|
+
# )
|
26
|
+
|
27
|
+
end
|
28
|
+
@credentials[credentials]
|
29
|
+
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
data/lib/core/enums.rb
CHANGED
@@ -6,6 +6,14 @@ module App
|
|
6
6
|
|
7
7
|
GIT_MERGE_DEFAULT_FILE = '/tmp/merge.txt'
|
8
8
|
|
9
|
+
# Get PATH to assets, scripts, etc.
|
10
|
+
# @return String
|
11
|
+
def self.get_base_path
|
12
|
+
base_path = File.dirname(File.expand_path(__FILE__))
|
13
|
+
base_path = base_path.gsub(/\/\w+\/\w+\z/i, '')
|
14
|
+
base_path
|
15
|
+
end
|
16
|
+
|
9
17
|
end
|
10
18
|
|
11
19
|
end
|
data/lib/core/git.rb
CHANGED
@@ -533,7 +533,7 @@ module App
|
|
533
533
|
else
|
534
534
|
if force_stash_message != false
|
535
535
|
abort_message = force_stash_message.is_a?(String) ? force_stash_message : nil
|
536
|
-
App::Terminal::abort(abort_message,["In this particular scenario, you #{App::Terminal::format_invalid('cannot continue', true)} unless you stash your changes."], true, false)
|
536
|
+
App::Terminal::abort(abort_message, ["In this particular scenario, you #{App::Terminal::format_invalid('cannot continue', true)} unless you stash your changes."], true, false)
|
537
537
|
end
|
538
538
|
unless App::Terminal::prompt_yes_no('Continue without stashing?', "By selecting #{App::Terminal::format_action('Yes')}\x1B[38;5;240m, you're changes will be carried over to the next branch.", nil, false)
|
539
539
|
App::Terminal::abort(nil, nil, true, false)
|
@@ -601,7 +601,6 @@ module App
|
|
601
601
|
"#{App::Terminal::format_directory(get_repo_shorthand(App::Config.param(App::Config::WORKSTATION_PATH_TO_BP_DB)))} is on #{App::Terminal::format_branch(branch_db)}"
|
602
602
|
])
|
603
603
|
when SAME_BRANCH_ERROR
|
604
|
-
else
|
605
604
|
App::Terminal::error("You're on #{App::Terminal::format_highlight('2 different branches')}", [
|
606
605
|
"#{App::Terminal::format_directory(get_repo_shorthand(App::Config.param(App::Config::WORKSTATION_PATH_TO_BP_CODE)))} is on #{App::Terminal::format_branch(branch_code)}",
|
607
606
|
"#{App::Terminal::format_directory(get_repo_shorthand(App::Config.param(App::Config::WORKSTATION_PATH_TO_BP_DB)))} is on #{App::Terminal::format_branch(branch_db)}",
|
@@ -695,6 +694,10 @@ module App
|
|
695
694
|
# Checks if branch exists ANYWHERE -- Local, Remote, Code, DB. If the branch name is found anywhere, will return FALSE.
|
696
695
|
# @return boolean
|
697
696
|
def branch_exists_anywhere(branch_name, case_sensitive = false)
|
697
|
+
# If new branch is 12345, find possible branches.
|
698
|
+
if branch_name =~ /\A\d{4,5}\z/i
|
699
|
+
branch_name = resolve_branch_for_jira(branch_name)
|
700
|
+
end
|
698
701
|
existing_branches = get_all_branches_as_array
|
699
702
|
if case_sensitive
|
700
703
|
existing_branches.map!(&:downcase)
|
@@ -782,6 +785,45 @@ module App
|
|
782
785
|
end
|
783
786
|
end
|
784
787
|
|
788
|
+
# Resolves possible branch names from 12345
|
789
|
+
# @return String
|
790
|
+
def resolve_branch_for_jira(jira_number)
|
791
|
+
resolved_branch = jira_number
|
792
|
+
possible_branches = []
|
793
|
+
if jira_number =~ /\A\d{4,5}\z/
|
794
|
+
get_all_branches_as_array.each do |possible_branch|
|
795
|
+
if possible_branch =~ /(bug|bp|feature)-#{jira_number}\z/i
|
796
|
+
# If more than one possible branch exists, IE: bug-14145 & bp-14145
|
797
|
+
if possible_branches.any?
|
798
|
+
App::Terminal::error("More than one possible branch found for jira number: #{App::Terminal::format_highlight(jira_number)}", [App::Terminal::format_branch(possible_branches[0]), App::Terminal::format_branch(possible_branch), nil, "In this case, you must specify the branch name #{App::Terminal::format_highlight('explicitly')}."], true)
|
799
|
+
end
|
800
|
+
possible_branches << possible_branch
|
801
|
+
App::Terminal::output("Resolved branch #{App::Terminal::format_branch(possible_branch)} from jira number: #{App::Terminal::format_highlight(jira_number)}", App::Terminal::MSG_AUTOMATIC)
|
802
|
+
end
|
803
|
+
end
|
804
|
+
unless possible_branches.any?
|
805
|
+
App::Terminal::error("No branch found for jira number: #{App::Terminal::format_highlight(jira_number)}", ['Please check your input and try again.'], true)
|
806
|
+
end
|
807
|
+
resolved_branch = possible_branches[0]
|
808
|
+
end
|
809
|
+
resolved_branch
|
810
|
+
end
|
811
|
+
|
812
|
+
# Returns TRUE if changes exist or FALSE if there is nothing to commit.
|
813
|
+
# @return boolean
|
814
|
+
def changes_exist(repo_dir)
|
815
|
+
validate_repo_dir(repo_dir)
|
816
|
+
git_results = App::Terminal::command_capture('git status', repo_dir)
|
817
|
+
changes_exist = true
|
818
|
+
git_results = git_results[0].split("\n")
|
819
|
+
git_results.each do |line|
|
820
|
+
if line =~ /nothing to commit, working directory clean/
|
821
|
+
changes_exist = false
|
822
|
+
end
|
823
|
+
end
|
824
|
+
changes_exist
|
825
|
+
end
|
826
|
+
|
785
827
|
# Get list of files that have changed between 2 branches
|
786
828
|
# @return Array
|
787
829
|
def get_changed_files(repo_dir, branch_to_compare_to = "origin/#{App::Git::MASTER}")
|