Class: Fanforce::CLI::Apps
- Inherits:
-
Object
- Object
- Fanforce::CLI::Apps
- Extended by:
- Forwardable
- Includes:
- Singleton
- Defined in:
- lib/fanforce/cli/apps.rb
Instance Method Summary collapse
Instance Method Details
#count ⇒ Object
32 33 34 |
# File 'lib/fanforce/cli/apps.rb', line 32 def count dir_names.size end |
#dir_names ⇒ Object
6 7 8 9 10 11 12 13 14 |
# File 'lib/fanforce/cli/apps.rb', line 6 def dir_names @dirs ||= Dir.chdir($HomeDir) do Dir['*/'].inject([]) do |dirs, d| d = d.gsub('/', '') next dirs if d !~ /^(app-[a-z0-9-]+)\/?$/ next dirs << d if $Filter.blank? next dirs << d if $Filter[:dir_name].present? and $Filter[:dir_name] == d next dirs end end end |
#dirs ⇒ Object
16 17 18 19 20 |
# File 'lib/fanforce/cli/apps.rb', line 16 def dirs dir_names.inject([]) do |result, d| result << "#{$HomeDir}/#{d}" end end |
#each(&block) ⇒ Object
22 23 24 25 26 27 28 29 30 |
# File 'lib/fanforce/cli/apps.rb', line 22 def each(&block) cur_count = 0 total = dir_names.size dir_names.each do |d| cur_count += 1 app = Fanforce::CLI::App.load("#{$HomeDir}/#{d}") Dir.chdir(app.dir) { block.call(app, cur_count, total) } end end |