procodile 1.0.11 → 1.0.12

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 90d57673d57a817411b10a60ebbaa04b8222f644
4
- data.tar.gz: a928bbe14abe7ad22dee7e98763ef42d12abffb3
3
+ metadata.gz: 507f12e0dc524f32be34c9dfaf80f1696dd6da41
4
+ data.tar.gz: ff6feb4c0ccf2d3f7db4972ded509729cc18ab50
5
5
  SHA512:
6
- metadata.gz: 227c83421e688d37e8fc544959ead123ca7c1abb5e0f00c465525a7298225a4b3af000eba4b1041ee57ffbba1cb91a7e7332457e35def291697b01dd510436a0
7
- data.tar.gz: ce6efd84d43fc76f094ef4f8788c7848d3992548f12493ea529aa0321ec0819c5e9d752a02451227ac57833542e435173aa574136f33beb2a40743cc2b12af55
6
+ metadata.gz: 295a7caf4a5969807ed492ee3dad806dd120c060d73d21880af573c3f5fde655f941d0cf45fb8c32464ab24174fc9498ee229b1a63c70a999e4189ed2cb9dad2
7
+ data.tar.gz: af5cbb8a7678c306f1ce4844bef0c2e87e1d3126686d554aa015e26b33bad5531cc37818bc31d29534be4051eaacfc655aaf469283fc9b4acdea41bb1534f718
data/bin/procodile CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  trap("INT") { puts ; exit 1 }
4
4
 
5
+ ORIGINAL_ARGV = ARGV.join(' ')
6
+
5
7
  $:.unshift(File.expand_path('../../lib', __FILE__))
6
8
 
7
9
  require 'optparse'
@@ -66,29 +68,41 @@ else
66
68
  if File.exist?(global_config_path)
67
69
  global_config = YAML.load_file(global_config_path)
68
70
  if global_config.is_a?(Array)
69
- puts "There are multiple applications configured in #{global_config_path}"
70
- if File.file?("Procfile")
71
- puts "\e[45;37mChoose an appplication or press ENTER to use the current directory:\e[0m"
71
+ if ENV['PROCODILE_APP_ID']
72
+ app_id = ENV['PROCODILE_APP_ID'].to_i
73
+ preselect = true
72
74
  else
73
- puts "\e[45;37mChoose an application:\e[0m"
74
- end
75
- global_config.each_with_index do |app, i|
76
- col = i % 3
77
- print "#{(i+1)}) #{app['name']}"[0,28].ljust(col != 2 ? 30 : 0, ' ')
78
- if col == 2 || i == global_config.size - 1
79
- puts
75
+ puts "There are multiple applications configured in #{global_config_path}"
76
+ if File.file?("Procfile")
77
+ puts "\e[45;37mChoose an appplication or press ENTER to use the current directory:\e[0m"
78
+ else
79
+ puts "\e[45;37mChoose an application:\e[0m"
80
80
  end
81
+ global_config.each_with_index do |app, i|
82
+ col = i % 3
83
+ print "#{(i+1)}) #{app['name']}"[0,28].ljust(col != 2 ? 30 : 0, ' ')
84
+ if col == 2 || i == global_config.size - 1
85
+ puts
86
+ end
87
+ end
88
+ app_id = STDIN.gets.to_i
89
+ ENV['PROCODILE_APP_ID'] = app_id.to_s
90
+ preselect = false
81
91
  end
82
- app_id = STDIN.gets.to_i
92
+
83
93
  if app_id == 0
84
94
  if File.file?('Procfile')
85
- puts "Skipping application selection... using current directory"
95
+ unless preselect
96
+ puts "Skipping application selection... using current directory"
97
+ end
86
98
  global_config = {}
87
99
  else
88
100
  exit 1
89
101
  end
90
102
  elsif app = global_config[app_id - 1]
91
- puts "\e[35mYou selected #{app['name']}\e[0m"
103
+ unless preselect
104
+ puts "\e[35mYou selected #{app['name']}\e[0m"
105
+ end
92
106
  global_config = app
93
107
  else
94
108
  puts "Invalid app number"
@@ -101,7 +115,7 @@ end
101
115
  if global_config['user'] && ENV['USER'] != global_config['user']
102
116
  if global_config['user_reexec']
103
117
  $stderr.puts "\e[31mProcodile must be run as #{global_config['user']}. Re-executing as #{global_config['user']}...\e[0m"
104
- exec "sudo -u #{global_config['user']} -- #{$0} #{ARGV.join(' ')}"
118
+ exec("sudo -E -u #{global_config['user']} -- #{$0} #{ORIGINAL_ARGV}")
105
119
  else
106
120
  $stderr.puts "\e[31mError: Procodile must be run as #{global_config['user']}\e[0m"
107
121
  exit 1
@@ -1,3 +1,3 @@
1
1
  module Procodile
2
- VERSION = '1.0.11'
2
+ VERSION = '1.0.12'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: procodile
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.11
4
+ version: 1.0.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Cooke
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-03-20 00:00:00.000000000 Z
11
+ date: 2017-03-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json