mimas 0.2.3 → 0.3.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 +4 -4
- data/lib/mimas/archiver.rb +6 -10
- data/lib/mimas/cli.rb +1 -0
- data/lib/mimas/commands/archive.rb +19 -0
- data/lib/mimas/commands/console.rb +1 -1
- data/lib/mimas/deployment/paths.rb +1 -1
- data/lib/mimas/deployment/ruby_app.rb +1 -1
- data/lib/mimas/deployment/static_site.rb +1 -1
- data/lib/mimas/deployment.rb +1 -1
- data/lib/mimas/site/archive.rb +13 -0
- data/lib/mimas/site.rb +18 -3
- data/lib/mimas/version.rb +1 -1
- data/lib/mimas.rb +2 -0
- metadata +3 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ea7a87706ea7f9976b782cb891e446b813c7c866e2a4907f451565e670d194a5
|
|
4
|
+
data.tar.gz: adde800fcc3df657cc512cfd14b9fe1ef314e3d4f19f903c68259c3d7394ef28
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 984c764fc02feeb671c63f33528258abb8ad271811400d27affe7e220fd4eb6d66652b57a3b829fa1bf972aa23a6a2d5fbb42fe6bc7ec290cf1c1155fc352654
|
|
7
|
+
data.tar.gz: 939fa01df07457e75ecb9b2929757edfa0045cb109ec7f7b33366566397af491aca94df1f4a00125f99bd119ab05fc8cc4b318f3cb6c21e0bdabbc03a1853619
|
data/lib/mimas/archiver.rb
CHANGED
|
@@ -2,18 +2,12 @@ require 'zlib'
|
|
|
2
2
|
require 'rubygems/package'
|
|
3
3
|
|
|
4
4
|
module Mimas
|
|
5
|
-
module Archive
|
|
6
|
-
def archive(root: Dir.pwd, output:, archive_root: "", glob: nil, files: [])
|
|
7
|
-
Archiver
|
|
8
|
-
.new(root: root, output: output, archive_root: archive_root, glob: glob, files: files)
|
|
9
|
-
.package
|
|
10
|
-
end
|
|
11
|
-
end
|
|
12
|
-
|
|
13
5
|
class Archiver
|
|
14
|
-
|
|
6
|
+
DEFAULT_OUTPUT_PATH = Pathname.new(Dir.pwd).join("tmp")
|
|
7
|
+
|
|
8
|
+
def initialize(root:, output_path: DEFAULT_OUTPUT_PATH, output_file:, archive_root: nil, glob: nil, files: [])
|
|
15
9
|
@root = root || Dir.pwd
|
|
16
|
-
@output =
|
|
10
|
+
@output = Pathname.new(output_path).join(output_file)
|
|
17
11
|
@archive_root = archive_root || ""
|
|
18
12
|
@glob = glob
|
|
19
13
|
@source_files = files
|
|
@@ -27,6 +21,8 @@ module Mimas
|
|
|
27
21
|
|
|
28
22
|
tar.close
|
|
29
23
|
gz.close
|
|
24
|
+
|
|
25
|
+
return @output.to_s
|
|
30
26
|
end
|
|
31
27
|
|
|
32
28
|
private
|
data/lib/mimas/cli.rb
CHANGED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
module Mimas
|
|
2
|
+
module CLI
|
|
3
|
+
module Commands
|
|
4
|
+
class Archive < BaseCommand
|
|
5
|
+
desc "Create your site's archive which will be uploaded to the server"
|
|
6
|
+
|
|
7
|
+
argument :site, desc: "The name of the site to archive"
|
|
8
|
+
|
|
9
|
+
def call(site: :default)
|
|
10
|
+
site = Config.current.sites[site.to_sym]
|
|
11
|
+
|
|
12
|
+
site.archive
|
|
13
|
+
|
|
14
|
+
say "Your site's archive has been created in #{Archiver::DEFAULT_OUTPUT_PATH}"
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -7,7 +7,7 @@ module Mimas
|
|
|
7
7
|
argument :server_name, required: true, desc: "The name of the server to run the console on"
|
|
8
8
|
argument :site, desc: "The site to run the console for. Uses the default site if unspecified"
|
|
9
9
|
|
|
10
|
-
def call(server_name
|
|
10
|
+
def call(server_name:, site: :default)
|
|
11
11
|
server = Config.current.servers[server_name.to_sym]
|
|
12
12
|
site = Config.current.sites[site.to_sym]
|
|
13
13
|
|
|
@@ -4,7 +4,7 @@ module Mimas
|
|
|
4
4
|
def deploy_static_site
|
|
5
5
|
say "Starting deployment for #{site.domain}"
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
@archive_path = site.archive(filename: archive_name)
|
|
8
8
|
|
|
9
9
|
ssh(server) do |session|
|
|
10
10
|
refreshing_caddy(session) do
|
data/lib/mimas/deployment.rb
CHANGED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
module Mimas
|
|
2
|
+
class Site
|
|
3
|
+
module Archive
|
|
4
|
+
def archive(filename: "#{name}.tar.gz")
|
|
5
|
+
if self.ruby_app?
|
|
6
|
+
Archiver.new(output_file: filename, files: files).package
|
|
7
|
+
else
|
|
8
|
+
Archiver.new(root: root_dir, output_file: filename, archive_root: "root", glob: glob, files: files).package
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
data/lib/mimas/site.rb
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
module Mimas
|
|
2
2
|
class Site
|
|
3
|
+
include Archive
|
|
4
|
+
|
|
3
5
|
attr_reader :name
|
|
4
6
|
def initialize(name, args)
|
|
5
7
|
@name = name
|
|
@@ -21,21 +23,34 @@ module Mimas
|
|
|
21
23
|
services.any?
|
|
22
24
|
end
|
|
23
25
|
|
|
26
|
+
# Placeholder, will be overwritten by the config file if defined
|
|
27
|
+
def glob
|
|
28
|
+
nil
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
# Placeholder, will be overwritten by the config file if defined
|
|
32
|
+
def files
|
|
33
|
+
nil
|
|
34
|
+
end
|
|
35
|
+
|
|
24
36
|
def validate!
|
|
25
37
|
raise Config::InvalidConfiguration.new("`site` requires a `domain`") \
|
|
26
38
|
unless self.respond_to?(:domain)
|
|
27
39
|
|
|
28
40
|
if ruby_app?
|
|
29
41
|
raise Config::InvalidConfiguration.new("`site` requires a `files` directive") \
|
|
30
|
-
unless self.
|
|
42
|
+
unless self.files != nil
|
|
31
43
|
|
|
32
44
|
services.values.each do |service|
|
|
33
45
|
raise Config::InvalidConfiguration.new("#{service[:name]} service requires a `command` directive") \
|
|
34
46
|
unless service[:command]
|
|
35
47
|
end
|
|
36
48
|
else
|
|
37
|
-
raise Config::InvalidConfiguration.new("`site` requires a `root_dir`
|
|
38
|
-
unless self.respond_to?(:root_dir)
|
|
49
|
+
raise Config::InvalidConfiguration.new("`site` requires a `root_dir` directive") \
|
|
50
|
+
unless self.respond_to?(:root_dir)
|
|
51
|
+
|
|
52
|
+
raise Config::InvalidConfiguration.new("`site` requires a `files` or `glob` directive") \
|
|
53
|
+
unless self.glob != nil || self.files != nil
|
|
39
54
|
end
|
|
40
55
|
|
|
41
56
|
true
|
data/lib/mimas/version.rb
CHANGED
data/lib/mimas.rb
CHANGED
|
@@ -16,6 +16,7 @@ require_relative "mimas/hooks"
|
|
|
16
16
|
|
|
17
17
|
require_relative "mimas/config"
|
|
18
18
|
|
|
19
|
+
require_relative "mimas/site/archive"
|
|
19
20
|
require_relative "mimas/site"
|
|
20
21
|
|
|
21
22
|
require_relative "mimas/server/prerequisites"
|
|
@@ -35,6 +36,7 @@ require_relative "mimas/deployment"
|
|
|
35
36
|
require_relative "mimas/plugins"
|
|
36
37
|
|
|
37
38
|
require_relative "mimas/base_command"
|
|
39
|
+
require_relative "mimas/commands/archive"
|
|
38
40
|
require_relative "mimas/commands/console"
|
|
39
41
|
require_relative "mimas/commands/init"
|
|
40
42
|
require_relative "mimas/commands/install"
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: mimas
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ayush Newatia
|
|
@@ -104,6 +104,7 @@ files:
|
|
|
104
104
|
- lib/mimas/archiver.rb
|
|
105
105
|
- lib/mimas/base_command.rb
|
|
106
106
|
- lib/mimas/cli.rb
|
|
107
|
+
- lib/mimas/commands/archive.rb
|
|
107
108
|
- lib/mimas/commands/console.rb
|
|
108
109
|
- lib/mimas/commands/init.rb
|
|
109
110
|
- lib/mimas/commands/install.rb
|
|
@@ -135,6 +136,7 @@ files:
|
|
|
135
136
|
- lib/mimas/server/prerequisites.rb
|
|
136
137
|
- lib/mimas/server/ruby.rb
|
|
137
138
|
- lib/mimas/site.rb
|
|
139
|
+
- lib/mimas/site/archive.rb
|
|
138
140
|
- lib/mimas/ssh.rb
|
|
139
141
|
- lib/mimas/template.rb
|
|
140
142
|
- lib/mimas/templates/Caddyfile.ruby.erb
|