djin 0.4.0 → 0.8.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: 395a6c76f1aac739197b1721dfedca93dfffcfcf456d3fc748fa16f024fb5a94
4
- data.tar.gz: c2915512107075ee0fb3bafbfe50033925410241fef29dd54db747a2d0686328
3
+ metadata.gz: 558aca989aad2d1cfd7b19768a7a5d6fd2f660afb5135fb9ca3ae03eacb233b4
4
+ data.tar.gz: f2e5c3861c6db601b77bc04321386cb2c22ec049d315781966830ba8a5f6e8af
5
5
  SHA512:
6
- metadata.gz: 802cfbb81399c9ec9494b98036c7bd5932e735eb028b44ff84abc1ff0f2ff7930fe4d5a2d9b2bdae2b493684289e0e1d8631e570c942c71351321faa641bac85
7
- data.tar.gz: 3b895f090fb9c73aac047c234a13191702393cf7fdff8c6b9eb0437daed931e7ae71ba0d6c8113d45b84d6424897309c66f310bfd470f58c955c1b508aa771d9
6
+ metadata.gz: a898ea486006d81980a4e963a1e7b2d31f40c5bec00d9b5948f4b32d0be5c222b61525c90fd214523cd482aadeab88e3927cb3a3697f7fc86b8180901e015543
7
+ data.tar.gz: 3d6b0a29b1faa6a3bffb0fa5076ee88083229cbb36f77f2166e44bc19ddd84b73bd6b254578da2c721e1c08ffc7e9583f1325bdd73acc87511ceec47b3f0e512
@@ -18,3 +18,17 @@ jobs:
18
18
  gem install bundler
19
19
  bundle install --jobs 4 --retry 3
20
20
  bundle exec rake
21
+
22
+ lint:
23
+ runs-on: ubuntu-16.04
24
+ name: Lint
25
+ steps:
26
+ - uses: actions/checkout@v2
27
+ - uses: actions/setup-ruby@v1
28
+ with:
29
+ ruby-version: '2.6'
30
+ - run: |
31
+ gem install bundler
32
+ bundle install --jobs 4 --retry 3
33
+ bundle exec rubocop
34
+
@@ -0,0 +1,8 @@
1
+ inherit_from: .rubocop_todo.yml
2
+
3
+ Style/Documentation:
4
+ Enabled: false
5
+
6
+ Metrics/BlockLength:
7
+ Exclude:
8
+ - spec/**/*
@@ -0,0 +1,17 @@
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config`
3
+ # on 2020-07-14 01:12:35 UTC using RuboCop version 0.86.0.
4
+ # The point is for the user to remove these configuration records
5
+ # one by one as the offenses are removed from the code base.
6
+ # Note that changes in the inspected code, or installation of new
7
+ # versions of RuboCop, may require this file to be generated again.
8
+
9
+ # Offense count: 2
10
+ # Configuration parameters: IgnoredMethods.
11
+ Metrics/AbcSize:
12
+ Max: 21
13
+
14
+ # Offense count: 2
15
+ # Configuration parameters: CountComments, ExcludedMethods.
16
+ Metrics/MethodLength:
17
+ Max: 19
@@ -1,3 +1,19 @@
1
+ ## 0.8.0 - 31/08/2020
2
+ * [FEATURE] Adds aliases option
3
+
4
+ ## 0.7.0 - 20/08/2020
5
+ * [FEATURE] Adds description option
6
+
7
+ ## 0.6.1 - 11/08/2020
8
+ * [TECH] Better Error Handling
9
+
10
+ ## 0.6.0 - 22/07/2020
11
+ * [FEATURE] Djin Variables
12
+
13
+ ## 0.5.0 - 13/07/2020
14
+ * [FEATURE] Adds local command task
15
+ * [FEATURE] Template Args for entire djin.yml
16
+
1
17
  ## 0.4.0 - 25/06/2020
2
18
  * [FEATURE] Adds Custom Args and Environment support in djin.yml
3
19
 
data/Gemfile CHANGED
@@ -1,4 +1,6 @@
1
- source "https://rubygems.org"
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
2
4
 
3
5
  # Specify your gem's dependencies in djin.gemspec
4
6
  gemspec
@@ -1,8 +1,9 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- djin (0.4.0)
4
+ djin (0.8.0)
5
5
  dry-cli (~> 0.6.0)
6
+ dry-equalizer (~> 0.3.0)
6
7
  dry-struct (~> 1.3.0)
7
8
  dry-validation (~> 1.5.1)
8
9
  mustache (~> 1.1.1)
@@ -13,7 +14,7 @@ GEM
13
14
  specs:
14
15
  ast (2.4.1)
15
16
  byebug (11.1.1)
16
- concurrent-ruby (1.1.6)
17
+ concurrent-ruby (1.1.7)
17
18
  diff-lcs (1.3)
18
19
  dry-cli (0.6.0)
19
20
  concurrent-ruby (~> 1.0)
@@ -29,11 +30,11 @@ GEM
29
30
  dry-equalizer (0.3.0)
30
31
  dry-inflector (0.2.0)
31
32
  dry-initializer (3.0.3)
32
- dry-logic (1.0.6)
33
+ dry-logic (1.0.7)
33
34
  concurrent-ruby (~> 1.0)
34
35
  dry-core (~> 0.2)
35
36
  dry-equalizer (~> 0.2)
36
- dry-schema (1.5.1)
37
+ dry-schema (1.5.3)
37
38
  concurrent-ruby (~> 1.0)
38
39
  dry-configurable (~> 0.8, >= 0.8.3)
39
40
  dry-core (~> 0.4)
@@ -53,7 +54,7 @@ GEM
53
54
  dry-equalizer (~> 0.3)
54
55
  dry-inflector (~> 0.1, >= 0.1.2)
55
56
  dry-logic (~> 1.0, >= 1.0.2)
56
- dry-validation (1.5.1)
57
+ dry-validation (1.5.4)
57
58
  concurrent-ruby (~> 1.0)
58
59
  dry-container (~> 0.7, >= 0.7.1)
59
60
  dry-core (~> 0.4)
data/README.md CHANGED
@@ -1,6 +1,7 @@
1
1
  # Djin
2
2
 
3
3
  ![](https://github.com/catks/djin/workflows/Ruby/badge.svg?branch=master)
4
+ [![Maintainability](https://api.codeclimate.com/v1/badges/824a2e78399813543212/maintainability)](https://codeclimate.com/github/catks/djin/maintainability)
4
5
 
5
6
  Djin is a make-like utility for docker containers
6
7
 
@@ -25,104 +26,168 @@ If you use Rbenv you can install djin only once and create a alias in your .basr
25
26
  To use djin first you need to create a djin.yml file:
26
27
 
27
28
  ```yaml
28
- djin_version: '0.4.0'
29
-
30
- # With a docker image
31
- script:
32
- docker:
33
- image: "ruby:2.6"
34
- run:
35
- commands:
36
- - "ruby /scripts/my_ruby_script.rb"
37
- options: "--rm -v $(pwd)/my_ruby_script.rb:/scripts/my_ruby_script.rb"
38
-
39
- # Using a docker-compose service
40
- test:
41
- docker-compose:
42
- service: app
43
- run:
44
- commands: rspec
45
- options: "--rm"
46
-
29
+ djin_version: '0.8.0'
30
+
31
+ tasks:
32
+ # With a docker image
33
+ script:
34
+ docker:
35
+ image: "ruby:2.6"
36
+ run:
37
+ commands:
38
+ - "ruby /scripts/my_ruby_script.rb"
39
+ options: "--rm -v $(pwd)/my_ruby_script.rb:/scripts/my_ruby_script.rb"
40
+
41
+ # Using a docker-compose service
42
+ test:
43
+ docker-compose:
44
+ service: app
45
+ run:
46
+ commands: rspec
47
+ options: "--rm"
48
+ aliases: # Optional Array of strings
49
+ - rspec
47
50
  ```
48
51
 
49
52
  You can also set task dependencies with depends_on option:
50
53
 
51
54
 
52
55
  ```yaml
53
- djin_version: '0.4.0'
56
+ djin_version: '0.8.0'
54
57
 
55
58
  _default_run_options: &default_run_options
56
59
  options: "--rm"
57
60
 
58
- "db:create":
59
- docker-compose:
60
- service: app
61
- run:
62
- commands: rake db:create
63
- <<: *default_run_options
64
-
65
- "db:migrate":
66
- docker-compose:
67
- service: app
68
- run:
69
- commands: rake db:migrate
70
- <<: *default_run_options
71
-
72
- "db:setup":
73
- depends_on:
74
- - "db:create"
75
- - "db:migrate"
61
+ tasks:
62
+ "db:create":
63
+ docker-compose:
64
+ service: app
65
+ run:
66
+ commands: rake db:create
67
+ <<: *default_run_options
68
+
69
+ "db:migrate":
70
+ docker-compose:
71
+ service: app
72
+ run:
73
+ commands: rake db:migrate
74
+ <<: *default_run_options
75
+
76
+ "db:setup":
77
+ depends_on:
78
+ - "db:create"
79
+ - "db:migrate"
80
+ ```
81
+
82
+ Or mix local commands and docker/docker-compose commands:
83
+
84
+ ```yaml
85
+ djin_version: '0.8.0'
76
86
 
87
+ _default_run_options: &default_run_options
88
+ options: "--rm"
89
+
90
+ tasks:
91
+ "db:create":
92
+ docker-compose:
93
+ service: app
94
+ run:
95
+ commands: rake db:create
96
+ <<: *default_run_options
97
+
98
+ "db:migrate":
99
+ docker-compose:
100
+ service: app
101
+ run:
102
+ commands: rake db:migrate
103
+ <<: *default_run_options
104
+
105
+ "setup:copy_samples":
106
+ local:
107
+ run:
108
+ - cp config/database.yml.sample config/database.yml
109
+
110
+ "setup":
111
+ depends_on:
112
+ - "setup:copy_samples"
113
+ - "db:create"
114
+ - "db:migrate"
77
115
  ```
78
116
 
79
117
  After that you can run `djin {{task_name}}`, like `djin script` or `djin test`
80
118
 
81
- ## Using Environment variables and custom args in djin.yml run tasks
119
+ ## Using Environment variables, custom variables and custom args in djin.yml tasks
82
120
 
83
- You can use environment variables using the '{{YOUR_ENV_HERE}}' syntax, like so:
121
+ You can also use environment variables using the '{{YOUR_ENV_HERE}}' syntax, like so:
84
122
 
85
123
  ```yaml
86
- djin_version: '0.4.0'
124
+ djin_version: '0.8.0'
87
125
 
88
126
  _default_run_options: &default_run_options
89
127
  options: "--rm"
90
128
 
91
- "db:migrate":
92
- docker-compose:
93
- service: app
94
- run:
95
- commands: ENV={{ENV}} rake db:migrate
96
- <<: *default_run_options
129
+ tasks:
130
+ "db:migrate":
131
+ docker-compose:
132
+ service: app
133
+ run:
134
+ commands: ENV={{ENV}} rake db:migrate
135
+ <<: *default_run_options
136
+
137
+ ```
138
+
139
+ Or define some variables to use in multiple locations
140
+ ```yaml
141
+ djin_version: '0.8.0'
142
+
143
+ _default_run_options: &default_run_options
144
+ options: "--rm"
145
+
146
+ variables:
147
+ my_ssh_user: user
148
+ some_host: test.local
149
+
150
+ tasks:
151
+ "some_host:ssh":
152
+ local:
153
+ run:
154
+ - ssh {{my_ssh_user}}@{{some_host}}
97
155
 
156
+ "some_host:logs":
157
+ local:
158
+ run:
159
+ - ssh -t {{my_ssh_user}}@{{some_host}} 'tail -f /var/log/syslog'
98
160
  ```
99
161
 
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:
162
+ It's also possible to pass custom arguments to the command, which means is possible to make a djin task act like the command itself:
101
163
 
102
164
  ```yaml
103
- djin_version: '0.4.0'
165
+ djin_version: '0.8.0'
104
166
 
105
167
  _default_run_options: &default_run_options
106
168
  options: "--rm"
107
169
 
108
- "rubocop":
109
- docker-compose:
110
- service: app
111
- run:
112
- commands: rubocop {{args}}
113
- <<: *default_run_options
170
+ tasks:
171
+ "rubocop":
172
+ docker-compose:
173
+ service: app
174
+ run:
175
+ commands: rubocop {{args}}
176
+ <<: *default_run_options
177
+ aliases:
178
+ - lint
114
179
 
115
180
  ```
116
181
 
117
182
  With that you can pass custom args after `--`, eg: `djin rubocop -- --parallel`, which wil make djin runs `rubocop --parallel` inside the service `app`.
118
183
 
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)
184
+ 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
185
 
121
186
  ## Development
122
187
 
123
188
  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.
124
189
 
125
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
190
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, run `djin release -- {{increment_option}}` (where {{incremment_option}} can be `--patch`, `--minor` or `major`), which will change version, update the CHANGELOG.md, create a new commit, create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
126
191
 
127
192
  ## TODO:
128
193
 
data/Rakefile CHANGED
@@ -1,10 +1,12 @@
1
- require "bundler/gem_tasks"
2
- require "rspec/core/rake_task"
3
- require_relative "lib/djin"
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
4
+ require 'rspec/core/rake_task'
5
+ require_relative 'lib/djin'
4
6
 
5
7
  RSpec::Core::RakeTask.new(:spec)
6
8
 
7
- task :default => :spec
9
+ task default: :spec
8
10
 
9
11
  desc 'Djin REPL'
10
12
  task :console do
data/Vertofile CHANGED
@@ -29,10 +29,11 @@ context(branch('master')) {
29
29
  git!('add CHANGELOG.md')
30
30
 
31
31
  file('lib/djin/version.rb').replace(latest_version.to_s, new_version.to_s)
32
- git!('add lib/djin/version.rb')
33
-
32
+ file('djin.yml').replace(latest_version.to_s, new_version.to_s)
33
+ file('examples/djin.yml').replace(latest_version.to_s, new_version.to_s)
34
34
  file('README.md').replace_all(latest_version.to_s, new_version.to_s)
35
- git!('add README.md')
35
+
36
+ git!('add lib/djin/version.rb djin.yml examples/djin.yml README.md')
36
37
 
37
38
  sh!('bundle install')
38
39
  sh!('rake install')
@@ -1,7 +1,8 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
- require "bundler/setup"
4
- require "djin"
4
+ require 'bundler/setup'
5
+ require 'djin'
5
6
 
6
7
  # You can add fixtures and/or initialization code here to make experimenting
7
8
  # with your gem easier. You can also use a different console, if you like.
@@ -10,5 +11,5 @@ require "djin"
10
11
  # require "pry"
11
12
  # Pry.start
12
13
 
13
- require "irb"
14
+ require 'irb'
14
15
  IRB.start(__FILE__)
@@ -1,38 +1,41 @@
1
- lib = File.expand_path("lib", __dir__)
1
+ # frozen_string_literal: true
2
+
3
+ lib = File.expand_path('lib', __dir__)
2
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
- require "djin/version"
5
+ require 'djin/version'
4
6
 
5
7
  Gem::Specification.new do |spec|
6
- spec.name = "djin"
8
+ spec.name = 'djin'
7
9
  spec.version = Djin::VERSION
8
- spec.authors = ["Carlos Atkinson"]
9
- spec.email = ["carlos.atks@gmail.com"]
10
+ spec.authors = ['Carlos Atkinson']
11
+ spec.email = ['carlos.atks@gmail.com']
10
12
 
11
- spec.summary = %q{djin is a make-like utility for docker containers}
12
- spec.homepage = "https://github.com/catks/djin"
13
- spec.license = "MIT"
13
+ spec.summary = 'djin is a make-like utility for docker containers'
14
+ spec.homepage = 'https://github.com/catks/djin'
15
+ spec.license = 'MIT'
14
16
 
15
17
  # spec.metadata["homepage_uri"] = spec.homepage
16
- #spec.metadata["source_code_uri"] = "TODO: Put your gem's public repo URL here."
17
- #spec.metadata["changelog_uri"] = "TODO: Put your gem's CHANGELOG.md URL here."
18
+ # spec.metadata["source_code_uri"] = "TODO: Put your gem's public repo URL here."
19
+ # spec.metadata["changelog_uri"] = "TODO: Put your gem's CHANGELOG.md URL here."
18
20
 
19
21
  # Specify which files should be added to the gem when it is released.
20
22
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
21
- spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
23
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
22
24
  `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
23
25
  end
24
- spec.bindir = "exe"
26
+ spec.bindir = 'exe'
25
27
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
26
- spec.require_paths = ["lib"]
28
+ spec.require_paths = ['lib']
27
29
 
28
- spec.add_dependency "dry-struct", "~> 1.3.0"
29
- spec.add_dependency "dry-cli", "~> 0.6.0"
30
- spec.add_dependency "dry-validation", "~> 1.5.1"
31
- spec.add_dependency "vseries", "~> 0.1.0"
32
- spec.add_dependency "mustache", "~> 1.1.1"
33
- spec.add_development_dependency "bundler", "~> 2.0"
34
- spec.add_development_dependency "rake", "~> 13.0"
35
- spec.add_development_dependency "rspec", "~> 3.0"
36
- spec.add_development_dependency "rubocop"
37
- spec.add_development_dependency "byebug"
30
+ spec.add_dependency 'dry-cli', '~> 0.6.0'
31
+ spec.add_dependency 'dry-equalizer', '~> 0.3.0'
32
+ spec.add_dependency 'dry-struct', '~> 1.3.0'
33
+ spec.add_dependency 'dry-validation', '~> 1.5.1'
34
+ spec.add_dependency 'mustache', '~> 1.1.1'
35
+ spec.add_dependency 'vseries', '~> 0.1.0'
36
+ spec.add_development_dependency 'bundler', '~> 2.0'
37
+ spec.add_development_dependency 'byebug'
38
+ spec.add_development_dependency 'rake', '~> 13.0'
39
+ spec.add_development_dependency 'rspec', '~> 3.0'
40
+ spec.add_development_dependency 'rubocop'
38
41
  end