prepare locomotive as a gem

This commit is contained in:
dinedine 2010-12-16 13:39:05 +01:00
parent 88b1686053
commit 727a824745
11 changed files with 78 additions and 77 deletions

View File

@ -8,7 +8,7 @@ gem 'warden'
gem 'devise', '= 1.1.3' gem 'devise', '= 1.1.3'
gem 'mongoid', '2.0.0.beta.19' gem 'mongoid', '2.0.0.beta.19'
gem 'bson_ext', '1.1.4' gem 'bson_ext', '1.1.5'
gem 'locomotive_mongoid_acts_as_tree', '0.1.5.1', :require => 'mongoid_acts_as_tree' gem 'locomotive_mongoid_acts_as_tree', '0.1.5.1', :require => 'mongoid_acts_as_tree'
gem 'will_paginate' gem 'will_paginate'
@ -27,8 +27,8 @@ gem 'actionmailer-with-request'
gem 'heroku' gem 'heroku'
gem 'httparty', '>= 0.6.1' gem 'httparty', '>= 0.6.1'
gem 'RedCloth' gem 'RedCloth'
gem 'delayed_job', '2.1.0.pre2' gem 'delayed_job', '2.1.2'
gem 'delayed_job_mongoid', '1.0.0.rc' gem 'delayed_job_mongoid', '1.0.1'
gem 'rubyzip' gem 'rubyzip'
gem 'jammit-s3' gem 'jammit-s3'

View File

@ -7,9 +7,9 @@ GIT
GIT GIT
remote: http://github.com/ianwhite/pickle.git remote: http://github.com/ianwhite/pickle.git
revision: 55f2af5ff3f036f742605b34f5940ec663ff461a revision: 02483df89b513a9598f73be500af96fe8a398dda
specs: specs:
pickle (0.4.3) pickle (0.4.4)
cucumber (>= 0.8) cucumber (>= 0.8)
rake rake
rspec (>= 1.3) rspec (>= 1.3)
@ -53,7 +53,7 @@ GEM
autotest (4.4.6) autotest (4.4.6)
ZenTest (>= 4.4.1) ZenTest (>= 4.4.1)
bcrypt-ruby (2.1.2) bcrypt-ruby (2.1.2)
bson (1.1.4) bson (1.1.5)
bson_ext (1.1.4) bson_ext (1.1.4)
builder (2.1.2) builder (2.1.2)
capybara (0.4.0) capybara (0.4.0)
@ -87,11 +87,11 @@ GEM
mongoid (>= 2.0.0.beta.18) mongoid (>= 2.0.0.beta.18)
daemons (1.1.0) daemons (1.1.0)
database_cleaner (0.6.0) database_cleaner (0.6.0)
delayed_job (2.1.0.pre2) delayed_job (2.1.2)
activesupport (~> 3.0) activesupport (~> 3.0)
daemons daemons
delayed_job_mongoid (1.0.0.rc) delayed_job_mongoid (1.0.1)
delayed_job (~> 2.1) delayed_job (~> 2.1.1)
mongoid (~> 2.0) mongoid (~> 2.0)
devise (1.1.3) devise (1.1.3)
bcrypt-ruby (~> 2.1.2) bcrypt-ruby (~> 2.1.2)
@ -99,7 +99,7 @@ GEM
diff-lcs (1.1.2) diff-lcs (1.1.2)
erubis (2.6.6) erubis (2.6.6)
abstract (>= 1.0.0) abstract (>= 1.0.0)
excon (0.3.3) excon (0.3.4)
factory_girl (1.3.2) factory_girl (1.3.2)
factory_girl_rails (1.0) factory_girl_rails (1.0)
factory_girl (~> 1.3) factory_girl (~> 1.3)
@ -125,7 +125,7 @@ GEM
growl-glue (1.0.7) growl-glue (1.0.7)
haml (3.0.18) haml (3.0.18)
has_scope (0.5.0) has_scope (0.5.0)
heroku (1.14.8) heroku (1.14.10)
json_pure (>= 1.2.0, < 1.5.0) json_pure (>= 1.2.0, < 1.5.0)
launchy (~> 0.3.2) launchy (~> 0.3.2)
rest-client (>= 1.4.0, < 1.7.0) rest-client (>= 1.4.0, < 1.7.0)
@ -267,8 +267,8 @@ DEPENDENCIES
cucumber-rails cucumber-rails
custom_fields (= 1.0.0.beta2) custom_fields (= 1.0.0.beta2)
database_cleaner database_cleaner
delayed_job (= 2.1.0.pre2) delayed_job (= 2.1.2)
delayed_job_mongoid (= 1.0.0.rc) delayed_job_mongoid (= 1.0.1)
devise (= 1.1.3) devise (= 1.1.3)
factory_girl_rails factory_girl_rails
fog (= 0.3.7) fog (= 0.3.7)

View File

@ -17,10 +17,9 @@ test:
# set these environment variables on your prod server # set these environment variables on your prod server
production: production:
<<: *defaults <<: *defaults
database: locomotive_dev database: locomotive_prod
# <<: *defaults host: <%= ENV['MONGOID_HOST'] %>
# host: <%= ENV['MONGOID_HOST'] %> port: <%= ENV['MONGOID_PORT'] %>
# port: <%= ENV['MONGOID_PORT'] %> username: <%= ENV['MONGOID_USERNAME'] %>
# username: <%= ENV['MONGOID_USERNAME'] %> password: <%= ENV['MONGOID_PASSWORD'] %>
# password: <%= ENV['MONGOID_PASSWORD'] %> database: <%= ENV['MONGOID_DATABASE'] %>
# database: <%= ENV['MONGOID_DATABASE'] %>

View File

@ -1,7 +1,7 @@
BOARD: BOARD:
x jammit-s3: assets x jammit-s3: assets
- copy assets.yml config file when using it as gem - copy assets.yml config file when using it as gem (http://asciicasts.com/episodes/218-making-generators-in-rails-3)
- import theme without delayed_job - import theme without delayed_job
BACKLOG: BACKLOG:

View File

@ -1,14 +0,0 @@
module Locomotive
class CopyAssetsGenerator < Rails::Generators::Base
def self.source_root
@_locomotive_source_root ||= File.expand_path('../../../../../', __FILE__)
@_locomotive_source_root
end
def copy_public_files
directory 'public', 'public', :recursive => true
end
end
end

View File

@ -1,21 +1,27 @@
module Locomotive module Locomotive
class InstallGenerator < Rails::Generators::Base class InstallGenerator < Rails::Generators::Base
def self.source_root source_root File.expand_path('../../../../../', __FILE__)
@_locomotive_source_root ||= File.expand_path('../templates', __FILE__)
def copy_mongoid_config
copy_file 'config/mongoid.yml', 'config/mongoid.yml'
end end
def copy_assets
directory 'public', 'public', :recursive => true
copy_file 'config/assets.yml', 'config/assets.yml'
end
def copy_initializer def copy_initializer
@source_paths = nil # reset it for the find_in_source_paths method
Locomotive::InstallGenerator.source_root(File.expand_path('../templates', __FILE__))
template 'locomotive.rb', 'config/initializers/locomotive.rb' template 'locomotive.rb', 'config/initializers/locomotive.rb'
end end
def seed_db def remove_index_html
append_file 'db/seeds.rb', %{ remove_file 'public/index.html'
# Uncomment the following lines if you want to create the first website / account
#account = Account.create! :name => 'Admin', :email => 'admin@example.com', :password => 'locomotive', :password_confirmation => 'locomotive'
#site = Site.new :name => 'Locomotive test website', :subdomain => 'test'
#site.memberships.build :account => account, :admin => true
#site.save!}
end end
def show_readme def show_readme

View File

@ -1,17 +1,19 @@
=============================================================================== ===============================================================================
Locomotive initializer has been added to your application. Your db/seeds.rb file has also been updated. The Locomotive initializer has been added to your application.
1. Take a look at this to match your environment. 1. Edit the config/initializers/locomotive.rb file (+ the config/mongoid.yml one)
2. Uncomment added code in db/seeds.rb if necessary
Note: do not forget to run rake db:seed if you modify your db/seeds.rb file.
Once it is done, the next step is to install assets:
bundle exec rails g locomotive:copy_assets 2. Launch the server
Fire your application server and launch a browser ! > unicorn_rails
3. Open your browser
> open localhost:8080
4. Follow the installation wizzard steps
5. Enjoy !
=============================================================================== ===============================================================================

View File

@ -1,22 +1,24 @@
puts "...loading Locomotive engine" puts "...loading Locomotive engine"
require 'rails' require 'rails'
require 'heroku'
require 'inherited_resources'
require 'mimetype_fu'
require 'liquid'
require 'devise' require 'devise'
require 'carrierwave'
require 'formtastic'
require 'mongoid' require 'mongoid'
require 'mongoid_acts_as_tree' require 'mongoid_acts_as_tree'
require 'will_paginate'
require 'haml'
require 'liquid'
require 'formtastic'
require 'inherited_resources'
require 'carrierwave'
require 'custom_fields'
require 'mimetype_fu'
require 'actionmailer_with_request'
require 'heroku'
require 'httparty' require 'httparty'
require 'redcloth' require 'redcloth'
require 'actionmailer_with_request'
require 'zip/zipfilesystem'
require 'custom_fields'
require 'delayed_job_mongoid' require 'delayed_job_mongoid'
require 'will_paginate' require 'zip/zipfilesystem'
require 'jammit'
$:.unshift File.dirname(__FILE__) $:.unshift File.dirname(__FILE__)

View File

@ -26,6 +26,7 @@ module Locomotive
end end
def require_site def require_site
Locomotive.logger "[require_site] #{Account.count} account(s) / #{Site.count} site(s)"
redirect_to admin_installation_url and return false if Account.count == 0 || Site.count == 0 redirect_to admin_installation_url and return false if Account.count == 0 || Site.count == 0
render_no_site_error and return false if current_site.nil? render_no_site_error and return false if current_site.nil?

View File

@ -1,3 +1,3 @@
module Locomotive #:nodoc module Locomotive #:nodoc
VERSION = "0.0.4.beta5" VERSION = "0.0.4.beta6"
end end

View File

@ -18,28 +18,33 @@ Gem::Specification.new do |s|
s.rubyforge_project = "nowarning" s.rubyforge_project = "nowarning"
s.add_dependency "rails", ">= 3.0.0" s.add_dependency "rails", ">= 3.0.0"
s.add_dependency "locomotive_liquid", "2.2.2"
s.add_dependency "bson_ext", "1.1.1"
s.add_dependency "mongoid", "2.0.0.beta.19"
s.add_dependency "locomotive_mongoid_acts_as_tree", "0.1.5.1"
s.add_dependency "warden" s.add_dependency "warden"
s.add_dependency "devise", "= 1.1.3" s.add_dependency "devise", "= 1.1.3"
s.add_dependency "mongoid", "2.0.0.beta.19"
s.add_dependency "bson_ext", "1.1.5"
s.add_dependency "locomotive_mongoid_acts_as_tree", "0.1.5.1"
s.add_dependency "will_paginate"
s.add_dependency "haml", "= 3.0.18" s.add_dependency "haml", "= 3.0.18"
s.add_dependency "locomotive_liquid", "2.2.2"
s.add_dependency "formtastic", ">= 1.1.0"
s.add_dependency "inherited_resources", ">= 1.1.2"
s.add_dependency "rmagick", "= 2.12.2" s.add_dependency "rmagick", "= 2.12.2"
s.add_dependency "locomotive_carrierwave", "0.5.0.1.beta2"
s.add_dependency "custom_fields", "1.0.0.beta2"
s.add_dependency "fog" s.add_dependency "fog"
s.add_dependency "mimetype-fu" s.add_dependency "mimetype-fu"
s.add_dependency "formtastic", ">= 1.1.0"
s.add_dependency "locomotive_carrierwave", "0.5.0.1.beta2"
s.add_dependency "actionmailer-with-request" s.add_dependency "actionmailer-with-request"
s.add_dependency "heroku" s.add_dependency "heroku"
s.add_dependency "httparty", ">= 0.6.1" s.add_dependency "httparty", ">= 0.6.1"
s.add_dependency "RedCloth" s.add_dependency "RedCloth"
s.add_dependency "inherited_resources", ">= 1.1.2" s.add_dependency "delayed_job", "2.1.2"
s.add_dependency "delayed_job", "2.1.0.pre2" s.add_dependency "delayed_job_mongoid", "1.0.1"
s.add_dependency "delayed_job_mongoid", "1.0.0.rc"
s.add_dependency "custom_fields", "1.0.0.beta2"
s.add_dependency "rubyzip" s.add_dependency "rubyzip"
s.add_dependency "will_paginate" s.add_dependency "jammit-s3"
s.files = Dir[ "Gemfile", s.files = Dir[ "Gemfile",
"{app}/**/*", "{app}/**/*",