Module: Rda::Rails

Defined in:
lib/rda/rails.rb

Class Method Summary collapse

Class Method Details

.app_nameObject



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/rda/rails.rb', line 3

def self.app_name
  @app_name ||= begin
                  IO.foreach(File.join(Dir.pwd, 'config.ru')) do |l|
                    if l =~ /run\s+(.*)::Application/
                      return $1.underscore.dasherize
                    end
                  end
                rescue
                end

  unless @app_name
    $stderr.puts "ERROR: You should run rda under rails applications"
    exit
  end
end

.rootObject



19
20
21
# File 'lib/rda/rails.rb', line 19

def self.root
  Dir.pwd if app_name
end