Class: RailsWayback::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/rails_wayback/configuration.rb

Constant Summary collapse

DEFAULT_VIEW_PATHS =

Includes the common places where Rails apps put render targets. app/components is picked up by the ViewComponent gem; app/views is stock Rails.

["app/views", "app/components"].freeze
DEFAULT_ASSET_PATHS =
["app/assets", "public"].freeze
DEFAULT_MAX_COMMITS =
50

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



17
18
19
20
21
22
23
24
# File 'lib/rails_wayback/configuration.rb', line 17

def initialize
  @view_paths = DEFAULT_VIEW_PATHS.dup
  @asset_paths = DEFAULT_ASSET_PATHS.dup
  @max_commits = DEFAULT_MAX_COMMITS
  @app_root = nil
  @cache_root = nil
  @toggle_file = nil
end

Instance Attribute Details

#app_rootObject

Returns the value of attribute app_root.



14
15
16
# File 'lib/rails_wayback/configuration.rb', line 14

def app_root
  @app_root
end

#asset_pathsObject

Returns the value of attribute asset_paths.



14
15
16
# File 'lib/rails_wayback/configuration.rb', line 14

def asset_paths
  @asset_paths
end

#cache_rootObject

Returns the value of attribute cache_root.



14
15
16
# File 'lib/rails_wayback/configuration.rb', line 14

def cache_root
  @cache_root
end

#max_commitsObject

Returns the value of attribute max_commits.



14
15
16
# File 'lib/rails_wayback/configuration.rb', line 14

def max_commits
  @max_commits
end

#toggle_fileObject

Returns the value of attribute toggle_file.



14
15
16
# File 'lib/rails_wayback/configuration.rb', line 14

def toggle_file
  @toggle_file
end

#view_pathsObject

Returns the value of attribute view_paths.



14
15
16
# File 'lib/rails_wayback/configuration.rb', line 14

def view_paths
  @view_paths
end

Instance Method Details

#app_root_pathObject



26
27
28
# File 'lib/rails_wayback/configuration.rb', line 26

def app_root_path
  Pathname.new(@app_root || RailsWayback.root)
end

#cache_root_pathObject



30
31
32
# File 'lib/rails_wayback/configuration.rb', line 30

def cache_root_path
  Pathname.new(@cache_root || app_root_path.join("tmp", "rails_wayback"))
end

#refs_cache_pathObject



38
39
40
# File 'lib/rails_wayback/configuration.rb', line 38

def refs_cache_path
  cache_root_path.join("refs")
end

#toggle_file_pathObject



34
35
36
# File 'lib/rails_wayback/configuration.rb', line 34

def toggle_file_path
  Pathname.new(@toggle_file || cache_root_path.join("enabled"))
end