devup 0.5.2 → 0.6.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6cac2c49e58ab10b2851c040543e3d0559ba2827ddb65c0194e902ddaedc7b77
4
- data.tar.gz: 75645b22886ac2e5ed3935797b53ef16a0221bee4b312f0a9cb5617619b7535e
3
+ metadata.gz: cad20921807b07f89d5f023a3c1cdb67f99c4b0768f6dca9a92403159cc179c7
4
+ data.tar.gz: 91a2e16e6d0d8dd48e2eac8e02c30bd4005b09a3a63933b71dc8f5aa1e75d66f
5
5
  SHA512:
6
- metadata.gz: 80c00c1ba35664e0239b66aef478ee585b96b6000d8931ff27bce090448e002e2daa358d1e28f2ecaf896d55235ec21a6dcf69d28a0507f6dbd24009e58b243b
7
- data.tar.gz: 1a94f305329fc701429203c17412b41406e4f14de59596d52895f68f4d7b1b4f92dca7f9212cbaa947b74949e6697acb7f146a2dfd6c353d487e90feba85c88c
6
+ metadata.gz: dee679549ee12b6b27c6673e5f69df48cf410ad1d5690f6e8e238cef4b8eb6f76b32d4a7b1db28ecb43c23ad188dd449d9b0b237cbb6abc9d7866b4b694d05f0
7
+ data.tar.gz: 64080623291135a341af34c102b2b8223c80cafbe9eef40425851cf20bea71bb04e8a68cc7bbad567d55a883f03841f1cee53f656bc898943aa4a3646e397be5
data/.gitignore CHANGED
@@ -9,12 +9,14 @@
9
9
  /tmp/
10
10
 
11
11
  # rspec failure tracking
12
- .rspec_status
12
+ /spec/examples.txt
13
13
 
14
14
  # Editor config
15
15
  .vimrc
16
+ .nvimrc
16
17
 
17
- .env.services
18
+ /.env.services
19
+ /.env.local
18
20
  spec/dummy/.env.services
19
21
  spec/dummy_rails/.env.services
20
22
 
data/.rspec CHANGED
@@ -1,3 +1,4 @@
1
- --format documentation
1
+ --format progress
2
2
  --color
3
3
  --require spec_helper
4
+ --tag ~@integration
data/.travis.yml CHANGED
@@ -23,7 +23,8 @@ jobs:
23
23
  - chmod +x ./cc-test-reporter
24
24
  - "./cc-test-reporter before-build"
25
25
  script:
26
- - bundle exec rake spec
26
+ - bundle exec rspec
27
+ - SIMPLECOV_COMMAND_NAME=integration bundle exec rspec --tag @integration
27
28
  after_script:
28
29
  - "./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT"
29
30
  - stage: test
data/.vimrc CHANGED
@@ -1 +1,3 @@
1
+ let g:ale_linters = {'ruby': ['standardrb'], 'javascript': ['standard'], 'json': ['jsonlint']}
2
+ let g:ale_fixers = {'ruby': ['standardrb'], 'javascript': ['standard'], 'json': ['jq']}
1
3
  let g:ale_fix_on_save = 1
data/CHANGELOG.md ADDED
@@ -0,0 +1,76 @@
1
+ # Change Log
2
+
3
+ ## master (unreleased)
4
+
5
+
6
+ ## 0.6.1
7
+
8
+ * require "devup/env" to prevent boot on every load
9
+
10
+ ## 0.6.0
11
+ * Docker Compose v2.x support added
12
+ * refactoring
13
+
14
+
15
+ ## 0.5.3
16
+
17
+ * readme updated
18
+ * fix disabled mode
19
+
20
+ ## 0.5.2
21
+
22
+ * NameError rescue
23
+ * version display fixed
24
+
25
+ ## 0.5.0
26
+
27
+ * local envs
28
+ * readme updated
29
+
30
+ ## 0.4.3.1
31
+
32
+ * env shortcut for a first port
33
+
34
+ ## 0.4.2
35
+
36
+ * performance optimization
37
+
38
+ ## 0.4.0
39
+
40
+ * commands rework with dry-cli
41
+ * hits of code metric added
42
+ * better spring support
43
+ * no port errro fixed
44
+
45
+ ## 0.3.3
46
+
47
+ * refactoring
48
+ * debug option added
49
+ * up timeout added
50
+ * magic env names removed
51
+
52
+ ## 0.3.2
53
+
54
+ * reverted "remove old volumes (--renew-anon-volumes)"
55
+
56
+ ## 0.3.1
57
+
58
+ * do not clear env each time
59
+
60
+ ## 0.3.0
61
+
62
+ * magic ENV names for postgres, redis, mysql
63
+ * readme updated
64
+ * Spring integaration
65
+ * ability to disable
66
+ * log errors
67
+ * remove old volumes (--renew-anon-volumes)
68
+
69
+ ## 0.2.0
70
+
71
+ * CI configured
72
+ * proof of concept
73
+
74
+ ## 0.1.0
75
+
76
+ * repo init
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- devup (0.5.2)
4
+ devup (0.6.1)
5
5
  dotenv
6
6
  dry-cli
7
7
 
@@ -12,7 +12,7 @@ GEM
12
12
  byebug (11.1.3)
13
13
  concurrent-ruby (1.1.7)
14
14
  diff-lcs (1.4.4)
15
- docile (1.3.2)
15
+ docile (1.4.0)
16
16
  dotenv (2.7.6)
17
17
  dry-cli (0.6.0)
18
18
  concurrent-ruby (~> 1.0)
@@ -50,10 +50,12 @@ GEM
50
50
  rubocop-performance (1.6.1)
51
51
  rubocop (>= 0.71.0)
52
52
  ruby-progressbar (1.10.1)
53
- simplecov (0.18.5)
53
+ simplecov (0.21.2)
54
54
  docile (~> 1.1)
55
55
  simplecov-html (~> 0.11)
56
- simplecov-html (0.12.2)
56
+ simplecov_json_formatter (~> 0.1)
57
+ simplecov-html (0.12.3)
58
+ simplecov_json_formatter (0.1.3)
57
59
  standard (0.4.7)
58
60
  rubocop (~> 0.85.0)
59
61
  rubocop-performance (~> 1.6.0)
data/README.md CHANGED
@@ -1,6 +1,12 @@
1
1
  # DevUp! [![Travis (.com) branch](https://img.shields.io/travis/com/sergio-fry/devup/master)](https://travis-ci.com/github/sergio-fry/devup) [![Gem](https://img.shields.io/gem/v/devup)](https://rubygems.org/gems/devup) [![Code Climate coverage](https://img.shields.io/codeclimate/coverage/sergio-fry/devup)](https://codeclimate.com/github/sergio-fry/devup) [![Code Climate maintainability](https://img.shields.io/codeclimate/maintainability/sergio-fry/devup)](https://codeclimate.com/github/sergio-fry/devup) [![Gem](https://img.shields.io/gem/dt/devup)](https://rubygems.org/gems/devup) [![Hits-of-Code](https://hitsofcode.com/github/sergio-fry/devup)](https://hitsofcode.com/view/github/sergio-fry/devup)
2
2
 
3
- Describe development dependencies with docker-compose. It is not required to remember any fancy command to start docker. Just start developing your app. Rails is a first-class citizen, but could be used without ruby.
3
+
4
+ Instead of installing and configuring local PostgreSQL, Redis and other external services, describe development dependencies with docker-compose. It is not required to remember any fancy command to start docker. Just start developing your app. Rails is a first-class citizen, but could be used without ruby.
5
+
6
+ 1. `bundle add aasm --group=development,test`
7
+ 2. Describe external services inside docker-compose.devup.yml
8
+ 3. `devup up`
9
+ 4. Confugure app to use ENV
4
10
 
5
11
 
6
12
  ## Requirements
@@ -28,6 +34,9 @@ Add **DevUp!** to your Gemfile
28
34
 
29
35
  ```ruby
30
36
  gem "devup", group: [:development, :test]
37
+
38
+ # To prevent devup boot every time, you can require "devup/env" only:
39
+ # gem "devup", group: [:development, :test], require: "devup/env"
31
40
  ```
32
41
 
33
42
  and
@@ -110,7 +119,7 @@ Now you can run app
110
119
 
111
120
  ### Disable **DevUp!**
112
121
 
113
- If you don't want devup to setup your dev services, you can disable it by using `DEVUP_ENABLED=false`. Just add it to .env.local file.
122
+ If you don't want devup to setup your dev services, you can disable it by using `DEVUP_ENABLED=false`. Just add it to .env.test.local file.
114
123
 
115
124
  ### Override some service
116
125
 
data/devup.gemspec CHANGED
@@ -11,7 +11,7 @@ Gem::Specification.new do |spec|
11
11
  spec.email = ["sergei@udalovs.ru"]
12
12
 
13
13
  spec.summary = "A tool to manage docker-compose for development"
14
- # spec.description = %q{TODO: Write a longer description or delete this line.}
14
+ spec.description = "Describe development services with YAML"
15
15
  spec.homepage = "https://github.com/sergio-fry/devup"
16
16
  spec.license = "MIT"
17
17
  spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
20
20
 
21
21
  spec.metadata["homepage_uri"] = spec.homepage
22
22
  spec.metadata["source_code_uri"] = spec.homepage
23
- # spec.metadata["changelog_uri"] = "TODO: Put your gem's CHANGELOG.md URL here."
23
+ spec.metadata["changelog_uri"] = "https://github.com/sergio-fry/devup/blob/master/CHANGELOG.md"
24
24
 
25
25
  # Specify which files should be added to the gem when it is released.
26
26
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
@@ -6,9 +6,7 @@ require "dotenv"
6
6
  module Devup
7
7
  class Application
8
8
  def run
9
- return if devup_disabled?
10
-
11
- boot
9
+ boot unless devup_disabled?
12
10
  load_env
13
11
  end
14
12
 
@@ -27,19 +25,17 @@ module Devup
27
25
  def devup
28
26
  @devup ||= Devup::Environment.new(
29
27
  pwd: `pwd`,
30
- logger: Devup::Logger.build(log_level)
28
+ logger: Devup::Logger.new(level: log_level)
31
29
  )
32
30
  end
33
31
 
34
32
  def load_env
35
- begin
33
+ if defined? ActiveSupport::Notifications
36
34
  Dotenv.instrumenter = ActiveSupport::Notifications
37
35
  ActiveSupport::Notifications.subscribe(/^dotenv/) do |*args|
38
36
  event = ActiveSupport::Notifications::Event.new(*args)
39
- Spring.watch event.payload[:env].filename # if Rails.application
37
+ Spring.watch event.payload[:env].filename if defined? Spring
40
38
  end
41
- rescue LoadError, ArgumentError, NameError
42
- # Spring is not available
43
39
  end
44
40
 
45
41
  Dotenv.load(*dotenv_list.to_a)
@@ -13,7 +13,7 @@ module Devup
13
13
  attr_reader :opts
14
14
 
15
15
  def logger
16
- @logger ||= Devup::Logger.build(log_level)
16
+ @logger ||= Devup::Logger.new(level: log_level)
17
17
  end
18
18
 
19
19
  def log_level
@@ -0,0 +1,17 @@
1
+ module Devup
2
+ module Compose
3
+ class PortConfig
4
+ def initialize(config)
5
+ @config = config
6
+ end
7
+
8
+ def from
9
+ @config.split(":")[-1].to_i
10
+ end
11
+
12
+ def ==(another)
13
+ from == another.from
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,103 @@
1
+ require "yaml"
2
+
3
+ require "devup/compose/v1/processes"
4
+ require "devup/compose/port_config"
5
+
6
+ module Devup
7
+ module Compose
8
+ module V1
9
+ class Compose
10
+ attr_reader :path, :project, :logger, :shell
11
+
12
+ class Error < StandardError; end
13
+
14
+ def initialize(path, project: "devup", logger:, shell:)
15
+ @path = path
16
+ @project = project
17
+ @logger = logger
18
+ @shell = shell
19
+ end
20
+
21
+ def check
22
+ true
23
+ end
24
+
25
+ def services
26
+ config["services"].keys
27
+ end
28
+
29
+ def service_ports(name)
30
+ return [] if config["services"][name]["ports"].nil?
31
+
32
+ config["services"][name]["ports"].map { |el| PortConfig.new(el.to_s) }
33
+ end
34
+
35
+ def port_mapping(port)
36
+ processes.port_mapping(port)
37
+ end
38
+
39
+ def up
40
+ exec "up -d --remove-orphans"
41
+
42
+ wait_alive 3
43
+ end
44
+
45
+ def stop
46
+ exec "stop"
47
+ end
48
+
49
+ def rm
50
+ exec "rm -f"
51
+ end
52
+
53
+ private
54
+
55
+ def wait_alive(timeout, retry_sleep: 0.3)
56
+ start = Time.now
57
+
58
+ loop {
59
+ break if alive?
60
+
61
+ if Time.now - start > timeout
62
+ logger.error "can't run services"
63
+ break
64
+ end
65
+ sleep retry_sleep
66
+ }
67
+ end
68
+
69
+ def alive?
70
+ processes(cached: false).up?
71
+ end
72
+
73
+ def processes(cached: true)
74
+ Processes.new(cached ? exec_ps_cached : exec_ps)
75
+ end
76
+
77
+ def exec_ps
78
+ @exec_ps_output = exec("ps")
79
+ end
80
+
81
+ def exec_ps_cached
82
+ @exec_ps_output ||= exec("ps")
83
+ end
84
+
85
+ def exec(cmd)
86
+ resp = shell.exec "docker-compose -p #{project} -f #{path} #{cmd}"
87
+
88
+ raise(Error) unless resp.success?
89
+
90
+ resp.data
91
+ end
92
+
93
+ def config
94
+ YAML.safe_load(config_content)
95
+ end
96
+
97
+ def config_content
98
+ File.read(path)
99
+ end
100
+ end
101
+ end
102
+ end
103
+ end
@@ -0,0 +1,34 @@
1
+ require "devup/port_mapping"
2
+
3
+ module Devup
4
+ module Compose
5
+ module V1
6
+ class Processes
7
+ attr_reader :output
8
+ def initialize(output)
9
+ @output = output
10
+ end
11
+
12
+ def up?
13
+ service_lines.map { |line|
14
+ line.match(/Up/) && !line.match(/Exit/)
15
+ }.all?
16
+ end
17
+
18
+ def port_mapping(port)
19
+ m = output.match(/\d{1,3}.\d{1,3}.\d{1,3}.\d{1,3}:(\d+)->#{port}\/tcp/)
20
+
21
+ return PortMapping.new(port, nil) if m.nil?
22
+
23
+ PortMapping.new(port, m[1].to_i)
24
+ end
25
+
26
+ private
27
+
28
+ def service_lines
29
+ output.split("\n")[2..-1]
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,14 @@
1
+ require "devup/compose/v1/compose"
2
+ require "devup/compose/v2/processes"
3
+
4
+ module Devup
5
+ module Compose
6
+ module V2
7
+ class Compose < V1::Compose
8
+ def processes(cached: true)
9
+ Processes.new(cached ? exec_ps_cached : exec_ps)
10
+ end
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,21 @@
1
+ require "devup/compose/v1/processes"
2
+
3
+ module Devup
4
+ module Compose
5
+ module V2
6
+ class Processes < V1::Processes
7
+ def up?
8
+ service_lines.map { |line|
9
+ line.match(/running/) && !line.match(/exited/)
10
+ }.all?
11
+ end
12
+
13
+ private
14
+
15
+ def service_lines
16
+ output.split("\n")[1..-1]
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
data/lib/devup/compose.rb CHANGED
@@ -1,94 +1,17 @@
1
- require "yaml"
2
-
3
- require "devup/compose/ps"
1
+ require "devup/compose/v1/compose"
2
+ require "devup/compose/v2/compose"
4
3
 
5
4
  module Devup
6
- class Compose
7
- attr_reader :path, :project, :logger, :shell
8
-
9
- class Error < StandardError; end
10
-
11
- def initialize(path, project: "devup", logger:, shell:)
12
- @path = path
13
- @project = project
14
- @logger = logger
15
- @shell = shell
16
- end
17
-
18
- def check
19
- true
20
- end
21
-
22
- def services
23
- config["services"].keys
24
- end
25
-
26
- def service_ports(name)
27
- return [] if config["services"][name]["ports"].nil?
28
-
29
- config["services"][name]["ports"].map { |el| el.to_s.split(":")[-1].to_i }
30
- end
31
-
32
- def port_mapping(port)
33
- ComposeHelpers::Ps.new(exec_ps_cached).port_mapping(port)
34
- end
35
-
36
- def up
37
- exec "up -d --remove-orphans"
38
-
39
- wait_alive 3
40
- end
41
-
42
- def stop
43
- exec "stop"
44
- end
45
-
46
- def rm
47
- exec "rm -f"
48
- end
49
-
50
- private
51
-
52
- def wait_alive(timeout, retry_sleep: 0.3)
53
- start = Time.now
54
-
55
- loop {
56
- break if alive?
57
-
58
- if Time.now - start > timeout
59
- logger.error "can't run services"
60
- break
61
- end
62
- sleep retry_sleep
63
- }
64
- end
65
-
66
- def alive?
67
- ComposeHelpers::Ps.new(exec_ps).up?
68
- end
69
-
70
- def exec_ps
71
- @exec_ps_output = exec("ps")
72
- end
73
-
74
- def exec_ps_cached
75
- @exec_ps_output ||= exec("ps")
76
- end
77
-
78
- def exec(cmd)
79
- resp = shell.exec "docker-compose -p #{project} -f #{path} #{cmd}"
80
-
81
- raise(Error) unless resp.success?
82
-
83
- resp.data
84
- end
85
-
86
- def config
87
- YAML.safe_load(config_content)
88
- end
89
-
90
- def config_content
91
- File.read(path)
5
+ module Compose
6
+ def self.current_version(version = `docker-compose -v`)
7
+ case version.match(/(\d).\d+.\d+/)[1].to_i
8
+ when 1
9
+ V1::Compose
10
+ when 2
11
+ V2::Compose
12
+ else
13
+ raise "Can't detect compose version"
14
+ end
92
15
  end
93
16
  end
94
17
  end
@@ -1,14 +1,18 @@
1
1
  module Devup
2
2
  class DotenvLoadList
3
3
  def initialize(env: nil)
4
- @env = env.to_sym unless env.nil?
4
+ @env = env&.to_sym
5
5
  end
6
6
 
7
7
  def to_a
8
8
  list = []
9
9
 
10
10
  list << ".env.#{@env}.local" if env_defined?
11
+
12
+ # .env.local is ignored by dotenv-rails too. So behaviour is the same.
13
+ # https://github.com/bkeepers/dotenv/blob/08f22148fb14019dce1e9b1d8ac1a74788e49e1b/lib/dotenv/rails.rb#L69
11
14
  list << ".env.local" unless test?
15
+
12
16
  list << ".env.services"
13
17
  list << ".env.#{@env}" if env_defined?
14
18
  list << ".env"
data/lib/devup/env.rb ADDED
@@ -0,0 +1,10 @@
1
+ require "devup/version"
2
+ require "devup/environment"
3
+ require "devup/application"
4
+
5
+ module Devup
6
+ class Error < StandardError; end
7
+ end
8
+
9
+ app = Devup::Application.new
10
+ app.load_env
@@ -1,16 +1,17 @@
1
1
  require "yaml"
2
2
 
3
3
  require "devup/logger"
4
- require "devup/compose"
5
4
  require "devup/service"
6
- require "devup/service_presenter"
5
+ require "devup/service_dotenv"
7
6
  require "devup/shell"
8
7
 
8
+ require "devup/compose"
9
+
9
10
  module Devup
10
11
  class Environment
11
12
  attr_reader :pwd, :logger, :shell
12
13
 
13
- def initialize(pwd:, compose: nil, logger: Logger.build, shell: Shell.new(pwd: pwd, logger: logger))
14
+ def initialize(pwd:, compose: nil, logger:, shell: Shell.new(pwd: pwd, logger: logger))
14
15
  @pwd = pwd.to_s.strip
15
16
  @compose = compose
16
17
  @logger = logger
@@ -75,7 +76,7 @@ module Devup
75
76
  end
76
77
 
77
78
  def service_env(service)
78
- ServicePresenter.new(service, project: project).call
79
+ ServiceDotenv.new(service, project: project).text
79
80
  end
80
81
 
81
82
  def write_dotenv
@@ -103,7 +104,7 @@ module Devup
103
104
 
104
105
  def compose
105
106
  @compose ||= begin
106
- Compose.new(
107
+ Compose.current_version.new(
107
108
  root.join("docker-compose.devup.yml"),
108
109
  project: project, logger: logger, shell: shell
109
110
  )
data/lib/devup/logger.rb CHANGED
@@ -1,14 +1,36 @@
1
1
  require "logger"
2
2
 
3
3
  module Devup
4
- class Logger < ::Logger
5
- def self.build(level = :info)
6
- formatter = ->(severity, _time, _progname, msg) { "DevUp! #{severity} #{msg}\n" }
7
- logger = new(STDOUT, formatter: formatter)
4
+ class Logger
5
+ def initialize(device: STDOUT, level: :info)
6
+ @level = level
7
+ @device = device
8
+ end
9
+
10
+ def debug(msg)
11
+ logger.debug msg
12
+ end
8
13
 
9
- logger.level = level
14
+ def info(msg)
15
+ logger.info msg
16
+ end
17
+
18
+ def error(msg)
19
+ logger.error msg
20
+ end
21
+
22
+ private
23
+
24
+ def logger
25
+ logger = ::Logger.new(@device, formatter: formatter)
26
+
27
+ logger.level = @level
10
28
 
11
29
  logger
12
30
  end
31
+
32
+ def formatter
33
+ ->(severity, _time, _progname, msg) { "DevUp! #{severity} #{msg}\n" }
34
+ end
13
35
  end
14
36
  end
@@ -2,6 +2,7 @@ require "socket"
2
2
  require "timeout"
3
3
 
4
4
  module Devup
5
+ # TODO we should use this to check ports are ready
5
6
  class PortChecker
6
7
  def call(port)
7
8
  s = TCPSocket.new("0.0.0.0", port)
@@ -0,0 +1,14 @@
1
+ module Devup
2
+ class PortMapping
3
+ def initialize(from, to)
4
+ @from = from
5
+ @to = to
6
+ end
7
+
8
+ attr_reader :from, :to
9
+
10
+ def ==(another)
11
+ @from == another.from && @to == another.to
12
+ end
13
+ end
14
+ end
data/lib/devup/service.rb CHANGED
@@ -1,4 +1,4 @@
1
- require "ostruct"
1
+ require_relative "port_mapping"
2
2
 
3
3
  module Devup
4
4
  class Service
@@ -16,11 +16,8 @@ module Devup
16
16
  private
17
17
 
18
18
  def fetch_ports
19
- compose.service_ports(name).map do |from|
20
- OpenStruct.new(
21
- from: from,
22
- to: compose.port_mapping(from)
23
- )
19
+ compose.service_ports(name).map do |el|
20
+ compose.port_mapping(el.from)
24
21
  end
25
22
  end
26
23
  end
@@ -1,5 +1,5 @@
1
1
  module Devup
2
- class ServicePresenter
2
+ class ServiceDotenv
3
3
  attr_reader :service, :project
4
4
 
5
5
  def initialize(service, project: nil)
@@ -7,7 +7,7 @@ module Devup
7
7
  @project = project
8
8
  end
9
9
 
10
- def call
10
+ def text
11
11
  res = []
12
12
 
13
13
  res << "# #{service.name}"
data/lib/devup/shell.rb CHANGED
@@ -9,6 +9,7 @@ module Devup
9
9
  @logger = logger
10
10
  end
11
11
 
12
+ # TODO maybe it should become somthing like ExecutedShellCommand ?
12
13
  Result = Struct.new(:data, :status) {
13
14
  def success?
14
15
  status
data/lib/devup/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Devup
2
- VERSION = "0.5.2"
2
+ VERSION = "0.6.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: devup
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.2
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sergei O. Udalov
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-10-15 00:00:00.000000000 Z
11
+ date: 2022-05-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dotenv
@@ -38,7 +38,7 @@ dependencies:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
- description:
41
+ description: Describe development services with YAML
42
42
  email:
43
43
  - sergei@udalovs.ru
44
44
  executables:
@@ -52,6 +52,7 @@ files:
52
52
  - ".standard.yml"
53
53
  - ".travis.yml"
54
54
  - ".vimrc"
55
+ - CHANGELOG.md
55
56
  - CODE_OF_CONDUCT.md
56
57
  - Gemfile
57
58
  - Gemfile.lock
@@ -70,13 +71,19 @@ files:
70
71
  - lib/devup/cli/commands/down.rb
71
72
  - lib/devup/cli/commands/up.rb
72
73
  - lib/devup/compose.rb
73
- - lib/devup/compose/ps.rb
74
+ - lib/devup/compose/port_config.rb
75
+ - lib/devup/compose/v1/compose.rb
76
+ - lib/devup/compose/v1/processes.rb
77
+ - lib/devup/compose/v2/compose.rb
78
+ - lib/devup/compose/v2/processes.rb
74
79
  - lib/devup/dotenv_load_list.rb
80
+ - lib/devup/env.rb
75
81
  - lib/devup/environment.rb
76
82
  - lib/devup/logger.rb
77
83
  - lib/devup/port_checker.rb
84
+ - lib/devup/port_mapping.rb
78
85
  - lib/devup/service.rb
79
- - lib/devup/service_presenter.rb
86
+ - lib/devup/service_dotenv.rb
80
87
  - lib/devup/shell.rb
81
88
  - lib/devup/version.rb
82
89
  homepage: https://github.com/sergio-fry/devup
@@ -85,6 +92,7 @@ licenses:
85
92
  metadata:
86
93
  homepage_uri: https://github.com/sergio-fry/devup
87
94
  source_code_uri: https://github.com/sergio-fry/devup
95
+ changelog_uri: https://github.com/sergio-fry/devup/blob/master/CHANGELOG.md
88
96
  post_install_message:
89
97
  rdoc_options: []
90
98
  require_paths:
@@ -1,30 +0,0 @@
1
- module Devup
2
- module ComposeHelpers
3
- class Ps
4
- attr_reader :output
5
- def initialize(output)
6
- @output = output
7
- end
8
-
9
- def up?
10
- service_lines.map { |line|
11
- line.match(/Up/) && !line.match(/Exit/)
12
- }.all?
13
- end
14
-
15
- def port_mapping(port)
16
- m = output.match(/\d{1,3}.\d{1,3}.\d{1,3}.\d{1,3}:(\d+)->#{port}\/tcp/)
17
-
18
- return if m.nil?
19
-
20
- m[1].to_i
21
- end
22
-
23
- private
24
-
25
- def service_lines
26
- output.split("\n")[2..-1]
27
- end
28
- end
29
- end
30
- end