Importing theme works with ruby 1.9.2 + clean code

This commit is contained in:
dinedine 2010-12-27 12:59:54 +01:00
parent d0a089fb77
commit 8d610dee49
8 changed files with 32 additions and 24 deletions

View File

@ -1,6 +1,6 @@
GIT
remote: git://github.com/floehopper/mocha.git
revision: 1ed96f77a967b497746176e0b8a46746f5b4d722
revision: 9de0e619d46ba50c938fb1d24d30e931c38ebef1
specs:
mocha (0.9.10.20101125155727)
rake
@ -42,7 +42,7 @@ GEM
arel (2.0.6)
autotest (4.4.6)
ZenTest (>= 4.4.1)
bcrypt-ruby (2.1.2)
bcrypt-ruby (2.1.3)
bson (1.1.5)
bson_ext (1.1.5)
builder (2.1.2)
@ -56,7 +56,7 @@ GEM
selenium-webdriver (>= 0.0.27)
xpath (~> 0.1.2)
celerity (0.8.6)
childprocess (0.1.4)
childprocess (0.1.6)
ffi (~> 0.6.3)
closure-compiler (0.3.3)
columnize (0.3.2)
@ -89,7 +89,7 @@ GEM
diff-lcs (1.1.2)
erubis (2.6.6)
abstract (>= 1.0.0)
excon (0.3.4)
excon (0.3.6)
factory_girl (1.3.2)
factory_girl_rails (1.0)
factory_girl (~> 1.3)
@ -115,7 +115,7 @@ GEM
growl-glue (1.0.7)
haml (3.0.18)
has_scope (0.5.0)
heroku (1.14.10)
heroku (1.15.1)
json_pure (>= 1.2.0, < 1.5.0)
launchy (~> 0.3.2)
rest-client (>= 1.4.0, < 1.7.0)
@ -134,7 +134,7 @@ GEM
s3 (>= 0.3.7)
json (1.4.6)
json_pure (1.4.6)
kgio (2.0.0)
kgio (2.1.1)
launchy (0.3.7)
configuration (>= 0.0.5)
rake (>= 0.8.1)
@ -147,7 +147,7 @@ GEM
locomotive_mongoid_acts_as_tree (0.1.5.1)
bson (>= 0.20.1)
mongoid (<= 2.0.0.beta.19)
mail (2.2.12)
mail (2.2.13)
activesupport (>= 2.3.6)
i18n (>= 0.4.0)
mime-types (~> 1.16)
@ -226,8 +226,8 @@ GEM
rubyzip (0.9.4)
s3 (0.3.7)
proxies
selenium-webdriver (0.1.1)
childprocess (= 0.1.4)
selenium-webdriver (0.1.2)
childprocess (~> 0.1.5)
ffi (~> 0.6.3)
json_pure
rubyzip
@ -238,15 +238,15 @@ GEM
polyglot (>= 0.3.1)
trollop (1.16.2)
tzinfo (0.3.23)
unicorn (3.1.0)
kgio (~> 2.0.0)
unicorn (3.2.1)
kgio (~> 2.1)
rack
warden (0.10.7)
rack (>= 1.0.0)
will_paginate (3.0.pre2)
xpath (0.1.2)
nokogiri (~> 1.3)
yard (0.6.3)
yard (0.6.4)
yui-compressor (0.9.1)
PLATFORMS

View File

@ -28,7 +28,7 @@ module Admin
:reset => Boolean.set(params[:reset])
})
flash[:notice] = t('flash.admin.imports.create.notice')
flash[:notice] = t("flash.admin.imports.create.#{Locomotive.config.delayed_job ? 'notice' : 'done'}")
redirect_to Locomotive.config.delayed_job ? admin_import_url : new_admin_import_url
rescue

View File

@ -44,13 +44,13 @@ module Admin
@site.save
if @site.valid?
# begin
begin
unless params[:zipfile].blank?
Locomotive::Import::Job.run!(params[:zipfile], @site, { :samples => true })
end
# rescue Exception => e
# logger.error "Import failed because of #{e.message}"
# end
rescue Exception => e
logger.error "Import failed because of #{e.message}"
end
redirect_to admin_session_url(:host => Site.first.domains.first, :port => request.port)
else

View File

@ -111,5 +111,6 @@ en:
imports:
create:
done: "Your site was successfully updated."
notice: "Your site is being updated."
alert: "The import was not done."

View File

@ -111,5 +111,6 @@ fr:
imports:
create:
done: "Votre site a été mis à jour"
notice: "Votre site est en train d'être mis à jour"
alert: "L'import n'a pas pu se faire"

View File

@ -4,8 +4,8 @@ x jammit-s3: assets
x copy assets.yml config file when using it as gem (http://asciicasts.com/episodes/218-making-generators-in-rails-3)
x import theme without delayed_job
x rspec 2.3
- ruby 1.9.2:
- DelayedJob not working
x ruby 1.9.2:
x DelayedJob not working
BACKLOG:

View File

@ -17,6 +17,8 @@ module Locomotive
@identifier = self.store_zipfile(zipfile)
raise "Theme identifier not found" if @identifier.blank?
@uploader = nil # fix issue with Ruby 1.9.2 and serialization
end
def before(worker)
@ -95,11 +97,10 @@ module Locomotive
begin
uploader.store!(file)
rescue CarrierWave::IntegrityError
return nil
end
uploader.identifier
rescue CarrierWave::IntegrityError
nil
end
end
def retrieve_zipfile

5
script/delayed_job Executable file
View File

@ -0,0 +1,5 @@
#!/usr/bin/env ruby
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'config', 'environment'))
require 'delayed/command'
Delayed::Command.new(ARGV).daemonize