devup 0.5.1 → 0.5.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d01ca2f4289ff4e43debcf48281affb38e3a81a108e1404206a00c41585fc77f
4
- data.tar.gz: '08befd6589ddd7f58728659dca4f852a207a976aadb80728a68cfa461f49e8c5'
3
+ metadata.gz: 6cac2c49e58ab10b2851c040543e3d0559ba2827ddb65c0194e902ddaedc7b77
4
+ data.tar.gz: 75645b22886ac2e5ed3935797b53ef16a0221bee4b312f0a9cb5617619b7535e
5
5
  SHA512:
6
- metadata.gz: c9302d63bdf377844ee4dd4928ebb8d57a3a509c339aa1ae9374f4fb8bcf6f45506cd64f3bfde46341dfcab74c1af722c417dd7117adc39abf9eb79495bee7a6
7
- data.tar.gz: 07f6b96af54b5fe8338935c287a3b380a5ac20c05a15686ab782f0c7dc77ca2213518b5c2f32145cfbcfe237695c52327f65f5512bf81cefbd0f17365517455e
6
+ metadata.gz: 80c00c1ba35664e0239b66aef478ee585b96b6000d8931ff27bce090448e002e2daa358d1e28f2ecaf896d55235ec21a6dcf69d28a0507f6dbd24009e58b243b
7
+ data.tar.gz: 1a94f305329fc701429203c17412b41406e4f14de59596d52895f68f4d7b1b4f92dca7f9212cbaa947b74949e6697acb7f146a2dfd6c353d487e90feba85c88c
@@ -12,15 +12,6 @@ services:
12
12
  before_install:
13
13
  - gem install bundler -v $BUNDLER_VERSION
14
14
  bundler_args: "--jobs=3 --retry=3"
15
- deploy:
16
- provider: rubygems
17
- api_key:
18
- secure: sMr+AT3gK44uTM6PHPrPAN8zxFf4njsqp65tC7l69dnzzYCuz9xBpUlYW18XFTTkJaFsr9s4A5ptdQ4gi7D12LdjFbRUkLkrCcAedALQ4PoQVkAQoNPaEPI40F7GUxElyBqbbHlUzgsxf6YPmVPykl+sbaD+WLZM26P9rxFpjwwlVsG4aaQ1TKHXQ4PZUch0LZDjuA3Z6cs9Tb22Ep0kur+Lb8EYyvgB+p50gidsBuFy2fb7/PYApqq2NhZn7bgS0vd5tTfuPzhq8B0PJzBrio52Ymn8Ry7n3WVJRXtoG2ZuynL+nxkLtUHuC4HGt336d/kx+8hLGHDRbBQurF2B+UQowD6+EZVb1d5zqYGJAvMXVBZ73+aa99tCU4hUVK8TWmwfaRgrZyLbOpOfkMEO905nsqRVFduI0HRI3MhD8ZzzwPiXmmtx4/dxzx+UX1tQiBRMmBKUaeXB8iCry7C5IcKPuTFMs1qVYmFfDrcnpL8H4FWtZ2diCgop8ocqtRRqLF7ZgdGticNlYkI6jISn7ToDCH/V+brVI9B/QQWq9xUVCUw10kGBllWFd9TJ7eZ7coQ+tOFfTibFd92xyRyR0QLUXE0ECyXMLI2kW31VN3yWMYYm4k+rXXXOsdQ3CJI7ozSVGDAO/7V6BLlaOeNqe9dgW/nD2NMr8RuSJr2akUA=
19
- gem: devup
20
- on:
21
- tags: true
22
- repo: sergio-fry/devup
23
- skip_cleanup: 'true'
24
15
 
25
16
  jobs:
26
17
  include:
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- devup (0.5.1)
4
+ devup (0.5.2)
5
5
  dotenv
6
6
  dry-cli
7
7
 
@@ -1,11 +1,10 @@
1
1
  require "devup/version"
2
2
  require "devup/environment"
3
+ require "devup/application"
3
4
 
4
5
  module Devup
5
6
  class Error < StandardError; end
6
7
  end
7
8
 
8
- if ENV.fetch("DEVUP_ENABLED", "true") == "true"
9
- require "devup/boot"
10
- require "devup/dotenv"
11
- end
9
+ app = Devup::Application.new
10
+ app.run
@@ -0,0 +1,68 @@
1
+ require "devup/dotenv_load_list"
2
+ require "devup/environment"
3
+ require "devup/logger"
4
+ require "dotenv"
5
+
6
+ module Devup
7
+ class Application
8
+ def run
9
+ return if devup_disabled?
10
+
11
+ boot
12
+ load_env
13
+ end
14
+
15
+ def boot
16
+ devup.up
17
+
18
+ begin
19
+ require "spring/commands"
20
+
21
+ Spring.watch devup.root.join("docker-compose.yml")
22
+ rescue LoadError, ArgumentError, NameError
23
+ # Spring is not available
24
+ end
25
+ end
26
+
27
+ def devup
28
+ @devup ||= Devup::Environment.new(
29
+ pwd: `pwd`,
30
+ logger: Devup::Logger.build(log_level)
31
+ )
32
+ end
33
+
34
+ def load_env
35
+ begin
36
+ Dotenv.instrumenter = ActiveSupport::Notifications
37
+ ActiveSupport::Notifications.subscribe(/^dotenv/) do |*args|
38
+ event = ActiveSupport::Notifications::Event.new(*args)
39
+ Spring.watch event.payload[:env].filename # if Rails.application
40
+ end
41
+ rescue LoadError, ArgumentError, NameError
42
+ # Spring is not available
43
+ end
44
+
45
+ Dotenv.load(*dotenv_list.to_a)
46
+ end
47
+
48
+ def app_env
49
+ (ENV["RAILS_ENV"] || ENV["RACK_ENV"] || "development").to_sym
50
+ end
51
+
52
+ def dotenv_list
53
+ Devup::DotenvLoadList.new(env: app_env)
54
+ end
55
+
56
+ def dotenv_vars
57
+ Dotenv.parse(*dotenv_list.to_a)
58
+ end
59
+
60
+ def log_level
61
+ ENV.fetch("DEVUP_LOG_LEVEL", dotenv_vars["DEVUP_LOG_LEVEL"] || "info")
62
+ end
63
+
64
+ def devup_disabled?
65
+ ENV.fetch("DEVUP_ENABLED", dotenv_vars["DEVUP_ENABLED"] || "true") != "true"
66
+ end
67
+ end
68
+ end
@@ -1,5 +1,6 @@
1
1
  require "dry/cli"
2
2
 
3
+ require "devup/version"
3
4
  require "devup/cli/commands/up"
4
5
  require "devup/cli/commands/down"
5
6
 
@@ -1,3 +1,3 @@
1
1
  module Devup
2
- VERSION = "0.5.1"
2
+ VERSION = "0.5.2"
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.1
4
+ version: 0.5.2
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-01 00:00:00.000000000 Z
11
+ date: 2020-10-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dotenv
@@ -64,14 +64,13 @@ files:
64
64
  - docker-compose.devup.yml
65
65
  - exe/devup
66
66
  - lib/devup.rb
67
- - lib/devup/boot.rb
67
+ - lib/devup/application.rb
68
68
  - lib/devup/cli.rb
69
69
  - lib/devup/cli/commands/command.rb
70
70
  - lib/devup/cli/commands/down.rb
71
71
  - lib/devup/cli/commands/up.rb
72
72
  - lib/devup/compose.rb
73
73
  - lib/devup/compose/ps.rb
74
- - lib/devup/dotenv.rb
75
74
  - lib/devup/dotenv_load_list.rb
76
75
  - lib/devup/environment.rb
77
76
  - lib/devup/logger.rb
@@ -1,13 +0,0 @@
1
- devup = Devup::Environment.new(
2
- pwd: `pwd`,
3
- logger: Devup::Logger.build(ENV.fetch("DEVUP_LOG_LEVEL", "info"))
4
- )
5
- devup.up
6
-
7
- begin
8
- require "spring/commands"
9
-
10
- Spring.watch devup.root.join("docker-compose.yml")
11
- rescue LoadError, ArgumentError, NameError
12
- # Spring is not available
13
- end
@@ -1,16 +0,0 @@
1
- require "dotenv"
2
- require "devup/dotenv_load_list"
3
-
4
- begin
5
- Dotenv.instrumenter = ActiveSupport::Notifications
6
- ActiveSupport::Notifications.subscribe(/^dotenv/) do |*args|
7
- event = ActiveSupport::Notifications::Event.new(*args)
8
- Spring.watch event.payload[:env].filename # if Rails.application
9
- end
10
- rescue LoadError, ArgumentError, NameError
11
- # Spring is not available
12
- end
13
-
14
- env = (ENV["RAILS_ENV"] || "development").to_sym
15
- list = Devup::DotenvLoadList.new(env: env)
16
- Dotenv.load(*list.to_a)