satorix-rails 1.2.2 → 1.3.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
  SHA256:
3
- metadata.gz: 3949871c7a24df013f4f59c91eea2e07cc1d954c42535116b3a1c4dc6832b546
4
- data.tar.gz: 6b6ea3f3229e0d5379a0781be75ca3c8215a83e5109758d512cbdb744f556c67
3
+ metadata.gz: 435a13aeb52a37926e1c05131e9ade2acef2a753076fd973cdcec8fc42a1dbbc
4
+ data.tar.gz: 5809274213b07e1bcdc4f573efabd0f2f0c3d67105f6f25e5eff09f6e80c077b
5
5
  SHA512:
6
- metadata.gz: 416449f6f8f67cdee5340d9c04cff43b584a698eee6fcdacc6c3e68409d747df89bb56adbc854cef88eada785319dc38c344b0c45b958d0add3695bcb9801fd9
7
- data.tar.gz: 7f23d2e504afd46918a4a6063085626a60af6a020e0a21634dafd51b32b8941d6f4d7d96a21c31e8f8cef6ad7c5fb1012bdd789d7072d556eb151955c3510235
6
+ metadata.gz: cc01af9987e38d189dee15d4b4d5ee89c9ef0a443beed6f23d6b2a869b381273563355dd378754615ad784f30c3574cb7e8c4b04dcd7739a3918388fb77577fd
7
+ data.tar.gz: 46fa05b77b27a9e5c8892aa23c8d87f052adcac05004886966d769c05c35a6152280e0b766056318c11a89ce23cdd98fd411c9e19592d5b9b3dd60d83322b804
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- satorix-rails (1.2.2)
4
+ satorix-rails (1.3.0)
5
5
  passenger
6
6
 
7
7
  GEM
@@ -3,10 +3,8 @@ module Satorix
3
3
  module Deploy
4
4
  module MockDeploy
5
5
 
6
-
7
6
  include Satorix::Shared::Console
8
7
 
9
-
10
8
  extend self
11
9
 
12
10
 
@@ -17,19 +15,18 @@ module Satorix
17
15
  end
18
16
 
19
17
 
20
- private ########################################################################################################
18
+ private
21
19
 
22
20
 
23
- def turbines_to_speed
24
- batnap
25
- puts 'Roger. Ready to move out.'
26
- end
21
+ def turbines_to_speed
22
+ batnap
23
+ puts 'Roger. Ready to move out.'
24
+ end
27
25
 
28
26
 
29
- def batnap
30
- sleep(rand(6))
31
- end
32
-
27
+ def batnap
28
+ sleep(rand(6))
29
+ end
33
30
 
34
31
  end
35
32
  end
@@ -5,21 +5,16 @@ module Satorix
5
5
  # This is the simplest possible implementation of a custom job.
6
6
  module BareBones
7
7
 
8
-
9
8
  extend self
10
9
 
11
10
  # go() is the method that will be called during the CI run.
12
11
  # You can add your own logic to do whatever you want.
13
12
  def go
14
- # Uncomment the line below if you want to execute in the context of the app's buildpack.
15
- # Satorix::CI::Test::Shared::BuildpackManager.go
16
13
  puts "\n\nRunning BareBones#go..."
17
14
  end
18
15
 
19
-
20
16
  end
21
17
 
22
-
23
18
  end
24
19
  end
25
20
  end
@@ -3,17 +3,13 @@ module Satorix
3
3
  module Test
4
4
  module Info
5
5
 
6
-
7
6
  include Satorix::Shared::Console
8
7
 
9
-
10
8
  extend self
11
9
 
12
10
  # go() is the method that will be called during the CI run.
13
11
  # You can add your own logic to do whatever you want.
14
12
  def go
15
- # Uncomment the line below if you want to execute in the context of the app's buildpack.
16
- # Satorix::CI::Test::Shared::BuildpackManager.go
17
13
 
18
14
  log_bench('Describing logging...') do
19
15
  describe_log
@@ -22,7 +18,7 @@ module Satorix
22
18
  end
23
19
 
24
20
  log_bench('Describing console commands...') do
25
- describe_run_command_string
21
+ describe_unsafe_run_command_string
26
22
  describe_run_command_array
27
23
  describe_run_command_filtered
28
24
  describe_run_command_quiet
@@ -33,62 +29,67 @@ module Satorix
33
29
  end
34
30
 
35
31
 
36
- private ########################################################################################################
32
+ private
37
33
 
38
34
 
39
- def describe_environment_variables
40
- puts "Remember, #{ ENV['GITLAB_USER_EMAIL'] }, that you have access to all of the environment variables ",
41
- ' described at https://docs.gitlab.com/ce/ci/variables/#predefined-variables-environment-variables'
42
- end
35
+ def describe_environment_variables
36
+ puts "Remember, #{ ENV['GITLAB_USER_EMAIL'] }, that you have access to all of the environment variables ",
37
+ ' described at https://docs.gitlab.com/ce/ci/variables/#predefined-variables-environment-variables'
38
+ end
43
39
 
44
40
 
45
- def describe_log
46
- log 'The log() method writes a message to the log'
47
- colors.keys.each { |color| log "You can provide an optional color, like :#{ color }", color }
48
- end
41
+ def describe_log
42
+ log 'The log() method writes a message to the log'
43
+ colors.keys.each { |color| log "You can provide an optional color, like :#{ color }", color }
44
+ end
49
45
 
50
46
 
51
- def describe_log_error
52
- log_error 'The log_error() method writes an error to the log'
53
- end
47
+ def describe_log_error
48
+ log_error 'The log_error() method writes an error to the log'
49
+ end
54
50
 
55
51
 
56
- def describe_log_error_and_abort
57
- log_error 'The log_error_and_abort() method writes an error to the log and aborts the job'
58
- rescue SystemExit => e
59
- puts 'Rescuing from the error, to continue the tutorial.',
60
- e.inspect
61
- end
52
+ def describe_log_error_and_abort
53
+ log_error 'The log_error_and_abort() method writes an error to the log and aborts the job'
54
+ rescue SystemExit => e
55
+ puts 'Rescuing from the error, to continue the tutorial.',
56
+ e.inspect
57
+ end
62
58
 
63
59
 
64
- def describe_run_command_string
65
- run_command "echo 'We can safely run string console commands with the run_command() method'"
66
- end
67
-
60
+ def describe_unsafe_run_command_string
61
+ # It is possible to use a string command that is assumed to be already escaped and will not be escaped further.
62
+ # See below for safer alternate options.
63
+ # Please see the run_command documentation in the satorix gem for more information and examples.
64
+ run_command "echo 'We can run string console commands that have already been properly escaped with the run_command() method and the `string_verified_safe: true` option. This is best avoided!'",
65
+ string_verified_safe: true
66
+ end
68
67
 
69
- def describe_run_command_array
70
- run_command ['echo', "'We can safely run array console commands with the run_command() method'"]
71
- end
72
68
 
69
+ def describe_run_command_array
70
+ # It is preferred to use an array command, especially for anything containing dynamic input. Escaping will be taken care of for you.
71
+ # Please see the run_command documentation in the satorix gem for more information and examples.
72
+ run_command ['echo', 'We can safely run unescaped array console commands with the run_command() method. This is ideal!']
73
+ end
73
74
 
74
- def describe_run_command_quiet
75
- run_command "echo 'This will not be displayed'", quiet: true
76
- end
77
75
 
76
+ def describe_run_command_quiet
77
+ run_command ['echo', 'This will not be displayed (but will return the output).'], quiet: true
78
+ end
78
79
 
79
- def describe_run_command_filtered
80
- run_command "echo 'You can filter secrets, like 1234 and 5678 (unless you explicitly display them)'", filtered_text: %w(1234 5678)
81
- end
82
80
 
81
+ def describe_run_command_filtered
82
+ run_command ['echo', 'You can filter sensitive text from the logs, like 1234 and 5678 (the original output will be returned).'], filtered_text: %w(1234 5678)
83
+ end
83
84
 
84
- def describe_run_command_with_error
85
- run_command 'false'
86
- rescue SystemExit
87
- puts 'Commands that exit with a non-zero return code abort operation, unless rescued.',
88
- 'Rescuing from the error, to continue the tutorial.',
89
- e.inspect
90
- end
91
85
 
86
+ def describe_run_command_with_error
87
+ run_command %w[false]
88
+ rescue SystemExit
89
+ puts 'Commands that exit with a non-zero return code abort operation, unless rescued.',
90
+ 'Rescuing from the error, to continue the tutorial.',
91
+ e.inspect
92
+ end
92
93
 
93
94
  end
94
95
  end
@@ -1,7 +1,7 @@
1
1
  module Satorix
2
2
  module Rails
3
3
  module Version
4
- VERSION = '1.2.2'
4
+ VERSION = '1.3.0'
5
5
  end
6
6
  end
7
7
  end
@@ -3,13 +3,10 @@ module Satorix
3
3
  module Deploy
4
4
  module Rubygems
5
5
 
6
-
7
6
  require 'fileutils'
8
7
 
9
-
10
8
  include Satorix::Shared::Console
11
9
 
12
-
13
10
  extend self
14
11
 
15
12
 
@@ -21,113 +18,111 @@ module Satorix
21
18
  end
22
19
 
23
20
 
24
- private ########################################################################################################
21
+ private
25
22
 
26
23
 
27
- def build_gem
28
- Dir.chdir(Satorix.app_dir) do
29
- run_command 'bundle exec rake build'
24
+ def build_gem
25
+ Dir.chdir(Satorix.app_dir) do
26
+ run_command(%w[bundle exec rake build])
27
+ end
30
28
  end
31
- end
32
29
 
33
30
 
34
- def built_gems
35
- Dir.glob(File.join(gem_build_directory, '*.gem')).select { |e| File.file? e }
36
- end
37
-
38
-
39
- def gem_build_directory
40
- File.join Satorix.app_dir, 'pkg'
41
- end
31
+ def built_gems
32
+ Dir.glob(File.join(gem_build_directory, '*.gem')).select { |e| File.file? e }
33
+ end
42
34
 
43
35
 
44
- def generate_rubygems_configuration_file
45
- path = File.join(Dir.home, '.gem')
46
- FileUtils.mkdir_p(path) unless File.exist?(path)
36
+ def gem_build_directory
37
+ File.join Satorix.app_dir, 'pkg'
38
+ end
47
39
 
48
- file = File.join(path, 'credentials')
49
- File.open(file, 'w') { |f| f.write rubygems_configuration_file_contents }
50
- FileUtils.chmod 0600, file
51
- end
52
40
 
41
+ def generate_rubygems_configuration_file
42
+ path = File.join(Dir.home, '.gem')
43
+ FileUtils.mkdir_p(path) unless File.exist?(path)
53
44
 
54
- def prepare_gem_build_directory
55
- run_command "rm -rf #{ gem_build_directory }"
56
- FileUtils.mkdir_p gem_build_directory
57
- end
45
+ file = File.join(path, 'credentials')
46
+ File.open(file, 'w') { |f| f.write rubygems_configuration_file_contents }
47
+ FileUtils.chmod 0600, file
48
+ end
58
49
 
59
50
 
60
- def publish_gem(gem)
61
- run_command "gem push #{ gem } --config-file #{ File.join(Dir.home, '.gem', 'credentials') }"
62
- rescue RuntimeError
63
- # To prevent the display of an ugly stacktrace.
64
- abort "\nGem was not published!"
65
- end
51
+ def prepare_gem_build_directory
52
+ run_command(['rm', '-rf', gem_build_directory])
53
+ FileUtils.mkdir_p gem_build_directory
54
+ end
66
55
 
67
56
 
68
- def rubygems_api_key
69
- ENV['SATORIX_CI_RUBYGEMS_API_KEY']
70
- end
57
+ def publish_gem(gem)
58
+ run_command ['gem', 'push', gem, '--config-file', File.join(Dir.home, '.gem', 'credentials')]
59
+ rescue RuntimeError
60
+ # To prevent the display of an ugly stacktrace.
61
+ abort "\nGem was not published!"
62
+ end
71
63
 
72
64
 
73
- def rubygems_configuration_file_contents
74
- "---\n:rubygems_api_key: #{ rubygems_api_key }"
75
- end
65
+ def rubygems_api_key
66
+ ENV['SATORIX_CI_RUBYGEMS_API_KEY']
67
+ end
76
68
 
77
69
 
78
- # To be used for rake release - START
70
+ def rubygems_configuration_file_contents
71
+ "---\n:rubygems_api_key: #{ rubygems_api_key }"
72
+ end
79
73
 
80
74
 
81
- def configure_git
82
- run_command 'git config user.name Satorix'
83
- run_command 'git config user.email satorix@iexposure.com'
84
- run_command 'git config push.default simple'
85
- end
75
+ # To be used for rake release - START
86
76
 
77
+ def configure_git
78
+ run_command(%w[git config user.name Satorix])
79
+ run_command(%w[git config user.email satorix@iexposure.com])
80
+ run_command(%w[git config push.default simple])
81
+ end
87
82
 
88
- def configure_ssh
89
- run_command 'whoami'
90
- run_command 'printenv'
91
83
 
92
- path = File.join(Dir.home, '.ssh')
93
- FileUtils.mkdir_p(path) unless File.exist?(path)
84
+ def configure_ssh
85
+ run_command(%w[whoami])
86
+ run_command(%w[printenv])
94
87
 
95
- public_key_file = File.join(path, 'id_rsa.pub')
96
- File.open(public_key_file, 'w') { |f| f.write ssh_public_key }
97
- FileUtils.chmod 0600, public_key_file
98
- run_command "cat #{ public_key_file }"
88
+ path = File.join(Dir.home, '.ssh')
89
+ FileUtils.mkdir_p(path) unless File.exist?(path)
99
90
 
100
- private_key_file = File.join(path, 'id_rsa')
101
- File.open(private_key_file, 'w') { |f| f.write ssh_private_key }
102
- FileUtils.chmod 0600, private_key_file
91
+ public_key_file = File.join(path, 'id_rsa.pub')
92
+ File.open(public_key_file, 'w') { |f| f.write ssh_public_key }
93
+ FileUtils.chmod 0600, public_key_file
94
+ run_command(['cat', public_key_file])
103
95
 
104
- config_file = File.join(path, 'config')
105
- File.open(config_file, 'w') { |f| f.write "IdentityFile #{ private_key_file }" }
106
- FileUtils.chmod 0600, config_file
107
- run_command "cat #{ config_file }"
96
+ private_key_file = File.join(path, 'id_rsa')
97
+ File.open(private_key_file, 'w') { |f| f.write ssh_private_key }
98
+ FileUtils.chmod 0600, private_key_file
108
99
 
109
- system 'eval `ssh-agent -s`'
110
- run_command "ssh-add #{ private_key_file }"
111
- end
100
+ config_file = File.join(path, 'config')
101
+ File.open(config_file, 'w') { |f| f.write "IdentityFile #{ private_key_file }" }
102
+ FileUtils.chmod 0600, config_file
103
+ run_command(['cat', config_file])
112
104
 
105
+ system 'eval `ssh-agent -s`'
106
+ run_command(['ssh-add', private_key_file])
107
+ end
113
108
 
114
- def rake_release
115
- run_command 'bundle exec rake release'
116
- end
117
109
 
110
+ def rake_release
111
+ run_command(%w[bundle exec rake release])
112
+ end
118
113
 
119
- def ssh_private_key
120
- ENV['SATORIX_CI_SSH_PRIVATE_KEY']
121
- end
122
114
 
115
+ def ssh_private_key
116
+ ENV['SATORIX_CI_SSH_PRIVATE_KEY']
117
+ end
123
118
 
124
- def ssh_public_key
125
- ENV['SATORIX_CI_SSH_PUBLIC_KEY']
126
- end
127
119
 
120
+ def ssh_public_key
121
+ ENV['SATORIX_CI_SSH_PUBLIC_KEY']
122
+ end
128
123
 
129
- # To be used for rake release - END
130
124
 
125
+ # To be used for rake release - END
131
126
 
132
127
  end
133
128
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: satorix-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.2
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Satorix
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-09-10 00:00:00.000000000 Z
11
+ date: 2021-01-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: passenger