Skip to content

Commit 96cab16

Browse files
committed
Now you need to write 'yes' when updating to accept that you were told to backup. Sorted out what happens when (update or fresh install)
1 parent 203ee43 commit 96cab16

14 files changed

+50
-31
lines changed

Gemfile

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ end
2727
# gem 'aws-s3', :require => 'aws/s3'
2828

2929
# REFINERY CMS ================================================================
30+
# Anything you put in here will be overridden when the app gets updated.
3031

3132
# gem 'refinerycms', '~> 0.9.9.1'
3233

authentication/refinerycms-authentication.gemspec

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Gem::Specification.new do |s|
55
s.version = %q{0.9.9.1}
66
s.summary = %q{Authentication engine for Refinery CMS}
77
s.description = %q{The default authentication engine for Refinery CMS}
8-
s.date = %q{2011-02-14}
8+
s.date = %q{2011-02-15}
99
s.email = %q{[email protected]}
1010
s.homepage = %q{http://refinerycms.com}
1111
s.rubyforge_project = %q{refinerycms}

base/refinerycms-base.gemspec

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Gem::Specification.new do |s|
55
s.version = %q{0.9.9.1}
66
s.summary = %q{Base engine for Refinery CMS}
77
s.description = %q{The basic base for Refinery CMS Refinery CMS}
8-
s.date = %q{2011-02-14}
8+
s.date = %q{2011-02-15}
99
s.email = %q{[email protected]}
1010
s.homepage = %q{http://refinerycms.com}
1111
s.rubyforge_project = %q{refinerycms}

bin/refinerycms

+34-19
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,15 @@ module Refinery
213213
exit(1)
214214
end
215215
end
216+
217+
if @options[:update]
218+
puts "Please ensure you have a backup of your project and its database."
219+
puts "Type 'yes' to continue (anything other than 'yes' will cancel)"
220+
unless $stdin.gets.strip == 'yes'
221+
puts "Cancelling..."
222+
exit
223+
end
224+
end
216225
end
217226

218227
def update!
@@ -236,34 +245,32 @@ module Refinery
236245
exit(1)
237246
elsif defined? JRUBY_VERSION
238247
find_and_replace(@app_path.join('Gemfile'), /['|"]sqlite3['|"]/, "'activerecord-jdbcsqlite3-adapter'")
248+
249+
# Override username and password
250+
find_and_replace('config/database.yml', %r{username:.*}, "username: #{@options[:database][:username]}")
251+
find_and_replace('config/database.yml', %r{password:.*}, "password: #{@options[:database][:password]}")
252+
253+
puts "\n---------"
254+
puts "Refinery successfully installed in '#{@app_path}'!\n\n"
239255
end
240256
end
241257

242258
def bundle!
243-
# Add refinery gems to the Gemfile
244-
gemfile_contents = Refinery.root.join('Gemfile').read
245-
refinery_gems = gemfile_contents.match(/# REFINERY CMS =+.*# END REFINERY CMS =+/m)[0]
259+
# Insert the current REFINERY CMS section (you shouldn't put anything in here).
260+
refinery_gems = Refinery.root.join('Gemfile').read.match(/# REFINERY CMS =+.*# END REFINERY CMS =+/m)[0]
246261
refinery_gems.gsub!("# gem 'refinerycms'", "gem 'refinerycms'") # Enable refinerycms
247262
refinery_gems.gsub!("gem 'refinerycms-testing'", "# gem 'refinerycms-testing'") # Disable testing
248-
refinery_user_defined_gems = gemfile_contents.match(/# USER DEFINED(.*)# END USER DEFINED/m)
249-
refinery_user_defined_gems = refinery_user_defined_gems[1] unless refinery_user_defined_gems.nil?
250-
app_gemfile = @app_path.join('Gemfile')
251-
FileUtils::cp app_gemfile, "#{app_gemfile}.backup"
252263
unless @options[:update]
264+
app_gemfile = @app_path.join('Gemfile')
265+
FileUtils::cp app_gemfile, "#{app_gemfile}.backup"
253266
app_gemfile.open('a') do |f|
254267
f.write "\n#{refinery_gems}\n"
255-
@options[:gems] = ([refinery_user_defined_gems] | [@options[:gems]]).flatten.compact
256-
257268
f.write "\n# USER DEFINED\n#{@options[:gems].join("\n")}\n# END USER DEFINED" if @options[:gems].any?
258269
end
270+
else
271+
find_and_replace(@app_path.join('Gemfile'), /# REFINERY CMS =+.*# END REFINERY CMS =+/m, refinery_gems)
259272
end
260273

261-
# Override database username and password
262-
unless @options[:update]
263-
# Override username and password
264-
find_and_replace('config/database.yml', %r{username:.*}, "username: #{@options[:database][:username]}")
265-
find_and_replace('config/database.yml', %r{password:.*}, "password: #{@options[:database][:password]}")
266-
end
267274

268275
# Specify the correct version of the Refinery CMS gem (may be git source).
269276
src = Refinery.version !~ /\.pre$/ ? "'= #{Refinery.version}'" : ":git => 'git://github.com/resolve/refinerycms'"
@@ -273,15 +280,14 @@ module Refinery
273280
find_and_replace('Gemfile', "# gem 'aws-s3', :require => 'aws/s3'",
274281
"gem 'aws-s3', :require => 'aws/s3'") if @options[:heroku]
275282

276-
puts "\n---------"
277-
puts "Refinery successfully installed in '#{@app_path}'!\n\n"
278-
279283
# Automate
280284
# TODO: Check exit codes to see whether or not these worked
281285
puts "Installing gem requirements using bundler..\n"
282286

283287
# Ensure RefineryCMS is up to date if we're updating
284-
run_command("bundle update refinerycms refinerycms-generators", {:fail => "Unable to update core gems"}) if @options[:update]
288+
if @options[:update]
289+
run_command("bundle update refinerycms refinerycms-generators", {:fail => "Unable to update core gems"})
290+
end
285291

286292
# Install!
287293
run_command("bundle install", {:fail => "Unable to install necessary gems"})
@@ -328,6 +334,15 @@ module Refinery
328334
puts "heroku config:add S3_BUCKET=XXXXXXXXX S3_KEY=XXXXXXXXX S3_SECRET=XXXXXXXXXX"
329335
end
330336

337+
puts "\n--- Refinery CMS 0.9.9.1 note ---"
338+
puts "New 'core' engine called 'refinerycms-testing' which handles RSpec and Cucumber support."
339+
puts "You will see this disabled in your Gemfile in the '# REFINERY CMS' section."
340+
puts "To enable it, uncomment the gem line in your Gemfile and run:"
341+
puts "\nbundle install"
342+
puts "rails generate refinerycms_testing"
343+
puts "\nIf it prompts you about whether you want to overwrite any files that conflict, choose yes."
344+
puts "--- End upgrade note ---\n"
345+
331346
puts "\nThanks for installing Refinery, enjoy creating your new application!"
332347
puts "---------\n\n"
333348
end

core/lib/generators/refinerycms_generator.rb

+3
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,9 @@ def generate
8686
self.class.source_root.join('db', 'seeds.rb').read
8787
end
8888

89+
force_options = self.options.dup
90+
force_options[:force] = self.options[:force] || self.options[:update]
91+
self.options = force_options
8992
# Seeds and migrations now need to be copied from their various engines.
9093
existing_source_root = self.class.source_root
9194
::Refinery::Plugins.registered.pathnames.reject{|p| !p.join('db').directory?}.sort.each do |pathname|

core/refinerycms-core.gemspec

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Gem::Specification.new do |s|
55
s.version = %q{0.9.9.1}
66
s.summary = %q{Core engine for Refinery CMS}
77
s.description = %q{The core of Refinery CMS. This handles the common functionality and is required by most engines}
8-
s.date = %q{2011-02-14}
8+
s.date = %q{2011-02-15}
99
s.email = %q{[email protected]}
1010
s.homepage = %q{http://refinerycms.com}
1111
s.rubyforge_project = %q{refinerycms}

dashboard/refinerycms-dashboard.gemspec

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Gem::Specification.new do |s|
55
s.version = %q{0.9.9.1}
66
s.summary = %q{Dashboard engine for Refinery CMS}
77
s.description = %q{The dashboard is usually the first engine the user sees in the backend of Refinery CMS. It displays useful information and contains links to common functionality.}
8-
s.date = %q{2011-02-14}
8+
s.date = %q{2011-02-15}
99
s.email = %q{[email protected]}
1010
s.homepage = %q{http://refinerycms.com}
1111
s.rubyforge_project = %q{refinerycms}

images/refinerycms-images.gemspec

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Gem::Specification.new do |s|
55
s.version = %q{0.9.9.1}
66
s.summary = %q{Images engine for Refinery CMS}
77
s.description = %q{Handles all image upload and processing functionality in Refinery CMS.}
8-
s.date = %q{2011-02-14}
8+
s.date = %q{2011-02-15}
99
s.email = %q{[email protected]}
1010
s.homepage = %q{http://refinerycms.com}
1111
s.rubyforge_project = %q{refinerycms}

lib/gemspec.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
s.executables = %w(#{Dir['bin/*'].join(' ').gsub('bin/', '')})
4545
4646
# Bundler
47-
s.add_dependency 'bundler', '~> 1.0.5'
47+
s.add_dependency 'bundler', '~> 1.0.10'
4848
4949
# Refinery CMS
5050
s.add_dependency 'refinerycms-authentication', '~> #{::Refinery::Version}'

pages/refinerycms-pages.gemspec

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Gem::Specification.new do |s|
55
s.version = %q{0.9.9.1}
66
s.summary = %q{Pages engine for Refinery CMS}
77
s.description = %q{The default content engine of Refinery CMS. This engine handles the administration and display of user-editable pages.}
8-
s.date = %q{2011-02-14}
8+
s.date = %q{2011-02-15}
99
s.email = %q{[email protected]}
1010
s.homepage = %q{http://refinerycms.com}
1111
s.rubyforge_project = %q{refinerycms}

refinerycms.gemspec

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Gem::Specification.new do |s|
44
s.name = %q{refinerycms}
55
s.version = %q{0.9.9.1}
66
s.description = %q{A Ruby on Rails CMS that supports Rails 3. It's easy to extend and sticks to 'the Rails way' where possible.}
7-
s.date = %q{2011-02-14}
7+
s.date = %q{2011-02-15}
88
s.summary = %q{A Ruby on Rails CMS that supports Rails 3}
99
s.email = %q{[email protected]}
1010
s.homepage = %q{http://refinerycms.com}
@@ -15,7 +15,7 @@ Gem::Specification.new do |s|
1515
s.executables = %w(refinerycms)
1616

1717
# Bundler
18-
s.add_dependency 'bundler', '~> 1.0.5'
18+
s.add_dependency 'bundler', '~> 1.0.10'
1919

2020
# Refinery CMS
2121
s.add_dependency 'refinerycms-authentication', '~> 0.9.9.1'

resources/refinerycms-resources.gemspec

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Gem::Specification.new do |s|
55
s.version = %q{0.9.9.1}
66
s.summary = %q{Resources engine for Refinery CMS}
77
s.description = %q{Handles all file upload and processing functionality in Refinery CMS.}
8-
s.date = %q{2011-02-14}
8+
s.date = %q{2011-02-15}
99
s.email = %q{[email protected]}
1010
s.homepage = %q{http://refinerycms.com}
1111
s.rubyforge_project = %q{refinerycms}

settings/refinerycms-settings.gemspec

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Gem::Specification.new do |s|
55
s.version = %q{0.9.9.1}
66
s.summary = %q{Settings engine for Refinery CMS}
77
s.description = %q{The default settings engine that is required by Refinery CMS core. Adds programmer creatable, user editable settings for each engine.}
8-
s.date = %q{2011-02-14}
8+
s.date = %q{2011-02-15}
99
s.email = %q{[email protected]}
1010
s.homepage = %q{http://refinerycms.com}
1111
s.rubyforge_project = %q{refinerycms}

testing/refinerycms-testing.gemspec

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Gem::Specification.new do |s|
55
s.version = %q{0.9.9.1}
66
s.summary = %q{Testing plugin for Refinery CMS}
77
s.description = %q{This plugin adds the ability to run cucumber and rspec against the RefineryCMS gem while inside a RefineryCMS project}
8-
s.date = %q{2011-02-14}
8+
s.date = %q{2011-02-15}
99
s.email = %q{[email protected]}
1010
s.homepage = %q{http://refinerycms.com}
1111
s.rubyforge_project = %q{refinerycms}

0 commit comments

Comments
 (0)