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.



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

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

#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



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

def exporting!
  @exporting = true
end

#exporting?Boolean

Check to see if we’re compiling

Returns:

  • (Boolean)


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

def exporting?
  @exporting
end

#production!Object

Mark this Frank run as production



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

def production!
  @production = true
end

#production?Boolean

Check to see if we’re in production mode

Returns:

  • (Boolean)


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

def production?
  @production
end

#proj_nameObject

return the proj folder name



56
57
58
# File 'lib/frank/settings.rb', line 56

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

#publishing!Object

Mark this Frank run as publishing



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

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

#resetObject

Reset settings to the defaults



24
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
# File 'lib/frank/settings.rb', line 24

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 = nil
  @export.silent = false

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

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

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

#serving_static!Object

Mark this Frank run as serving static



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

def serving_static!
  @serving_static = true
end

#serving_static?Boolean

Are we serving up a raw static folder?

Returns:

  • (Boolean)


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

def serving_static?
  @serving_static
end

#silent_export?Boolean

Silent export if set or in test

Returns:

  • (Boolean)


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

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