Sha256: 723a433909e4397edec9c7c7c4187f486d6ecaad9f4acc7011802fb888924bc4

Contents?: true

Size: 1.41 KB

Versions: 60

Compression:

Stored size: 1.41 KB

Contents

require 'commands/meta/command'


module Nutella
  class Runs < Command
    @description = 'Displays a list of runs for the current application or all applications'
  
    def run(args=nil)

      # If invoked with "all" it will show all the runs under this instance of nutella
      if args[0]=='--all' || args[0]=='-a'
        display_all_runs
      else
        # If the current directory is not a nutella application, return
        unless Nutella.current_app.exist?
          console.warn 'The current directory is not a nutella application'
          return
        end
        # Display list of runs for current nutella application
        display_app_runs
      end
    end
    
    
    private 
    
    
    def display_all_runs
      if Nutella.runlist.empty?
        console.info 'You are not running any nutella apps'
      else
        console.info 'Currently running:'
        Nutella.runlist.all_runs.each do |app_id, _|
          console.info "#{app_id}:"
          Nutella.runlist.runs_for_app(app_id).each do |run_id|
            console.info "  #{run_id}"
          end
        end
      end
    end
    
    def display_app_runs
      app_id = Nutella.current_app.config['name']
      app_runs = Nutella.runlist.runs_for_app app_id
      console.info "Currently running #{app_runs.length} instances of app '#{app_id}':"
      app_runs.each do |run_id|
        console.info "  #{run_id}"
      end
    end
    
    
  end
end

Version data entries

60 entries across 60 versions & 1 rubygems

Version Path
nutella_framework-0.9.2 lib/commands/runs.rb
nutella_framework-0.9.1 lib/commands/runs.rb
nutella_framework-0.9.0 lib/commands/runs.rb
nutella_framework-0.8.0 lib/commands/runs.rb
nutella_framework-0.7.3 lib/commands/runs.rb
nutella_framework-0.7.2 lib/commands/runs.rb
nutella_framework-0.7.1 lib/commands/runs.rb
nutella_framework-0.7.0 lib/commands/runs.rb
nutella_framework-0.6.21 lib/commands/runs.rb
nutella_framework-0.6.20 lib/commands/runs.rb
nutella_framework-0.6.19 lib/commands/runs.rb
nutella_framework-0.6.18 lib/commands/runs.rb
nutella_framework-0.6.17 lib/commands/runs.rb
nutella_framework-0.6.16 lib/commands/runs.rb
nutella_framework-0.6.15 lib/commands/runs.rb
nutella_framework-0.6.13 lib/commands/runs.rb
nutella_framework-0.6.12 lib/commands/runs.rb
nutella_framework-0.6.11 lib/commands/runs.rb
nutella_framework-0.6.10 lib/commands/runs.rb
nutella_framework-0.6.9 lib/commands/runs.rb