Class: RefinerycmsConvertor
- Inherits:
-
Object
- Object
- RefinerycmsConvertor
- Defined in:
- lib/refinerycms-convertor.rb
Instance Attribute Summary collapse
-
#original_dir ⇒ Object
readonly
Returns the value of attribute original_dir.
-
#theme ⇒ Object
readonly
Returns the value of attribute theme.
-
#theme_dir ⇒ Object
readonly
Returns the value of attribute theme_dir.
Instance Method Summary collapse
- #convert! ⇒ Object
-
#initialize(theme) ⇒ RefinerycmsConvertor
constructor
A new instance of RefinerycmsConvertor.
Constructor Details
#initialize(theme) ⇒ RefinerycmsConvertor
Returns a new instance of RefinerycmsConvertor.
10 11 12 13 14 15 16 |
# File 'lib/refinerycms-convertor.rb', line 10 def initialize(theme) raise ArgumentError, "Theme not found" unless File.directory?(@theme_dir = Rails.root.join('themes', theme)) raise ArgumentError, "Theme does not have an 'original' folder" unless File.directory?(@original_dir = Rails.root.join(@theme_dir, 'original')) raise ArgumentError, "No 'index.html' in 'original' folder" unless File.exists?(@index_html = Rails.root.join(@original_dir, 'index.html')) @theme = theme end |
Instance Attribute Details
#original_dir ⇒ Object (readonly)
Returns the value of attribute original_dir.
8 9 10 |
# File 'lib/refinerycms-convertor.rb', line 8 def original_dir @original_dir end |
#theme ⇒ Object (readonly)
Returns the value of attribute theme.
8 9 10 |
# File 'lib/refinerycms-convertor.rb', line 8 def theme @theme end |
#theme_dir ⇒ Object (readonly)
Returns the value of attribute theme_dir.
8 9 10 |
# File 'lib/refinerycms-convertor.rb', line 8 def theme_dir @theme_dir end |
Instance Method Details
#convert! ⇒ Object
18 19 20 21 22 23 24 25 26 |
# File 'lib/refinerycms-convertor.rb', line 18 def convert! ['images', 'javascripts', 'stylesheets', 'views/layouts', 'views/pages', 'views/shared'].each do |dir| FileUtils.mkdir_p(@theme_dir + dir) end @layout = ConvertorLayout.new(@index_html) @layout.extract_to_partials(@theme_dir + "views/shared") end |