Module: Eyeballs::AppDetector

Included in:
AppGenerator, ControllerGenerator, ModelGenerator, ScaffoldGenerator
Defined in:
lib/eyeballs/app_detector.rb

Instance Method Summary collapse

Instance Method Details

#app_pathObject



14
15
16
17
18
19
20
21
# File 'lib/eyeballs/app_detector.rb', line 14

def app_path
  @app_path ||= if rack_app?
    $stdout.puts "public folder detected, installing to public/javascripts"
    'public/javascripts'
  else
    '.'
  end
end

#new_app_pathObject



5
6
7
8
9
10
11
12
# File 'lib/eyeballs/app_detector.rb', line 5

def new_app_path
  @new_app_path ||= if rack_app?
    $stdout.puts "public folder detected, installing to public/javascripts"
    'public/javascripts'
  else
    name
  end
end

#prefixObject



31
32
33
# File 'lib/eyeballs/app_detector.rb', line 31

def prefix
  '/public/' if rack_app?
end

#public_pathObject



23
24
25
26
27
28
29
# File 'lib/eyeballs/app_detector.rb', line 23

def public_path
  @public_path ||= if rack_app?
    'public'
  else
    '.'
  end
end

#rack_app?Boolean

Returns:

  • (Boolean)


35
36
37
# File 'lib/eyeballs/app_detector.rb', line 35

def rack_app?
  File.exists?('public')
end