procsd 0.5.2 → 0.5.3

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: 417ecd3b90ef7fe2c1c1b9194db6cf90a3ca9af0be6ea2807b875d2323a36122
4
- data.tar.gz: 4684afccd53e642bbc21ab45a7432e6a39b5ecab9839f9bd79c2cb0c226cf1fd
3
+ metadata.gz: cdf2c20fbe8f6aada5790a37464fa13eceb7db3ec671a821c32a8ea6471e579d
4
+ data.tar.gz: 4bdca0fd4c9b095a678988cde054031363ed80d5f48332ecc445803e16f402b0
5
5
  SHA512:
6
- metadata.gz: 138c52b892a4e5afd53610a00082842b5db62c221c57820ffbb766d1fd91a5d5b9015b1248dd529ffbc27f75d68bf7c534158c32a38c23e82b45eac3f3ca14b3
7
- data.tar.gz: 8caaae341c22e986466cc28173f0fb0a35f40f1d74d25af7a78ebb6af3cdfa20ab0110dece121602ddb3bf4989b6f64d197000509afb2b5b731bcd49c28f1da3
6
+ metadata.gz: ef4ac450a0847a268685a5c15f22772896d41de580b359d4a212432c31daed795b47d5e5d774e3307a20a3686f10372293ccc8047954b9b905321555de92ba79
7
+ data.tar.gz: 1392ebe266e97c45a77fd72a0f55d0aa261720bdb0950369838403c4412e005eb16b3fefa33ff20211bc46e8435baf4a27ecf048407d89db1b0c9f0b9f549a7d
@@ -1,4 +1,13 @@
1
1
  # CHANGELOG
2
+ ## 0.5.3
3
+ * Fix: procsd config sudoers command
4
+ * Add: procsd config services command
5
+
6
+ ## 0.5.2
7
+ * Fix: use uniq app name in Nginx config files
8
+ * Add: custom option public_folder_path (Nginx)
9
+ * Add: --dev option for exec command (to require dev_environment in development mode)
10
+
2
11
  ## 0.5.1
3
12
  * Fix bug `uninitialized constant Procsd::Generator::Pathname`, thanks to @koppen
4
13
 
data/README.md CHANGED
@@ -249,7 +249,7 @@ environment:
249
249
  RAILS_LOG_TO_STDOUT: true
250
250
  nginx:
251
251
  server_name: my-domain.com
252
- public_folder_path: public # path is relative to the main project directory, not required, default value is `public`.
252
+ public_folder_path: public # path is relative to the main project directory, default value is `public`.
253
253
  ```
254
254
 
255
255
  Configuration is done! Run [procsd create](#create-an-application-export-to-systemd) to create app services with Nginx reverse proxy config:
@@ -21,7 +21,7 @@ module Procsd
21
21
 
22
22
  public_folder_path = @config[:nginx]["public_folder_path"] || "public"
23
23
  unless Dir.exist?(File.join options["dir"], public_folder_path)
24
- raise ConfigurationError, "Missing public/ folder to use with Nginx"
24
+ raise ConfigurationError, "Missing public folder path to use with Nginx"
25
25
  end
26
26
 
27
27
  unless @config.dig(:environment, "PORT")
@@ -192,15 +192,28 @@ module Procsd
192
192
  execute command, type: :exec
193
193
  end
194
194
 
195
- desc "config", "Print config files based on current settings. Available types: sudoers"
195
+ desc "config", "Print config files based on current settings. Available types: sudoers, services"
196
196
  def config(name)
197
197
  preload!
198
198
 
199
+ options = { "user" => ENV["USER"], "dir" => ENV["PWD"], "path" => `/bin/bash -ilc 'echo $PATH'`.strip }
200
+ generator = Generator.new(@config, options)
201
+
199
202
  case name
200
203
  when "sudoers"
201
- say generate_sudoers_rule(ENV["USER"])
204
+ say generator.generate_sudoers(options["user"], has_reload: has_reload?)
205
+ when "services"
206
+ return unless valid_create_options?(options)
207
+
208
+ services = generator.generate_units
209
+ services.each do |service_name, service_data|
210
+ puts "Service: #{service_name} (size: #{service_data[:size]}):"
211
+ puts "---\n\n"
212
+ puts service_data[:content]
213
+ puts "---\n\n"
214
+ end
202
215
  else
203
- raise ArgumentError, "Wring type of argument: #{name}"
216
+ raise ArgumentError, "Wrong type of argument: #{name}"
204
217
  end
205
218
  end
206
219
 
@@ -230,16 +243,23 @@ module Procsd
230
243
 
231
244
  private
232
245
 
233
- def perform_create
234
- options.each do |key, value|
246
+ def valid_create_options?(opts)
247
+ opts.each do |key, value|
235
248
  next unless %w(user dir path).include? key
236
249
  if value.nil? || value.empty?
237
- say("Can't fetch value for --#{key}, please provide it's as an argument", :red) and return
250
+ say("Can't fetch value for --#{key}, please provide it's as an argument", :red)
251
+ return false
238
252
  else
239
253
  say("Value of the --#{key} option: #{value}", :yellow)
240
254
  end
241
255
  end
242
256
 
257
+ true
258
+ end
259
+
260
+ def perform_create
261
+ return unless valid_create_options?(options)
262
+
243
263
  generator = Generator.new(@config, options)
244
264
  generator.generate_units(save: true)
245
265
 
@@ -1,4 +1,4 @@
1
- require "pathname"
1
+ require 'pathname'
2
2
 
3
3
  module Procsd
4
4
  class Generator
@@ -1,3 +1,3 @@
1
1
  module Procsd
2
- VERSION = "0.5.2"
2
+ VERSION = "0.5.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: procsd
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.2
4
+ version: 0.5.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Victor Afanasev