Class: Rc
- Inherits:
-
Object
- Object
- Rc
- Defined in:
- lib/capistrano-freebsd/rc.rb
Constant Summary collapse
- @@path =
'/etc/rc.conf'
Class Method Summary collapse
- .configs(base, configs) ⇒ Object
- .init(lines) ⇒ Object
- .print_line(line) ⇒ Object
- .print_lines(lines) ⇒ Object
- .section(title) ⇒ Object
Class Method Details
.configs(base, configs) ⇒ Object
23 24 25 26 |
# File 'lib/capistrano-freebsd/rc.rb', line 23 def self.configs base, configs section base print_lines(configs.map { |config| base + '_' + config }) end |
.init(lines) ⇒ Object
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/capistrano-freebsd/rc.rb', line 8 def self.init lines as :root do execute :echo, "> #{@@path}" end print_lines [ "# These configurations are automatically generated", "# at #{Datetime.now.to_s}.", ] end |
.print_line(line) ⇒ Object
32 33 34 35 36 |
# File 'lib/capistrano-freebsd/rc.rb', line 32 def self.print_line line as :root do execute :echo, "#{line} >> #{@@path}" end end |
.print_lines(lines) ⇒ Object
28 29 30 |
# File 'lib/capistrano-freebsd/rc.rb', line 28 def self.print_lines lines lines.map(&method(:print_line)) end |
.section(title) ⇒ Object
19 20 21 |
# File 'lib/capistrano-freebsd/rc.rb', line 19 def self.section title print_lines ["", "# #{title}"] end |