comfortable_mexican_sofa 1.2.4 → 1.2.5

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -144,13 +144,15 @@ You can put this module in /config/initializers/comfortable\_mexican\_sofa.rb an
144
144
 
145
145
  Working with Fixtures
146
146
  ---------------------
147
- Sofa allows you to build entire site using files instead of updating database via admin area. This significantly speeds up initial content population. To enable fixtures go to the initializer and set this: `config.enable_fixtures = true`. You may also change the folder that is used to store fixtures.
147
+ Sofa allows you to build entire site using files instead of updating database via admin area. This significantly speeds up initial content population. Go to the initializer and set this to enable fixtures in development environment: `config.enable_fixtures = Rails.env.development?`. You may also change the folder that is used to store fixtures.
148
148
 
149
- If you run `rails g cms` you should find an example set of fixtures in [/db/cms\_fixtures](https://github.com/twg/comfortable-mexican-sofa/blob/master/db/cms_fixtures). If you run multiple sites, each set of fixtures should be inside a folder named as the hostname of the site. It's optional if you only have one site.
149
+ If you run `rails g cms` you should find an example set of fixtures in [/db/cms\_fixtures](https://github.com/twg/comfortable-mexican-sofa/blob/master/db/cms_fixtures).
150
150
 
151
151
  When fixtures are enabled, database is updated with each request, but only if fixture file is newer than the database entry. Database is also purged of items that are not defined in fixtures. So be careful not to clear out your database by mistake.
152
152
 
153
- When deploying to a production server don't forget to turn off fixtures. To load them into the database just run this rake task: `rake comfortable_mexican_sofa:fixtures:import`. When running multiple sites specify which one by passing argument like this: `SITE=example.com`.
153
+ To load fixtures into the database just run this rake task: `rake comfortable_mexican_sofa:fixtures:import FROM=example.local TO=example.com`. `from` indicates folder the fixtures are in and `to` is the Site hostname you have defined in the database.
154
+
155
+ If you need to dump database contents into fixture files run: `rake comfortable_mexican_sofa:fixtures:import FROM=example.com TO=example.local`. This will create example.local folder and dump all content from example.com Site.
154
156
 
155
157
  Active Components
156
158
  -----------------
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.2.4
1
+ 1.2.5
@@ -1,6 +1,7 @@
1
1
  class CmsAdmin::SitesController < CmsAdmin::BaseController
2
2
 
3
- skip_before_filter :load_admin_cms_site
3
+ skip_before_filter :load_admin_cms_site,
4
+ :load_fixtures
4
5
 
5
6
  before_filter :build_cms_site, :only => [:new, :create]
6
7
  before_filter :load_cms_site, :only => [:edit, :update, :destroy]
@@ -1,5 +1,7 @@
1
1
  class CmsAdmin::UploadsController < CmsAdmin::BaseController
2
2
 
3
+ skip_before_filter :load_fixtures
4
+
3
5
  before_filter :load_cms_upload, :only => :destroy
4
6
 
5
7
  def index
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{comfortable_mexican_sofa}
8
- s.version = "1.2.4"
8
+ s.version = "1.2.5"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Oleg Khabarov", "The Working Group Inc"]
12
- s.date = %q{2011-05-19}
12
+ s.date = %q{2011-05-30}
13
13
  s.description = %q{}
14
14
  s.email = %q{oleg@theworkinggroup.ca}
15
15
  s.extra_rdoc_files = [
@@ -6,24 +6,25 @@ end
6
6
  namespace :comfortable_mexican_sofa do
7
7
  namespace :fixtures do
8
8
 
9
- desc 'Import Fixture data into database (options: FOLDER=example.local SITE=example.com)'
9
+ desc 'Import Fixture data into database (options: FROM=example.local TO=example.com)'
10
10
  task :import => :environment do |task, args|
11
- hostname = args[:site] || args[:folder]
12
- site = Cms::Site.find_by_hostname(hostname)
13
- abort "Site with hostname [#{hostname}] not found. Aborting." if !site
11
+ to = args[:to] || args[:from]
12
+ from = args[:from]
14
13
 
15
- puts "Importing for #{site.hostname}"
16
- ComfortableMexicanSofa::Fixtures.import_all(site.hostname, (args[:site] || site.hostname))
14
+ abort "Site with hostname [#{to}] not found. Aborting." if !Cms::Site.find_by_hostname(to)
15
+ puts "Importing from Folder [#{from}] to Site [#{to}] ..."
16
+ ComfortableMexicanSofa::Fixtures.import_all(to, from)
17
17
  puts 'Done!'
18
18
  end
19
19
 
20
- desc 'Export database data into Fixtures (options: SITE=example.com FOLDER=example.local)'
20
+ desc 'Export database data into Fixtures (options: FROM=example.com TO=example.local)'
21
21
  task :export => :environment do |task, args|
22
- site = Cms::Site.find_by_hostname(args[:folder])
23
- abort "Site with hostname [#{hostname}] not found. Aborting." if !site
22
+ to = args[:to] || args[:from]
23
+ from = args[:from]
24
24
 
25
- puts "Exporting for #{site.hostname}"
26
- ComfortableMexicanSofa::Fixtures.export_all((args[:site] || site.hostname), site.hostname)
25
+ abort "Site with hostname [#{from}] not found. Aborting." if !Cms::Site.find_by_hostname(from)
26
+ puts "Exporting from Site [#{from}] to Folder [#{to}] ..."
27
+ ComfortableMexicanSofa::Fixtures.export_all(from, to)
27
28
  puts 'Done!'
28
29
  end
29
30
  end
@@ -55,7 +55,6 @@ class FixturesTest < ActionDispatch::IntegrationTest
55
55
  end
56
56
  end
57
57
  end
58
-
59
58
  end
60
59
 
61
60
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: comfortable_mexican_sofa
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 1.2.4
5
+ version: 1.2.5
6
6
  platform: ruby
7
7
  authors:
8
8
  - Oleg Khabarov
@@ -11,7 +11,7 @@ autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
13
 
14
- date: 2011-05-19 00:00:00 Z
14
+ date: 2011-05-30 00:00:00 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rails
@@ -325,7 +325,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
325
325
  requirements:
326
326
  - - ">="
327
327
  - !ruby/object:Gem::Version
328
- hash: 1078846512726975166
328
+ hash: 2921441635492529325
329
329
  segments:
330
330
  - 0
331
331
  version: "0"