simplify the installation procedure for bushido users
This commit is contained in:
parent
164be33e06
commit
2ce1fadf52
1
.gitignore
vendored
1
.gitignore
vendored
@ -30,3 +30,4 @@ config/deploy.rb
|
|||||||
perf/*.rb
|
perf/*.rb
|
||||||
gem_graph.png
|
gem_graph.png
|
||||||
sites/
|
sites/
|
||||||
|
permanent
|
||||||
|
10
Gemfile
10
Gemfile
@ -27,7 +27,6 @@ gem 'fog', '0.3.7'
|
|||||||
gem 'mimetype-fu'
|
gem 'mimetype-fu'
|
||||||
gem 'actionmailer-with-request', :require => 'actionmailer_with_request'
|
gem 'actionmailer-with-request', :require => 'actionmailer_with_request'
|
||||||
gem 'heroku', '1.19.1'
|
gem 'heroku', '1.19.1'
|
||||||
gem 'bushido'
|
|
||||||
gem 'httparty', '>= 0.6.1'
|
gem 'httparty', '>= 0.6.1'
|
||||||
gem 'RedCloth', '4.2.7'
|
gem 'RedCloth', '4.2.7'
|
||||||
gem 'delayed_job', '2.1.4'
|
gem 'delayed_job', '2.1.4'
|
||||||
@ -41,11 +40,16 @@ gem 'SystemTimer', :platforms => :ruby_18
|
|||||||
group :development do
|
group :development do
|
||||||
# Using unicorn_rails instead of webrick (default server)
|
# Using unicorn_rails instead of webrick (default server)
|
||||||
gem 'unicorn'
|
gem 'unicorn'
|
||||||
|
gem 'bushido_stub', :path => '../gems/bushido_stub'
|
||||||
end
|
end
|
||||||
|
|
||||||
group :test, :development do
|
group :test, :development do
|
||||||
gem "ruby-debug", :platforms => :mri_18
|
gem 'ruby-debug', :platforms => :mri_18
|
||||||
gem "ruby-debug19", :platforms => :mri_19
|
gem 'ruby-debug19', :platforms => :mri_19
|
||||||
|
end
|
||||||
|
|
||||||
|
group :production do
|
||||||
|
gem 'bushido'
|
||||||
end
|
end
|
||||||
|
|
||||||
group :test do
|
group :test do
|
||||||
|
15
Gemfile.lock
15
Gemfile.lock
@ -11,6 +11,12 @@ GIT
|
|||||||
xpath (0.1.2)
|
xpath (0.1.2)
|
||||||
nokogiri (~> 1.4)
|
nokogiri (~> 1.4)
|
||||||
|
|
||||||
|
PATH
|
||||||
|
remote: ../gems/bushido_stub
|
||||||
|
specs:
|
||||||
|
bushido_stub (0.0.1)
|
||||||
|
activesupport
|
||||||
|
|
||||||
GEM
|
GEM
|
||||||
remote: http://rubygems.org/
|
remote: http://rubygems.org/
|
||||||
specs:
|
specs:
|
||||||
@ -74,7 +80,6 @@ GEM
|
|||||||
celerity (0.8.9)
|
celerity (0.8.9)
|
||||||
childprocess (0.1.9)
|
childprocess (0.1.9)
|
||||||
ffi (~> 1.0.6)
|
ffi (~> 1.0.6)
|
||||||
closure-compiler (1.1.1)
|
|
||||||
columnize (0.3.2)
|
columnize (0.3.2)
|
||||||
configuration (1.2.0)
|
configuration (1.2.0)
|
||||||
crack (0.1.8)
|
crack (0.1.8)
|
||||||
@ -141,9 +146,8 @@ GEM
|
|||||||
inherited_resources (1.1.2)
|
inherited_resources (1.1.2)
|
||||||
has_scope (~> 0.5.0)
|
has_scope (~> 0.5.0)
|
||||||
responders (~> 0.6.0)
|
responders (~> 0.6.0)
|
||||||
jammit (0.6.0)
|
jammit (0.6.3)
|
||||||
closure-compiler (>= 0.1.0)
|
yui-compressor (>= 0.9.3)
|
||||||
yui-compressor (>= 0.9.1)
|
|
||||||
json (1.5.1)
|
json (1.5.1)
|
||||||
json_pure (1.4.6)
|
json_pure (1.4.6)
|
||||||
kgio (2.4.1)
|
kgio (2.4.1)
|
||||||
@ -244,7 +248,7 @@ GEM
|
|||||||
ffi (>= 1.0.7)
|
ffi (>= 1.0.7)
|
||||||
json_pure
|
json_pure
|
||||||
rubyzip
|
rubyzip
|
||||||
spork (0.8.4)
|
spork (0.8.5)
|
||||||
term-ansicolor (1.0.5)
|
term-ansicolor (1.0.5)
|
||||||
thor (0.14.6)
|
thor (0.14.6)
|
||||||
treetop (1.4.9)
|
treetop (1.4.9)
|
||||||
@ -271,6 +275,7 @@ DEPENDENCIES
|
|||||||
autotest
|
autotest
|
||||||
bson_ext (~> 1.3.0)
|
bson_ext (~> 1.3.0)
|
||||||
bushido
|
bushido
|
||||||
|
bushido_stub!
|
||||||
capybara
|
capybara
|
||||||
cucumber (= 0.8.5)
|
cucumber (= 0.8.5)
|
||||||
cucumber-rails
|
cucumber-rails
|
||||||
|
@ -27,4 +27,14 @@ Locomotive::Application.configure do
|
|||||||
:port => 1025,
|
:port => 1025,
|
||||||
:domain => "example.com"
|
:domain => "example.com"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# set up the bushido stub (uncomment it)
|
||||||
|
# config.bushido_stub_env = false
|
||||||
|
|
||||||
|
config.bushido_stub_env = {
|
||||||
|
'APP_TLD' => 'bushi.do',
|
||||||
|
'BUSHIDO_APP' => 'san_francisco',
|
||||||
|
'BUSHIDO_HOST' => 'bushi.do',
|
||||||
|
'LOCOMOTIVE_SITE_NAME' => 'Locomotive TEST'
|
||||||
|
}
|
||||||
end
|
end
|
@ -14,7 +14,7 @@ it:
|
|||||||
membership_email: Email account
|
membership_email: Email account
|
||||||
file: File
|
file: File
|
||||||
preview: Anteprima
|
preview: Anteprima
|
||||||
options: Opzioni
|
options: Opzioni avanzate
|
||||||
custom_fields: Campi personalizzati
|
custom_fields: Campi personalizzati
|
||||||
other_fields: Altre informazioni
|
other_fields: Altre informazioni
|
||||||
presentation: Presentazione
|
presentation: Presentazione
|
||||||
|
20
doc/TODO
20
doc/TODO
@ -1,28 +1,25 @@
|
|||||||
BOARD:
|
BOARD:
|
||||||
|
|
||||||
x bugs:
|
|
||||||
x #50
|
|
||||||
x #51
|
|
||||||
~ editable_elements: inheritable: false (Mattias) => seems to be fixed by Dirk's last pull request (#44) => content tag
|
~ editable_elements: inheritable: false (Mattias) => seems to be fixed by Dirk's last pull request (#44) => content tag
|
||||||
- bushido version
|
- bushido version
|
||||||
- upgrade warning if new version of locomotive (maybe based on the commit id)
|
- default template
|
||||||
- duostack version
|
|
||||||
x 2 different sites on the same main domain (one in www, the other one in something else) (Raphael Costa)
|
|
||||||
- seo section for the page form: seo title, seo keywords, seo description
|
|
||||||
- icon for redirection page in the pages section (back-office)
|
|
||||||
- write my first tutorial about locomotive
|
|
||||||
|
|
||||||
BACKLOG:
|
BACKLOG:
|
||||||
|
|
||||||
- custom_fields:
|
- custom_fields:
|
||||||
- validation: regexp (pre-defined regexps ?)
|
- validation: regexp (pre-defined regexps ?)
|
||||||
- new type: belongs_to => association
|
x new type: belongs_to => association
|
||||||
- inline editing (http://www.aloha-editor.com/wiki/index.php/Aloha_PHP_Example)
|
- inline editing (http://www.aloha-editor.com/wiki/index.php/Aloha_PHP_Example)
|
||||||
- html view in the aloha popup
|
- html view in the aloha popup
|
||||||
- editable elements should wrap a tag: div, h1, ...etc (default span)
|
- editable elements should wrap a tag: div, h1, ...etc (default span)
|
||||||
- edit images (upload new ones, ...etc) => wait for aloha or send them an email ?
|
- edit images (upload new ones, ...etc) => wait for aloha or send them an email ?
|
||||||
- global regions: keyword in editable element (http://www.mongodb.org/display/DOCS/Updating)
|
- global regions: keyword in editable element (http://www.mongodb.org/display/DOCS/Updating)
|
||||||
- cucumber features for admin pages (in progress)
|
- cucumber features for admin pages (in progress)
|
||||||
|
(- duostack version)
|
||||||
|
- icon for redirection page in the pages section (back-office)
|
||||||
|
- write my first tutorial about locomotive
|
||||||
|
- upgrade warning if new version of locomotive (maybe based on the commit id)
|
||||||
|
|
||||||
|
|
||||||
REFACTORING:
|
REFACTORING:
|
||||||
|
|
||||||
@ -212,3 +209,6 @@ x pull request #44
|
|||||||
x bug on dates (https://github.com/locomotivecms/engine/issues#issue/48)
|
x bug on dates (https://github.com/locomotivecms/engine/issues#issue/48)
|
||||||
x generated sitemaps are invalid (url + date)
|
x generated sitemaps are invalid (url + date)
|
||||||
x integrate new locomotivecms home
|
x integrate new locomotivecms home
|
||||||
|
x seo section for the page form: seo title, seo keywords, seo description
|
||||||
|
x bugs: #50, #51
|
||||||
|
x 2 different sites on the same main domain (one in www, the other one in something else) (Raphael Costa)
|
@ -29,7 +29,7 @@ module Locomotive
|
|||||||
|
|
||||||
self.setup_smtp_settings
|
self.setup_smtp_settings
|
||||||
|
|
||||||
self.config.delayed_job = true # force the use of delayed_job
|
self.config.delayed_job = false #true # force the use of delayed_job
|
||||||
|
|
||||||
self.bushido_domains = ::Bushido::App.domains
|
self.bushido_domains = ::Bushido::App.domains
|
||||||
self.bushido_subdomain = ::Bushido::App.subdomain
|
self.bushido_subdomain = ::Bushido::App.subdomain
|
||||||
|
@ -7,3 +7,9 @@ require 'locomotive/import/asset_collections'
|
|||||||
require 'locomotive/import/content_types'
|
require 'locomotive/import/content_types'
|
||||||
require 'locomotive/import/snippets'
|
require 'locomotive/import/snippets'
|
||||||
require 'locomotive/import/pages'
|
require 'locomotive/import/pages'
|
||||||
|
|
||||||
|
module Locomotive
|
||||||
|
module Import
|
||||||
|
DEFAULT_SITE_TEMPLATE = 'https://github.com/locomotivecms/default-site-template/zipball/master'
|
||||||
|
end
|
||||||
|
end
|
@ -70,6 +70,7 @@ module Locomotive
|
|||||||
job = self.new(zipfile, site, options)
|
job = self.new(zipfile, site, options)
|
||||||
|
|
||||||
if Locomotive.config.delayed_job
|
if Locomotive.config.delayed_job
|
||||||
|
puts "delayed::JOB !"
|
||||||
Delayed::Job.enqueue job, { :site => site, :job_type => 'import' }
|
Delayed::Job.enqueue job, { :site => site, :job_type => 'import' }
|
||||||
else
|
else
|
||||||
job.perform
|
job.perform
|
||||||
|
@ -10,7 +10,11 @@ module Locomotive
|
|||||||
|
|
||||||
def call(env)
|
def call(env)
|
||||||
if env["PATH_INFO"] =~ @path_regexp
|
if env["PATH_INFO"] =~ @path_regexp
|
||||||
|
if Locomotive.config.multi_sites?
|
||||||
site = fetch_site(env['SERVER_NAME'])
|
site = fetch_site(env['SERVER_NAME'])
|
||||||
|
else
|
||||||
|
site = Site.first
|
||||||
|
end
|
||||||
|
|
||||||
if site.nil?
|
if site.nil?
|
||||||
@app.call(env)
|
@app.call(env)
|
||||||
|
@ -1,10 +1,53 @@
|
|||||||
require 'bushido'
|
require 'bushido'
|
||||||
require 'jammit'
|
require 'jammit'
|
||||||
|
require 'net/http'
|
||||||
|
|
||||||
namespace :bushido do
|
namespace :bushido do
|
||||||
desc "Prepare an app to run on the Bushido hosting platform, only called during the initial installation. Called just before booting the app."
|
desc "Prepare an app to run on the Bushido hosting platform, only called during the initial installation. Called just before booting the app."
|
||||||
task :install do
|
task :install => :environment do
|
||||||
Jammit.package!
|
Jammit.package!
|
||||||
|
|
||||||
|
if ENV['BUSHIDO_USER_EMAIL'] && ENV['BUSHIDO_USER_ID']
|
||||||
|
# already logged in in Bushido
|
||||||
|
account = Account.create!({
|
||||||
|
:email => ENV['BUSHIDO_USER_EMAIL'],
|
||||||
|
:name => ENV['BUSHIDO_USER_NAME'] || ENV['BUSHIDO_USER_EMAIL'].split('@').first,
|
||||||
|
:password => ActiveSupport::SecureRandom.base64(6)
|
||||||
|
})
|
||||||
|
else
|
||||||
|
# create an anonymous account right away
|
||||||
|
account = Account.create!({
|
||||||
|
:email => "#{ENV['BUSHIDO_APP']}@#{ENV['BUSHIDO_HOST']}",
|
||||||
|
:name => ENV['BUSHIDO_APP'],
|
||||||
|
:password => ActiveSupport::SecureRandom.base64(6)
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
# create the site
|
||||||
|
site = Site.create_first_one(:name => ENV['LOCOMOTIVE_SITE_NAME'] || ENV['BUSHIDO_APP'])
|
||||||
|
|
||||||
|
# fetch the site template
|
||||||
|
template_url = ENV['SITE_TEMPLATE_URL'] || Locomotive::Import::DEFAULT_SITE_TEMPLATE
|
||||||
|
template_url = "http://#{template_url}" unless template_url =~ /^https?:\/\//
|
||||||
|
|
||||||
|
template_local_path = "#{Rails.root}/permanent/site_template.zip"
|
||||||
|
|
||||||
|
uri = URI.parse(template_url)
|
||||||
|
http = Net::HTTP.new(uri.host, uri.port)
|
||||||
|
|
||||||
|
if template_url.starts_with?('https') # ssl request ?
|
||||||
|
http.use_ssl = true
|
||||||
|
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
||||||
|
end
|
||||||
|
|
||||||
|
case http.request(Net::HTTP::Get.new(uri.request_uri))
|
||||||
|
when Net::HTTPSuccess, Net::HTTPFound
|
||||||
|
`curl -L -s -o #{template_local_path} #{template_url}`
|
||||||
|
|
||||||
|
Locomotive::Import::Job.run!(File.open(template_local_path), site, { :samples => true })
|
||||||
|
else
|
||||||
|
# do nothing
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
desc "Prepare an app to run on the Bushido hosting platform, called on every update. Called just before booting the app."
|
desc "Prepare an app to run on the Bushido hosting platform, called on every update. Called just before booting the app."
|
||||||
|
12
lib/tasks/locomotive.rake
Normal file
12
lib/tasks/locomotive.rake
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
namespace :locomotive do
|
||||||
|
|
||||||
|
desc 'Fetch the Locomotive default site template for the installation'
|
||||||
|
task :fetch_default_site_template => :environment do
|
||||||
|
puts "Downloading default site template from '#{Locomotive::Import.DEFAULT_SITE_TEMPLATE}'"
|
||||||
|
`curl -L -s -o #{Rails.root}/tmp/default_site_template.zip #{Locomotive::Import.DEFAULT_SITE_TEMPLATE}`
|
||||||
|
puts '...done'
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user