satorix-rails 1.0.11 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitlab-ci.yml +5 -5
- data/lib/satorix/rails/version.rb +1 -1
- data/satorix/CI/deploy/rubygems.rb +133 -0
- data/satorix/custom.rb +2 -2
- metadata +4 -4
- data/satorix/CI/deploy/ie_gem_server.rb +0 -80
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3d1f056ae46c1a30b11c11a567472d7b254cef1f
|
4
|
+
data.tar.gz: 2ac2d811653c9bbccde23798c2a95e5b168fe178
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0fb99f81039e25fcc45cec5a6a3eea40f81c627572f4d0530fdda5005616a04b0ae62fa086b03173d6b1b8bb5fad797fc656a218d5b5d04006ae51fca026b09d
|
7
|
+
data.tar.gz: 86f4beb0bb36105bc144778137776dddd93c74f97bd5d3cf59d39b23cdbfd8597cfb4b92e8505f83604da7d52d23d393257258027035698cb4477a60df80a437
|
data/.gitlab-ci.yml
CHANGED
@@ -14,14 +14,14 @@ cache:
|
|
14
14
|
- 'tmp/satorix/cache' # To cache buildpack gems between runs.
|
15
15
|
|
16
16
|
|
17
|
-
rspec:
|
18
|
-
before_script:
|
19
|
-
- sed -i -e 's/add_development_dependency/add_dependency/g' satorix-rails.gemspec # To avoid an application dependency, but still be available for CI
|
20
|
-
<<: *satorix
|
17
|
+
#rspec:
|
18
|
+
# before_script:
|
19
|
+
# - sed -i -e 's/add_development_dependency/add_dependency/g' satorix-rails.gemspec # To avoid an application dependency, but still be available for CI
|
20
|
+
# <<: *satorix
|
21
21
|
|
22
22
|
|
23
23
|
# This is a custom job, defined at satorix/CI/deploy/ie_gem_server.rb
|
24
|
-
|
24
|
+
deploy_to_rubygems:
|
25
25
|
environment:
|
26
26
|
name: $CI_COMMIT_REF_NAME
|
27
27
|
url: 'http://gems.iexposure.com/gems/satorix-rails'
|
@@ -0,0 +1,133 @@
|
|
1
|
+
module Satorix
|
2
|
+
module CI
|
3
|
+
module Deploy
|
4
|
+
module Rubygems
|
5
|
+
|
6
|
+
|
7
|
+
require 'fileutils'
|
8
|
+
|
9
|
+
|
10
|
+
include Satorix::Shared::Console
|
11
|
+
|
12
|
+
|
13
|
+
extend self
|
14
|
+
|
15
|
+
|
16
|
+
def go
|
17
|
+
log_bench('Generating rubygems.org configuration_file...') { generate_rubygems_configuration_file }
|
18
|
+
log_bench('Preparing gem build directory...') { prepare_gem_build_directory }
|
19
|
+
log_bench('Building gem...') { build_gem }
|
20
|
+
built_gems.each { |gem| log_bench("Publishing #{ File.basename gem }...") { publish_gem gem } }
|
21
|
+
end
|
22
|
+
|
23
|
+
|
24
|
+
private ########################################################################################################
|
25
|
+
|
26
|
+
|
27
|
+
def build_gem
|
28
|
+
run_command 'rake build'
|
29
|
+
end
|
30
|
+
|
31
|
+
|
32
|
+
def built_gems
|
33
|
+
Dir.glob(File.join(gem_build_directory, '*.gem')).select { |e| File.file? e }
|
34
|
+
end
|
35
|
+
|
36
|
+
|
37
|
+
def gem_build_directory
|
38
|
+
File.join Satorix.app_root, 'pkg'
|
39
|
+
end
|
40
|
+
|
41
|
+
|
42
|
+
def generate_rubygems_configuration_file
|
43
|
+
path = File.join(Dir.home, '.gem')
|
44
|
+
FileUtils.mkdir_p(path) unless File.exist?(path)
|
45
|
+
|
46
|
+
file = File.join(path, 'credentials')
|
47
|
+
File.open(file, 'w') { |f| f.write rubygems_configuration_file_contents }
|
48
|
+
FileUtils.chmod 0600, file
|
49
|
+
end
|
50
|
+
|
51
|
+
|
52
|
+
def prepare_gem_build_directory
|
53
|
+
run_command "rm -rf #{ gem_build_directory }"
|
54
|
+
FileUtils.mkdir_p gem_build_directory
|
55
|
+
end
|
56
|
+
|
57
|
+
|
58
|
+
def publish_gem(gem)
|
59
|
+
run_command "gem push #{ gem } --config-file #{ File.join(Dir.home, '.gem', 'credentials') }"
|
60
|
+
rescue RuntimeError
|
61
|
+
# To prevent the display of an ugly stacktrace.
|
62
|
+
abort "\nGem was not published!"
|
63
|
+
end
|
64
|
+
|
65
|
+
|
66
|
+
def rubygems_api_key
|
67
|
+
ENV['SATORIX_CI_RUBYGEMS_API_KEY']
|
68
|
+
end
|
69
|
+
|
70
|
+
|
71
|
+
def rubygems_configuration_file_contents
|
72
|
+
"---\n:rubygems_api_key: #{ rubygems_api_key }"
|
73
|
+
end
|
74
|
+
|
75
|
+
|
76
|
+
# To be used for rake release - START
|
77
|
+
|
78
|
+
|
79
|
+
def configure_git
|
80
|
+
run_command 'git config user.name Satorix'
|
81
|
+
run_command 'git config user.email satorix@iexposure.com'
|
82
|
+
run_command 'git config push.default simple'
|
83
|
+
end
|
84
|
+
|
85
|
+
|
86
|
+
def configure_ssh
|
87
|
+
run_command 'whoami'
|
88
|
+
run_command 'printenv'
|
89
|
+
|
90
|
+
path = File.join(Dir.home, '.ssh')
|
91
|
+
FileUtils.mkdir_p(path) unless File.exist?(path)
|
92
|
+
|
93
|
+
public_key_file = File.join(path, 'id_rsa.pub')
|
94
|
+
File.open(public_key_file, 'w') { |f| f.write ssh_public_key }
|
95
|
+
FileUtils.chmod 0600, public_key_file
|
96
|
+
run_command "cat #{ public_key_file }"
|
97
|
+
|
98
|
+
private_key_file = File.join(path, 'id_rsa')
|
99
|
+
File.open(private_key_file, 'w') { |f| f.write ssh_private_key }
|
100
|
+
FileUtils.chmod 0600, private_key_file
|
101
|
+
|
102
|
+
config_file = File.join(path, 'config')
|
103
|
+
File.open(config_file, 'w') { |f| f.write "IdentityFile #{ private_key_file }" }
|
104
|
+
FileUtils.chmod 0600, config_file
|
105
|
+
run_command "cat #{ config_file }"
|
106
|
+
|
107
|
+
system 'eval `ssh-agent -s`'
|
108
|
+
run_command "ssh-add #{ private_key_file }"
|
109
|
+
end
|
110
|
+
|
111
|
+
|
112
|
+
def rake_release
|
113
|
+
run_command 'bundle exec rake release'
|
114
|
+
end
|
115
|
+
|
116
|
+
|
117
|
+
def ssh_private_key
|
118
|
+
ENV['SATORIX_CI_SSH_PRIVATE_KEY']
|
119
|
+
end
|
120
|
+
|
121
|
+
|
122
|
+
def ssh_public_key
|
123
|
+
ENV['SATORIX_CI_SSH_PUBLIC_KEY']
|
124
|
+
end
|
125
|
+
|
126
|
+
|
127
|
+
# To be used for rake release - END
|
128
|
+
|
129
|
+
|
130
|
+
end
|
131
|
+
end
|
132
|
+
end
|
133
|
+
end
|
data/satorix/custom.rb
CHANGED
@@ -2,7 +2,7 @@ module Satorix
|
|
2
2
|
module Custom
|
3
3
|
|
4
4
|
|
5
|
-
require_relative 'CI/deploy/
|
5
|
+
require_relative 'CI/deploy/rubygems.rb'
|
6
6
|
|
7
7
|
|
8
8
|
extend self
|
@@ -11,7 +11,7 @@ module Satorix
|
|
11
11
|
def available_jobs
|
12
12
|
{
|
13
13
|
deploy: {
|
14
|
-
|
14
|
+
deploy_to_rubygems: Satorix::CI::Deploy::Rubygems
|
15
15
|
}
|
16
16
|
}
|
17
17
|
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.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Internet Exposure
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-08-
|
11
|
+
date: 2017-08-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: passenger
|
@@ -100,7 +100,7 @@ files:
|
|
100
100
|
- lib/satorix/rails.rb
|
101
101
|
- lib/satorix/rails/version.rb
|
102
102
|
- satorix-rails.gemspec
|
103
|
-
- satorix/CI/deploy/
|
103
|
+
- satorix/CI/deploy/rubygems.rb
|
104
104
|
- satorix/custom.rb
|
105
105
|
homepage: https://www.satorix.com
|
106
106
|
licenses: []
|
@@ -122,7 +122,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
122
122
|
version: '0'
|
123
123
|
requirements: []
|
124
124
|
rubyforge_project:
|
125
|
-
rubygems_version: 2.6.
|
125
|
+
rubygems_version: 2.6.12
|
126
126
|
signing_key:
|
127
127
|
specification_version: 4
|
128
128
|
summary: Satorix in Rails
|
@@ -1,80 +0,0 @@
|
|
1
|
-
module Satorix
|
2
|
-
module CI
|
3
|
-
module Deploy
|
4
|
-
module IeGemServer
|
5
|
-
|
6
|
-
|
7
|
-
require 'fileutils'
|
8
|
-
|
9
|
-
|
10
|
-
include Satorix::Shared::Console
|
11
|
-
|
12
|
-
|
13
|
-
extend self
|
14
|
-
|
15
|
-
|
16
|
-
def go
|
17
|
-
log_bench('Installing the geminabox gem...') { install_geminabox_gem }
|
18
|
-
log_bench('Preparing gem build directory...') { prepare_gem_build_directory }
|
19
|
-
log_bench('Building gem...') { build_gem }
|
20
|
-
built_gems.each { |gem| log_bench("Publishing #{ File.basename gem }...") { publish_gem gem } }
|
21
|
-
end
|
22
|
-
|
23
|
-
|
24
|
-
private ########################################################################################################
|
25
|
-
|
26
|
-
|
27
|
-
def build_gem
|
28
|
-
run_command 'rake build'
|
29
|
-
end
|
30
|
-
|
31
|
-
|
32
|
-
def built_gems
|
33
|
-
Dir.glob(File.join(gem_build_directory, '*.gem')).select { |e| File.file? e }
|
34
|
-
end
|
35
|
-
|
36
|
-
|
37
|
-
def gem_build_directory
|
38
|
-
File.join Satorix.app_root, 'pkg'
|
39
|
-
end
|
40
|
-
|
41
|
-
|
42
|
-
def ie_gem_server_host
|
43
|
-
"https://#{ ie_gem_server_user_name }:#{ ie_gem_server_password }@gems.iexposure.com"
|
44
|
-
end
|
45
|
-
|
46
|
-
|
47
|
-
def ie_gem_server_password
|
48
|
-
ENV['SATORIX_CI_IE_GEM_SERVER_PASSWORD']
|
49
|
-
end
|
50
|
-
|
51
|
-
|
52
|
-
def ie_gem_server_user_name
|
53
|
-
ENV['SATORIX_CI_IE_GEM_SERVER_USER_NAME']
|
54
|
-
end
|
55
|
-
|
56
|
-
|
57
|
-
def install_geminabox_gem
|
58
|
-
run_command 'gem install geminabox --source https://gems.iexposure.com --no-document'
|
59
|
-
end
|
60
|
-
|
61
|
-
|
62
|
-
def prepare_gem_build_directory
|
63
|
-
run_command "rm -rf #{ gem_build_directory }"
|
64
|
-
FileUtils.mkdir_p gem_build_directory
|
65
|
-
end
|
66
|
-
|
67
|
-
|
68
|
-
def publish_gem(gem)
|
69
|
-
run_command "gem inabox #{ gem } --host #{ ie_gem_server_host }",
|
70
|
-
filtered_text: [ie_gem_server_user_name, ie_gem_server_password]
|
71
|
-
rescue RuntimeError
|
72
|
-
# To prevent the display of an ugly stacktrace.
|
73
|
-
abort "\nGem was not published!"
|
74
|
-
end
|
75
|
-
|
76
|
-
|
77
|
-
end
|
78
|
-
end
|
79
|
-
end
|
80
|
-
end
|