Class: Frank::Settings

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/frank/settings.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeSettings

Returns a new instance of Settings.



20
21
22
# File 'lib/frank/settings.rb', line 20

def initialize
  reset
end

Instance Attribute Details

#dynamic_folderObject

Returns the value of attribute dynamic_folder.



13
14
15
# File 'lib/frank/settings.rb', line 13

def dynamic_folder
  @dynamic_folder
end

#environmentObject

Returns the value of attribute environment.



7
8
9
# File 'lib/frank/settings.rb', line 7

def environment
  @environment
end

#exportObject

Returns the value of attribute export.



15
16
17
# File 'lib/frank/settings.rb', line 15

def export
  @export
end

#haml_optionsObject

Returns the value of attribute haml_options.



18
19
20
# File 'lib/frank/settings.rb', line 18

def haml_options
  @haml_options
end

#layouts_folderObject

Returns the value of attribute layouts_folder.



14
15
16
# File 'lib/frank/settings.rb', line 14

def layouts_folder
  @layouts_folder
end

#optionsObject

Returns the value of attribute options.



11
12
13
# File 'lib/frank/settings.rb', line 11

def options
  @options
end

#publishObject

Returns the value of attribute publish.



16
17
18
# File 'lib/frank/settings.rb', line 16

def publish
  @publish
end

#rootObject

Returns the value of attribute root.



8
9
10
# File 'lib/frank/settings.rb', line 8

def root
  @root
end

#sass_optionsObject

Returns the value of attribute sass_options.



17
18
19
# File 'lib/frank/settings.rb', line 17

def sass_options
  @sass_options
end

#serverObject

Returns the value of attribute server.



10
11
12
# File 'lib/frank/settings.rb', line 10

def server
  @server
end

#static_folderObject

Returns the value of attribute static_folder.



12
13
14
# File 'lib/frank/settings.rb', line 12

def static_folder
  @static_folder
end

Instance Method Details

#exporting!Object

Mark this Frank run as compiling



80
81
82
# File 'lib/frank/settings.rb', line 80

def exporting!
  @exporting = true
end

#exporting?Boolean

Check to see if we’re compiling

Returns:

  • (Boolean)


75
76
77
# File 'lib/frank/settings.rb', line 75

def exporting?
  @exporting
end

#force_export!Object

Force overwrite export folder if it exists



100
101
102
# File 'lib/frank/settings.rb', line 100

def force_export!
  @export.force = true
end

#production!Object

Mark this Frank run as production



95
96
97
# File 'lib/frank/settings.rb', line 95

def production!
  @production = true
end

#production?Boolean

Check to see if we’re in production mode

Returns:

  • (Boolean)


90
91
92
# File 'lib/frank/settings.rb', line 90

def production?
  @production
end

#proj_nameObject

return the proj folder name



60
61
62
# File 'lib/frank/settings.rb', line 60

def proj_name
  @root.split('/').last
end

#publishing!Object

Mark this Frank run as publishing



105
106
107
108
# File 'lib/frank/settings.rb', line 105

def publishing!
  @exporting  = true
  @production = true
end

#resetObject

Reset settings to the defaults



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/frank/settings.rb', line 25

def reset
  # reset server settings
  @server = OpenStruct.new
  @server.handler = "mongrel"
  @server.hostname = "0.0.0.0"
  @server.port = "3601"

  # reset options
  @options = OpenStruct.new

  # export settings
  @export = OpenStruct.new
  @export.path = "exported"
  @export.silent = false
  @export.force = false

  # publish options
  @publish = OpenStruct.new
  @publish.host = nil
  @publish.path = nil
  @publish.username = nil
  @publish.password = nil
  @publish.mode = nil

  # setup folders
  @static_folder = "static"
  @dynamic_folder = "dynamic"
  @layouts_folder = "layouts"

  # setup 3rd party configurations
  @sass_options = {}
  @haml_options = {}
end

#serving_static!Object

Mark this Frank run as serving static



70
71
72
# File 'lib/frank/settings.rb', line 70

def serving_static!
  @serving_static = true
end

#serving_static?Boolean

Are we serving up a raw static folder?

Returns:

  • (Boolean)


65
66
67
# File 'lib/frank/settings.rb', line 65

def serving_static?
  @serving_static
end

#silent_export?Boolean

Silent export if set or in test

Returns:

  • (Boolean)


85
86
87
# File 'lib/frank/settings.rb', line 85

def silent_export?
  @environment == :test || @export.silent
end