Class: RailsFinder::Runner
- Inherits:
-
Object
- Object
- RailsFinder::Runner
- Defined in:
- lib/rails_finder.rb
Instance Attribute Summary collapse
-
#dir ⇒ Object
readonly
Returns the value of attribute dir.
-
#output ⇒ Object
readonly
Returns the value of attribute output.
Instance Method Summary collapse
- #apps ⇒ Object
-
#initialize(dir, output = $stdout) ⇒ Runner
constructor
A new instance of Runner.
- #print ⇒ Object
Constructor Details
#initialize(dir, output = $stdout) ⇒ Runner
Returns a new instance of Runner.
13 14 15 16 |
# File 'lib/rails_finder.rb', line 13 def initialize(dir, output = $stdout) @dir = dir @output = output end |
Instance Attribute Details
#dir ⇒ Object (readonly)
Returns the value of attribute dir.
11 12 13 |
# File 'lib/rails_finder.rb', line 11 def dir @dir end |
#output ⇒ Object (readonly)
Returns the value of attribute output.
11 12 13 |
# File 'lib/rails_finder.rb', line 11 def output @output end |
Instance Method Details
#apps ⇒ Object
28 29 30 31 32 |
# File 'lib/rails_finder.rb', line 28 def apps @apps ||= Dir["#{dir}/**/config/environment.rb"].map do |file| App.new(File.("../..", file)) end end |
#print ⇒ Object
18 19 20 21 22 23 24 25 26 |
# File 'lib/rails_finder.rb', line 18 def print if apps.any? apps.sort_by { |a| Naturally.normalize(a.rails_version) }.each do |app| output.puts "#{app.basename.ljust(root_width)} #{app.rails_version.ljust(version_width)} #{app.root}" end else output.puts "none found" end end |