neptuno 1.4.10 → 1.5.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/.github/workflows/gem-push.yml +15 -8
- data/Gemfile.lock +1 -1
- data/lib/neptuno/cli/execute.rb +2 -2
- data/lib/neptuno/cli/init.rb +5 -5
- data/lib/neptuno/cli/install.rb +14 -14
- data/lib/neptuno/docker/build.rb +9 -9
- data/lib/neptuno/docker/down.rb +9 -9
- data/lib/neptuno/docker/restart.rb +13 -13
- data/lib/neptuno/docker/up.rb +6 -6
- data/lib/neptuno/environment/update.rb +1 -1
- data/lib/neptuno/overmind/connect.rb +13 -13
- data/lib/neptuno/services/update.rb +8 -8
- data/lib/neptuno/tty/config.rb +9 -9
- data/lib/neptuno/tty/file.rb +6 -6
- data/lib/neptuno/version.rb +1 -1
- data/neptuno.gemspec +29 -29
- metadata +1 -3
- data/.github/workflows/gem-push_new.yml +0 -48
- data/.github/workflows/main.yml +0 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 743d657aeb6ae7ae40576ca45102386dd88352074df89fb2b53fcf32d24f7423
|
4
|
+
data.tar.gz: 382681c2b6a45feb68a12189827d365792550fdac3b1eb0ce8b38952db424d55
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '08d6e07a4a1246312d4c4471aae818c22dbb4c1797686a28f99bf673fd8db71581168b6a1d8ab2810e89973f9da1d4174d673f5776239e6adcf525f01f9a96e7'
|
7
|
+
data.tar.gz: 9346e2746dc83236aa46c828657232356d6129e67535cd9fc6cd15284e04a5a71971bbefde462c5ef98e0d5c6849f222c0ac4f437509a0e297b84da45e1ccfe8
|
@@ -15,23 +15,30 @@ jobs:
|
|
15
15
|
packages: write
|
16
16
|
|
17
17
|
steps:
|
18
|
-
- uses: actions/checkout@
|
19
|
-
- name: Set up Ruby
|
18
|
+
- uses: actions/checkout@v4
|
19
|
+
- name: Set up Ruby 3.3.0
|
20
|
+
# To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
|
21
|
+
# change this to (see https://github.com/ruby/setup-ruby#versioning):
|
22
|
+
# uses: ruby/setup-ruby@v1
|
20
23
|
uses: ruby/setup-ruby@v1
|
21
24
|
with:
|
22
|
-
ruby-version:
|
23
|
-
|
25
|
+
ruby-version: 3.3.0
|
26
|
+
bundler-cache: true
|
27
|
+
|
28
|
+
- name: Run the default task
|
29
|
+
run: bundle exec rake
|
30
|
+
|
24
31
|
- name: Publish to GPR
|
25
32
|
run: |
|
26
33
|
mkdir -p $HOME/.gem
|
27
34
|
touch $HOME/.gem/credentials
|
28
35
|
chmod 0600 $HOME/.gem/credentials
|
29
|
-
printf -- "---\n:github:
|
30
|
-
cat $HOME/.gem/credentials
|
36
|
+
printf -- "---\n:github: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
|
31
37
|
gem build *.gemspec
|
32
|
-
gem push --KEY github --host https://rubygems.pkg.github.com
|
38
|
+
gem push --KEY github --host https://rubygems.pkg.github.com/${OWNER} *.gem
|
33
39
|
env:
|
34
|
-
GEM_HOST_API_KEY: "${{secrets.GITHUB_TOKEN}}"
|
40
|
+
GEM_HOST_API_KEY: "Bearer ${{secrets.GITHUB_TOKEN}}"
|
41
|
+
OWNER: ${{ github.repository_owner }}
|
35
42
|
|
36
43
|
- name: Publish to RubyGems
|
37
44
|
run: |
|
data/Gemfile.lock
CHANGED
data/lib/neptuno/cli/execute.rb
CHANGED
@@ -15,8 +15,8 @@ module Neptuno
|
|
15
15
|
command = options[:args].last if commands.include?(options[:args]&.last)
|
16
16
|
puts "#{neptuno_path}/scripts/#{service}/*"
|
17
17
|
puts service
|
18
|
-
puts commands
|
19
|
-
puts Dir.glob("#{neptuno_path}/scripts/#{service}/*")
|
18
|
+
puts commands
|
19
|
+
puts Dir.glob("#{neptuno_path}/scripts/#{service}/*")
|
20
20
|
command ||= prompt.select("execute", commands || [])
|
21
21
|
`cd #{neptuno_path}/scripts/#{service} && ./#{command}`
|
22
22
|
end
|
data/lib/neptuno/cli/init.rb
CHANGED
@@ -8,19 +8,19 @@ module Neptuno
|
|
8
8
|
include TTY::Config
|
9
9
|
include TTY::Which
|
10
10
|
|
11
|
-
desc
|
11
|
+
desc "Initializes a Neptuno project folder structure"
|
12
12
|
|
13
|
-
WORK_TREE = {
|
13
|
+
WORK_TREE = {"." => [{"services" => [], "dockerfiles" => [], "procfiles" => [], "environments" => []}]}.freeze
|
14
14
|
|
15
15
|
CONFIG = nil
|
16
16
|
|
17
17
|
def call(**)
|
18
|
-
abort
|
18
|
+
abort "Neptuno projects can not be nested." if neptuno_path != ""
|
19
19
|
::TTY::File.create_dir(WORK_TREE, Dir.pwd)
|
20
|
-
config.set(:configured_services, value:
|
20
|
+
config.set(:configured_services, value: "")
|
21
21
|
config.set(:services, value: [])
|
22
22
|
config.write(create: true, force: true)
|
23
|
-
`cp -r #{File.expand_path(
|
23
|
+
`cp -r #{File.expand_path("../templates", __dir__)}/* ./`
|
24
24
|
end
|
25
25
|
end
|
26
26
|
end
|
data/lib/neptuno/cli/install.rb
CHANGED
@@ -10,20 +10,20 @@ module Neptuno
|
|
10
10
|
include TTY::Config
|
11
11
|
include TTY::Which
|
12
12
|
|
13
|
-
desc
|
13
|
+
desc "Installs git, docker, tmux, tmuxinator and overmind"
|
14
14
|
|
15
15
|
CONFIG = nil
|
16
16
|
|
17
17
|
def call(**)
|
18
|
-
install
|
19
|
-
install
|
20
|
-
install
|
21
|
-
install
|
22
|
-
install
|
18
|
+
install "git"
|
19
|
+
install "docker"
|
20
|
+
install "tmux"
|
21
|
+
install "overmind"
|
22
|
+
install "tmuxinator"
|
23
23
|
|
24
|
-
return unless system(
|
24
|
+
return unless system("apt-get -v")
|
25
25
|
|
26
|
-
system(
|
26
|
+
system("sudo apt-get update")
|
27
27
|
end
|
28
28
|
|
29
29
|
def install(package)
|
@@ -31,13 +31,13 @@ module Neptuno
|
|
31
31
|
puts "#{package} is already installed"
|
32
32
|
else
|
33
33
|
puts "Installing #{package}"
|
34
|
-
if system(
|
34
|
+
if system("brew -v")
|
35
35
|
system("brew install #{package}")
|
36
|
-
elsif package ==
|
37
|
-
system(
|
38
|
-
elsif package ==
|
39
|
-
system(
|
40
|
-
system(
|
36
|
+
elsif package == "overmind"
|
37
|
+
system("go install github.com/DarthSim/overmind/v2@latest")
|
38
|
+
elsif package == "tmuxinator"
|
39
|
+
system("ASDF_RUBY_VERSION=system gem update bundler")
|
40
|
+
system("ASDF_RUBY_VERSION=system gem install tmuxinator")
|
41
41
|
else
|
42
42
|
system("sudo apt-get install #{package} -y")
|
43
43
|
end
|
data/lib/neptuno/docker/build.rb
CHANGED
@@ -4,20 +4,20 @@ module Neptuno
|
|
4
4
|
module Docker
|
5
5
|
# Build docker container for Neptuno project
|
6
6
|
class Build < Neptuno::CLI::Base
|
7
|
-
desc
|
7
|
+
desc "Docker: Build docker containers for project"
|
8
8
|
|
9
|
-
option :all, type: :boolean, default: false, desc:
|
10
|
-
argument :services, type: :array, required: false, desc:
|
11
|
-
option :options, required: false, desc:
|
9
|
+
option :all, type: :boolean, default: false, desc: "Run on all services"
|
10
|
+
argument :services, type: :array, required: false, desc: "Optional list of services"
|
11
|
+
option :options, required: false, desc: "Optional string of options passed to build"
|
12
12
|
|
13
13
|
def call(services: [], **options)
|
14
|
-
command_services_to(
|
14
|
+
command_services_to("build", all: options.fetch(:all), services_as_args: services) do |services|
|
15
15
|
make_service_files(services)
|
16
16
|
opts = options.fetch(:options, nil) || get_gpr
|
17
17
|
services.each do |service|
|
18
|
-
puts
|
18
|
+
puts "********************"
|
19
19
|
puts "building #{service}"
|
20
|
-
puts
|
20
|
+
puts "********************"
|
21
21
|
system("cd #{neptuno_path} && docker compose build #{opts} #{service}")
|
22
22
|
end
|
23
23
|
end
|
@@ -29,8 +29,8 @@ module Neptuno
|
|
29
29
|
rescue Errno::ENOENT
|
30
30
|
return
|
31
31
|
end
|
32
|
-
gpr = lines&.select { |line| line[/BUNDLE_RUBYGEMS__PKG__GITHUB__COM/] }&.last&.split(
|
33
|
-
"--build-arg gpr=#{gpr}".gsub('\"',
|
32
|
+
gpr = lines&.select { |line| line[/BUNDLE_RUBYGEMS__PKG__GITHUB__COM/] }&.last&.split(" ")&.last
|
33
|
+
"--build-arg gpr=#{gpr}".gsub('\"', "") if gpr
|
34
34
|
end
|
35
35
|
end
|
36
36
|
end
|
data/lib/neptuno/docker/down.rb
CHANGED
@@ -4,20 +4,20 @@ module Neptuno
|
|
4
4
|
module Docker
|
5
5
|
# Stop docker containers for Neptuno project
|
6
6
|
class Down < Neptuno::CLI::Base
|
7
|
-
desc
|
7
|
+
desc "Docker: Stop docker containers for current project"
|
8
8
|
|
9
|
-
option :all, type: :boolean, default: false, desc:
|
10
|
-
option :volumes, type: :boolean, default: false, desc:
|
11
|
-
argument :services, type: :array, required: false, desc:
|
9
|
+
option :all, type: :boolean, default: false, desc: "Run on all services"
|
10
|
+
option :volumes, type: :boolean, default: false, desc: "Remove named volumes"
|
11
|
+
argument :services, type: :array, required: false, desc: "Optional list of services"
|
12
12
|
|
13
13
|
def call(services: [], **options)
|
14
|
-
command_services_to(
|
14
|
+
command_services_to("go down", all: options.fetch(:all), services_as_args: services) do |services|
|
15
15
|
services_to_stop = services.intersection(services_with_procs).intersection(running_services)
|
16
16
|
make_service_files(services_to_stop)
|
17
|
-
system("cd #{neptuno_path} && docker compose stop -t 0 #{services.join(
|
18
|
-
system("cd #{neptuno_path} && docker compose rm -f #{services.join(
|
19
|
-
system("cd #{neptuno_path} && docker compose down -v #{services.join(
|
20
|
-
if config.fetch(
|
17
|
+
system("cd #{neptuno_path} && docker compose stop -t 0 #{services.join(" ")}")
|
18
|
+
system("cd #{neptuno_path} && docker compose rm -f #{services.join(" ")}")
|
19
|
+
system("cd #{neptuno_path} && docker compose down -v #{services.join(" ")}") if options.fetch(:volumes)
|
20
|
+
if config.fetch("procfile_manager") == "tmux"
|
21
21
|
services_to_stop.each do |service|
|
22
22
|
system("tmux kill-session -t #{service} 2>/dev/null ")
|
23
23
|
puts "Neptuno killed Tmux session for: #{service}" if `echo $TMUX`.strip.empty?
|
@@ -4,22 +4,22 @@ module Neptuno
|
|
4
4
|
module Docker
|
5
5
|
# Restart docker containers for Neptuno project
|
6
6
|
class Restart < Neptuno::CLI::Base
|
7
|
-
desc
|
7
|
+
desc "Docker: Rebuild and restart docker containers for current project"
|
8
8
|
|
9
|
-
option :all, type: :boolean, default: false, desc:
|
10
|
-
option :volumes, type: :boolean, default: false, desc:
|
11
|
-
argument :services, type: :array, required: false, desc:
|
12
|
-
option :options, required: false, desc:
|
9
|
+
option :all, type: :boolean, default: false, desc: "Run on all services"
|
10
|
+
option :volumes, type: :boolean, default: false, desc: "Remove named volumes"
|
11
|
+
argument :services, type: :array, required: false, desc: "Optional list of services"
|
12
|
+
option :options, required: false, desc: "Optional string of options passed to build"
|
13
13
|
|
14
14
|
def call(services: [], **options)
|
15
|
-
command_services_to(
|
15
|
+
command_services_to("restart", all: options.fetch(:all), services_as_args: services) do |services|
|
16
16
|
make_service_files(services)
|
17
17
|
opts = options.fetch(:options, nil) || get_gpr
|
18
|
-
system("cd #{neptuno_path} && docker compose stop -t 0 #{services.join(
|
19
|
-
system("cd #{neptuno_path} && docker compose down -v #{services.join(
|
20
|
-
system("cd #{neptuno_path} && docker compose rm -f #{services.join(
|
21
|
-
system("cd #{neptuno_path} && docker compose build #{opts} #{services.join(
|
22
|
-
system("cd #{neptuno_path} && docker compose up -d #{services.join(
|
18
|
+
system("cd #{neptuno_path} && docker compose stop -t 0 #{services.join(" ")}")
|
19
|
+
system("cd #{neptuno_path} && docker compose down -v #{services.join(" ")}") if options.fetch(:volumes)
|
20
|
+
system("cd #{neptuno_path} && docker compose rm -f #{services.join(" ")}")
|
21
|
+
system("cd #{neptuno_path} && docker compose build #{opts} #{services.join(" ")}")
|
22
|
+
system("cd #{neptuno_path} && docker compose up -d #{services.join(" ")}")
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
@@ -29,8 +29,8 @@ module Neptuno
|
|
29
29
|
rescue Errno::ENOENT
|
30
30
|
return
|
31
31
|
end
|
32
|
-
gpr = lines&.select { |line| line[/BUNDLE_RUBYGEMS__PKG__GITHUB__COM/] }&.last&.split(
|
33
|
-
"--build-arg gpr=#{gpr}".gsub('\"',
|
32
|
+
gpr = lines&.select { |line| line[/BUNDLE_RUBYGEMS__PKG__GITHUB__COM/] }&.last&.split(" ")&.last
|
33
|
+
"--build-arg gpr=#{gpr}".gsub('\"', "") if gpr
|
34
34
|
end
|
35
35
|
end
|
36
36
|
end
|
data/lib/neptuno/docker/up.rb
CHANGED
@@ -4,16 +4,16 @@ module Neptuno
|
|
4
4
|
module Docker
|
5
5
|
# Build docker container for Neptuno project
|
6
6
|
class Up < Neptuno::CLI::Base
|
7
|
-
desc
|
7
|
+
desc "Docker: bring up docker containers for current project"
|
8
8
|
|
9
|
-
option :all, type: :boolean, default: false, desc:
|
10
|
-
option :wait, type: :boolean, default: true, desc:
|
11
|
-
argument :services, type: :array, required: false, desc:
|
9
|
+
option :all, type: :boolean, default: false, desc: "Run on all services"
|
10
|
+
option :wait, type: :boolean, default: true, desc: "Wait for services to be healthy"
|
11
|
+
argument :services, type: :array, required: false, desc: "Optional list of services"
|
12
12
|
|
13
13
|
def call(services: [], **options)
|
14
|
-
command_services_to(
|
14
|
+
command_services_to("come up", all: options.fetch(:all), services_as_args: services) do |services, _project|
|
15
15
|
make_service_files(services)
|
16
|
-
system("cd #{neptuno_path} && docker compose up -d --wait #{services.join(
|
16
|
+
system("cd #{neptuno_path} && docker compose up -d --wait #{services.join(" ")}")
|
17
17
|
end
|
18
18
|
end
|
19
19
|
end
|
@@ -4,7 +4,7 @@ module Neptuno
|
|
4
4
|
module Environment
|
5
5
|
# Build docker container for Neptuno project
|
6
6
|
class Update < Neptuno::CLI::Base
|
7
|
-
desc
|
7
|
+
desc "Environment: Update all environment files"
|
8
8
|
|
9
9
|
def call
|
10
10
|
env_path = "#{neptuno_path}/environments/"
|
@@ -5,24 +5,24 @@ module Neptuno
|
|
5
5
|
# Build docker container for Neptuno project
|
6
6
|
class Connect < Neptuno::CLI::Base
|
7
7
|
include ::Neptuno::TTY::Config
|
8
|
-
desc
|
8
|
+
desc "Overmind: Connect to processes inside docker containers"
|
9
9
|
|
10
|
-
option :up, type: :boolean, default: true, desc:
|
11
|
-
option :start, type: :boolean, default: true, desc:
|
12
|
-
option :all, type: :boolean, default: false, desc:
|
13
|
-
option :wait, type: :boolean, default: true, desc:
|
14
|
-
option :dependencies, type: :boolean, default: true, desc:
|
15
|
-
argument :services, type: :array, required: false, desc:
|
10
|
+
option :up, type: :boolean, default: true, desc: "Try to start containers before connecting"
|
11
|
+
option :start, type: :boolean, default: true, desc: "Try to start processes on containers before connecting"
|
12
|
+
option :all, type: :boolean, default: false, desc: "Run on all services"
|
13
|
+
option :wait, type: :boolean, default: true, desc: "Wait for all services to be healthy"
|
14
|
+
option :dependencies, type: :boolean, default: true, desc: "Connect to service and its dependencies"
|
15
|
+
argument :services, type: :array, required: false, desc: "Optional list of services"
|
16
16
|
|
17
17
|
def call(services: [], **options)
|
18
|
-
command_services_to(
|
18
|
+
command_services_to("connect to procs", all: options.fetch(:all), services_as_args: services) do |services|
|
19
19
|
original_services = services
|
20
20
|
services = services_with_procs.intersection(get_dependants(services).concat(services).uniq).sort
|
21
|
-
`neptuno up #{services.join(
|
21
|
+
`neptuno up #{services.join(" ")}` if options.fetch(:up)
|
22
22
|
|
23
23
|
outside_tmux = `echo $TMUX`.strip.empty?
|
24
24
|
|
25
|
-
if config.fetch(
|
25
|
+
if config.fetch("procfile_manager") == "tmux"
|
26
26
|
services.each do |service|
|
27
27
|
if /#{service}/.match?(`tmux ls`)
|
28
28
|
puts "Neptuno will use the existing Tmux session for: #{service}"
|
@@ -30,14 +30,14 @@ module Neptuno
|
|
30
30
|
end
|
31
31
|
|
32
32
|
pid = spawn("cd #{neptuno_path} && tmuxinator start neptuno_#{service} #{service}",
|
33
|
-
|
33
|
+
3 => "/dev/null")
|
34
34
|
Process.detach(pid)
|
35
35
|
puts "Neptuno started Tmux session for: #{service}" if `echo $TMUX`.strip.empty?
|
36
36
|
end
|
37
37
|
else
|
38
|
-
puts `neptuno start --no-up #{services.join(
|
38
|
+
puts `neptuno start --no-up #{services.join(" ")}` if options.fetch(:start)
|
39
39
|
if outside_tmux
|
40
|
-
system("cd #{neptuno_path} && sleep 1 && tmuxinator start neptuno #{services.join(
|
40
|
+
system("cd #{neptuno_path} && sleep 1 && tmuxinator start neptuno #{services.join(" ")}")
|
41
41
|
else
|
42
42
|
puts "Connecting to #{original_services.first}"
|
43
43
|
system("cd #{neptuno_path}/procfiles/#{original_services.first} && sleep 2 && overmind connect shell")
|
@@ -4,15 +4,15 @@ module Neptuno
|
|
4
4
|
module Services
|
5
5
|
# Update project to to latest GH master/main
|
6
6
|
class Update < Neptuno::CLI::Base
|
7
|
-
desc
|
7
|
+
desc "Stashes changes and pulls latest from main/master"
|
8
8
|
|
9
|
-
option :all, type: :boolean, default: false, desc:
|
9
|
+
option :all, type: :boolean, default: false, desc: "Run on all services"
|
10
10
|
option :main, type: :boolean, default: false,
|
11
|
-
|
12
|
-
argument :services, type: :array, required: false, desc:
|
11
|
+
desc: "Keep service on main/master after pull. Uncommited changes are stashed as 'neptuno_stash'"
|
12
|
+
argument :services, type: :array, required: false, desc: "Optional list of services"
|
13
13
|
|
14
14
|
def call(services: [], **options)
|
15
|
-
command_services_to(
|
15
|
+
command_services_to("update", all: options.fetch(:all), services_as_args: services) do |services|
|
16
16
|
services.each do |service|
|
17
17
|
puts "---Updating #{service}---"
|
18
18
|
current_branch = `git branch --show-current`
|
@@ -22,14 +22,14 @@ module Neptuno
|
|
22
22
|
`cd #{neptuno_path}/services/#{service} 2>/dev/null && git checkout master 2>/dev/null`
|
23
23
|
system("cd #{neptuno_path}/services/#{service} 2>/dev/null && git pull")
|
24
24
|
unless options.fetch(:main)
|
25
|
-
stash_id = `git stash list`.lines.find { |str| str =~ /neptuno_stash/ }&.split(
|
25
|
+
stash_id = `git stash list`.lines.find { |str| str =~ /neptuno_stash/ }&.split(":")&.first
|
26
26
|
`cd #{neptuno_path}/services/#{service} 2>/dev/null && git checkout #{current_branch} 2>/dev/null`
|
27
27
|
if stash_id
|
28
|
-
puts
|
28
|
+
puts "Applying stashed changes"
|
29
29
|
system("cd #{neptuno_path}/services/#{service} 2>/dev/null && git stash pop -q #{stash_id}")
|
30
30
|
end
|
31
31
|
end
|
32
|
-
puts
|
32
|
+
puts ""
|
33
33
|
end
|
34
34
|
end
|
35
35
|
end
|
data/lib/neptuno/tty/config.rb
CHANGED
@@ -6,9 +6,9 @@ module Neptuno
|
|
6
6
|
module Config
|
7
7
|
include TTY::File
|
8
8
|
TTY = ::TTY::Config.new
|
9
|
-
TTY.filename =
|
9
|
+
TTY.filename = "neptuno"
|
10
10
|
|
11
|
-
ABORT_MESSAGE =
|
11
|
+
ABORT_MESSAGE = "fatal: there are no registered services. Add one with: neptuno services add"
|
12
12
|
|
13
13
|
def config
|
14
14
|
TTY
|
@@ -25,11 +25,11 @@ module Neptuno
|
|
25
25
|
end
|
26
26
|
|
27
27
|
def docker_compose_services
|
28
|
-
docker_compose_hash.fetch(
|
28
|
+
docker_compose_hash.fetch("services").keys.sort
|
29
29
|
end
|
30
30
|
|
31
31
|
def auto_restart_procs
|
32
|
-
config.fetch(
|
32
|
+
config.fetch("auto_restart_procs")
|
33
33
|
end
|
34
34
|
|
35
35
|
def services
|
@@ -39,7 +39,7 @@ module Neptuno
|
|
39
39
|
end
|
40
40
|
|
41
41
|
def configured_services
|
42
|
-
config.fetch(
|
42
|
+
config.fetch("configured_services")
|
43
43
|
end
|
44
44
|
|
45
45
|
def running_services
|
@@ -47,11 +47,11 @@ module Neptuno
|
|
47
47
|
end
|
48
48
|
|
49
49
|
def json_services_status
|
50
|
-
neptuno_path =
|
50
|
+
neptuno_path = "./"
|
51
51
|
services = `cd #{neptuno_path} && docker compose ps --all --format json`.split("\n")
|
52
52
|
services.map do |line|
|
53
53
|
service = JSON.parse(line)
|
54
|
-
[service.dig(
|
54
|
+
[service.dig("Service"), service.dig("Status")]
|
55
55
|
end
|
56
56
|
end
|
57
57
|
|
@@ -66,13 +66,13 @@ module Neptuno
|
|
66
66
|
end
|
67
67
|
|
68
68
|
def services_with_procs
|
69
|
-
`cd #{neptuno_path} && find procfiles -type f -size +0`.split.map { |x| x.split(
|
69
|
+
`cd #{neptuno_path} && find procfiles -type f -size +0`.split.map { |x| x.split("/")[1] }
|
70
70
|
end
|
71
71
|
|
72
72
|
def get_dependants(services = [])
|
73
73
|
return [] if services.empty?
|
74
74
|
|
75
|
-
deps = services.map { |service| docker_compose_hash.dig(
|
75
|
+
deps = services.map { |service| docker_compose_hash.dig("services", service, "depends_on") }.flatten.uniq
|
76
76
|
[deps, get_dependants(deps - services)].flatten.compact.uniq
|
77
77
|
end
|
78
78
|
end
|
data/lib/neptuno/tty/file.rb
CHANGED
@@ -5,7 +5,7 @@ module Neptuno
|
|
5
5
|
# Wrapper class for TTY gem
|
6
6
|
module File
|
7
7
|
TTY = ::TTY::File
|
8
|
-
ABORT_MESSAGE =
|
8
|
+
ABORT_MESSAGE = "fatal: not a Neptuno repository (or any of the parent directories)"
|
9
9
|
|
10
10
|
def file
|
11
11
|
TTY
|
@@ -13,7 +13,7 @@ module Neptuno
|
|
13
13
|
|
14
14
|
# define path helpers
|
15
15
|
def project
|
16
|
-
neptuno_path.split(
|
16
|
+
neptuno_path.split("/").last
|
17
17
|
end
|
18
18
|
|
19
19
|
def in_service?
|
@@ -21,7 +21,7 @@ module Neptuno
|
|
21
21
|
end
|
22
22
|
|
23
23
|
def service
|
24
|
-
ENV[
|
24
|
+
ENV["PWD"].match(%r{services/([^/]*)})&.captures&.first
|
25
25
|
end
|
26
26
|
|
27
27
|
def neptuno_path
|
@@ -29,10 +29,10 @@ module Neptuno
|
|
29
29
|
|
30
30
|
pwd = Dir.pwd
|
31
31
|
loop do
|
32
|
-
return pwd if pwd ==
|
33
|
-
return @base_path = pwd if Dir.children(pwd).include?(
|
32
|
+
return pwd if pwd == ""
|
33
|
+
return @base_path = pwd if Dir.children(pwd).include?("neptuno.yml")
|
34
34
|
|
35
|
-
pwd = pwd.split(
|
35
|
+
pwd = pwd.split("/")[0..-2].join("/")
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
data/lib/neptuno/version.rb
CHANGED
data/neptuno.gemspec
CHANGED
@@ -1,48 +1,48 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative
|
3
|
+
require_relative "lib/neptuno/version"
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
|
-
spec.name =
|
6
|
+
spec.name = "neptuno"
|
7
7
|
spec.version = Neptuno::VERSION
|
8
|
-
spec.authors = [
|
9
|
-
spec.email = [
|
8
|
+
spec.authors = ["Roberto Plancarte"]
|
9
|
+
spec.email = ["roberto.plancarte@gmail.com"]
|
10
10
|
|
11
|
-
spec.summary =
|
12
|
-
spec.description =
|
13
|
-
spec.homepage =
|
14
|
-
spec.license =
|
15
|
-
spec.required_ruby_version =
|
11
|
+
spec.summary = "Unified Development Environment CLI"
|
12
|
+
spec.description = "A CLI for Neptuno distributed architectural style applications"
|
13
|
+
spec.homepage = "https://github.com/apptegy/neptuno"
|
14
|
+
spec.license = "Apache-2.0"
|
15
|
+
spec.required_ruby_version = ">= 2.3.0"
|
16
16
|
|
17
17
|
# spec.metadata['allowed_push_host'] = "TODO: Set to 'https://mygemserver.com'"
|
18
18
|
|
19
|
-
spec.metadata[
|
20
|
-
spec.metadata[
|
21
|
-
spec.metadata[
|
22
|
-
spec.metadata[
|
19
|
+
spec.metadata["homepage_uri"] = "https://apptegy.github.io/neptuno/"
|
20
|
+
spec.metadata["source_code_uri"] = "https://github.com/apptegy/neptuno"
|
21
|
+
spec.metadata["changelog_uri"] = "https://github.com/apptegy/releases"
|
22
|
+
spec.metadata["github_repo"] = "git@github.com:apptegy/neptuno.git"
|
23
23
|
|
24
24
|
# Specify which files should be added to the gem when it is released.
|
25
25
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
26
26
|
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
27
27
|
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{\A(?:test|spec|features)/}) }
|
28
28
|
end
|
29
|
-
spec.bindir =
|
29
|
+
spec.bindir = "exe"
|
30
30
|
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
31
|
-
spec.require_paths = [
|
31
|
+
spec.require_paths = ["lib"]
|
32
32
|
|
33
33
|
# Neptuno dependency list
|
34
|
-
spec.add_dependency
|
35
|
-
spec.add_dependency
|
36
|
-
spec.add_dependency
|
37
|
-
spec.add_dependency
|
38
|
-
spec.add_dependency
|
39
|
-
spec.add_dependency
|
40
|
-
spec.add_dependency
|
41
|
-
spec.add_dependency
|
42
|
-
spec.add_dependency
|
43
|
-
spec.add_dependency
|
44
|
-
spec.add_dependency
|
45
|
-
|
46
|
-
spec.add_development_dependency
|
47
|
-
spec.add_development_dependency
|
34
|
+
spec.add_dependency "dotiw"
|
35
|
+
spec.add_dependency "dry-cli"
|
36
|
+
spec.add_dependency "hirb"
|
37
|
+
spec.add_dependency "psych", "< 4"
|
38
|
+
spec.add_dependency "tty-command"
|
39
|
+
spec.add_dependency "tty-config"
|
40
|
+
spec.add_dependency "tty-file"
|
41
|
+
spec.add_dependency "tty-prompt"
|
42
|
+
spec.add_dependency "tty-spinner"
|
43
|
+
spec.add_dependency "tty-which"
|
44
|
+
spec.add_dependency "zeitwerk"
|
45
|
+
|
46
|
+
spec.add_development_dependency "minitest-reporters"
|
47
|
+
spec.add_development_dependency "standard"
|
48
48
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: neptuno
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Roberto Plancarte
|
@@ -201,8 +201,6 @@ extensions: []
|
|
201
201
|
extra_rdoc_files: []
|
202
202
|
files:
|
203
203
|
- ".github/workflows/gem-push.yml"
|
204
|
-
- ".github/workflows/gem-push_new.yml"
|
205
|
-
- ".github/workflows/main.yml"
|
206
204
|
- ".gitignore"
|
207
205
|
- AUTHORS
|
208
206
|
- CHANGELOG.md
|
@@ -1,48 +0,0 @@
|
|
1
|
-
name: Ruby Gem
|
2
|
-
|
3
|
-
on:
|
4
|
-
push:
|
5
|
-
branches: [ "main" ]
|
6
|
-
pull_request:
|
7
|
-
branches: [ "main" ]
|
8
|
-
|
9
|
-
jobs:
|
10
|
-
build:
|
11
|
-
name: Build + Publish
|
12
|
-
runs-on: ubuntu-latest
|
13
|
-
permissions:
|
14
|
-
contents: read
|
15
|
-
packages: write
|
16
|
-
|
17
|
-
steps:
|
18
|
-
- uses: actions/checkout@v4
|
19
|
-
- name: Set up Ruby 3.3.0
|
20
|
-
# To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
|
21
|
-
# change this to (see https://github.com/ruby/setup-ruby#versioning):
|
22
|
-
# uses: ruby/setup-ruby@v1
|
23
|
-
uses: ruby/setup-ruby@v1
|
24
|
-
with:
|
25
|
-
ruby-version: 3.3.0
|
26
|
-
|
27
|
-
- name: Publish to GPR
|
28
|
-
run: |
|
29
|
-
mkdir -p $HOME/.gem
|
30
|
-
touch $HOME/.gem/credentials
|
31
|
-
chmod 0600 $HOME/.gem/credentials
|
32
|
-
printf -- "---\n:github: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
|
33
|
-
gem build *.gemspec
|
34
|
-
gem push --KEY github --host https://rubygems.pkg.github.com/${OWNER} *.gem
|
35
|
-
env:
|
36
|
-
GEM_HOST_API_KEY: "Bearer ${{secrets.GITHUB_TOKEN}}"
|
37
|
-
OWNER: ${{ github.repository_owner }}
|
38
|
-
|
39
|
-
- name: Publish to RubyGems
|
40
|
-
run: |
|
41
|
-
mkdir -p $HOME/.gem
|
42
|
-
touch $HOME/.gem/credentials
|
43
|
-
chmod 0600 $HOME/.gem/credentials
|
44
|
-
printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
|
45
|
-
gem build *.gemspec
|
46
|
-
gem push *.gem
|
47
|
-
env:
|
48
|
-
GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_AUTH_TOKEN}}"
|
data/.github/workflows/main.yml
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
name: Ruby
|
2
|
-
|
3
|
-
on: [push,pull_request]
|
4
|
-
|
5
|
-
jobs:
|
6
|
-
build:
|
7
|
-
runs-on: ubuntu-latest
|
8
|
-
steps:
|
9
|
-
- uses: actions/checkout@v2
|
10
|
-
- name: Set up Ruby
|
11
|
-
uses: ruby/setup-ruby@v1
|
12
|
-
with:
|
13
|
-
ruby-version: 3.0.3
|
14
|
-
bundler-cache: true
|
15
|
-
- name: Run the default task
|
16
|
-
run: bundle exec rake
|