Class: Serum::Rails::App

Inherits:
Object
  • Object
show all
Defined in:
lib/serum/rails/app.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(root) ⇒ App

Returns a new instance of App.



7
8
9
10
11
# File 'lib/serum/rails/app.rb', line 7

def initialize(root)
  @root = File.expand_path(root)
  ensure_root_exists
  ensure_is_rails_app
end

Instance Attribute Details

#rootObject (readonly)

Returns the value of attribute root.



5
6
7
# File 'lib/serum/rails/app.rb', line 5

def root
  @root
end

Instance Method Details

#count_gemsObject



30
31
32
33
34
# File 'lib/serum/rails/app.rb', line 30

def count_gems
  Dir.chdir(@root) do
    run_command('bundle list').split(/\n/).size - 1
  end
end

#count_routesObject



24
25
26
27
28
# File 'lib/serum/rails/app.rb', line 24

def count_routes
  Dir.chdir(@root) do
    run_command('bundle exec rake routes').split(/\n/).size - 1
  end
end

#lines_of_codeObject

def gems

cd
bundle list | wc -l

end



18
19
20
# File 'lib/serum/rails/app.rb', line 18

def lines_of_code
  count_lines # matches anything in all folders
end