Module: CassetteRack::Configure

Defined in:
lib/cassette-rack/configure.rb

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.cassette_pathObject

Returns the value of attribute cassette_path.



6
7
8
# File 'lib/cassette-rack/configure.rb', line 6

def cassette_path
  @cassette_path
end

.content_layoutObject



37
38
39
# File 'lib/cassette-rack/configure.rb', line 37

def content_layout
  @content_layout ||= File.expand_path('content.md.liquid', File.join(self.templates_path, 'layouts'))
end

.urlObject

Returns the value of attribute url.



6
7
8
# File 'lib/cassette-rack/configure.rb', line 6

def url
  @url
end

Class Method Details

.application_layoutObject



33
34
35
# File 'lib/cassette-rack/configure.rb', line 33

def application_layout
  @application_layout ||= File.expand_path('application.html.liquid', File.join(self.templates_path, 'layouts'))
end

.application_templateObject



45
46
47
# File 'lib/cassette-rack/configure.rb', line 45

def application_template
  File.read(self.application_layout)
end

.content_templateObject



49
50
51
# File 'lib/cassette-rack/configure.rb', line 49

def content_template
  File.read(self.content_layout)
end

.keysObject



21
22
23
# File 'lib/cassette-rack/configure.rb', line 21

def keys
  @keys ||= i[cassette_path url]
end

.preview_layoutObject



41
42
43
# File 'lib/cassette-rack/configure.rb', line 41

def preview_layout
  @preview_layout ||= File.expand_path('preview.liquid', File.join(self.templates_path, 'layouts'))
end

.preview_templateObject



53
54
55
# File 'lib/cassette-rack/configure.rb', line 53

def preview_template
  File.read(self.preview_layout)
end

.setupObject



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/cassette-rack/configure.rb', line 9

def setup
  keys.each do |key|
    instance_variable_set(:"@#{key}", CassetteRack::Default.send(key))
  end

  FileUtils.mkdir_p(self.source_path)

  VCR.configure do |config|
    config.cassette_library_dir = self.source_path
  end
end

.source_pathObject



25
26
27
# File 'lib/cassette-rack/configure.rb', line 25

def source_path
  @source_path ||= File.expand_path(self.cassette_path)
end

.templates_pathObject



29
30
31
# File 'lib/cassette-rack/configure.rb', line 29

def templates_path
  @templates_path ||= CassetteRack.root.join('lib', 'templates').to_s
end