devup 0.3.3 → 0.4.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d83b3c98d30a71d2414a1fc5106d9a907612911f4b05a2246404f08215be203c
4
- data.tar.gz: 772cee331bdcd822f497cc7121a6d6201b971b65b930e47864770d7cbb30df62
3
+ metadata.gz: 99a6b3579f7d44d86a42c61b5d5b55dcd32e8d7aac580c49e5bce9a95500ff02
4
+ data.tar.gz: 2a73831a4d8d1549d6150050c12d4806ab8cc41089cbb9ce2b81420d09b02c8a
5
5
  SHA512:
6
- metadata.gz: e29107cb8acd259d0e1f038e93cd7809e5b933abdedace59e17001e974220632ed95fe14aadb8e28007c6164665fbd4b4398268b1b476d35042c89457dde78b7
7
- data.tar.gz: 7145ada30c07f14547ea5fc4c3d6ef9222a7dee288bb2d38b547a1907d844646e737d43a8f740668739465de60217d7e1a0501601618bb5e270c77e99903e713
6
+ metadata.gz: 709e5c38a2786273085eba92ab0fa70f70dd8fbbfe1200b631ab1bd527b072df097fe6b856bab1e57a5790952dd2476665bcca965e302a69fa8ea2d47cb0d2a4
7
+ data.tar.gz: 5c81a935db87d41f22be697fcce631d9f80262f155bbc5eac146c2782e8d1ff49a4a805a86ad0b2c14b3d91e118807c80e0f857ba8584927a1743eab3fd7d87a
@@ -1,17 +1,21 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- devup (0.3.3)
4
+ devup (0.4.0)
5
5
  dotenv
6
+ dry-cli
6
7
 
7
8
  GEM
8
9
  remote: https://rubygems.org/
9
10
  specs:
10
11
  ast (2.4.0)
11
12
  byebug (11.1.3)
13
+ concurrent-ruby (1.1.6)
12
14
  diff-lcs (1.3)
13
15
  docile (1.3.2)
14
16
  dotenv (2.7.5)
17
+ dry-cli (0.6.0)
18
+ concurrent-ruby (~> 1.0)
15
19
  jaro_winkler (1.5.4)
16
20
  json (2.3.0)
17
21
  lefthook (0.7.2)
data/README.md CHANGED
@@ -1,4 +1,4 @@
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)
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
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.
4
4
 
@@ -77,7 +77,7 @@ Install DevUp!
77
77
 
78
78
  Start up services
79
79
 
80
- $ devup
80
+ $ devup up
81
81
  DevUp! INFO starting up...
82
82
  DevUp! INFO up
83
83
 
@@ -106,7 +106,7 @@ If you don't want devup to setup your dev services, you can disable it by using
106
106
  ### Debug
107
107
 
108
108
  $ export DEVUP_LOG_LEVEL=debug
109
- $ devup
109
+ $ devup up
110
110
 
111
111
  ## Development
112
112
 
@@ -32,4 +32,5 @@ Gem::Specification.new do |spec|
32
32
  spec.require_paths = ["lib"]
33
33
 
34
34
  spec.add_dependency "dotenv"
35
+ spec.add_dependency "dry-cli"
35
36
  end
@@ -6,3 +6,6 @@ services:
6
6
  ports:
7
7
  - "5432"
8
8
 
9
+ web:
10
+ image: nginx
11
+
data/exe/devup CHANGED
@@ -1,16 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require "devup/environment"
3
+ require "devup/cli"
4
4
 
5
- devup = Devup::Environment.new(
6
- pwd: `pwd`,
7
- logger: Devup::Logger.build(ENV.fetch("DEVUP_LOG_LEVEL", "info"))
8
- )
9
-
10
- # TODO: use dry-cli here
11
- case ARGV[0]
12
- when "down"
13
- devup.down
14
- else
15
- devup.up
16
- end
5
+ Dry::CLI.new(Devup::CLI::Commands).call
@@ -0,0 +1,22 @@
1
+ require "dry/cli"
2
+
3
+ require "devup/cli/commands/up"
4
+ require "devup/cli/commands/down"
5
+
6
+ module Devup
7
+ module CLI
8
+ module Commands
9
+ extend Dry::CLI::Registry
10
+
11
+ class Version < Dry::CLI::Command
12
+ def call(*)
13
+ puts Devup::VERSION
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
19
+
20
+ Devup::CLI::Commands.register "version", Devup::CLI::Commands::Version, aliases: ["v", "-v", "--version"]
21
+ Devup::CLI::Commands.register "up", Devup::CLI::Commands::Up
22
+ Devup::CLI::Commands.register "down", Devup::CLI::Commands::Down
@@ -0,0 +1,38 @@
1
+ require "devup/logger"
2
+
3
+ module Devup
4
+ module CLI
5
+ module Commands
6
+ class Command < Dry::CLI::Command
7
+ def call(**options)
8
+ @opts = options
9
+ end
10
+
11
+ private
12
+
13
+ attr_reader :opts
14
+
15
+ def logger
16
+ @logger ||= Devup::Logger.build(log_level)
17
+ end
18
+
19
+ def log_level
20
+ if opts.fetch(:verbose)
21
+ :debug
22
+ else
23
+ :info
24
+ end
25
+ end
26
+
27
+ def devup
28
+ require "devup/environment"
29
+
30
+ @devup ||= Devup::Environment.new(
31
+ pwd: `pwd`,
32
+ logger: logger
33
+ )
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,17 @@
1
+ module Devup
2
+ module CLI
3
+ module Commands
4
+ class Down < Command
5
+ desc "Stop dev services"
6
+
7
+ option :verbose, type: :boolean, default: false, desc: "Verbose"
8
+
9
+ def call(**options)
10
+ super
11
+
12
+ devup.down
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,33 @@
1
+ require "devup/cli/commands/command"
2
+ module Devup
3
+ module CLI
4
+ module Commands
5
+ class Up < Command
6
+ desc "Run dev services"
7
+
8
+ option :verbose, type: :boolean, default: false, desc: "Verbose"
9
+
10
+ def call(**options)
11
+ super
12
+
13
+ devup.up
14
+ print_info
15
+ end
16
+
17
+ private
18
+
19
+ def print_info
20
+ puts <<~INFO
21
+
22
+ Now you are ready to use services. All variables are available
23
+ in a .env.services file. Just start you ruby application if
24
+ gem "devup" is used. Or load variable manually with
25
+
26
+ $ source .env.services
27
+
28
+ INFO
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end
@@ -24,6 +24,8 @@ module Devup
24
24
  end
25
25
 
26
26
  def service_ports(name)
27
+ return [] if config["services"][name]["ports"].nil?
28
+
27
29
  config["services"][name]["ports"].map { |el| el.to_s.split(":")[-1].to_i }
28
30
  end
29
31
 
@@ -35,6 +35,7 @@ module Devup
35
35
  clear_dotenv
36
36
  logger.debug ex
37
37
  logger.error "halted"
38
+ raise ex
38
39
  end
39
40
 
40
41
  def down
@@ -1,3 +1,3 @@
1
1
  module Devup
2
- VERSION = "0.3.3"
2
+ VERSION = "0.4.0"
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.3.3
4
+ version: 0.4.0
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-06-10 00:00:00.000000000 Z
11
+ date: 2020-06-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dotenv
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: dry-cli
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
27
41
  description:
28
42
  email:
29
43
  - sergei@udalovs.ru
@@ -52,6 +66,10 @@ files:
52
66
  - lefthook.yml
53
67
  - lib/devup.rb
54
68
  - lib/devup/boot.rb
69
+ - lib/devup/cli.rb
70
+ - lib/devup/cli/commands/command.rb
71
+ - lib/devup/cli/commands/down.rb
72
+ - lib/devup/cli/commands/up.rb
55
73
  - lib/devup/compose.rb
56
74
  - lib/devup/compose/ps.rb
57
75
  - lib/devup/dotenv.rb