Module: Offroad::ControllerExtensions::InstanceMethods

Defined in:
lib/controller_extensions.rb

Instance Method Summary collapse

Instance Method Details

#load_down_mirror_file(group, data, options = {}) ⇒ Object

Raises:



43
44
45
46
47
48
49
50
51
52
# File 'lib/controller_extensions.rb', line 43

def load_down_mirror_file(group, data, options = {})
  ensure_group_offline(group) if group
  raise PluginError.new("Cannot accept down mirror file when app is in online mode") if Offroad::app_online?
  m = MirrorData.new(
    group,
    :initial_mode => options[:initial_mode],
    :skip_validation => options[:skip_validation]
  )
  m.load_downwards_data(data)
end

#load_up_mirror_file(group, data, options = {}) ⇒ Object

Raises:



33
34
35
36
37
38
39
40
41
# File 'lib/controller_extensions.rb', line 33

def load_up_mirror_file(group, data, options = {})
  ensure_group_offline(group)
  raise PluginError.new("Cannot accept up mirror file when app is in offline mode") if Offroad::app_offline?
  m = MirrorData.new(
    group,
    :skip_validation => options[:skip_validation]
  )
  m.load_upwards_data(data)
end

#render_down_mirror_file(group, filename, render_args = {}) ⇒ Object

Raises:



20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/controller_extensions.rb', line 20

def render_down_mirror_file(group, filename, render_args = {})
  ensure_group_offline(group)
  raise PluginError.new("Cannot generate down-mirror file when app in offline mode") if Offroad::app_offline?
  mirror_data = MirrorData.new(
    group,
    :initial_mode => render_args.delete(:initial_mode),
    :skip_validation => render_args.delete(:skip_validation)
  )
  render_appending_mirror_data(group, filename, render_args) do |output|
    mirror_data.write_downwards_data(output)
  end
end

#render_up_mirror_file(group, filename, render_args = {}) ⇒ Object

Raises:



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/controller_extensions.rb', line 8

def render_up_mirror_file(group, filename, render_args = {})
  ensure_group_offline(group)
  raise PluginError.new("Cannot generate up-mirror file when app in online mode") if Offroad::app_online?
  mirror_data = MirrorData.new(
    group,
    :skip_validation => render_args.delete(:skip_validation)
  )
  render_appending_mirror_data(group, filename, render_args) do |output|
    mirror_data.write_upwards_data(output)
  end
end