snippets were missing in the export
This commit is contained in:
parent
9008324367
commit
711110a6e0
1
doc/TODO
1
doc/TODO
@ -78,7 +78,6 @@ x export: problems with templatized pages (source => multi levels pages)
|
||||
- [bushido] guiders / welcome page / devise cas authentication (SSO)
|
||||
|
||||
|
||||
|
||||
BACKLOG:
|
||||
|
||||
- custom_fields:
|
||||
|
@ -97,7 +97,7 @@ module Locomotive
|
||||
|
||||
def copy_snippets
|
||||
@site.snippets.each do |snippet|
|
||||
File.open(File.join(self.snippets_folder, snippet.slug), 'w') do |f|
|
||||
File.open(File.join(self.snippets_folder, "#{snippet.slug}.liquid"), 'w') do |f|
|
||||
f.write(snippet.template)
|
||||
end
|
||||
end
|
||||
@ -262,13 +262,15 @@ module Locomotive
|
||||
case field.kind
|
||||
when 'file'
|
||||
uploader = content.send(field._name)
|
||||
filepath = File.join('/samples', content_type.slug, content.send("#{field._name}_filename"))
|
||||
|
||||
self.copy_file_from_an_uploader(uploader, File.join(self.public_folder, filepath))
|
||||
|
||||
unless uploader.blank?
|
||||
filepath = File.join('/samples', content_type.slug, content.send("#{field._name}_filename"))
|
||||
self.copy_file_from_an_uploader(uploader, File.join(self.public_folder, filepath))
|
||||
else
|
||||
filepath = nil
|
||||
end
|
||||
hash[field._alias] = filepath
|
||||
when 'text'
|
||||
value = self.replace_asset_urls_in(content.send(field._name.to_sym))
|
||||
value = self.replace_asset_urls_in(content.send(field._name.to_sym) || '')
|
||||
hash[field._alias] = value
|
||||
else
|
||||
hash[field._alias] = content.send(field._name.to_sym)
|
||||
|
@ -11,6 +11,15 @@ namespace :locomotive do
|
||||
puts '...done'
|
||||
end
|
||||
|
||||
desc 'Rebuild the serialized template of all the site pages'
|
||||
task :rebuild_serialized_page_templates do
|
||||
Page.all.each do |page|
|
||||
next unless page.template.nil?
|
||||
page.send :_parse_and_serialize_template
|
||||
page.save
|
||||
end
|
||||
end
|
||||
|
||||
desc 'Import a remote template described by its URL -- 2 options: SITE=name or id, RESET=by default false'
|
||||
task :import => :environment do
|
||||
url, site_name_or_id, reset = ENV['URL'], ENV['SITE'], Boolean.set(ENV['RESET']) || false
|
||||
|
BIN
spec/fixtures/themes/default.zip
vendored
BIN
spec/fixtures/themes/default.zip
vendored
Binary file not shown.
@ -24,6 +24,17 @@ describe Locomotive::Export do
|
||||
Dir[File.join(self.zip_folder, 'app', 'views', 'pages', '**/*.liquid')].size.should == 10
|
||||
end
|
||||
|
||||
it 'includes snippets' do
|
||||
self.unzip
|
||||
Dir[File.join(self.zip_folder, 'app', 'views', 'snippets', '*.liquid')].size.should == 1
|
||||
end
|
||||
|
||||
it 'has yaml files describing the content types as well as their data' do
|
||||
self.unzip
|
||||
Dir[File.join(self.zip_folder, 'app', 'content_types', '*.yml')].size.should == 4
|
||||
Dir[File.join(self.zip_folder, 'data', '*.yml')].size.should == 4
|
||||
end
|
||||
|
||||
def import_it
|
||||
job = Locomotive::Import::Job.new(FixturedTheme.duplicate_and_open('default.zip'), @site, { :samples => true, :reset => true })
|
||||
job.perform
|
||||
@ -35,7 +46,7 @@ describe Locomotive::Export do
|
||||
end
|
||||
|
||||
def zip_folder
|
||||
File.join(File.dirname(@zip_file), 'acme-website')
|
||||
File.join(File.dirname(@zip_file), 'locomotive-test-website-2')
|
||||
end
|
||||
|
||||
def unzip
|
||||
@ -51,6 +62,7 @@ describe Locomotive::Export do
|
||||
end
|
||||
|
||||
after(:all) do
|
||||
FileUtils.rm_rf(self.zip_folder) if File.exists?(self.zip_folder)
|
||||
Site.destroy_all
|
||||
end
|
||||
|
||||
|
@ -67,6 +67,10 @@ describe Locomotive::Import::Job do
|
||||
page.redirect_url.should == 'http://blog.locomotivecms.com'
|
||||
end
|
||||
|
||||
it 'inserts snippets' do
|
||||
@site.snippets.count.should == 1
|
||||
end
|
||||
|
||||
after(:all) do
|
||||
Site.destroy_all
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user