Class: Ecrire::Theme::Engine

Inherits:
Rails::Engine
  • Object
show all
Defined in:
lib/ecrire/theme/engine.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#post_pathObject

Returns the value of attribute post_path.



4
5
6
# File 'lib/ecrire/theme/engine.rb', line 4

def post_path
  @post_path
end

Instance Method Details

#has_migrations?Boolean

Returns:

  • (Boolean)


45
46
47
# File 'lib/ecrire/theme/engine.rb', line 45

def has_migrations?
  false
end

#pathsObject



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/ecrire/theme/engine.rb', line 23

def paths
  @paths ||= begin
    paths = Rails::Paths::Root.new(root_path)
    paths.add 'app/views', with: 'views'
    paths.add 'app/controllers', with: 'controllers', eager_load: true
    paths.add 'app/assets', with: 'assets', glob: '*'
    paths.add 'app/helpers', with: 'helpers', eager_load: true

    paths.add 'config/routes.rb', with: 'routes.rb'
    paths.add 'config/locales', with: 'locales', glob: '**/*.{rb,yml}'
    paths.add 'config/environments', with: 'environments', glob: "#{Rails.env}.rb"

    paths.add 'public', with: 'tmp/public'

    paths.add "lib/assets",          glob: "*"
    paths.add "vendor/assets",       glob: "*"
    paths.add "lib/tasks"

    paths
  end
end

#root_path(file = 'config.ru') ⇒ Object



49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/ecrire/theme/engine.rb', line 49

def root_path(file = 'config.ru')
  begin
    pathname = Pathname.pwd

    while !(pathname + file).exist? do
      pathname = pathname.parent
      if pathname.root?
        raise "Could not find #{file}. Type 'ecrire new blog_name' to create a new blog"
        break
      end
    end

    pathname
  end
end