skynet-deploy 1.2.0 → 2.0.0
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 +7 -0
- data/.gitignore +1 -0
- data/.ruby-version +1 -0
- data/.travis.yml +8 -0
- data/Gemfile +1 -1
- data/README.md +9 -1
- data/lib/skynet.rb +4 -1
- data/lib/skynet/app.rb +13 -8
- data/lib/skynet/builder/base.rb +16 -25
- data/lib/skynet/builder/jekyll.rb +1 -1
- data/lib/skynet/cli.rb +2 -2
- data/lib/skynet/version.rb +1 -1
- data/lib/skynet/wizard.rb +10 -6
- data/skynet.gemspec +14 -14
- data/spec/skynet/builder/base_spec.rb +31 -33
- data/spec/skynet/builder/jekyll_spec.rb +3 -3
- data/spec/skynet/builder/static_spec.rb +12 -12
- data/spec/skynet/builder_spec.rb +6 -6
- data/spec/spec_helper.rb +13 -0
- metadata +62 -89
- data/.rvmrc +0 -41
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: d95d2b638d8f8be544d5c42e7e6641cc5cb25d15c7b7ede90cb1619cef4898ee
|
|
4
|
+
data.tar.gz: 2442555551e7836aed334417344571c7e0aaf54e83960e2f3dc4c6d718992445
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 5c4e37a158a27f1b1e95c448d6ca7b11cf2e66f1398c874a89950fad652bdb338552c9c4724f937c5c9b972b880e3d1021c8d1b6d64544d8ea718822f98dd2db
|
|
7
|
+
data.tar.gz: 9d89854abc786aad9e87e3d1d5061525d2c0aa6431a668e1b67b64e87d39435d8547af35de4a4a24e90b5f3a9aea345454df18c94c22c6105e11a13764f4ed65
|
data/.gitignore
CHANGED
data/.ruby-version
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
2.7.2
|
data/.travis.yml
ADDED
data/Gemfile
CHANGED
data/README.md
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
Skynet
|
|
2
2
|
======
|
|
3
3
|
|
|
4
|
+
[](https://travis-ci.com/rahearn/skynet)
|
|
5
|
+
|
|
4
6
|
GitHub-aware website builder
|
|
5
7
|
|
|
6
8
|
Skynet builds and deploys web sites on your VPS or bare metal server. It is triggered by the post-receive hook.
|
|
@@ -20,7 +22,8 @@ Usage
|
|
|
20
22
|
* Install basic config file: `$ skynet config <first project name>`
|
|
21
23
|
* edit config file to add your repositories
|
|
22
24
|
* Run builder by hand to ensure everything works: `$ skynet build`
|
|
23
|
-
* Add `http://YOUR_SKYNET_SERVER/PROJECT_NAME` as a
|
|
25
|
+
* Add `http://YOUR_SKYNET_SERVER/PROJECT_NAME` as a Webhook Payload URL to your repository under
|
|
26
|
+
`Settings -> Webhooks`. Choose `application/json` as the Content type.
|
|
24
27
|
* Start server: `$ skynet server`
|
|
25
28
|
|
|
26
29
|
Config file arguments
|
|
@@ -55,3 +58,8 @@ a git server other than GitHub.
|
|
|
55
58
|
|
|
56
59
|
The URL must be visible from the Skynet server, as it will pull a new
|
|
57
60
|
copy of the repository from this server.
|
|
61
|
+
|
|
62
|
+
Upgrading from 1.x
|
|
63
|
+
==================
|
|
64
|
+
|
|
65
|
+
* Private repositories must explicitly set the `repository` key in the config to the ssh-compatible url. Previously this was optional for Github repos
|
data/lib/skynet.rb
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
require 'skynet/version'
|
|
2
2
|
require 'logger'
|
|
3
3
|
|
|
4
|
+
require 'i18n'
|
|
5
|
+
I18n.enforce_available_locales = false
|
|
6
|
+
|
|
4
7
|
module Skynet
|
|
5
8
|
|
|
6
9
|
autoload :Builder, 'skynet/builder'
|
|
@@ -10,7 +13,7 @@ module Skynet
|
|
|
10
13
|
autoload :HookGenerator, 'skynet/hook_generator'
|
|
11
14
|
|
|
12
15
|
def self.logger
|
|
13
|
-
@logger ||= Logger.new(
|
|
16
|
+
@logger ||= Logger.new($stdout)
|
|
14
17
|
end
|
|
15
18
|
|
|
16
19
|
def self.logger=(logger)
|
data/lib/skynet/app.rb
CHANGED
|
@@ -3,19 +3,21 @@ require 'json'
|
|
|
3
3
|
require 'active_support/core_ext/object/blank'
|
|
4
4
|
|
|
5
5
|
module Skynet
|
|
6
|
-
|
|
7
6
|
class App < Sinatra::Base
|
|
8
|
-
|
|
9
7
|
before do
|
|
10
|
-
@payload =
|
|
8
|
+
@payload = begin
|
|
9
|
+
JSON.parse request.body.read
|
|
10
|
+
rescue JSON::ParserError
|
|
11
|
+
{}
|
|
12
|
+
end
|
|
11
13
|
end
|
|
12
14
|
|
|
13
15
|
get '/' do
|
|
14
|
-
%[Hello. Check <a href="https://github.com/
|
|
16
|
+
%[Hello. Check <a href="https://github.com/rahearn/skynet">github</a> for more infomation on skynet]
|
|
15
17
|
end
|
|
16
18
|
|
|
17
19
|
post '/' do
|
|
18
|
-
Skynet.logger.debug "post
|
|
20
|
+
Skynet.logger.debug "post '/' payload: #{@payload.inspect}"
|
|
19
21
|
app_name = settings.config.each { |n, c| break n if c[:url] == @payload['repository']['url'] }
|
|
20
22
|
if app_name.is_a? String
|
|
21
23
|
deploy app_name
|
|
@@ -26,14 +28,14 @@ module Skynet
|
|
|
26
28
|
end
|
|
27
29
|
|
|
28
30
|
post '/:app_name' do |app_name|
|
|
29
|
-
Skynet.logger.debug "post /#{app_name}
|
|
31
|
+
Skynet.logger.debug "post '/#{app_name}' payload: #{@payload.inspect}"
|
|
30
32
|
deploy app_name
|
|
31
33
|
end
|
|
32
34
|
|
|
33
35
|
private
|
|
34
36
|
|
|
35
37
|
def deploy(app_name)
|
|
36
|
-
Skynet.logger.info %{Attempting to deploy "#{app_name
|
|
38
|
+
Skynet.logger.info %{Attempting to deploy "#{app_name}"}
|
|
37
39
|
config = settings.config[app_name]
|
|
38
40
|
if deployable? config
|
|
39
41
|
Builder.build app_name, config, branch
|
|
@@ -44,15 +46,18 @@ module Skynet
|
|
|
44
46
|
end
|
|
45
47
|
|
|
46
48
|
def deployable?(config)
|
|
49
|
+
Skynet.logger.debug "Payload url: #{@payload['repository']['url']}"
|
|
50
|
+
Skynet.logger.debug "Payload after: #{@payload['after']}"
|
|
47
51
|
config.present? &&
|
|
48
52
|
config[:url] == @payload['repository']['url'] &&
|
|
53
|
+
@payload['after'].present? &&
|
|
49
54
|
@payload['after'] !~ /^0{40}$/
|
|
50
55
|
end
|
|
51
56
|
|
|
52
57
|
def branch
|
|
58
|
+
Skynet.logger.debug "Payload ref: #{@payload['ref']}"
|
|
53
59
|
@payload['ref'] =~ %r[^refs/heads/(.*)$]
|
|
54
60
|
$1
|
|
55
61
|
end
|
|
56
62
|
end
|
|
57
|
-
|
|
58
63
|
end
|
data/lib/skynet/builder/base.rb
CHANGED
|
@@ -13,7 +13,7 @@ module Skynet
|
|
|
13
13
|
attr_accessor :app, :url, :branch, :destination, :branches, :type, :repository
|
|
14
14
|
attr_reader :source, :key
|
|
15
15
|
|
|
16
|
-
validates_presence_of :app, :url, :
|
|
16
|
+
validates_presence_of :app, :url, :branches, :branch, :destination
|
|
17
17
|
validates_inclusion_of :type,
|
|
18
18
|
in: ALLOWED_BUILDERS,
|
|
19
19
|
message: "must be one of #{ALLOWED_BUILDERS}"
|
|
@@ -26,26 +26,28 @@ module Skynet
|
|
|
26
26
|
@source = File.join Dir.pwd, app, '.'
|
|
27
27
|
@key = config[:key]
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
self.
|
|
33
|
-
else
|
|
34
|
-
self.branches = config[:branches]
|
|
29
|
+
self.branches = config[:branches]
|
|
30
|
+
if branches.present? && branches.first.present?
|
|
31
|
+
self.branch = branches.first[0]
|
|
32
|
+
self.destination = branches.first[1]
|
|
35
33
|
end
|
|
36
|
-
self.
|
|
37
|
-
self.
|
|
38
|
-
self.
|
|
39
|
-
self.type = config[:type]
|
|
40
|
-
self.repository = config[:repository]
|
|
34
|
+
self.url = config[:url]
|
|
35
|
+
self.type = config[:type]
|
|
36
|
+
self.repository = config[:repository]
|
|
41
37
|
end
|
|
42
38
|
|
|
43
39
|
def build(branch=nil)
|
|
44
|
-
|
|
40
|
+
if branch.present?
|
|
45
41
|
return if branches[branch].blank?
|
|
46
42
|
self.branches = { branch => branches[branch] }
|
|
47
43
|
end
|
|
48
44
|
|
|
45
|
+
unless valid?
|
|
46
|
+
Skynet.logger.error "Configuration error for #{app} (branch: #{branch})"
|
|
47
|
+
Skynet.logger.error errors.full_messages.join '. '
|
|
48
|
+
raise ArgumentError
|
|
49
|
+
end
|
|
50
|
+
|
|
49
51
|
branches.each_pair do |branch, destination|
|
|
50
52
|
self.branch = branch.to_s
|
|
51
53
|
self.destination = destination
|
|
@@ -70,18 +72,7 @@ module Skynet
|
|
|
70
72
|
end
|
|
71
73
|
|
|
72
74
|
def remote_repository
|
|
73
|
-
repository ||
|
|
74
|
-
end
|
|
75
|
-
|
|
76
|
-
def translate_url
|
|
77
|
-
uri = URI.parse url
|
|
78
|
-
if uri.host == 'github.com'
|
|
79
|
-
"git@github.com:#{uri.path.gsub %r[(^/)|(/$)|(\.git$)], ''}.git"
|
|
80
|
-
else
|
|
81
|
-
url
|
|
82
|
-
end
|
|
83
|
-
rescue URI::InvalidURIError
|
|
84
|
-
url
|
|
75
|
+
repository || url
|
|
85
76
|
end
|
|
86
77
|
|
|
87
78
|
def create_repo
|
|
@@ -6,7 +6,7 @@ module Skynet
|
|
|
6
6
|
|
|
7
7
|
def execute
|
|
8
8
|
Skynet.logger.debug "PWD: #{Dir.pwd} Source: #{source} Destination: #{destination}"
|
|
9
|
-
Skynet.logger.info `jekyll
|
|
9
|
+
Skynet.logger.info `jekyll build --source #{source} --destination #{destination}`
|
|
10
10
|
|
|
11
11
|
Skynet.logger.info 'Jekyll finished'
|
|
12
12
|
end
|
data/lib/skynet/cli.rb
CHANGED
|
@@ -20,9 +20,9 @@ module Skynet
|
|
|
20
20
|
method_option :port, type: :numeric, default: 7575, aliases: '-p', desc: 'Port to listen on'
|
|
21
21
|
method_option :host, type: :string, default: '0.0.0.0', aliases: '-h', desc: 'Interface to listen on'
|
|
22
22
|
method_option :file, type: :string, default: './config.yml', aliases: '-f', desc: 'Configuration file'
|
|
23
|
-
method_option :log, type: :string,
|
|
23
|
+
method_option :log, type: :string, aliases: '-l', desc: 'Log file'
|
|
24
24
|
def server
|
|
25
|
-
Skynet.logger = Logger.new
|
|
25
|
+
Skynet.logger = Logger.new(options[:log], 'weekly') unless options[:log].nil?
|
|
26
26
|
|
|
27
27
|
unless File.exist? options[:file]
|
|
28
28
|
Skynet.logger.fatal "Configuration file #{options[:file]} cannot be found"
|
data/lib/skynet/version.rb
CHANGED
data/lib/skynet/wizard.rb
CHANGED
|
@@ -19,9 +19,9 @@ module Skynet
|
|
|
19
19
|
def repository_url
|
|
20
20
|
if ask('Is the repository on github? (y/n)').downcase == 'y'
|
|
21
21
|
@github = true
|
|
22
|
-
owner = ask 'Repository owner:'
|
|
23
|
-
project = ask 'Github project name:'
|
|
24
|
-
"https://github.com/#{owner}/#{project}"
|
|
22
|
+
@owner = ask 'Repository owner:'
|
|
23
|
+
@project = ask 'Github project name:'
|
|
24
|
+
"https://github.com/#{@owner}/#{@project}"
|
|
25
25
|
else
|
|
26
26
|
@github = false
|
|
27
27
|
ask 'Repository URL:'
|
|
@@ -40,9 +40,13 @@ module Skynet
|
|
|
40
40
|
def private_key
|
|
41
41
|
needs_key = ask('Is this a private repository? (y/n)').downcase
|
|
42
42
|
if needs_key == 'y'
|
|
43
|
-
[" key: #{ask 'Full path to ssh key:'}"]
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
private_configs = [" key: #{ask 'Full path to ssh key:'}"]
|
|
44
|
+
if @github
|
|
45
|
+
private_configs << " repository: git@github.com:#{@owner}/#{@project}.git"
|
|
46
|
+
else
|
|
47
|
+
private_configs << " repository: #{ask 'SSH repository address:'}"
|
|
48
|
+
end
|
|
49
|
+
private_configs.join "\n"
|
|
46
50
|
else
|
|
47
51
|
nil
|
|
48
52
|
end
|
data/skynet.gemspec
CHANGED
|
@@ -7,28 +7,28 @@ Gem::Specification.new do |s|
|
|
|
7
7
|
s.version = Skynet::VERSION
|
|
8
8
|
s.platform = Gem::Platform::RUBY
|
|
9
9
|
s.authors = ["Ryan Ahearn"]
|
|
10
|
-
s.email = ["ryan@
|
|
11
|
-
s.homepage = "https://github.com/
|
|
10
|
+
s.email = ["ryan.ahearn@hey.com"]
|
|
11
|
+
s.homepage = "https://github.com/rahearn/skynet"
|
|
12
12
|
s.summary = %q{Sinatra app that listens for GitHub post-receive callbacks and deploys your code}
|
|
13
13
|
s.description = %q{Sinatra app that listens for GitHub post-receive callbacks and deploys your code}
|
|
14
14
|
|
|
15
|
-
s.
|
|
15
|
+
s.required_ruby_version = ">= 2.7.1"
|
|
16
16
|
|
|
17
17
|
s.files = `git ls-files`.split("\n")
|
|
18
18
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
|
19
19
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
|
20
20
|
s.require_paths = ["lib"]
|
|
21
21
|
|
|
22
|
-
s.add_runtime_dependency 'sinatra', '~> 1
|
|
23
|
-
s.add_runtime_dependency 'thin', '~> 1.
|
|
24
|
-
s.add_runtime_dependency 'json', '~>
|
|
25
|
-
s.add_runtime_dependency 'jekyll', '~>
|
|
26
|
-
s.add_runtime_dependency 'thor', '~> 0
|
|
27
|
-
s.add_runtime_dependency 'activesupport', '~>
|
|
28
|
-
s.add_runtime_dependency 'activemodel', '~>
|
|
29
|
-
s.add_runtime_dependency 'multi_json', '~> 1.
|
|
22
|
+
s.add_runtime_dependency 'sinatra', '~> 2.1'
|
|
23
|
+
s.add_runtime_dependency 'thin', '~> 1.7'
|
|
24
|
+
s.add_runtime_dependency 'json', '~> 2.3'
|
|
25
|
+
s.add_runtime_dependency 'jekyll', '~> 4.1'
|
|
26
|
+
s.add_runtime_dependency 'thor', '~> 1.0'
|
|
27
|
+
s.add_runtime_dependency 'activesupport', '~> 6.0'
|
|
28
|
+
s.add_runtime_dependency 'activemodel', '~> 6.0'
|
|
29
|
+
s.add_runtime_dependency 'multi_json', '~> 1.15'
|
|
30
30
|
|
|
31
|
-
s.add_development_dependency 'rake', '~> 0
|
|
32
|
-
s.add_development_dependency 'rspec', '~>
|
|
33
|
-
s.add_development_dependency 'shoulda-matchers', '~>
|
|
31
|
+
s.add_development_dependency 'rake', '~> 13.0'
|
|
32
|
+
s.add_development_dependency 'rspec', '~> 3.9'
|
|
33
|
+
s.add_development_dependency 'shoulda-matchers', '~> 4.4'
|
|
34
34
|
end
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
require 'spec_helper'
|
|
2
|
-
require 'active_model'
|
|
3
|
-
require 'shoulda-matchers'
|
|
4
2
|
|
|
5
|
-
describe Skynet::Builder::Base do
|
|
3
|
+
describe Skynet::Builder::Base, type: :model do
|
|
6
4
|
|
|
7
5
|
let(:source) { File.join Dir.pwd, 'app', '.' }
|
|
8
6
|
let(:url) { 'https://github.com/org/app' }
|
|
9
7
|
let(:repo) { 'git@github.com:org/app.git' }
|
|
10
|
-
let(:options) { {url: url,
|
|
8
|
+
let(:options) { {url: url, branches: {main: '/var/www'}, type: 'static'} }
|
|
11
9
|
subject { described_class.new 'app', options }
|
|
12
10
|
|
|
13
11
|
describe ".validations" do
|
|
@@ -16,48 +14,48 @@ describe Skynet::Builder::Base do
|
|
|
16
14
|
it { should validate_presence_of :branch }
|
|
17
15
|
it { should validate_presence_of :destination }
|
|
18
16
|
it { should validate_presence_of :branches }
|
|
19
|
-
it { should
|
|
17
|
+
it { should validate_inclusion_of(:type).in_array(%w[static jekyll]).with_message("must be one of [\"static\", \"jekyll\"]") }
|
|
20
18
|
it { should_not allow_value('base').for :type }
|
|
21
19
|
describe "on @branches" do
|
|
22
20
|
before(:each) { subject.valid? }
|
|
23
21
|
|
|
24
22
|
context "when passed a single branch" do
|
|
25
|
-
specify { subject.errors[:branches].
|
|
23
|
+
specify { expect(subject.errors[:branches]).to be_empty }
|
|
26
24
|
end
|
|
27
25
|
context "when passed multiple valid branches" do
|
|
28
|
-
let(:options) { {url: url, type: 'static', branches: {
|
|
29
|
-
specify { subject.errors[:branches].
|
|
26
|
+
let(:options) { {url: url, type: 'static', branches: {main: '/var/www/production', develop: '/var/www/staging'}} }
|
|
27
|
+
specify { expect(subject.errors[:branches]).to be_empty }
|
|
30
28
|
end
|
|
31
29
|
context "when passed an invalid branch" do
|
|
32
|
-
let(:options) { {url: url, type: 'static', branches: {
|
|
30
|
+
let(:options) { {url: url, type: 'static', branches: {main: '/var/www', develop: ''}} }
|
|
33
31
|
it "has an error on branches" do
|
|
34
|
-
subject.errors[:branches].
|
|
32
|
+
expect(subject.errors[:branches]).to include('develop must have a destination')
|
|
35
33
|
end
|
|
36
34
|
end
|
|
37
35
|
end
|
|
38
36
|
describe "on @key" do
|
|
39
37
|
context "when not passed a key" do
|
|
40
38
|
before(:each) { subject.valid? }
|
|
41
|
-
specify { subject.errors[:key].
|
|
39
|
+
specify { expect(subject.errors[:key]).to be_empty }
|
|
42
40
|
end
|
|
43
41
|
|
|
44
42
|
context "when passed a valid key" do
|
|
45
|
-
let(:options) { {key: 'keyfile'} }
|
|
43
|
+
let(:options) { {branches: {main: "/tmp"}, key: 'keyfile'} }
|
|
46
44
|
before(:each) do
|
|
47
|
-
File.
|
|
45
|
+
allow(File).to receive(:readable?).and_return true
|
|
48
46
|
subject.valid?
|
|
49
47
|
end
|
|
50
|
-
specify { subject.errors[:key].
|
|
48
|
+
specify { expect(subject.errors[:key]).to be_empty }
|
|
51
49
|
end
|
|
52
50
|
|
|
53
51
|
context "when passed an invalid key" do
|
|
54
|
-
let(:options) { {key: 'missing_keyfile'} }
|
|
52
|
+
let(:options) { {branches: {main: "/tmp"}, key: 'missing_keyfile'} }
|
|
55
53
|
before(:each) do
|
|
56
|
-
File.
|
|
54
|
+
allow(File).to receive(:readable?).and_return false
|
|
57
55
|
subject.valid?
|
|
58
56
|
end
|
|
59
57
|
it "has an error on key" do
|
|
60
|
-
subject.errors[:key].
|
|
58
|
+
expect(subject.errors[:key]).to include('must be present and readable')
|
|
61
59
|
end
|
|
62
60
|
end
|
|
63
61
|
end
|
|
@@ -65,8 +63,8 @@ describe Skynet::Builder::Base do
|
|
|
65
63
|
|
|
66
64
|
describe "#build" do
|
|
67
65
|
before(:each) do
|
|
68
|
-
subject.
|
|
69
|
-
subject.
|
|
66
|
+
allow(subject).to receive(:build_repository)
|
|
67
|
+
allow(subject).to receive(:execute)
|
|
70
68
|
end
|
|
71
69
|
|
|
72
70
|
context "when valid" do
|
|
@@ -77,7 +75,7 @@ describe Skynet::Builder::Base do
|
|
|
77
75
|
it { expect { subject.build }.to raise_error ArgumentError }
|
|
78
76
|
end
|
|
79
77
|
context "when passing a branch" do
|
|
80
|
-
it { expect { subject.build '
|
|
78
|
+
it { expect { subject.build 'main' }.to_not raise_error }
|
|
81
79
|
it "d" do
|
|
82
80
|
subject.build 'develop'
|
|
83
81
|
end
|
|
@@ -86,44 +84,44 @@ describe Skynet::Builder::Base do
|
|
|
86
84
|
|
|
87
85
|
context "private methods" do
|
|
88
86
|
before(:each) do
|
|
89
|
-
subject.branch = '
|
|
87
|
+
subject.branch = 'main'
|
|
90
88
|
subject.destination = '/var/www'
|
|
91
89
|
end
|
|
92
90
|
|
|
93
91
|
describe "#build_repository" do
|
|
94
92
|
context "repo already exists" do
|
|
95
|
-
before(:each) { subject.
|
|
93
|
+
before(:each) { allow(subject).to receive(:repo_exists?).and_return true }
|
|
96
94
|
|
|
97
95
|
it "updates the repository" do
|
|
98
|
-
subject.
|
|
96
|
+
expect(subject).to receive(:update_repo).with no_args
|
|
99
97
|
subject.send :build_repository
|
|
100
98
|
end
|
|
101
99
|
end
|
|
102
100
|
|
|
103
101
|
context "repo does not exist" do
|
|
104
|
-
before(:each) { subject.
|
|
102
|
+
before(:each) { allow(subject).to receive(:repo_exists?).and_return false }
|
|
105
103
|
|
|
106
104
|
it "creates a new repository" do
|
|
107
|
-
subject.
|
|
105
|
+
expect(subject).to receive(:create_repo).with no_args
|
|
108
106
|
subject.send :build_repository
|
|
109
107
|
end
|
|
110
108
|
end
|
|
111
109
|
end
|
|
112
110
|
|
|
113
111
|
describe "#create_repo" do
|
|
114
|
-
before(:each) { subject.
|
|
112
|
+
before(:each) { expect(subject).to receive(:`).with "rm -rf #{source}" }
|
|
115
113
|
|
|
116
114
|
context "without key" do
|
|
117
115
|
it "should call git clone" do
|
|
118
|
-
subject.
|
|
116
|
+
expect(subject).to receive(:`).with "git clone #{url} app; cd #{source}; git checkout main"
|
|
119
117
|
subject.send :create_repo
|
|
120
118
|
end
|
|
121
119
|
end
|
|
122
120
|
|
|
123
121
|
context "with key" do
|
|
124
|
-
let(:options) { {key: 'keyfile', url: url,
|
|
122
|
+
let(:options) { {key: 'keyfile', url: url, repository: repo, branches: {main: '/var/www'}, type: 'static'} }
|
|
125
123
|
it "should call git clone" do
|
|
126
|
-
subject.
|
|
124
|
+
expect(subject).to receive(:`).with "ssh-agent bash -c 'ssh-add keyfile; git clone #{repo} app'; cd #{source}; git checkout main"
|
|
127
125
|
subject.send :create_repo
|
|
128
126
|
end
|
|
129
127
|
end
|
|
@@ -132,15 +130,15 @@ describe Skynet::Builder::Base do
|
|
|
132
130
|
describe "#update_repo" do
|
|
133
131
|
context "without key" do
|
|
134
132
|
it "should call git pull" do
|
|
135
|
-
subject.
|
|
133
|
+
expect(subject).to receive(:`).with "cd #{source}; git checkout main; git pull origin main"
|
|
136
134
|
subject.send :update_repo
|
|
137
135
|
end
|
|
138
136
|
end
|
|
139
137
|
|
|
140
138
|
context "with key" do
|
|
141
|
-
let(:options) { {key: 'keyfile', url: url,
|
|
139
|
+
let(:options) { {key: 'keyfile', url: url, branches: {main: '/var/www'}, type: 'static'} }
|
|
142
140
|
it "should call git pull" do
|
|
143
|
-
subject.
|
|
141
|
+
expect(subject).to receive(:`).with "cd #{source}; git checkout main; ssh-agent bash -c 'ssh-add keyfile; git pull origin main'"
|
|
144
142
|
subject.send :update_repo
|
|
145
143
|
end
|
|
146
144
|
end
|
|
@@ -148,7 +146,7 @@ describe Skynet::Builder::Base do
|
|
|
148
146
|
|
|
149
147
|
describe "#repo_exists?" do
|
|
150
148
|
before(:each) do
|
|
151
|
-
File.
|
|
149
|
+
expect(File).to receive(:exist?).with(File.join(source, '.git'))
|
|
152
150
|
end
|
|
153
151
|
|
|
154
152
|
it { subject.send :repo_exists? }
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
require 'spec_helper'
|
|
2
2
|
|
|
3
|
-
describe Skynet::Builder::Jekyll do
|
|
3
|
+
describe Skynet::Builder::Jekyll, type: :model do
|
|
4
4
|
|
|
5
5
|
let(:app) { 'app' }
|
|
6
6
|
let(:dest) { '/var/www/app' }
|
|
7
|
-
let(:options) { {
|
|
7
|
+
let(:options) { {branches: {main: dest}} }
|
|
8
8
|
let(:source) { File.join Dir.pwd, app, '.' }
|
|
9
9
|
subject do
|
|
10
10
|
described_class.new(app, options).tap do |b|
|
|
@@ -14,7 +14,7 @@ describe Skynet::Builder::Jekyll do
|
|
|
14
14
|
|
|
15
15
|
describe "#execute" do
|
|
16
16
|
it "runs jekyll with the source and destination" do
|
|
17
|
-
subject.
|
|
17
|
+
expect(subject).to receive(:`).with "jekyll build --source #{source} --destination #{dest}"
|
|
18
18
|
subject.execute
|
|
19
19
|
end
|
|
20
20
|
end
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
require 'spec_helper'
|
|
2
2
|
|
|
3
|
-
describe Skynet::Builder::Static do
|
|
3
|
+
describe Skynet::Builder::Static, type: :model do
|
|
4
4
|
|
|
5
5
|
let(:app) { 'app' }
|
|
6
6
|
let(:dest) { '/var/www/app' }
|
|
7
|
-
let(:options) { {
|
|
7
|
+
let(:options) { {branches: {main: dest}} }
|
|
8
8
|
let(:source) { File.join Dir.pwd, app, '.' }
|
|
9
9
|
subject do
|
|
10
10
|
described_class.new(app, options).tap do |b|
|
|
@@ -13,26 +13,26 @@ describe Skynet::Builder::Static do
|
|
|
13
13
|
end
|
|
14
14
|
|
|
15
15
|
describe "#execute" do
|
|
16
|
-
before(:each) { Dir.
|
|
16
|
+
before(:each) { allow(Dir).to receive(:glob).and_return([:one, :two]) }
|
|
17
17
|
|
|
18
18
|
it "removes destination files first" do
|
|
19
|
-
FileUtils.
|
|
20
|
-
FileUtils.
|
|
21
|
-
FileUtils.
|
|
19
|
+
allow(FileUtils).to receive(:remove_entry_secure)
|
|
20
|
+
allow(FileUtils).to receive(:cp_r)
|
|
21
|
+
expect(FileUtils).to receive(:rm_rf).with([:one, :two], secure: true)
|
|
22
22
|
subject.execute
|
|
23
23
|
end
|
|
24
24
|
|
|
25
25
|
it "copies files to the destination" do
|
|
26
|
-
FileUtils.
|
|
27
|
-
FileUtils.
|
|
28
|
-
FileUtils.
|
|
26
|
+
allow(FileUtils).to receive(:rm_rf)
|
|
27
|
+
allow(FileUtils).to receive(:remove_entry_secure)
|
|
28
|
+
expect(FileUtils).to receive(:cp_r).with(source, dest)
|
|
29
29
|
subject.execute
|
|
30
30
|
end
|
|
31
31
|
|
|
32
32
|
it "removes .git from the destination" do
|
|
33
|
-
FileUtils.
|
|
34
|
-
FileUtils.
|
|
35
|
-
FileUtils.
|
|
33
|
+
allow(FileUtils).to receive(:rm_rf)
|
|
34
|
+
allow(FileUtils).to receive(:cp_r)
|
|
35
|
+
expect(FileUtils).to receive(:remove_entry_secure).with("#{dest}/.git")
|
|
36
36
|
subject.execute
|
|
37
37
|
end
|
|
38
38
|
end
|
data/spec/skynet/builder_spec.rb
CHANGED
|
@@ -2,16 +2,16 @@ require 'spec_helper'
|
|
|
2
2
|
|
|
3
3
|
describe Skynet::Builder do
|
|
4
4
|
|
|
5
|
-
let(:builder) {
|
|
6
|
-
let(:mock_class) {
|
|
5
|
+
let(:builder) { double('builder').as_null_object }
|
|
6
|
+
let(:mock_class) { double('builder class').as_null_object }
|
|
7
7
|
let(:config) { {type: 'static'} }
|
|
8
8
|
|
|
9
9
|
describe ".for_app" do
|
|
10
10
|
let(:args) { [:app, config] }
|
|
11
11
|
|
|
12
12
|
it "initializes a new builder class" do
|
|
13
|
-
described_class.
|
|
14
|
-
mock_class.
|
|
13
|
+
expect(described_class).to receive(:const_get).with('Static').and_return(mock_class)
|
|
14
|
+
expect(mock_class).to receive(:new).with(:app, config).and_return(builder)
|
|
15
15
|
|
|
16
16
|
described_class.for_app *args
|
|
17
17
|
end
|
|
@@ -21,8 +21,8 @@ describe Skynet::Builder do
|
|
|
21
21
|
let(:args) { [:app, config, :master] }
|
|
22
22
|
|
|
23
23
|
it "calls build on the new builder" do
|
|
24
|
-
described_class.
|
|
25
|
-
builder.
|
|
24
|
+
allow(described_class).to receive(:for_app).and_return(builder)
|
|
25
|
+
expect(builder).to receive(:build).with(:master)
|
|
26
26
|
|
|
27
27
|
described_class.build *args
|
|
28
28
|
end
|
data/spec/spec_helper.rb
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
require 'bundler/setup'
|
|
2
|
+
require 'active_model'
|
|
3
|
+
require 'shoulda-matchers'
|
|
2
4
|
|
|
3
5
|
require 'skynet'
|
|
4
6
|
|
|
@@ -6,4 +8,15 @@ Skynet.logger = Logger.new File.join(File.dirname(__FILE__), 'test.log')
|
|
|
6
8
|
|
|
7
9
|
RSpec.configure do |config|
|
|
8
10
|
config.mock_with :rspec
|
|
11
|
+
config.expect_with :rspec
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
Shoulda::Matchers.configure do |config|
|
|
15
|
+
config.integrate do |with|
|
|
16
|
+
with.test_framework :rspec
|
|
17
|
+
|
|
18
|
+
# Keep as many of these lines as are necessary:
|
|
19
|
+
# with.library :active_record
|
|
20
|
+
with.library :active_model
|
|
21
|
+
end
|
|
9
22
|
end
|
metadata
CHANGED
|
@@ -1,204 +1,182 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: skynet-deploy
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
5
|
-
prerelease:
|
|
4
|
+
version: 2.0.0
|
|
6
5
|
platform: ruby
|
|
7
6
|
authors:
|
|
8
7
|
- Ryan Ahearn
|
|
9
|
-
autorequire:
|
|
8
|
+
autorequire:
|
|
10
9
|
bindir: bin
|
|
11
10
|
cert_chain: []
|
|
12
|
-
date:
|
|
11
|
+
date: 2020-10-12 00:00:00.000000000 Z
|
|
13
12
|
dependencies:
|
|
14
13
|
- !ruby/object:Gem::Dependency
|
|
15
14
|
name: sinatra
|
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
|
17
|
-
none: false
|
|
18
16
|
requirements:
|
|
19
|
-
- - ~>
|
|
17
|
+
- - "~>"
|
|
20
18
|
- !ruby/object:Gem::Version
|
|
21
|
-
version: '1
|
|
19
|
+
version: '2.1'
|
|
22
20
|
type: :runtime
|
|
23
21
|
prerelease: false
|
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
25
|
-
none: false
|
|
26
23
|
requirements:
|
|
27
|
-
- - ~>
|
|
24
|
+
- - "~>"
|
|
28
25
|
- !ruby/object:Gem::Version
|
|
29
|
-
version: '1
|
|
26
|
+
version: '2.1'
|
|
30
27
|
- !ruby/object:Gem::Dependency
|
|
31
28
|
name: thin
|
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
|
33
|
-
none: false
|
|
34
30
|
requirements:
|
|
35
|
-
- - ~>
|
|
31
|
+
- - "~>"
|
|
36
32
|
- !ruby/object:Gem::Version
|
|
37
|
-
version: '1.
|
|
33
|
+
version: '1.7'
|
|
38
34
|
type: :runtime
|
|
39
35
|
prerelease: false
|
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
|
41
|
-
none: false
|
|
42
37
|
requirements:
|
|
43
|
-
- - ~>
|
|
38
|
+
- - "~>"
|
|
44
39
|
- !ruby/object:Gem::Version
|
|
45
|
-
version: '1.
|
|
40
|
+
version: '1.7'
|
|
46
41
|
- !ruby/object:Gem::Dependency
|
|
47
42
|
name: json
|
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
|
49
|
-
none: false
|
|
50
44
|
requirements:
|
|
51
|
-
- - ~>
|
|
45
|
+
- - "~>"
|
|
52
46
|
- !ruby/object:Gem::Version
|
|
53
|
-
version: '
|
|
47
|
+
version: '2.3'
|
|
54
48
|
type: :runtime
|
|
55
49
|
prerelease: false
|
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
|
57
|
-
none: false
|
|
58
51
|
requirements:
|
|
59
|
-
- - ~>
|
|
52
|
+
- - "~>"
|
|
60
53
|
- !ruby/object:Gem::Version
|
|
61
|
-
version: '
|
|
54
|
+
version: '2.3'
|
|
62
55
|
- !ruby/object:Gem::Dependency
|
|
63
56
|
name: jekyll
|
|
64
57
|
requirement: !ruby/object:Gem::Requirement
|
|
65
|
-
none: false
|
|
66
58
|
requirements:
|
|
67
|
-
- - ~>
|
|
59
|
+
- - "~>"
|
|
68
60
|
- !ruby/object:Gem::Version
|
|
69
|
-
version: '
|
|
61
|
+
version: '4.1'
|
|
70
62
|
type: :runtime
|
|
71
63
|
prerelease: false
|
|
72
64
|
version_requirements: !ruby/object:Gem::Requirement
|
|
73
|
-
none: false
|
|
74
65
|
requirements:
|
|
75
|
-
- - ~>
|
|
66
|
+
- - "~>"
|
|
76
67
|
- !ruby/object:Gem::Version
|
|
77
|
-
version: '
|
|
68
|
+
version: '4.1'
|
|
78
69
|
- !ruby/object:Gem::Dependency
|
|
79
70
|
name: thor
|
|
80
71
|
requirement: !ruby/object:Gem::Requirement
|
|
81
|
-
none: false
|
|
82
72
|
requirements:
|
|
83
|
-
- - ~>
|
|
73
|
+
- - "~>"
|
|
84
74
|
- !ruby/object:Gem::Version
|
|
85
|
-
version: '0
|
|
75
|
+
version: '1.0'
|
|
86
76
|
type: :runtime
|
|
87
77
|
prerelease: false
|
|
88
78
|
version_requirements: !ruby/object:Gem::Requirement
|
|
89
|
-
none: false
|
|
90
79
|
requirements:
|
|
91
|
-
- - ~>
|
|
80
|
+
- - "~>"
|
|
92
81
|
- !ruby/object:Gem::Version
|
|
93
|
-
version: '0
|
|
82
|
+
version: '1.0'
|
|
94
83
|
- !ruby/object:Gem::Dependency
|
|
95
84
|
name: activesupport
|
|
96
85
|
requirement: !ruby/object:Gem::Requirement
|
|
97
|
-
none: false
|
|
98
86
|
requirements:
|
|
99
|
-
- - ~>
|
|
87
|
+
- - "~>"
|
|
100
88
|
- !ruby/object:Gem::Version
|
|
101
|
-
version: '
|
|
89
|
+
version: '6.0'
|
|
102
90
|
type: :runtime
|
|
103
91
|
prerelease: false
|
|
104
92
|
version_requirements: !ruby/object:Gem::Requirement
|
|
105
|
-
none: false
|
|
106
93
|
requirements:
|
|
107
|
-
- - ~>
|
|
94
|
+
- - "~>"
|
|
108
95
|
- !ruby/object:Gem::Version
|
|
109
|
-
version: '
|
|
96
|
+
version: '6.0'
|
|
110
97
|
- !ruby/object:Gem::Dependency
|
|
111
98
|
name: activemodel
|
|
112
99
|
requirement: !ruby/object:Gem::Requirement
|
|
113
|
-
none: false
|
|
114
100
|
requirements:
|
|
115
|
-
- - ~>
|
|
101
|
+
- - "~>"
|
|
116
102
|
- !ruby/object:Gem::Version
|
|
117
|
-
version: '
|
|
103
|
+
version: '6.0'
|
|
118
104
|
type: :runtime
|
|
119
105
|
prerelease: false
|
|
120
106
|
version_requirements: !ruby/object:Gem::Requirement
|
|
121
|
-
none: false
|
|
122
107
|
requirements:
|
|
123
|
-
- - ~>
|
|
108
|
+
- - "~>"
|
|
124
109
|
- !ruby/object:Gem::Version
|
|
125
|
-
version: '
|
|
110
|
+
version: '6.0'
|
|
126
111
|
- !ruby/object:Gem::Dependency
|
|
127
112
|
name: multi_json
|
|
128
113
|
requirement: !ruby/object:Gem::Requirement
|
|
129
|
-
none: false
|
|
130
114
|
requirements:
|
|
131
|
-
- - ~>
|
|
115
|
+
- - "~>"
|
|
132
116
|
- !ruby/object:Gem::Version
|
|
133
|
-
version: '1.
|
|
117
|
+
version: '1.15'
|
|
134
118
|
type: :runtime
|
|
135
119
|
prerelease: false
|
|
136
120
|
version_requirements: !ruby/object:Gem::Requirement
|
|
137
|
-
none: false
|
|
138
121
|
requirements:
|
|
139
|
-
- - ~>
|
|
122
|
+
- - "~>"
|
|
140
123
|
- !ruby/object:Gem::Version
|
|
141
|
-
version: '1.
|
|
124
|
+
version: '1.15'
|
|
142
125
|
- !ruby/object:Gem::Dependency
|
|
143
126
|
name: rake
|
|
144
127
|
requirement: !ruby/object:Gem::Requirement
|
|
145
|
-
none: false
|
|
146
128
|
requirements:
|
|
147
|
-
- - ~>
|
|
129
|
+
- - "~>"
|
|
148
130
|
- !ruby/object:Gem::Version
|
|
149
|
-
version: '0
|
|
131
|
+
version: '13.0'
|
|
150
132
|
type: :development
|
|
151
133
|
prerelease: false
|
|
152
134
|
version_requirements: !ruby/object:Gem::Requirement
|
|
153
|
-
none: false
|
|
154
135
|
requirements:
|
|
155
|
-
- - ~>
|
|
136
|
+
- - "~>"
|
|
156
137
|
- !ruby/object:Gem::Version
|
|
157
|
-
version: '0
|
|
138
|
+
version: '13.0'
|
|
158
139
|
- !ruby/object:Gem::Dependency
|
|
159
140
|
name: rspec
|
|
160
141
|
requirement: !ruby/object:Gem::Requirement
|
|
161
|
-
none: false
|
|
162
142
|
requirements:
|
|
163
|
-
- - ~>
|
|
143
|
+
- - "~>"
|
|
164
144
|
- !ruby/object:Gem::Version
|
|
165
|
-
version: '
|
|
145
|
+
version: '3.9'
|
|
166
146
|
type: :development
|
|
167
147
|
prerelease: false
|
|
168
148
|
version_requirements: !ruby/object:Gem::Requirement
|
|
169
|
-
none: false
|
|
170
149
|
requirements:
|
|
171
|
-
- - ~>
|
|
150
|
+
- - "~>"
|
|
172
151
|
- !ruby/object:Gem::Version
|
|
173
|
-
version: '
|
|
152
|
+
version: '3.9'
|
|
174
153
|
- !ruby/object:Gem::Dependency
|
|
175
154
|
name: shoulda-matchers
|
|
176
155
|
requirement: !ruby/object:Gem::Requirement
|
|
177
|
-
none: false
|
|
178
156
|
requirements:
|
|
179
|
-
- - ~>
|
|
157
|
+
- - "~>"
|
|
180
158
|
- !ruby/object:Gem::Version
|
|
181
|
-
version: '
|
|
159
|
+
version: '4.4'
|
|
182
160
|
type: :development
|
|
183
161
|
prerelease: false
|
|
184
162
|
version_requirements: !ruby/object:Gem::Requirement
|
|
185
|
-
none: false
|
|
186
163
|
requirements:
|
|
187
|
-
- - ~>
|
|
164
|
+
- - "~>"
|
|
188
165
|
- !ruby/object:Gem::Version
|
|
189
|
-
version: '
|
|
166
|
+
version: '4.4'
|
|
190
167
|
description: Sinatra app that listens for GitHub post-receive callbacks and deploys
|
|
191
168
|
your code
|
|
192
169
|
email:
|
|
193
|
-
- ryan@
|
|
170
|
+
- ryan.ahearn@hey.com
|
|
194
171
|
executables:
|
|
195
172
|
- skynet
|
|
196
173
|
extensions: []
|
|
197
174
|
extra_rdoc_files: []
|
|
198
175
|
files:
|
|
199
|
-
- .gitignore
|
|
200
|
-
- .rspec
|
|
201
|
-
- .
|
|
176
|
+
- ".gitignore"
|
|
177
|
+
- ".rspec"
|
|
178
|
+
- ".ruby-version"
|
|
179
|
+
- ".travis.yml"
|
|
202
180
|
- Gemfile
|
|
203
181
|
- README.md
|
|
204
182
|
- Rakefile
|
|
@@ -220,32 +198,27 @@ files:
|
|
|
220
198
|
- spec/skynet/builder/static_spec.rb
|
|
221
199
|
- spec/skynet/builder_spec.rb
|
|
222
200
|
- spec/spec_helper.rb
|
|
223
|
-
homepage: https://github.com/
|
|
201
|
+
homepage: https://github.com/rahearn/skynet
|
|
224
202
|
licenses: []
|
|
225
|
-
|
|
203
|
+
metadata: {}
|
|
204
|
+
post_install_message:
|
|
226
205
|
rdoc_options: []
|
|
227
206
|
require_paths:
|
|
228
207
|
- lib
|
|
229
208
|
required_ruby_version: !ruby/object:Gem::Requirement
|
|
230
|
-
none: false
|
|
231
209
|
requirements:
|
|
232
|
-
- -
|
|
210
|
+
- - ">="
|
|
233
211
|
- !ruby/object:Gem::Version
|
|
234
|
-
version:
|
|
235
|
-
segments:
|
|
236
|
-
- 0
|
|
237
|
-
hash: -3009597360161477294
|
|
212
|
+
version: 2.7.1
|
|
238
213
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
239
|
-
none: false
|
|
240
214
|
requirements:
|
|
241
|
-
- -
|
|
215
|
+
- - ">="
|
|
242
216
|
- !ruby/object:Gem::Version
|
|
243
|
-
version:
|
|
217
|
+
version: '0'
|
|
244
218
|
requirements: []
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
specification_version: 3
|
|
219
|
+
rubygems_version: 3.1.4
|
|
220
|
+
signing_key:
|
|
221
|
+
specification_version: 4
|
|
249
222
|
summary: Sinatra app that listens for GitHub post-receive callbacks and deploys your
|
|
250
223
|
code
|
|
251
224
|
test_files:
|
data/.rvmrc
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
|
|
3
|
-
# This is an RVM Project .rvmrc file, used to automatically load the ruby
|
|
4
|
-
# development environment upon cd'ing into the directory
|
|
5
|
-
|
|
6
|
-
# First we specify our desired <ruby>[@<gemset>], the @gemset name is optional.
|
|
7
|
-
environment_id="ruby-1.9.3-p327@skynet"
|
|
8
|
-
|
|
9
|
-
#
|
|
10
|
-
# First we attempt to load the desired environment directly from the environment
|
|
11
|
-
# file. This is very fast and efficient compared to running through the entire
|
|
12
|
-
# CLI and selector. If you want feedback on which environment was used then
|
|
13
|
-
# insert the word 'use' after --create as this triggers verbose mode.
|
|
14
|
-
#
|
|
15
|
-
if [[ -d "${rvm_path:-$HOME/.rvm}/environments" \
|
|
16
|
-
&& -s "${rvm_path:-$HOME/.rvm}/environments/$environment_id" ]]
|
|
17
|
-
then
|
|
18
|
-
\. "${rvm_path:-$HOME/.rvm}/environments/$environment_id"
|
|
19
|
-
|
|
20
|
-
if [[ -s ".rvm/hooks/after_use" ]]
|
|
21
|
-
then
|
|
22
|
-
. ".rvm/hooks/after_use"
|
|
23
|
-
fi
|
|
24
|
-
else
|
|
25
|
-
# If the environment file has not yet been created, use the RVM CLI to select.
|
|
26
|
-
if ! rvm --create "$environment_id"
|
|
27
|
-
then
|
|
28
|
-
echo "Failed to create RVM environment ''."
|
|
29
|
-
fi
|
|
30
|
-
fi
|
|
31
|
-
|
|
32
|
-
#
|
|
33
|
-
# If you use an RVM gemset file to install a list of gems (*.gems), you can have
|
|
34
|
-
# it be automatically loaded. Uncomment the following and adjust the filename if
|
|
35
|
-
# necessary.
|
|
36
|
-
#
|
|
37
|
-
# filename=".gems"
|
|
38
|
-
# if [[ -s "$filename" ]] ; then
|
|
39
|
-
# rvm gemset import "$filename" | grep -v already | grep -v listed | grep -v complete | sed '/^$/d'
|
|
40
|
-
# fi
|
|
41
|
-
|