fig_rake 0.9.2 → 0.9.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 +4 -4
 - data/lib/fig_rake/cli.rb +1 -1
 - data/lib/fig_rake/command.rb +5 -5
 - data/lib/fig_rake/configuration.rb +46 -16
 - data/lib/fig_rake/mixin.rb +2 -2
 - data/lib/fig_rake/version.rb +1 -1
 - metadata +2 -2
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: a6ef47c17d9a59c98f96866d8f8fc91369281e89
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 9aac41cfabd1428ae42deebddea9314b0b9c165b
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: bc6f2ff4c81db2169b0f836f1b4ddc6a33dff7b9a1bfb3f3c2580ae0f366621afa52dae633725d1887eb1baa6ca09e3e5acf0840bda991f755b27e58c7ee1253
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 106ae7164565dbab78919dafd856c81c56f6f3eb6f92b4fd3e03a57c4ec533498081d119443300091e96133a5afdc57bd2607e1ac16c049378ca724611aa9887
         
     | 
    
        data/lib/fig_rake/cli.rb
    CHANGED
    
    | 
         @@ -7,7 +7,7 @@ module FigRake 
     | 
|
| 
       7 
7 
     | 
    
         
             
                def initialize(command, arguments)
         
     | 
| 
       8 
8 
     | 
    
         
             
                  @options = Configuration.new
         
     | 
| 
       9 
9 
     | 
    
         
             
                  parse_arguments(command, arguments)
         
     | 
| 
       10 
     | 
    
         
            -
                  @command = Command.new(command, @options.container_name, @options.rake_args)
         
     | 
| 
      
 10 
     | 
    
         
            +
                  @command = Command.new(command, @options.container_name, @options.rake_args, @options.docker_command)
         
     | 
| 
       11 
11 
     | 
    
         
             
                end
         
     | 
| 
       12 
12 
     | 
    
         | 
| 
       13 
13 
     | 
    
         
             
                def exec
         
     | 
    
        data/lib/fig_rake/command.rb
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            module FigRake
         
     | 
| 
       2 
2 
     | 
    
         
             
              class Command
         
     | 
| 
       3 
     | 
    
         
            -
                attr_accessor :container_name, :rake_args, :command
         
     | 
| 
      
 3 
     | 
    
         
            +
                attr_accessor :container_name, :rake_args, :command, :docker_command
         
     | 
| 
       4 
4 
     | 
    
         | 
| 
       5 
     | 
    
         
            -
                def initialize(command, container_name, rake_args)
         
     | 
| 
       6 
     | 
    
         
            -
                  @command, @container_name, @rake_args = command, container_name, rake_args
         
     | 
| 
      
 5 
     | 
    
         
            +
                def initialize(command, container_name, rake_args, docker_command)
         
     | 
| 
      
 6 
     | 
    
         
            +
                  @command, @container_name, @rake_args, @docker_command = command, container_name, rake_args, docker_command
         
     | 
| 
       7 
7 
     | 
    
         
             
                end
         
     | 
| 
       8 
8 
     | 
    
         | 
| 
       9 
9 
     | 
    
         
             
                def exec
         
     | 
| 
       10 
     | 
    
         
            -
                  p " 
     | 
| 
       11 
     | 
    
         
            -
                  exit system(" 
     | 
| 
      
 10 
     | 
    
         
            +
                  p "#{docker_command} run --rm --entrypoint=#{command} #{container_name} #{rake_args.join(' ')}"
         
     | 
| 
      
 11 
     | 
    
         
            +
                  exit system("#{docker_command} run --rm --entrypoint=#{command} #{container_name} #{rake_args.join(' ')}")
         
     | 
| 
       12 
12 
     | 
    
         
             
                end
         
     | 
| 
       13 
13 
     | 
    
         
             
              end
         
     | 
| 
       14 
14 
     | 
    
         
             
            end
         
     | 
| 
         @@ -2,35 +2,65 @@ require 'yaml' 
     | 
|
| 
       2 
2 
     | 
    
         | 
| 
       3 
3 
     | 
    
         
             
            module FigRake
         
     | 
| 
       4 
4 
     | 
    
         
             
              class Configuration
         
     | 
| 
       5 
     | 
    
         
            -
                attr_accessor :container_name, :rake_args
         
     | 
| 
      
 5 
     | 
    
         
            +
                attr_accessor :container_name, :rake_args, :docker_command
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
                COMPOSE_FILE = "docker-compose.yml"
         
     | 
| 
      
 8 
     | 
    
         
            +
                FIG_FILE = "fig.yml"
         
     | 
| 
       6 
9 
     | 
    
         | 
| 
       7 
     | 
    
         
            -
                def initialize(name 
     | 
| 
       8 
     | 
    
         
            -
                  @container_name = name  
     | 
| 
      
 10 
     | 
    
         
            +
                def initialize(name: nil, command: nil)
         
     | 
| 
      
 11 
     | 
    
         
            +
                  @container_name = name || name_from_defaults
         
     | 
| 
      
 12 
     | 
    
         
            +
                  @docker_command = command || command_from_defaults
         
     | 
| 
       9 
13 
     | 
    
         
             
                end
         
     | 
| 
       10 
14 
     | 
    
         | 
| 
       11 
15 
     | 
    
         
             
                def name_from_defaults
         
     | 
| 
       12 
     | 
    
         
            -
                  name_from_environment ||
         
     | 
| 
       13 
     | 
    
         
            -
             
     | 
| 
       14 
     | 
    
         
            -
             
     | 
| 
      
 16 
     | 
    
         
            +
                  name_from_environment || name_from_file
         
     | 
| 
      
 17 
     | 
    
         
            +
                end
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
                def command_from_defaults
         
     | 
| 
      
 20 
     | 
    
         
            +
                  command_from_environment || command_from_file
         
     | 
| 
       15 
21 
     | 
    
         
             
                end
         
     | 
| 
       16 
22 
     | 
    
         | 
| 
       17 
23 
     | 
    
         
             
                def name_from_environment
         
     | 
| 
       18 
     | 
    
         
            -
                  ENV[' 
     | 
| 
      
 24 
     | 
    
         
            +
                  ENV['FIG_RAKE_CONTAINER']
         
     | 
| 
      
 25 
     | 
    
         
            +
                end
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
      
 27 
     | 
    
         
            +
                def command_from_environment
         
     | 
| 
      
 28 
     | 
    
         
            +
                  ENV['FIG_RAKE_COMMAND']
         
     | 
| 
       19 
29 
     | 
    
         
             
                end
         
     | 
| 
       20 
30 
     | 
    
         | 
| 
       21 
     | 
    
         
            -
                def  
     | 
| 
       22 
     | 
    
         
            -
                  File. 
     | 
| 
       23 
     | 
    
         
            -
                 
     | 
| 
       24 
     | 
    
         
            -
             
     | 
| 
      
 31 
     | 
    
         
            +
                def compose_file_exists?
         
     | 
| 
      
 32 
     | 
    
         
            +
                  File.exists? COMPOSE_FILE
         
     | 
| 
      
 33 
     | 
    
         
            +
                end
         
     | 
| 
      
 34 
     | 
    
         
            +
             
     | 
| 
      
 35 
     | 
    
         
            +
                def fig_file_exists?
         
     | 
| 
      
 36 
     | 
    
         
            +
                  File.exists? FIG_FILE
         
     | 
| 
      
 37 
     | 
    
         
            +
                end
         
     | 
| 
      
 38 
     | 
    
         
            +
             
     | 
| 
      
 39 
     | 
    
         
            +
                def command_from_file
         
     | 
| 
      
 40 
     | 
    
         
            +
                  case
         
     | 
| 
      
 41 
     | 
    
         
            +
                  when compose_file_exists?
         
     | 
| 
      
 42 
     | 
    
         
            +
                    "docker-compose"
         
     | 
| 
      
 43 
     | 
    
         
            +
                  when fig_file_exists?
         
     | 
| 
      
 44 
     | 
    
         
            +
                    "fig"
         
     | 
| 
      
 45 
     | 
    
         
            +
                  else
         
     | 
| 
      
 46 
     | 
    
         
            +
                    raise "No configuration file found are you in the right Directory?"
         
     | 
| 
      
 47 
     | 
    
         
            +
                  end
         
     | 
| 
       25 
48 
     | 
    
         
             
                end
         
     | 
| 
       26 
49 
     | 
    
         | 
| 
       27 
     | 
    
         
            -
                def  
     | 
| 
       28 
     | 
    
         
            -
                   
     | 
| 
      
 50 
     | 
    
         
            +
                def name_from_file
         
     | 
| 
      
 51 
     | 
    
         
            +
                  file_name = case
         
     | 
| 
      
 52 
     | 
    
         
            +
                              when compose_file_exists?
         
     | 
| 
      
 53 
     | 
    
         
            +
                                COMPOSE_FILE
         
     | 
| 
      
 54 
     | 
    
         
            +
                              when fig_file_exists?
         
     | 
| 
      
 55 
     | 
    
         
            +
                                FIG_FILE
         
     | 
| 
      
 56 
     | 
    
         
            +
                              else
         
     | 
| 
      
 57 
     | 
    
         
            +
                                raise "No configuration file found are you in the right Directory?"
         
     | 
| 
      
 58 
     | 
    
         
            +
                              end
         
     | 
| 
      
 59 
     | 
    
         
            +
                  
         
     | 
| 
      
 60 
     | 
    
         
            +
                  container_config = YAML.load(File.read(file_name)).to_a.select do |(_, opts)|
         
     | 
| 
       29 
61 
     | 
    
         
             
                    opts.has_key?("build")
         
     | 
| 
       30 
62 
     | 
    
         
             
                  end
         
     | 
| 
       31 
63 
     | 
    
         
             
                  container_config.first.first
         
     | 
| 
       32 
     | 
    
         
            -
                rescue Errno::ENOENT
         
     | 
| 
       33 
     | 
    
         
            -
                  nil
         
     | 
| 
       34 
64 
     | 
    
         
             
                end
         
     | 
| 
       35 
     | 
    
         
            -
              end
         
     | 
| 
      
 65 
     | 
    
         
            +
              end 
         
     | 
| 
       36 
66 
     | 
    
         
             
            end
         
     | 
    
        data/lib/fig_rake/mixin.rb
    CHANGED
    
    | 
         @@ -4,8 +4,8 @@ require 'fig_rake/command' 
     | 
|
| 
       4 
4 
     | 
    
         
             
            module FigRake
         
     | 
| 
       5 
5 
     | 
    
         
             
              module Mixin
         
     | 
| 
       6 
6 
     | 
    
         
             
                def run_in_fig(args)
         
     | 
| 
       7 
     | 
    
         
            -
                  configuration = Configuration.new(default_name)
         
     | 
| 
       8 
     | 
    
         
            -
                  Command.new(command, configuration.container_name, args).exec
         
     | 
| 
      
 7 
     | 
    
         
            +
                  configuration = Configuration.new(name: default_name)
         
     | 
| 
      
 8 
     | 
    
         
            +
                  Command.new(command, configuration.container_name, args, configuration.docker_command).exec
         
     | 
| 
       9 
9 
     | 
    
         
             
                end
         
     | 
| 
       10 
10 
     | 
    
         
             
              end
         
     | 
| 
       11 
11 
     | 
    
         
             
            end
         
     | 
    
        data/lib/fig_rake/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: fig_rake
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0.9. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.9.3
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Edward Paget
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2015- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2015-03-23 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: bundler
         
     |