pult 0.0.13 → 0.0.14

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: 3c95b4fbc37783c8d725ba6ec5c3f850fff989de42fc1ed7fbbc049c1ebaf9e4
4
- data.tar.gz: 687d460564a5fc67fc6a1af46cd601910eb0cadabdd2f0ede02244e077ed66af
3
+ metadata.gz: 131574120a9bbecd16f9ae3884ce8449c2979ef40f28aac550f9bbb08c35ec2f
4
+ data.tar.gz: b269419bfaddb2cdb4724b37447b33dbfbece828bc0e1215d67ebeb7f0b91fbd
5
5
  SHA512:
6
- metadata.gz: 36252f5bdac3816e7250a727185717f9a2c6d8f58c0ed85100cfea9993bccdd30edf1dbc27ed419be819203d76af34a2dda2e0fe19599651fd6bc3b9d311968a
7
- data.tar.gz: 9bb3edaeeea1245dfceca81e8306070b3b6be34e905b44e94c6e750f79d1503953b8f9621d070324c74c7c63369b4480ec351dce0ce2acd9404fc5bf7db51d6d
6
+ metadata.gz: 5462a9625c8b7f2640b669e47bd67344ab04249a2822a35bb80475f5f51f0097b3dae9b80835a1bccfc5bb3ca6b6798e0a36f7df39312016d9bf517c98a693dc
7
+ data.tar.gz: 90fa33a0dd880f6b05f7d52e97d9d4a49bd0c7a2f0f2737bfd4d7bab3a0149da2a7caa3eaa87969f9d9b879ba7699c5c9a070c8c6baa19dbcb549e69d3165d9f
data/CHANGELOG.md CHANGED
@@ -4,6 +4,13 @@ All notable changes to this project will be documented in this file.
4
4
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
5
5
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
 
7
+ ## [0.0.13] - 2019-13-09
8
+ ### Status
9
+ - Dev version
10
+
11
+ ### Updates
12
+ - Add `pult` CLI (with `pult server|s` command for run API server)
13
+
7
14
  ## [0.0.9] - 2019-11-09
8
15
  ### Status
9
16
  - Dev version
data/README.md CHANGED
@@ -3,3 +3,96 @@
3
3
  **Under construction**! This is **Dev** version (0.0.*x*)
4
4
 
5
5
  Development progress can be reached at [CHANGELOG](./CHANGELOG.md)
6
+
7
+ Ruby *>= 2.3.0* require
8
+
9
+ # What is Pult?
10
+
11
+ Ruby or HTTP interface for your app tasks or services, described in yml file(s).
12
+
13
+ In another words, it is an API, that can be configured and running as a http server, or just been used via Ruby.
14
+
15
+ # Installation
16
+
17
+ ```bash
18
+ gem install pult
19
+ ```
20
+
21
+ # Usage
22
+
23
+ ## Usage: Via HTTP server
24
+
25
+ Put `pult.yml` anywere into your project folder.
26
+
27
+ Some kind of `<project>/config/pult.yml`:
28
+ ```yaml
29
+ #
30
+ # Rails, for example
31
+ #
32
+ appname:
33
+ test: 'pause 20 && echo 123'
34
+
35
+ # allow combine actions of the same level
36
+ up: [pull, prepare, start]
37
+ restart: [stop, start]
38
+
39
+ pull: git pull
40
+
41
+ prepare: rails assets:precompile
42
+
43
+ # if var is upcase, it will be required in API as a param ($PORT)
44
+ start: rails s -e production -p $PORT
45
+
46
+ # if var is downcase, it will be not required, just local stuff ($f)
47
+ stop: f=tmp/pids/server.pid; if [ -f "$f" ]; then rm $f; fi
48
+
49
+ # allow grouping actions in sublevels
50
+ log:
51
+ clean: >log/production.log
52
+ view: cat log/production.log
53
+ ```
54
+
55
+ Then in your project folder run:
56
+ ```bash
57
+ pult server
58
+ ```
59
+
60
+ Thats it! Pult API server is running (default port is *7070*).
61
+
62
+ Now, you can:
63
+ ```bash
64
+ # See your tasks
65
+ curl 'http://localhost:7070/api/appname/test'
66
+ curl 'http://localhost:7070/api/appname/up'
67
+ curl 'http://localhost:7070/api/appname/restart'
68
+ curl 'http://localhost:7070/api/appname/pull'
69
+ curl 'http://localhost:7070/api/appname/prepare'
70
+ curl 'http://localhost:7070/api/appname/start'
71
+ curl 'http://localhost:7070/api/appname/stop'
72
+ curl 'http://localhost:7070/api/appname/log/clean'
73
+ curl 'http://localhost:7070/api/appname/log/view'
74
+
75
+ # Next, test task example only (same for others)
76
+
77
+ # Run your tasks 'just in time' (can, but not preferably)
78
+ curl -X POST 'http://localhost:7070/api/appname/test'
79
+
80
+ # Run your tasks in a background (preferably)
81
+ curl -X POST 'http://localhost:7070/api/appname/test_job'
82
+
83
+ # See results (Stdout/Stderr, success) of your tasks after running
84
+ curl 'http://localhost:7070/api/appname/test_out'
85
+ curl 'http://localhost:7070/api/appname/test_err'
86
+ curl 'http://localhost:7070/api/appname/test_success'
87
+ ```
88
+
89
+ ## Usage: Via Ruby
90
+
91
+ TODO..
92
+
93
+ # TODO
94
+
95
+ - [ ] README (Usage via Ruby, Pult config, Licence)
96
+ - [ ] HTTP API swagger documentation WEB interface
97
+ - [ ] Live Stdout / Stderr / Pid of tasks, running in background
98
+ - [ ] Tests
data/example/pult.yml ADDED
@@ -0,0 +1,24 @@
1
+ #
2
+ # rails, for example
3
+ #
4
+ appname:
5
+ test: 'pause 20 && echo 123'
6
+
7
+ # allow combine actions of the same level
8
+ up: [pull, prepare, start]
9
+ restart: [stop, start]
10
+
11
+ pull: git pull
12
+
13
+ prepare: rails assets:precompile
14
+
15
+ # if var is upcase, it will be required in API as a param ($PORT)
16
+ start: rails s -e production -p $PORT
17
+
18
+ # if var is downcase, it will be not required, just local stuff ($f)
19
+ stop: f=tmp/pids/server.pid; if [ -f "$f" ]; then rm $f; fi
20
+
21
+ # allow grouping actions in sublevels
22
+ log:
23
+ clean: >log/production.log
24
+ view: cat log/production.log
@@ -6,6 +6,12 @@ class Pult::Api::Drawer
6
6
 
7
7
  prefix PREFIX
8
8
 
9
+ ENV_VAR = /[A-Z][A-Z0-9]*/
10
+
11
+ Runner = Pult::Panel::Injector::Runner
12
+
13
+ @@self = self
14
+
9
15
  UI = {
10
16
  red: ->(s){'<span style="color: red;">'+ s +'</span>'},
11
17
 
@@ -42,10 +48,6 @@ class Pult::Api::Drawer
42
48
  end
43
49
  end
44
50
 
45
- Runner = Pult::Panel::Injector::Runner
46
-
47
- @@self = self
48
-
49
51
  def self.draw! panel
50
52
  @@panel = panel
51
53
 
@@ -101,7 +103,7 @@ class Pult::Api::Drawer
101
103
  params do
102
104
  optional :screen, type: String
103
105
 
104
- @@command.scan(/(?<=\$)[^\s()]+/).each do |param|
106
+ @@command.scan(/(?<=\$)#{ENV_VAR}/).each do |param|
105
107
  description = { type: String }
106
108
 
107
109
  if ! (default = `echo -n $#{param}`).blank?
@@ -1,6 +1,6 @@
1
1
  module Pult::Api::Server
2
2
 
3
- PORT = ENV['PULT_API_PORT']&.to_i || 9292
3
+ PORT = ENV['PULT_API_PORT']&.to_i || 7070
4
4
 
5
5
  # temp fix curl -d ''
6
6
  METHS = WEBrick::HTTPRequest::BODY_CONTAINABLE_METHODS
data/lib/pult/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Pult
2
- VERSION = "0.0.13"
2
+ VERSION = "0.0.14"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pult
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.13
4
+ version: 0.0.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - dmitryck
@@ -140,6 +140,7 @@ files:
140
140
  - Rakefile
141
141
  - bin/console
142
142
  - bin/setup
143
+ - example/pult.yml
143
144
  - exe/pult
144
145
  - lib/init/boot.rb
145
146
  - lib/init/const.rb