rake-subproject 0.0.5 → 0.0.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 +8 -8
- data/lib/rake/subproject.rb +1 -0
- data/lib/rake/subproject/client/session_manager.rb +1 -1
- data/lib/rake/subproject/error.rb +4 -0
- data/lib/rake/subproject/server/session_manager.rb +1 -1
- data/lib/rake/subproject/server/task.rb +6 -0
- data/lib/rake/subproject/task_manager.rb +5 -1
- data/lib/rake/subproject/task_runner.rb +26 -6
- data/lib/rake/subproject/version.rb +1 -1
- metadata +3 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,15 +1,15 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            !binary "U0hBMQ==":
         | 
| 3 3 | 
             
              metadata.gz: !binary |-
         | 
| 4 | 
            -
                 | 
| 4 | 
            +
                ZjU1ZjYyZDg0ZGQzODYwZmQxNTAyMTMxN2RmZWRiYTdlYjg4NTAzYw==
         | 
| 5 5 | 
             
              data.tar.gz: !binary |-
         | 
| 6 | 
            -
                 | 
| 6 | 
            +
                ZTg4OTI4NTQzNzE5MzNhOGU4YzljM2YxZTExOTY2NzQwOWJlMjJiNw==
         | 
| 7 7 | 
             
            SHA512:
         | 
| 8 8 | 
             
              metadata.gz: !binary |-
         | 
| 9 | 
            -
                 | 
| 10 | 
            -
                 | 
| 11 | 
            -
                 | 
| 9 | 
            +
                OGYyYmExYWFiYjQ5M2JiMDEyYzRkZTU3ODEwZjhjODE4YTBhYTMwNWU4M2Mx
         | 
| 10 | 
            +
                NmZmMjRmYmUzNGFkZTA0NjgzZjhlMmY0M2Y4ZmEyYjYxMDYwM2JiOWJiYmU1
         | 
| 11 | 
            +
                NTI5N2FlNGRlNjZiYjY3ODk5Mzc0ODNiZjI0OGIyZjFkMWFmNzA=
         | 
| 12 12 | 
             
              data.tar.gz: !binary |-
         | 
| 13 | 
            -
                 | 
| 14 | 
            -
                 | 
| 15 | 
            -
                 | 
| 13 | 
            +
                ZTNlZjVlNmYxZmMxMzkwYTZjY2E5YzVmMzJkYjY2MWM1ZDU2MWU3ZTQ5ZjU1
         | 
| 14 | 
            +
                MmMzYjZjNjM0NWQ1MTFlNzgwMzQ5YzU2NzVmYWNmYzdlZjBjZGRiNGM5NjA2
         | 
| 15 | 
            +
                NjU3ZTA2ZjVkYzkzNTgyZmExOGYyMmM2ODlmOGQwNDZhMjI0MmI=
         | 
    
        data/lib/rake/subproject.rb
    CHANGED
    
    | @@ -10,5 +10,6 @@ require 'rake/subproject/client/session' | |
| 10 10 | 
             
            require 'rake/subproject/client/port'
         | 
| 11 11 | 
             
            require 'rake/subproject/task_runner'
         | 
| 12 12 | 
             
            require 'rake/subproject/task_manager'
         | 
| 13 | 
            +
            require 'rake/subproject/error'
         | 
| 13 14 | 
             
            require 'rake/subproject/ext/application'
         | 
| 14 15 | 
             
            require 'rake/subproject/ext/dsl'
         | 
| @@ -9,6 +9,12 @@ Rake::Task.define_task(:'subproject:server:start', [:fd]) do |t, args| | |
| 9 9 | 
             
              include Rake::Subproject::Server
         | 
| 10 10 | 
             
              Port.open(args[:fd].to_i, 'r+') do |port|
         | 
| 11 11 |  | 
| 12 | 
            +
                ['TERM', 'KILL', 'INT'].each do |sig|
         | 
| 13 | 
            +
                  Signal.trap(sig) do
         | 
| 14 | 
            +
                    port.close ; exit
         | 
| 15 | 
            +
                  end
         | 
| 16 | 
            +
                end
         | 
| 17 | 
            +
                
         | 
| 12 18 | 
             
                def log(message)
         | 
| 13 19 | 
             
                  $stderr.print "#{message}\n" if false
         | 
| 14 20 | 
             
                end
         | 
| @@ -2,8 +2,12 @@ module Rake::Subproject | |
| 2 2 | 
             
              module TaskManager
         | 
| 3 3 |  | 
| 4 4 | 
             
                def define_subproject(path)
         | 
| 5 | 
            +
                  raise "Subproject path '#{path}' does not exist" unless File.exist?(path)
         | 
| 6 | 
            +
             | 
| 7 | 
            +
                  directory = File.directory?(path) ? path : File.dirname(path)
         | 
| 8 | 
            +
             | 
| 5 9 | 
             
                  return if runners[path]
         | 
| 6 | 
            -
                  runners[ | 
| 10 | 
            +
                  runners[directory] = Rake::Subproject::TaskRunner.new(path)
         | 
| 7 11 | 
             
                end
         | 
| 8 12 |  | 
| 9 13 | 
             
                def [](task_name, scopes=nil)
         | 
| @@ -6,8 +6,15 @@ module Rake::Subproject | |
| 6 6 | 
             
                include FileUtils
         | 
| 7 7 | 
             
                include Rake::Subproject::Client
         | 
| 8 8 |  | 
| 9 | 
            -
                def initialize( | 
| 10 | 
            -
                   | 
| 9 | 
            +
                def initialize(path)
         | 
| 10 | 
            +
                  raise "Subproject path '#{path}' does not exist" unless File.exist?(path)
         | 
| 11 | 
            +
                  if File.directory?(path)
         | 
| 12 | 
            +
                    @directory = path
         | 
| 13 | 
            +
                  else
         | 
| 14 | 
            +
                    rakefile = path
         | 
| 15 | 
            +
                    @directory = File.dirname(path)
         | 
| 16 | 
            +
                  end
         | 
| 17 | 
            +
             | 
| 11 18 | 
             
                  @@rake_env ||= ARGV.each_with_object({}) do |arg, hash|
         | 
| 12 19 | 
             
                    hash[$1] = $2 if arg =~ /^(\w+)=(.*)$/m
         | 
| 13 20 | 
             
                  end
         | 
| @@ -16,14 +23,14 @@ module Rake::Subproject | |
| 16 23 | 
             
                  port = Port.new(parent_socket, "client")
         | 
| 17 24 | 
             
                  @session_manager = SessionManager.new(port)
         | 
| 18 25 | 
             
                  thread = Thread.new { @session_manager.start } 
         | 
| 26 | 
            +
                  
         | 
| 19 27 | 
             
                  at_exit do
         | 
| 20 28 | 
             
                    @session_manager.close
         | 
| 21 29 | 
             
                    port.close
         | 
| 22 30 | 
             
                    thread.join
         | 
| 23 31 | 
             
                  end
         | 
| 24 32 |  | 
| 25 | 
            -
                   | 
| 26 | 
            -
                    @server_pid = Process.spawn(
         | 
| 33 | 
            +
                  rake_args = [
         | 
| 27 34 | 
             
                      "bundle", "exec", "--keep-file-descriptors",
         | 
| 28 35 | 
             
                      "rake",
         | 
| 29 36 | 
             
                        # Do not search parent directories for the Rakefile.
         | 
| @@ -32,8 +39,21 @@ module Rake::Subproject | |
| 32 39 | 
             
                      "--libdir", File.dirname(__FILE__)+ "/server",
         | 
| 33 40 | 
             
                        # Require MODULE before executing rakefile.
         | 
| 34 41 | 
             
                      "-r", "task", "subproject:server:start[#{child_socket.fileno}]",
         | 
| 35 | 
            -
                       | 
| 42 | 
            +
                      
         | 
| 43 | 
            +
                  ]
         | 
| 44 | 
            +
                  rake_args = rake_args + ['--rakefile', File.basename(rakefile)] unless rakefile.nil?
         | 
| 45 | 
            +
                  rake_args << {child_socket.fileno => child_socket, :chdir => @directory}
         | 
| 46 | 
            +
             | 
| 47 | 
            +
                  Bundler.with_clean_env do
         | 
| 48 | 
            +
                    @server_pid = Process.spawn(*rake_args)
         | 
| 36 49 | 
             
                  end
         | 
| 50 | 
            +
             | 
| 51 | 
            +
                  ['TERM', 'KILL', 'INT'].each do |sig|
         | 
| 52 | 
            +
                    Signal.trap(sig) do
         | 
| 53 | 
            +
                      Process.kill(sig, @server_pid)
         | 
| 54 | 
            +
                    end
         | 
| 55 | 
            +
                  end
         | 
| 56 | 
            +
                  
         | 
| 37 57 | 
             
                  child_socket.close
         | 
| 38 58 | 
             
                end
         | 
| 39 59 |  | 
| @@ -43,7 +63,7 @@ module Rake::Subproject | |
| 43 63 | 
             
                    session.write(message: 'invoke_task', name: name, args: {hash: args.to_hash, array: args.to_a})
         | 
| 44 64 | 
             
                    response = session.read
         | 
| 45 65 | 
             
                    if (response['message'] == 'task_failed')
         | 
| 46 | 
            -
                      e = :: | 
| 66 | 
            +
                      e = ::Rake::Subproject::Error.new(response['exception']['message'])
         | 
| 47 67 | 
             
                      e.set_backtrace(response['exception']['backtrace'] + Thread.current.backtrace)
         | 
| 48 68 | 
             
                      raise e
         | 
| 49 69 | 
             
                    end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: rake-subproject
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.0. | 
| 4 | 
            +
              version: 0.0.6
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Michael Bishop
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2014-10- | 
| 11 | 
            +
            date: 2014-10-06 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: rake
         | 
| @@ -68,6 +68,7 @@ files: | |
| 68 68 | 
             
            - lib/rake/subproject/client/port.rb
         | 
| 69 69 | 
             
            - lib/rake/subproject/client/session.rb
         | 
| 70 70 | 
             
            - lib/rake/subproject/client/session_manager.rb
         | 
| 71 | 
            +
            - lib/rake/subproject/error.rb
         | 
| 71 72 | 
             
            - lib/rake/subproject/ext/application.rb
         | 
| 72 73 | 
             
            - lib/rake/subproject/ext/dsl.rb
         | 
| 73 74 | 
             
            - lib/rake/subproject/server/port.rb
         |