mimas 0.5.0 → 0.7.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/cli.rb +5 -0
- data/lib/mimas/commands/console.rb +1 -1
- data/lib/mimas/commands/env/edit.rb +32 -0
- data/lib/mimas/commands/env/view.rb +23 -0
- data/lib/mimas/commands/env.rb +10 -0
- data/lib/mimas/commands/push.rb +2 -2
- data/lib/mimas/ssh/interactive.rb +1 -1
- data/lib/mimas/ssh/session.rb +4 -0
- data/lib/mimas/version.rb +1 -1
- data/lib/mimas.rb +3 -0
- metadata +4 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 32d18ae6eabecfaf693befa2c2850b1b5603aa013078280ffc44898e23dd1706
|
|
4
|
+
data.tar.gz: 86f9b0644f120adf2ea0bb9e4e5cacda8ab89d216588c43491bebafb258c05b6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 448b7d3a1fb29e51b73068ceac56ed44fad6982e0e1c2eae5d29919601df144e3141d29bde0ec8ba1e2bce037a2cc363053505c8ec4c043edefde766ee75ae7e
|
|
7
|
+
data.tar.gz: 138a243453b2fc62b52fb2625331ee0af5939fd7704ffe2986d030be6af97c5b55e7902166fff7591502a103788adf627644e9d06c79b1d603608971b2e542ff
|
data/lib/mimas/cli.rb
CHANGED
|
@@ -15,6 +15,11 @@ module Mimas
|
|
|
15
15
|
setup.register "deploy_user", Setup::DeployUser
|
|
16
16
|
setup.register "ruby", Setup::Ruby
|
|
17
17
|
end
|
|
18
|
+
|
|
19
|
+
register "env" do |setup|
|
|
20
|
+
setup.register "edit", Env::Edit
|
|
21
|
+
setup.register "view", Env::View
|
|
22
|
+
end
|
|
18
23
|
end
|
|
19
24
|
|
|
20
25
|
Plugins.fetch.each do |plugin|
|
|
@@ -4,8 +4,8 @@ module Mimas
|
|
|
4
4
|
class Console < BaseCommand
|
|
5
5
|
desc "Run your app's console"
|
|
6
6
|
|
|
7
|
-
argument :site, default: :default, desc: "The site to run the console for. Uses the default site if unspecified"
|
|
8
7
|
argument :server_name, required: true, desc: "The name of the server to run the console on"
|
|
8
|
+
argument :site, default: :default, desc: "The site to run the console for. Uses the default site if unspecified"
|
|
9
9
|
|
|
10
10
|
def call(site:, server_name:, **)
|
|
11
11
|
site = Config.current.sites[site.to_sym]
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
module Mimas
|
|
2
|
+
module CLI
|
|
3
|
+
module Commands
|
|
4
|
+
class Env::Edit < Env
|
|
5
|
+
desc "Edit the env file for an app"
|
|
6
|
+
|
|
7
|
+
def call(site:, server_name:)
|
|
8
|
+
site = Config.current.sites[site.to_sym]
|
|
9
|
+
server = Config.current.servers[server_name.to_sym]
|
|
10
|
+
|
|
11
|
+
tmp_env_file = Pathname.new(".").join("tmp", ".#{site.name}.mimas.env")
|
|
12
|
+
|
|
13
|
+
system "mkdir -p tmp"
|
|
14
|
+
|
|
15
|
+
ssh(server) do |session|
|
|
16
|
+
session.run "mkdir -p #{server.site_root(site)}"
|
|
17
|
+
session.run "touch #{server.site_root(site).join(".env")}"
|
|
18
|
+
|
|
19
|
+
session.download server.site_root(site).join(".env"), tmp_env_file
|
|
20
|
+
|
|
21
|
+
system "$EDITOR --wait #{tmp_env_file}"
|
|
22
|
+
|
|
23
|
+
session.upload tmp_env_file.to_s, server.site_root(site).join(".env")
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
ensure
|
|
27
|
+
system "rm #{tmp_env_file}"
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
module Mimas
|
|
2
|
+
module CLI
|
|
3
|
+
module Commands
|
|
4
|
+
class Env::View < Env
|
|
5
|
+
desc "View the env file for an app"
|
|
6
|
+
|
|
7
|
+
def call(site:, server_name:)
|
|
8
|
+
site = Config.current.sites[site.to_sym]
|
|
9
|
+
server = Config.current.servers[server_name.to_sym]
|
|
10
|
+
|
|
11
|
+
ssh(server) do |session|
|
|
12
|
+
session.run "mkdir -p #{server.site_root(site)}"
|
|
13
|
+
session.run "touch #{server.site_root(site).join(".env")}"
|
|
14
|
+
|
|
15
|
+
env = session.run "cat #{server.site_root(site).join(".env")}", capture: true
|
|
16
|
+
|
|
17
|
+
say env.bold.white
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
data/lib/mimas/commands/push.rb
CHANGED
|
@@ -4,12 +4,12 @@ module Mimas
|
|
|
4
4
|
class Push < BaseCommand
|
|
5
5
|
desc "Push your Ruby app to the server"
|
|
6
6
|
|
|
7
|
-
argument :site, default: :default, desc: "The site to push. Uses the default site if unspecified"
|
|
8
7
|
argument :server_name, required: true, desc: "The name of the server to push to"
|
|
8
|
+
argument :site, default: :default, desc: "The site to push. Uses the default site if unspecified"
|
|
9
9
|
|
|
10
10
|
example [
|
|
11
11
|
"production # Push the default site to the production server",
|
|
12
|
-
"app
|
|
12
|
+
"production app # Push the `:app` site to the production server"
|
|
13
13
|
]
|
|
14
14
|
|
|
15
15
|
def call(site:, server_name:, **)
|
data/lib/mimas/ssh/session.rb
CHANGED
|
@@ -51,6 +51,10 @@ module Mimas
|
|
|
51
51
|
@ssh.scp.upload! source_file, destination_file
|
|
52
52
|
end
|
|
53
53
|
|
|
54
|
+
def download(source_file, destination_file)
|
|
55
|
+
@ssh.scp.download! source_file, destination_file
|
|
56
|
+
end
|
|
57
|
+
|
|
54
58
|
def script(name, sudo: false, vars: {})
|
|
55
59
|
filename = "#{name}.sh"
|
|
56
60
|
remote_location = "/tmp/#{filename}"
|
data/lib/mimas/version.rb
CHANGED
data/lib/mimas.rb
CHANGED
|
@@ -44,6 +44,9 @@ require_relative "mimas/commands/console"
|
|
|
44
44
|
require_relative "mimas/commands/init"
|
|
45
45
|
require_relative "mimas/commands/provision"
|
|
46
46
|
require_relative "mimas/commands/push"
|
|
47
|
+
require_relative "mimas/commands/env"
|
|
48
|
+
require_relative "mimas/commands/env/edit"
|
|
49
|
+
require_relative "mimas/commands/env/view"
|
|
47
50
|
require_relative "mimas/commands/ruby"
|
|
48
51
|
require_relative "mimas/commands/ruby/install"
|
|
49
52
|
require_relative "mimas/commands/setup"
|
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.7.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ayush Newatia
|
|
@@ -106,6 +106,9 @@ files:
|
|
|
106
106
|
- lib/mimas/cli.rb
|
|
107
107
|
- lib/mimas/commands/archive.rb
|
|
108
108
|
- lib/mimas/commands/console.rb
|
|
109
|
+
- lib/mimas/commands/env.rb
|
|
110
|
+
- lib/mimas/commands/env/edit.rb
|
|
111
|
+
- lib/mimas/commands/env/view.rb
|
|
109
112
|
- lib/mimas/commands/init.rb
|
|
110
113
|
- lib/mimas/commands/provision.rb
|
|
111
114
|
- lib/mimas/commands/push.rb
|