djin 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/Gemfile.lock +31 -8
- data/README.md +42 -2
- data/Vertofile +44 -0
- data/djin.gemspec +4 -2
- data/djin.yml +8 -0
- data/exe/djin +2 -0
- data/lib/djin.rb +2 -1
- data/lib/djin/cli.rb +2 -4
- data/lib/djin/executor.rb +11 -2
- data/lib/djin/version.rb +1 -1
- metadata +35 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 395a6c76f1aac739197b1721dfedca93dfffcfcf456d3fc748fa16f024fb5a94
|
4
|
+
data.tar.gz: c2915512107075ee0fb3bafbfe50033925410241fef29dd54db747a2d0686328
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 802cfbb81399c9ec9494b98036c7bd5932e735eb028b44ff84abc1ff0f2ff7930fe4d5a2d9b2bdae2b493684289e0e1d8631e570c942c71351321faa641bac85
|
7
|
+
data.tar.gz: 3b895f090fb9c73aac047c234a13191702393cf7fdff8c6b9eb0437daed931e7ae71ba0d6c8113d45b84d6424897309c66f310bfd470f58c955c1b508aa771d9
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
## 0.4.0 - 25/06/2020
|
2
|
+
* [FEATURE] Adds Custom Args and Environment support in djin.yml
|
3
|
+
|
4
|
+
## 0.3.1 - 29/05/2020
|
5
|
+
* [PATCH] Handles Ctrl + C
|
6
|
+
* [TECH] Adds Vertofile
|
7
|
+
|
1
8
|
## 0.3.0 - 19/05/2020
|
2
9
|
* [FEATURE] Adds Version Option
|
3
10
|
* [PATCH] Add task name in djin.yml parse errors
|
data/Gemfile.lock
CHANGED
@@ -1,21 +1,23 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
djin (0.
|
5
|
-
dry-cli (~> 0.
|
4
|
+
djin (0.4.0)
|
5
|
+
dry-cli (~> 0.6.0)
|
6
6
|
dry-struct (~> 1.3.0)
|
7
|
-
dry-validation (~> 1.5.
|
7
|
+
dry-validation (~> 1.5.1)
|
8
|
+
mustache (~> 1.1.1)
|
8
9
|
vseries (~> 0.1.0)
|
9
10
|
|
10
11
|
GEM
|
11
12
|
remote: https://rubygems.org/
|
12
13
|
specs:
|
14
|
+
ast (2.4.1)
|
13
15
|
byebug (11.1.1)
|
14
16
|
concurrent-ruby (1.1.6)
|
15
17
|
diff-lcs (1.3)
|
16
|
-
dry-cli (0.
|
18
|
+
dry-cli (0.6.0)
|
17
19
|
concurrent-ruby (~> 1.0)
|
18
|
-
dry-configurable (0.11.
|
20
|
+
dry-configurable (0.11.6)
|
19
21
|
concurrent-ruby (~> 1.0)
|
20
22
|
dry-core (~> 0.4, >= 0.4.7)
|
21
23
|
dry-equalizer (~> 0.2)
|
@@ -31,7 +33,7 @@ GEM
|
|
31
33
|
concurrent-ruby (~> 1.0)
|
32
34
|
dry-core (~> 0.2)
|
33
35
|
dry-equalizer (~> 0.2)
|
34
|
-
dry-schema (1.5.
|
36
|
+
dry-schema (1.5.1)
|
35
37
|
concurrent-ruby (~> 1.0)
|
36
38
|
dry-configurable (~> 0.8, >= 0.8.3)
|
37
39
|
dry-core (~> 0.4)
|
@@ -51,7 +53,7 @@ GEM
|
|
51
53
|
dry-equalizer (~> 0.3)
|
52
54
|
dry-inflector (~> 0.1, >= 0.1.2)
|
53
55
|
dry-logic (~> 1.0, >= 1.0.2)
|
54
|
-
dry-validation (1.5.
|
56
|
+
dry-validation (1.5.1)
|
55
57
|
concurrent-ruby (~> 1.0)
|
56
58
|
dry-container (~> 0.7, >= 0.7.1)
|
57
59
|
dry-core (~> 0.4)
|
@@ -59,7 +61,14 @@ GEM
|
|
59
61
|
dry-initializer (~> 3.0)
|
60
62
|
dry-schema (~> 1.5)
|
61
63
|
ice_nine (0.11.2)
|
64
|
+
mustache (1.1.1)
|
65
|
+
parallel (1.19.2)
|
66
|
+
parser (2.7.1.4)
|
67
|
+
ast (~> 2.4.1)
|
68
|
+
rainbow (3.0.0)
|
62
69
|
rake (13.0.1)
|
70
|
+
regexp_parser (1.7.1)
|
71
|
+
rexml (3.2.4)
|
63
72
|
rspec (3.9.0)
|
64
73
|
rspec-core (~> 3.9.0)
|
65
74
|
rspec-expectations (~> 3.9.0)
|
@@ -73,6 +82,19 @@ GEM
|
|
73
82
|
diff-lcs (>= 1.2.0, < 2.0)
|
74
83
|
rspec-support (~> 3.9.0)
|
75
84
|
rspec-support (3.9.2)
|
85
|
+
rubocop (0.86.0)
|
86
|
+
parallel (~> 1.10)
|
87
|
+
parser (>= 2.7.0.1)
|
88
|
+
rainbow (>= 2.2.2, < 4.0)
|
89
|
+
regexp_parser (>= 1.7)
|
90
|
+
rexml
|
91
|
+
rubocop-ast (>= 0.0.3, < 1.0)
|
92
|
+
ruby-progressbar (~> 1.7)
|
93
|
+
unicode-display_width (>= 1.4.0, < 2.0)
|
94
|
+
rubocop-ast (0.0.3)
|
95
|
+
parser (>= 2.7.0.1)
|
96
|
+
ruby-progressbar (1.10.1)
|
97
|
+
unicode-display_width (1.7.0)
|
76
98
|
vseries (0.1.1)
|
77
99
|
|
78
100
|
PLATFORMS
|
@@ -84,6 +106,7 @@ DEPENDENCIES
|
|
84
106
|
djin!
|
85
107
|
rake (~> 13.0)
|
86
108
|
rspec (~> 3.0)
|
109
|
+
rubocop
|
87
110
|
|
88
111
|
BUNDLED WITH
|
89
|
-
2.
|
112
|
+
2.1.4
|
data/README.md
CHANGED
@@ -25,7 +25,7 @@ If you use Rbenv you can install djin only once and create a alias in your .basr
|
|
25
25
|
To use djin first you need to create a djin.yml file:
|
26
26
|
|
27
27
|
```yaml
|
28
|
-
djin_version: '0.
|
28
|
+
djin_version: '0.4.0'
|
29
29
|
|
30
30
|
# With a docker image
|
31
31
|
script:
|
@@ -50,7 +50,7 @@ You can also set task dependencies with depends_on option:
|
|
50
50
|
|
51
51
|
|
52
52
|
```yaml
|
53
|
-
djin_version: '0.
|
53
|
+
djin_version: '0.4.0'
|
54
54
|
|
55
55
|
_default_run_options: &default_run_options
|
56
56
|
options: "--rm"
|
@@ -78,6 +78,46 @@ _default_run_options: &default_run_options
|
|
78
78
|
|
79
79
|
After that you can run `djin {{task_name}}`, like `djin script` or `djin test`
|
80
80
|
|
81
|
+
## Using Environment variables and custom args in djin.yml run tasks
|
82
|
+
|
83
|
+
You can use environment variables using the '{{YOUR_ENV_HERE}}' syntax, like so:
|
84
|
+
|
85
|
+
```yaml
|
86
|
+
djin_version: '0.4.0'
|
87
|
+
|
88
|
+
_default_run_options: &default_run_options
|
89
|
+
options: "--rm"
|
90
|
+
|
91
|
+
"db:migrate":
|
92
|
+
docker-compose:
|
93
|
+
service: app
|
94
|
+
run:
|
95
|
+
commands: ENV={{ENV}} rake db:migrate
|
96
|
+
<<: *default_run_options
|
97
|
+
|
98
|
+
```
|
99
|
+
|
100
|
+
It's also possible to pass custom arguments to the command, wich means is possible to make a djin task act like the command itself:
|
101
|
+
|
102
|
+
```yaml
|
103
|
+
djin_version: '0.4.0'
|
104
|
+
|
105
|
+
_default_run_options: &default_run_options
|
106
|
+
options: "--rm"
|
107
|
+
|
108
|
+
"rubocop":
|
109
|
+
docker-compose:
|
110
|
+
service: app
|
111
|
+
run:
|
112
|
+
commands: rubocop {{args}}
|
113
|
+
<<: *default_run_options
|
114
|
+
|
115
|
+
```
|
116
|
+
|
117
|
+
With that you can pass custom args after `--`, eg: `djin rubocop -- --parallel`, which wil make djin runs `rubocop --parallel` inside the service `app`.
|
118
|
+
|
119
|
+
Under the hood djin uses [Mustache](https://mustache.github.io/), so you can use other features like conditionals: `{{#IS_ENABLE}} Enabled {{/IS_ENABLE}}` (for args use the `args?`, eg: {{#args} {{args}} --and-other-thing{{/args?}}), to see more more options you can access this [Link](https://mustache.github.io/mustache.5.html)
|
120
|
+
|
81
121
|
## Development
|
82
122
|
|
83
123
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
data/Vertofile
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
verto_version '0.8.0'
|
2
|
+
|
3
|
+
config {
|
4
|
+
version.prefix = 'v' # Adds a version_prefix
|
5
|
+
git.pull_before_tag_creation = true
|
6
|
+
git.push_after_tag_creation = true
|
7
|
+
}
|
8
|
+
|
9
|
+
context(branch('master')) {
|
10
|
+
before_command_tag_up {
|
11
|
+
command_options.add(filter: 'release_only')
|
12
|
+
}
|
13
|
+
|
14
|
+
before_tag_creation {
|
15
|
+
version_changes = sh(
|
16
|
+
%q#git log --oneline --decorate | grep -B 100 -m 1 "tag:" | grep "pull request" | awk '{print $1}' | xargs git show --format='%b' | grep -v Approved | grep -v "^$" | grep -E "^[[:space:]]*\[.*\]" | sed 's/^[[:space:]]*\(.*\)/ * \1/'#, output: false
|
17
|
+
).output
|
18
|
+
|
19
|
+
puts "---------------------------"
|
20
|
+
version_changes = "## #{new_version} - #{Time.now.strftime('%d/%m/%Y')}\n#{version_changes}\n"
|
21
|
+
exit unless confirm("Create new Realease?\n" \
|
22
|
+
"---------------------------\n" \
|
23
|
+
"#{version_changes}" \
|
24
|
+
"---------------------------\n"
|
25
|
+
)
|
26
|
+
|
27
|
+
# CHANGELOG
|
28
|
+
file('CHANGELOG.md').prepend(version_changes)
|
29
|
+
git!('add CHANGELOG.md')
|
30
|
+
|
31
|
+
file('lib/djin/version.rb').replace(latest_version.to_s, new_version.to_s)
|
32
|
+
git!('add lib/djin/version.rb')
|
33
|
+
|
34
|
+
file('README.md').replace_all(latest_version.to_s, new_version.to_s)
|
35
|
+
git!('add README.md')
|
36
|
+
|
37
|
+
sh!('bundle install')
|
38
|
+
sh!('rake install')
|
39
|
+
git!('add Gemfile.lock')
|
40
|
+
|
41
|
+
git!('commit -m "Bumps Version"')
|
42
|
+
}
|
43
|
+
}
|
44
|
+
|
data/djin.gemspec
CHANGED
@@ -26,11 +26,13 @@ Gem::Specification.new do |spec|
|
|
26
26
|
spec.require_paths = ["lib"]
|
27
27
|
|
28
28
|
spec.add_dependency "dry-struct", "~> 1.3.0"
|
29
|
-
spec.add_dependency "dry-cli", "~> 0.
|
30
|
-
spec.add_dependency "dry-validation", "~> 1.5.
|
29
|
+
spec.add_dependency "dry-cli", "~> 0.6.0"
|
30
|
+
spec.add_dependency "dry-validation", "~> 1.5.1"
|
31
31
|
spec.add_dependency "vseries", "~> 0.1.0"
|
32
|
+
spec.add_dependency "mustache", "~> 1.1.1"
|
32
33
|
spec.add_development_dependency "bundler", "~> 2.0"
|
33
34
|
spec.add_development_dependency "rake", "~> 13.0"
|
34
35
|
spec.add_development_dependency "rspec", "~> 3.0"
|
36
|
+
spec.add_development_dependency "rubocop"
|
35
37
|
spec.add_development_dependency "byebug"
|
36
38
|
end
|
data/djin.yml
CHANGED
data/exe/djin
CHANGED
data/lib/djin.rb
CHANGED
@@ -5,6 +5,7 @@ require "dry-struct"
|
|
5
5
|
require "dry-validation"
|
6
6
|
require "vseries"
|
7
7
|
require "dry/cli"
|
8
|
+
require "mustache"
|
8
9
|
require "djin/extensions/hash_extensions"
|
9
10
|
require "djin/extensions/custom_predicates"
|
10
11
|
require "djin/entities/types"
|
@@ -17,12 +18,12 @@ require "djin/repositories/task_repository"
|
|
17
18
|
|
18
19
|
module Djin
|
19
20
|
class Error < StandardError; end
|
20
|
-
# Your code goes here...
|
21
21
|
|
22
22
|
def self.load_tasks!(path = Pathname.getwd.join('djin.yml'))
|
23
23
|
abort 'Error: djin.yml not found' unless path.exist?
|
24
24
|
|
25
25
|
djin_file = YAML.safe_load(path.read, [], [], true)
|
26
|
+
|
26
27
|
tasks = Djin::Interpreter.load!(djin_file)
|
27
28
|
|
28
29
|
@task_repository = TaskRepository.new(tasks)
|
data/lib/djin/cli.rb
CHANGED
data/lib/djin/executor.rb
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
module Djin
|
2
2
|
class Executor
|
3
|
-
def initialize(task_repository: Djin.task_repository)
|
3
|
+
def initialize(task_repository: Djin.task_repository, args: [])
|
4
4
|
@task_repository = task_repository
|
5
|
+
@args = args
|
5
6
|
end
|
6
7
|
|
7
8
|
def call(*tasks)
|
@@ -22,7 +23,15 @@ module Djin
|
|
22
23
|
end
|
23
24
|
|
24
25
|
def run(command)
|
25
|
-
|
26
|
+
command_with_args = Mustache.render(command,
|
27
|
+
args: @args.join(' '),
|
28
|
+
args?: @args.any?,
|
29
|
+
**env)
|
30
|
+
system command_with_args
|
31
|
+
end
|
32
|
+
|
33
|
+
def env
|
34
|
+
@env = ENV.to_h.map {|k,v| [k.to_sym, v]}.to_h
|
26
35
|
end
|
27
36
|
end
|
28
37
|
end
|
data/lib/djin/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: djin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Carlos Atkinson
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-06-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dry-struct
|
@@ -30,28 +30,28 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.
|
33
|
+
version: 0.6.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0.
|
40
|
+
version: 0.6.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: dry-validation
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 1.5.
|
47
|
+
version: 1.5.1
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 1.5.
|
54
|
+
version: 1.5.1
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: vseries
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -66,6 +66,20 @@ dependencies:
|
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: 0.1.0
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: mustache
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 1.1.1
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 1.1.1
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
84
|
name: bundler
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -108,6 +122,20 @@ dependencies:
|
|
108
122
|
- - "~>"
|
109
123
|
- !ruby/object:Gem::Version
|
110
124
|
version: '3.0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: rubocop
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
111
139
|
- !ruby/object:Gem::Dependency
|
112
140
|
name: byebug
|
113
141
|
requirement: !ruby/object:Gem::Requirement
|
@@ -141,6 +169,7 @@ files:
|
|
141
169
|
- LICENSE.txt
|
142
170
|
- README.md
|
143
171
|
- Rakefile
|
172
|
+
- Vertofile
|
144
173
|
- bin/console
|
145
174
|
- bin/setup
|
146
175
|
- djin.gemspec
|