djin 0.11.5 → 0.11.6
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 +4 -4
 - data/CHANGELOG.md +3 -0
 - data/Gemfile.lock +1 -1
 - data/README.md +10 -10
 - data/djin.yml +1 -1
 - data/examples/djin.yml +1 -1
 - data/examples/djin_lib/test.yml +1 -1
 - data/examples/local_tasks/djin.yml +1 -1
 - data/examples/remote_tasks/djin.yml +1 -1
 - data/lib/djin/include_contract.rb +11 -1
 - data/lib/djin/version.rb +1 -1
 - metadata +2 -2
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 73e54a9af2cfce75467f847bac4a279fbf97e502b3a4da93341f81d115fe80ce
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: d81ff6e9205f17290b7abf7b55754caef024bce6655fc0ed612a39c358810c59
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 5266c1fe3fe4ce7c65e33f22f714c46e117722a455a096a3bbab04c99d19e2ed079b9896c4a98551ef115347e81e5e97032289303f045e3693c6e7bd6a0ba056
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 1e12eeb951e19ecf6f1be10ad442979677d638c53139e9ad4b387f6258ee5ea8909c143bd33cf4fe21eca46da02e37c920a75cc5f924e73f964796f69d131483
         
     | 
    
        data/CHANGELOG.md
    CHANGED
    
    
    
        data/Gemfile.lock
    CHANGED
    
    
    
        data/README.md
    CHANGED
    
    | 
         @@ -27,7 +27,7 @@ If you use Rbenv you can install djin only once and create an alias in your .bas 
     | 
|
| 
       27 
27 
     | 
    
         
             
            To use djin first you need to create a djin.yml file:
         
     | 
| 
       28 
28 
     | 
    
         | 
| 
       29 
29 
     | 
    
         
             
            ```yaml
         
     | 
| 
       30 
     | 
    
         
            -
            djin_version: '0.11. 
     | 
| 
      
 30 
     | 
    
         
            +
            djin_version: '0.11.6'
         
     | 
| 
       31 
31 
     | 
    
         | 
| 
       32 
32 
     | 
    
         
             
            tasks:
         
     | 
| 
       33 
33 
     | 
    
         
             
              # With a docker image
         
     | 
| 
         @@ -54,7 +54,7 @@ You can also set task dependencies with depends_on option: 
     | 
|
| 
       54 
54 
     | 
    
         | 
| 
       55 
55 
     | 
    
         | 
| 
       56 
56 
     | 
    
         
             
            ```yaml
         
     | 
| 
       57 
     | 
    
         
            -
            djin_version: '0.11. 
     | 
| 
      
 57 
     | 
    
         
            +
            djin_version: '0.11.6'
         
     | 
| 
       58 
58 
     | 
    
         | 
| 
       59 
59 
     | 
    
         
             
            _default_run_options: &default_run_options
         
     | 
| 
       60 
60 
     | 
    
         
             
              options: "--rm"
         
     | 
| 
         @@ -83,7 +83,7 @@ tasks: 
     | 
|
| 
       83 
83 
     | 
    
         
             
            Or mix local commands and docker/docker-compose commands:
         
     | 
| 
       84 
84 
     | 
    
         | 
| 
       85 
85 
     | 
    
         
             
            ```yaml
         
     | 
| 
       86 
     | 
    
         
            -
            djin_version: '0.11. 
     | 
| 
      
 86 
     | 
    
         
            +
            djin_version: '0.11.6'
         
     | 
| 
       87 
87 
     | 
    
         | 
| 
       88 
88 
     | 
    
         
             
            _default_run_options: &default_run_options
         
     | 
| 
       89 
89 
     | 
    
         
             
              options: "--rm"
         
     | 
| 
         @@ -122,7 +122,7 @@ After that you can run `djin {{task_name}}`, like `djin script` or `djin test` 
     | 
|
| 
       122 
122 
     | 
    
         
             
            You can also use environment variables using the '{{YOUR_ENV_HERE}}' syntax, like so:
         
     | 
| 
       123 
123 
     | 
    
         | 
| 
       124 
124 
     | 
    
         
             
            ```yaml
         
     | 
| 
       125 
     | 
    
         
            -
            djin_version: '0.11. 
     | 
| 
      
 125 
     | 
    
         
            +
            djin_version: '0.11.6'
         
     | 
| 
       126 
126 
     | 
    
         | 
| 
       127 
127 
     | 
    
         
             
            _default_run_options: &default_run_options
         
     | 
| 
       128 
128 
     | 
    
         
             
              options: "--rm"
         
     | 
| 
         @@ -139,7 +139,7 @@ tasks: 
     | 
|
| 
       139 
139 
     | 
    
         | 
| 
       140 
140 
     | 
    
         
             
            Or define some variables to use in multiple locations
         
     | 
| 
       141 
141 
     | 
    
         
             
            ```yaml
         
     | 
| 
       142 
     | 
    
         
            -
            djin_version: '0.11. 
     | 
| 
      
 142 
     | 
    
         
            +
            djin_version: '0.11.6'
         
     | 
| 
       143 
143 
     | 
    
         | 
| 
       144 
144 
     | 
    
         
             
            _default_run_options: &default_run_options
         
     | 
| 
       145 
145 
     | 
    
         
             
              options: "--rm"
         
     | 
| 
         @@ -163,7 +163,7 @@ tasks: 
     | 
|
| 
       163 
163 
     | 
    
         
             
            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:
         
     | 
| 
       164 
164 
     | 
    
         | 
| 
       165 
165 
     | 
    
         
             
            ```yaml
         
     | 
| 
       166 
     | 
    
         
            -
            djin_version: '0.11. 
     | 
| 
      
 166 
     | 
    
         
            +
            djin_version: '0.11.6'
         
     | 
| 
       167 
167 
     | 
    
         | 
| 
       168 
168 
     | 
    
         
             
            _default_run_options: &default_run_options
         
     | 
| 
       169 
169 
     | 
    
         
             
              options: "--rm"
         
     | 
| 
         @@ -189,7 +189,7 @@ Under the hood djin uses [Mustache](https://mustache.github.io/), so you can use 
     | 
|
| 
       189 
189 
     | 
    
         
             
            If you have multiple tasks with similar behavior and with small differences you can use the `include` keyword, so this:
         
     | 
| 
       190 
190 
     | 
    
         | 
| 
       191 
191 
     | 
    
         
             
            ```yaml
         
     | 
| 
       192 
     | 
    
         
            -
            djin_version: '0.11. 
     | 
| 
      
 192 
     | 
    
         
            +
            djin_version: '0.11.6'
         
     | 
| 
       193 
193 
     | 
    
         | 
| 
       194 
194 
     | 
    
         
             
            tasks:
         
     | 
| 
       195 
195 
     | 
    
         
             
              "host1:ssh":
         
     | 
| 
         @@ -228,7 +228,7 @@ can become this: 
     | 
|
| 
       228 
228 
     | 
    
         | 
| 
       229 
229 
     | 
    
         
             
            ```yaml
         
     | 
| 
       230 
230 
     | 
    
         
             
            # djin.yml
         
     | 
| 
       231 
     | 
    
         
            -
            djin_version: '0.11. 
     | 
| 
      
 231 
     | 
    
         
            +
            djin_version: '0.11.6'
         
     | 
| 
       232 
232 
     | 
    
         | 
| 
       233 
233 
     | 
    
         
             
            include:
         
     | 
| 
       234 
234 
     | 
    
         
             
              - file: '.djin/server_tasks.yml'
         
     | 
| 
         @@ -250,7 +250,7 @@ include: 
     | 
|
| 
       250 
250 
     | 
    
         | 
| 
       251 
251 
     | 
    
         
             
            ```yaml
         
     | 
| 
       252 
252 
     | 
    
         
             
            # .djin/server_tasks.yml
         
     | 
| 
       253 
     | 
    
         
            -
            djin_version: '0.11. 
     | 
| 
      
 253 
     | 
    
         
            +
            djin_version: '0.11.6'
         
     | 
| 
       254 
254 
     | 
    
         | 
| 
       255 
255 
     | 
    
         
             
            tasks:
         
     | 
| 
       256 
256 
     | 
    
         
             
              "{{namespace}}:ssh":
         
     | 
| 
         @@ -272,7 +272,7 @@ tasks: 
     | 
|
| 
       272 
272 
     | 
    
         
             
            You can also reuse tasks in some git repository, to do that you need to declare a git source and optionally a version:
         
     | 
| 
       273 
273 
     | 
    
         | 
| 
       274 
274 
     | 
    
         
             
            ```yaml
         
     | 
| 
       275 
     | 
    
         
            -
            djin_version: '0.11. 
     | 
| 
      
 275 
     | 
    
         
            +
            djin_version: '0.11.6'
         
     | 
| 
       276 
276 
     | 
    
         | 
| 
       277 
277 
     | 
    
         
             
            include:
         
     | 
| 
       278 
278 
     | 
    
         
             
              - git: 'https://github.com/catks/djin.git'
         
     | 
    
        data/djin.yml
    CHANGED
    
    
    
        data/examples/djin.yml
    CHANGED
    
    
    
        data/examples/djin_lib/test.yml
    CHANGED
    
    
| 
         @@ -5,6 +5,8 @@ module Djin 
     | 
|
| 
       5 
5 
     | 
    
         
             
                using Djin::ObjectExtensions
         
     | 
| 
       6 
6 
     | 
    
         | 
| 
       7 
7 
     | 
    
         
             
                GIT_URI_REGEXP = Regexp.new('(\w+://)(.+@)*([\w\d\.]+)(:[\d]+){0,1}/*(.*)')
         
     | 
| 
      
 8 
     | 
    
         
            +
                GIT_SSH_REGEXP = Regexp.new('(.+@)+([\w\d\.]+):(.*)')
         
     | 
| 
      
 9 
     | 
    
         
            +
                GIT_FILE_REGEXP = Regexp.new('file://(.*)')
         
     | 
| 
       8 
10 
     | 
    
         | 
| 
       9 
11 
     | 
    
         
             
                ContextSchema = Dry::Schema.Params do
         
     | 
| 
       10 
12 
     | 
    
         
             
                  optional(:variables).filled(:hash)
         
     | 
| 
         @@ -21,9 +23,17 @@ module Djin 
     | 
|
| 
       21 
23 
     | 
    
         
             
                end
         
     | 
| 
       22 
24 
     | 
    
         | 
| 
       23 
25 
     | 
    
         
             
                rule(:git) do
         
     | 
| 
       24 
     | 
    
         
            -
                  key.failure("Invalid git uri in: #{value}") if value.present? && ! 
     | 
| 
      
 26 
     | 
    
         
            +
                  key.failure("Invalid git uri in: #{value}") if value.present? && !valid_git_repository_path?(value)
         
     | 
| 
       25 
27 
     | 
    
         
             
                end
         
     | 
| 
       26 
28 
     | 
    
         | 
| 
       27 
29 
     | 
    
         
             
                # TODO: Add more validations to file and to restricted unespected keys
         
     | 
| 
      
 30 
     | 
    
         
            +
                #
         
     | 
| 
      
 31 
     | 
    
         
            +
                private
         
     | 
| 
      
 32 
     | 
    
         
            +
             
     | 
| 
      
 33 
     | 
    
         
            +
                def valid_git_repository_path?(path)
         
     | 
| 
      
 34 
     | 
    
         
            +
                  [GIT_URI_REGEXP,
         
     | 
| 
      
 35 
     | 
    
         
            +
                   GIT_SSH_REGEXP,
         
     | 
| 
      
 36 
     | 
    
         
            +
                   GIT_FILE_REGEXP].any? { |regexp| regexp.match?(path) }
         
     | 
| 
      
 37 
     | 
    
         
            +
                end
         
     | 
| 
       28 
38 
     | 
    
         
             
              end
         
     | 
| 
       29 
39 
     | 
    
         
             
            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.11. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.11.6
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Carlos Atkinson
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: exe
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2021-02- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2021-02-27 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: dry-cli
         
     |