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 '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 'will_paginate'
@ -27,8 +27,8 @@ gem 'actionmailer-with-request'
gem 'heroku'
gem 'httparty', '>= 0.6.1'
gem 'RedCloth'
gem 'delayed_job', '2.1.0.pre2'
gem 'delayed_job_mongoid', '1.0.0.rc'
gem 'delayed_job', '2.1.2'
gem 'delayed_job_mongoid', '1.0.1'
gem 'rubyzip'
gem 'jammit-s3'

View File

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

View File

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

View File

@ -1,7 +1,7 @@
BOARD:
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
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
class InstallGenerator < Rails::Generators::Base
def self.source_root
@_locomotive_source_root ||= File.expand_path('../templates', __FILE__)
source_root File.expand_path('../../../../../', __FILE__)
def copy_mongoid_config
copy_file 'config/mongoid.yml', 'config/mongoid.yml'
end
def copy_assets
directory 'public', 'public', :recursive => true
copy_file 'config/assets.yml', 'config/assets.yml'
end
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'
end
def seed_db
append_file 'db/seeds.rb', %{
# 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!}
def remove_index_html
remove_file 'public/index.html'
end
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
2. Launch the server
Note: do not forget to run rake db:seed if you modify your db/seeds.rb file.
> unicorn_rails
Once it is done, the next step is to install assets:
3. Open your browser
bundle exec rails g locomotive:copy_assets
> open localhost:8080
Fire your application server and launch a browser !
4. Follow the installation wizzard steps
5. Enjoy !
===============================================================================

View File

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

View File

@ -26,6 +26,7 @@ module Locomotive
end
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
render_no_site_error and return false if current_site.nil?

View File

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

View File

@ -18,28 +18,33 @@ Gem::Specification.new do |s|
s.rubyforge_project = "nowarning"
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 "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 "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 "locomotive_carrierwave", "0.5.0.1.beta2"
s.add_dependency "custom_fields", "1.0.0.beta2"
s.add_dependency "fog"
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 "heroku"
s.add_dependency "httparty", ">= 0.6.1"
s.add_dependency "RedCloth"
s.add_dependency "inherited_resources", ">= 1.1.2"
s.add_dependency "delayed_job", "2.1.0.pre2"
s.add_dependency "delayed_job_mongoid", "1.0.0.rc"
s.add_dependency "custom_fields", "1.0.0.beta2"
s.add_dependency "delayed_job", "2.1.2"
s.add_dependency "delayed_job_mongoid", "1.0.1"
s.add_dependency "rubyzip"
s.add_dependency "will_paginate"
s.add_dependency "jammit-s3"
s.files = Dir[ "Gemfile",
"{app}/**/*",