brightpearl-cli 2.8.0 → 2.9.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5fa2dc02b38e839c3c1544027ad60872e07369f4
4
- data.tar.gz: 150f2cc0b9622895d36cd8982f32ee628ee7e13b
3
+ metadata.gz: 981bc0cdaf96eeed62900052eeaac2b19b5f6b3c
4
+ data.tar.gz: d2196666c9d8b5adf2ddd6b21195a7aa33eec8b8
5
5
  SHA512:
6
- metadata.gz: 2d21418f4619a11fa7b7329a623155666b404a886657b3b6ecd9d92c9f29fb7b39de7a8e96352aefee3706f6533d68d7bc814847cd845e7d31603059d9a36920
7
- data.tar.gz: 3445cceb4f5730d6c0f081c2737dfb94ed5a5d7b8dc086517d5b0a739d05d144c9ef219601eb537f1fe80e4ef774b0f433170d66111211d4717caa60430eaceb
6
+ metadata.gz: b77002aeb8e80b31cdd788f9a329523cf42a48bf4dc573f7be5985d5be27c6a421fff6d950f1c6ca14d38201942b9709a1a12b48b79aad7888cd65abb336ad2d
7
+ data.tar.gz: 39decddee4b8f262b0a38018e59ef8c54568a13d7532c0c411d5bc2198f75a5e75e8543909bab110a8893b3cbebe065e67bdde05a5c64b89d7c1aee66dfe4df9
@@ -177,6 +177,7 @@ module App
177
177
  opts.opt :delete_source_branches_remote, "Delete all source branches (remotely) in #{App::Terminal::format_directory(App::Git::GIT_MERGE_DEFAULT_FILE)}", :short => '-D', :long => '--delete-remote', :type => :boolean
178
178
  opts.opt :sanity_check, 'Run sanity check. Submit source/target branches same as you would during a merge.', :short => '-s', :long => '--sanity-check', :type => :boolean
179
179
  opts.opt :build_services, "Determine what services need to be built before merging to #{App::Terminal::format_branch(App::Git::MASTER)}.", :short => '-b', :long => '--build-services', :type => :boolean
180
+ opts.opt :push_changes, 'Update all remote source branches with merge changes (IE: Confict resolutions)', :short => '-P', :long => '--push-changes', :type => :boolean
180
181
  end
181
182
  git_merge.action do |opts, args|
182
183
  AppCommand::GitMerge.new(opts, args).execute
@@ -267,6 +268,7 @@ module App
267
268
  opts.opt :watchJava, 'Watch Java logs', :short => '-j', :long => '--watch-java-logs', :type => :boolean
268
269
  opts.opt :skipFetch, 'Skip fetching of new logs (quicker)', :short => '-s', :long => '--skip-fetch', :type => :boolean
269
270
  opts.opt :compare, 'Compare logs between 2 versions (requires 2 parameters -- source & target version)', :short => '-c', :long => '--compare', :type => :boolean
271
+ opts.opt :versionList, 'See a list of all versions which have been captured.', :short => '-V', :long => '--version-list', :type => :boolean
270
272
  end
271
273
  production_logs.action do |opts, args|
272
274
  AppCommand::ProductionLogs.new(opts, args).execute
@@ -97,10 +97,18 @@ module App
97
97
  missing_keys
98
98
  end
99
99
 
100
+ # Checks if a config parameter exists.
101
+ # @return boolean
100
102
  def self.param_exists(param_name)
101
103
  @params.has_key?(param_name)
102
104
  end
103
105
 
106
+ # Get ALL config parameters.
107
+ # @return Hash
108
+ def self.params
109
+ @params
110
+ end
111
+
104
112
  # Get custom keys from the config file (IE: ssh_ec2=user|host|pem)
105
113
  # @return String
106
114
  def self.get_custom_key(prefix, config_key)
@@ -116,4 +124,4 @@ module App
116
124
 
117
125
  end
118
126
 
119
- end
127
+ end
@@ -50,6 +50,8 @@ module App
50
50
 
51
51
  GIT_MERGE_DEFAULT_FILE = '~/tmp/bp-merge.txt'
52
52
  GIT_LAST_GIT_FETCH_FILE = '~/tmp/bp-last-git-fetch.tmp'
53
+ GIT_LAST_BRANCH_GET_DATA_FILE = '~/tmp/bp-last-branch-get-data-%s.tmp'
54
+ GIT_LAST_BRANCH_GET_TIME_FILE = '~/tmp/bp-last-branch-get-time-%s.tmp'
53
55
 
54
56
  def initialize
55
57
 
@@ -158,10 +160,36 @@ module App
158
160
  App::Terminal::error('Directory not found', "Directory doesn't exist: #{App::Terminal::format_directory(repo_dir)}", true)
159
161
  end
160
162
  update_origin(repo_dir_inner)
161
- raw_terminal_output = `
162
- cd #{repo_dir_inner} &&
163
- for branch in \`git branch -r | grep -v HEAD\`; do echo \`git show --format="%cn#{DELIMITER}%ce#{DELIMITER}%cd#{DELIMITER}%s#{DELIMITER}" $branch | head -n 1\` $branch; done | sort -r | sed 's/origin\\///g'
164
- `
163
+
164
+ data_file = GIT_LAST_BRANCH_GET_DATA_FILE.gsub('%s', get_repo_shorthand(repo_dir_inner))
165
+ time_file = GIT_LAST_BRANCH_GET_TIME_FILE.gsub('%s', get_repo_shorthand(repo_dir_inner))
166
+
167
+ unless App::UtilsFiles::file_exists(time_file)
168
+ App::UtilsFiles::write_file(time_file, [epoch_current])
169
+ end
170
+ unless App::UtilsFiles::file_exists(data_file)
171
+ App::UtilsFiles::write_file(data_file, [''])
172
+ end
173
+
174
+ data_file_data = App::UtilsFiles::read_file(data_file)
175
+
176
+ # IF THIS DATA WAS FETCHED IN THE LAST HOUR, DON'T DO IT AGAIN
177
+ epoch_last_fetch = App::UtilsFiles::read_file(time_file)[0]
178
+ time_difference = epoch_current - epoch_last_fetch.to_i
179
+
180
+ if time_difference < 86400 && !data_file_data[0].nil?
181
+ App::Terminal::output("Branch-data already up to date for #{App::Terminal::format_directory(get_repo_shorthand(repo_dir))} \xe2\x80\x94 \x1B[38;5;240m[#{epoch_current}\xe2\x80\x94#{epoch_last_fetch}\xe2\x80\x94#{time_difference}]\x1B[0m")
182
+ raw_terminal_output = data_file_data.join('')
183
+ else
184
+ App::Terminal::output("Getting branch-data for #{App::Terminal::format_directory(get_repo_shorthand(repo_dir))} \xe2\x80\x94 \x1B[38;5;240m[#{epoch_current}\xe2\x80\x94#{epoch_last_fetch}\xe2\x80\x94#{time_difference}]\x1B[0m")
185
+ App::UtilsFiles::write_file(time_file, [epoch_current])
186
+ raw_terminal_output = `
187
+ cd #{repo_dir_inner} &&
188
+ for branch in \`git branch -r | grep -v HEAD\`; do echo \`git show --format="%cn#{DELIMITER}%ce#{DELIMITER}%cd#{DELIMITER}%s#{DELIMITER}" $branch | head -n 1\` $branch; done | sort -r | sed 's/origin\\///g'
189
+ `
190
+ end
191
+ App::UtilsFiles::write_file_string(data_file, raw_terminal_output)
192
+
165
193
  branches = {}
166
194
  branch_count = 0
167
195
  raw_terminal_output.split("\n").each do |line|
@@ -454,7 +482,6 @@ module App
454
482
  # @return void
455
483
  def update_origin(repo_dir = nil)
456
484
  validate_repo_dir(repo_dir)
457
- epoch_current = Time.now.strftime('%s')
458
485
  unless App::UtilsFiles::file_exists(GIT_LAST_GIT_FETCH_FILE)
459
486
  App::UtilsFiles::write_file(GIT_LAST_GIT_FETCH_FILE, [epoch_current])
460
487
  end
@@ -464,12 +491,12 @@ module App
464
491
 
465
492
  # IF ORIGIN WAS UPDATED IN THE LAST HOUR, DON'T DO IT AGAIN
466
493
  epoch_last_fetch = App::UtilsFiles::read_file(GIT_LAST_GIT_FETCH_FILE)[0]
467
- time_difference = epoch_current.to_i - epoch_last_fetch.to_i
494
+ time_difference = epoch_current - epoch_last_fetch.to_i
468
495
  if time_difference < 3600
469
- App::UtilsFiles::write_file(GIT_LAST_GIT_FETCH_FILE, [epoch_current])
470
- App::Terminal::output("Origin already up to date \xe2\x80\x94 #{App::Terminal::format_directory(get_repo_shorthand(repo_dir))}")
496
+ App::Terminal::output("Origin already up to date \xe2\x80\x94 #{App::Terminal::format_directory(get_repo_shorthand(repo_dir))} \xe2\x80\x94 \x1B[38;5;240m[#{epoch_current}\xe2\x80\x94#{epoch_last_fetch}\xe2\x80\x94#{time_difference}]\x1B[0m")
471
497
  return
472
498
  end
499
+ App::UtilsFiles::write_file(GIT_LAST_GIT_FETCH_FILE, [epoch_current])
473
500
 
474
501
  App::Terminal::output("Updating origin \xe2\x80\x94 #{App::Terminal::format_directory(get_repo_shorthand(repo_dir))}")
475
502
  case repo_dir
@@ -983,6 +1010,12 @@ module App
983
1010
  end
984
1011
  end
985
1012
 
1013
+ # Returns current time in epoch
1014
+ # @return Integer
1015
+ def epoch_current
1016
+ Time.now.strftime('%s').to_i
1017
+ end
1018
+
986
1019
  end
987
1020
 
988
1021
  end
@@ -3,12 +3,17 @@ module App
3
3
  class SSH
4
4
 
5
5
  SCRIPT_PATH = 'vm-scripts/'
6
+ SSH_PREFIX = 'ssh_'
6
7
 
7
8
  # SSH into remote host.
8
9
  # @return void
9
10
  def self.ssh_into_remote(config_key)
10
- ssh_user, ssh_host, ssh_cert = get_ssh_credentials(config_key)
11
- ssh_into_remote_credentials(ssh_user, ssh_host, ssh_cert)
11
+ if config_key.nil?
12
+ show_available_ssh_hosts
13
+ else
14
+ ssh_user, ssh_host, ssh_cert = get_ssh_credentials(config_key)
15
+ ssh_into_remote_credentials(ssh_user, ssh_host, ssh_cert)
16
+ end
12
17
  end
13
18
 
14
19
  # SSH into remote with pre-supplied credentials.
@@ -25,6 +30,21 @@ module App
25
30
  # @return void
26
31
  def self.scp_to_remote(config_key, source, target)
27
32
 
33
+ if config_key.nil?
34
+ show_available_ssh_hosts
35
+ else
36
+
37
+ ssh_user, ssh_host, ssh_cert = get_ssh_credentials(config_key)
38
+
39
+ unless App::UtilsFiles::file_exists(source)
40
+ App::Terminal::error("The file doesn't exist: #{App::Terminal::format_directory(source)}", nil, true)
41
+ end
42
+
43
+
44
+ end
45
+
46
+ exit
47
+
28
48
  end
29
49
 
30
50
  # SCPs a script to a remote host and runs it.
@@ -54,24 +74,30 @@ module App
54
74
  # Get SSH credentials from the config file.
55
75
  # @return Array
56
76
  def self.get_ssh_credentials(config_key)
57
- ssh_parts = App::Config.get_custom_key('ssh_', config_key).split('|')
58
- ssh_user = ssh_parts[0]
59
- ssh_host = ssh_parts[1]
60
- ssh_cert = ssh_parts[2].to_s.strip.length == 0 ? nil : ssh_parts[2]
61
- help_message = [
62
- "The file: #{App::Terminal::format_directory(ConfigUnique::CONFIG_FILE)} must contain a line similar to the following:",
63
- nil,
64
- 'ssh_ec2=ec2-user|ec2-XX-XX-XX-XX.eu-west-1.compute.amazonaws.com|~/.ssh/pem-key.pem',
65
- 'ssh_ec2=ec2-user|ec2-XX-XX-XX-XX.eu-west-1.compute.amazonaws.com',
66
- ]
67
- App::Terminal::error("SSH #{App::Terminal::format_highlight('user')} required", help_message, true) if ssh_user.nil? || ssh_user == ''
68
- App::Terminal::error("SSH #{App::Terminal::format_highlight('host')} required", help_message, true) if ssh_host.nil? || ssh_host == ''
69
- unless ssh_cert.nil?
70
- unless App::UtilsFiles::file_exists(File.expand_path(ssh_cert))
71
- App::Terminal::error("PEM key not found: #{App::Terminal::format_directory(ssh_cert)}")
77
+ if @ssh_user.nil? || @ssh_host.nil?
78
+ ssh_parts = App::Config.get_custom_key(SSH_PREFIX, config_key).split('|')
79
+ ssh_user = ssh_parts[0]
80
+ ssh_host = ssh_parts[1]
81
+ ssh_cert = ssh_parts[2].to_s.strip.length == 0 ? nil : ssh_parts[2]
82
+ help_message = [
83
+ "The file: #{App::Terminal::format_directory(ConfigUnique::CONFIG_FILE)} must contain a line similar to the following:",
84
+ nil,
85
+ 'ssh_ec2=ec2-user|ec2-XX-XX-XX-XX.eu-west-1.compute.amazonaws.com|~/.ssh/pem-key.pem',
86
+ 'ssh_ec2=ec2-user|ec2-XX-XX-XX-XX.eu-west-1.compute.amazonaws.com',
87
+ ]
88
+ App::Terminal::error("SSH #{App::Terminal::format_highlight('user')} required", help_message, true) if ssh_user.nil? || ssh_user == ''
89
+ App::Terminal::error("SSH #{App::Terminal::format_highlight('host')} required", help_message, true) if ssh_host.nil? || ssh_host == ''
90
+ unless ssh_cert.nil?
91
+ unless App::UtilsFiles::file_exists(File.expand_path(ssh_cert))
92
+ App::Terminal::error("PEM key not found: #{App::Terminal::format_directory(ssh_cert)}")
93
+ end
72
94
  end
95
+ @ssh_user = ssh_user
96
+ @ssh_host = ssh_host
97
+ @ssh_cert = ssh_cert
98
+
73
99
  end
74
- return ssh_user, ssh_host, ssh_cert
100
+ return @ssh_user, @ssh_host, @ssh_cert
75
101
  end
76
102
 
77
103
  # Check script exists.
@@ -155,6 +181,27 @@ module App
155
181
  end
156
182
  end
157
183
 
184
+ # Show a list of available SSH hosts.
185
+ # @return void
186
+ def self.show_available_ssh_hosts
187
+ all_keys = App::Config::params
188
+ ssh_hosts = []
189
+ ssh_hosts_lengths = []
190
+ all_keys.keys.each do |key|
191
+ if key =~ /\A#{SSH_PREFIX}.+/i
192
+ ssh_hosts_lengths << key.length
193
+ end
194
+ end
195
+ max_key_length = ssh_hosts_lengths.uniq!.sort!.max - SSH_PREFIX.length
196
+ all_keys.keys.sort!.each do |key|
197
+ if key =~ /\A#{SSH_PREFIX}.+/i
198
+ ssh_user, ssh_host, ssh_cert = get_ssh_credentials(key.gsub(SSH_PREFIX, ''))
199
+ ssh_hosts << "\x1B[38;5;154m#{key.gsub(SSH_PREFIX, '').rjust(max_key_length, ' ')}\x1B[0m\x1B[38;5;240m \xe2\x80\x94 #{ssh_host} \x1B[38;5;245m(#{ssh_user})#{ssh_cert.nil? ? '' : "\x1B[38;5;204m #{ssh_cert}"}"
200
+ end
201
+ end
202
+ App::Terminal::info('Pre-configured hosts to SSH into:', ssh_hosts)
203
+ end
204
+
158
205
  end
159
206
 
160
207
  end
@@ -5,17 +5,14 @@ module App
5
5
 
6
6
  class UtilsFiles
7
7
 
8
+ # Write an "Array of Lines" to a file.
9
+ # @return void
8
10
  def self.write_file(full_path_and_file, array_of_lines)
9
11
  full_path_and_file = File.expand_path(full_path_and_file)
10
12
  unless array_of_lines.is_a? Array
11
13
  raise RuntimeError, "Expected an array of lines to write to file, instead got: #{array_of_lines.class}"
12
14
  end
13
- unless path_exists(File.dirname(full_path_and_file))
14
- FileUtils::mkdir_p(File.dirname(full_path_and_file))
15
- end
16
- if file_exists(full_path_and_file)
17
- File.delete(full_path_and_file)
18
- end
15
+ validate_file_and_path(full_path_and_file)
19
16
  begin
20
17
  File.open(full_path_and_file, 'w') { |file|
21
18
  array_of_lines.each_with_index do |line, index|
@@ -32,6 +29,26 @@ module App
32
29
  end
33
30
  end
34
31
 
32
+ # Write a "String" to a file.
33
+ # @return void
34
+ def self.write_file_string(full_path_and_file, content)
35
+ full_path_and_file = File.expand_path(full_path_and_file)
36
+ unless content.is_a? String
37
+ raise RuntimeError, "Expected an String to write to file, instead got: #{content.class}"
38
+ end
39
+ validate_file_and_path(full_path_and_file)
40
+ begin
41
+ File.open(full_path_and_file, 'w') { |file|
42
+ file.write("#{content}")
43
+ file.close
44
+ }
45
+ rescue Exception => e
46
+ App::Terminal::error('Something went wrong', "#{e.message}", true)
47
+ end
48
+ end
49
+
50
+ # Get content of a file as an "Array of Lines"
51
+ # @return Array
35
52
  def self.read_file(full_path_and_file)
36
53
  full_path_and_file = File.expand_path(full_path_and_file)
37
54
  unless file_exists(full_path_and_file)
@@ -73,6 +90,17 @@ module App
73
90
  files
74
91
  end
75
92
 
93
+ private
94
+
95
+ def self.validate_file_and_path(full_path_and_file)
96
+ unless path_exists(File.dirname(full_path_and_file))
97
+ FileUtils::mkdir_p(File.dirname(full_path_and_file))
98
+ end
99
+ if file_exists(full_path_and_file)
100
+ File.delete(full_path_and_file)
101
+ end
102
+ end
103
+
76
104
  end
77
105
 
78
106
  end
@@ -20,7 +20,7 @@ module App
20
20
  flags_set
21
21
  end
22
22
 
23
- # Will throw an error if more than one flag is set
23
+ # Will throw an error if more than one flag is set.
24
24
  # @param Array (@opts)
25
25
  # @return void
26
26
  def self.max_one_flag(opts)
@@ -35,7 +35,26 @@ module App
35
35
  all_flags.each do |flag|
36
36
  error_text << " \x1B[38;5;244m--#{flag}\x1B[0m"
37
37
  end
38
- App::Terminal::error("You can only set one #{App::Terminal::format_highlight('flag')} at a time", error_text)
38
+ App::Terminal::error("You can set #{App::Terminal::format_highlight('only one')} flag at a time", error_text)
39
+ end
40
+ end
41
+
42
+ # Will throw an error if no flags are set.
43
+ # @param Array (@opts)
44
+ # @return void
45
+ def self.atleast_one_flag(opts)
46
+ all_flags = []
47
+ opts.each_key do |key|
48
+ unless key.to_s =~ /_given\z/i || key == :version || key == :help
49
+ all_flags << key.to_s
50
+ end
51
+ end
52
+ if flags_set(opts) <= 0
53
+ error_text = ['Available flags are:', nil]
54
+ all_flags.each do |flag|
55
+ error_text << " \x1B[38;5;244m--#{flag}\x1B[0m"
56
+ end
57
+ App::Terminal::error("You must set #{App::Terminal::format_highlight('atleast one')} flag", error_text)
39
58
  end
40
59
  end
41
60
 
@@ -247,10 +247,8 @@ module AppCommand
247
247
  commands_3 = [
248
248
  "git diff --name-only #{App::Git::MASTER}"
249
249
  ]
250
- commands_4 = [
251
- 'git push',
252
- "git checkout #{@target_branch}"
253
- ]
250
+ commands_4 = @opts[:push_changes] ? ['git push'] : []
251
+ commands_4 << "git checkout #{@target_branch}"
254
252
  commands_5 = [
255
253
  "git merge #{branch_name} --no-edit",
256
254
  ]
@@ -284,6 +282,7 @@ module AppCommand
284
282
  changed_files_code["#{branch_name}"] = App::Terminal::command_capture(commands_3, cd_repo)
285
283
 
286
284
  App::Terminal::command(commands_4, cd_repo)
285
+
287
286
  merge_to_target = App::Terminal::command(commands_5, cd_repo)
288
287
  if merge_to_target[0] == false
289
288
  unless App::Terminal::prompt_yes_no('Merge conflict occurred', ["Unable to successfully merge #{App::Terminal::format_branch(branch_name)} \xe2\x86\x92 #{App::Terminal::format_branch(@target_branch)} \xe2\x80\x94 (#{App::Terminal::format_directory(@git.get_repo_shorthand(App::Config.param(App::Config::WORKSTATION_PATH_TO_BP_CODE)))})", mc_information_msg], mc_confirmation_msg)
@@ -318,7 +317,10 @@ module AppCommand
318
317
 
319
318
  # SQL UPDATE
320
319
  unless changed_files_db["#{branch_name}"].nil? || changed_files_db["#{branch_name}"] == '' || changed_files_db["#{branch_name}"] == ['']
321
- App::SqlUpdate::run_sql_update(branch_name)
320
+ App::Terminal::warning("Detected SQL Update. Following files were changed in #{App::Terminal::format_directory(@git.get_repo_shorthand(App::Config.param(ConfigUnique::WORKSTATION_PATH_TO_BP_DB)))}", changed_files_db["#{branch_name}"])
321
+ begin
322
+ App::SqlUpdate::run_sql_update(branch_name)
323
+ end
322
324
  ran_db_update = true
323
325
  end
324
326
 
@@ -32,6 +32,12 @@ module AppCommand
32
32
  @opts[:watchPHP] = true
33
33
  end
34
34
 
35
+ if @opts[:versionList]
36
+ if App::UtilsRoutes::flags_set(@opts) > 1
37
+ App::Terminal::error('Invalid number of flags', "When using the #{App::Terminal::format_flag('V')}, no other flags should be set.", true)
38
+ end
39
+ end
40
+
35
41
  if @opts[:compare]
36
42
  [@args[0], @args[1]].each do |version_number|
37
43
  if version_number.nil?
@@ -49,7 +55,9 @@ module AppCommand
49
55
 
50
56
  def opts_routing
51
57
 
52
- if @opts[:watchPHP]
58
+ if @opts[:versionList]
59
+ show_version_list
60
+ elsif @opts[:watchPHP]
53
61
  watch_php
54
62
  elsif @opts[:watchJava]
55
63
  watch_java
@@ -134,6 +142,16 @@ module AppCommand
134
142
 
135
143
  end
136
144
 
145
+ def show_version_list
146
+ versions_array = []
147
+ sql = 'SELECT account_version FROM brightpearl.php_logs GROUP BY account_version;'
148
+ versions = @ec2_connection.query(sql)
149
+ versions.each do|result|
150
+ versions_array << " \x1B[38;5;154m#{result['account_version']}\x1B[0m"
151
+ end
152
+ App::Terminal::info('Versions you can compare to are:', versions_array)
153
+ end
154
+
137
155
  private
138
156
 
139
157
  # Goes off to the BP UI Server logs and fetches data.
@@ -178,8 +196,10 @@ module AppCommand
178
196
  App::Terminal::warning('Query Failed', error_output)
179
197
  end
180
198
  end
181
- error_parsed = " \x1B[38;5;34m#{account_version}\x1B[0m \xe2\x86\x92 \x1B[38;5;81m#{account_name}\x1B[0m \xe2\x80\x94 \x1B[38;5;#{error_color}m#{error_message} \xe2\x80\x94 #{error_file} \xe2\x80\x94 Line #{error_line}"
182
- puts "#{error_parsed[0..(@terminal_width - 2)]}\x1B[0m"
199
+ error_unformatted = " #{account_version} > #{account_name} - #{error_message} - #{error_file} - Line #{error_line}"
200
+ error_parsed = " \x1B[38;5;34m#{account_version}\x1B[0m \xe2\x86\x92 \x1B[38;5;81m#{account_name}\x1B[0m \xe2\x80\x94 \x1B[38;5;#{error_color}m#{error_message} \xe2\x80\x94 #{error_file} \xe2\x80\x94 Line #{error_line}"
201
+ puts "#{error_parsed[0..((@terminal_width - 5) + (error_parsed.length - error_unformatted.length))]}\x1B[0m"
202
+
183
203
  end
184
204
  end
185
205
  end
@@ -192,27 +212,20 @@ module AppCommand
192
212
 
193
213
  raw_log_data = ''
194
214
  raw_log_uris = %w(
195
- http://54.235.155.6:7777/php/php.log
196
- http://ec2-174-129-36-164.compute-1.amazonaws.com:7777/php/php.log
197
- http://ec2-54-185-160-108.us-west-2.compute.amazonaws.com:7777/php/php.log
198
- http://ec2-54-190-109-53.us-west-2.compute.amazonaws.com:7777/php/php.log
199
215
  http://ec2-54-73-66-114.eu-west-1.compute.amazonaws.com:7777/php/php.log
200
216
  http://ec2-54-73-26-152.eu-west-1.compute.amazonaws.com:7777/php/php.log
201
217
  http://ec2-54-217-40-80.eu-west-1.compute.amazonaws.com:7777/php/php.log
218
+ http://ec2-174-129-36-164.compute-1.amazonaws.com:7777/php/php.log
202
219
  http://ec2-184-72-46-73.us-west-1.compute.amazonaws.com:7777/php/php.log
203
220
  http://ec2-184-72-49-68.us-west-1.compute.amazonaws.com:7777/php/php.log
221
+ http://ec2-174-129-36-164.compute-1.amazonaws.com:7777/php/php.log
222
+ http://ec2-54-235-155-6.compute-1.amazonaws.com:7777/php/php.log
204
223
  )
205
224
  raw_log_uris.each do |log_uri|
206
225
  App::Terminal::output("Retrieving data from: #{log_uri}")
207
226
  raw_log_data << RestClient.get(log_uri)
208
227
  end
209
228
 
210
- # # Mock Data
211
- # file_data_1 = File.open('/Users/Albert/Brightpearl/log_1.txt', 'rb')
212
- # file_data_2 = File.open('/Users/Albert/Brightpearl/log_2.txt', 'rb')
213
- # raw_log_data << file_data_1.read
214
- # raw_log_data << file_data_2.read
215
-
216
229
  raw_log_data
217
230
 
218
231
  end
@@ -16,7 +16,7 @@ module AppCommand
16
16
  App::UtilsRoutes::max_one_flag(@opts)
17
17
 
18
18
  if App::UtilsRoutes::flags_set(@opts) == 0
19
- @opts[:php] == true
19
+ @opts[:php] = true
20
20
  end
21
21
 
22
22
  end
@@ -1 +1 @@
1
- VERSION = '2.8.0'
1
+ VERSION = '2.9.0'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: brightpearl-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.8.0
4
+ version: 2.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Albert Rannetsperger
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-10 00:00:00.000000000 Z
11
+ date: 2015-09-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: columnist