refinerycms 0.9.8.7 → 0.9.8.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/Gemfile CHANGED
@@ -56,7 +56,7 @@ gem 'refinerycms-i18n', '~> 0.9'
56
56
 
57
57
  group :test do
58
58
  # RSpec
59
- gem 'rspec-rails', (RSPEC_VERSION = '~> 2.2')
59
+ gem 'rspec-rails', '~> 2.3'
60
60
  # Cucumber
61
61
  gem 'capybara'
62
62
  gem 'database_cleaner'
@@ -25,7 +25,11 @@ module Refinery
25
25
  # Default options
26
26
  @input = input
27
27
  @options = {
28
- :database => 'sqlite3',
28
+ :database => {
29
+ :adapter => 'sqlite3',
30
+ :username => 'root',
31
+ :password => ''
32
+ },
29
33
  :force => false,
30
34
  :heroku => false,
31
35
  :gems => []
@@ -41,7 +45,15 @@ module Refinery
41
45
  # Rails supports more options, but Refinery is only tested on these three
42
46
  databases = %w(mysql postgresql sqlite3)
43
47
  opts.on("-d DATABASE", "--database DATABASE", databases, "Select the database (default sqlite3)", " #{databases.join('/')}") do |db|
44
- @options[:database] = db
48
+ @options[:database][:adapter] = db
49
+ end
50
+
51
+ opts.on("-u USERNAME", '--database-username USERNAME', String, "Set the database username", ' (default root)') do |username|
52
+ @options[:database][:username] = username
53
+ end
54
+
55
+ opts.on("-p PASSWORD", '--database-password PASSWORD', String, "Set the database password", " (default '')") do |password|
56
+ @options[:database][:password] = password
45
57
  end
46
58
 
47
59
  opts.on("-g", "--gems gem1,gem2,gem3", Array, "Additional gems to install") do |gems|
@@ -119,7 +131,7 @@ module Refinery
119
131
  def generate!
120
132
  # Generate a rails application
121
133
  rails_command = "rails new \"#{@app_path}\""
122
- rails_command << " --database #{@options[:database]}"
134
+ rails_command << " --database #{@options[:database][:adapter]}"
123
135
  rails_command << " --force" if @options[:force]
124
136
  rails_command << " --skip-test-unit --skip-prototype"
125
137
  run_command(rails_command, {:cd => false})
@@ -160,6 +172,10 @@ module Refinery
160
172
  f.write "\n" + refinery_gems + "\n\n# USER DEFINED\n" + @options[:gems].join("\n") + "\n# END USER DEFINED"
161
173
  end
162
174
 
175
+ # Override database username and password
176
+ find_and_replace('config/database.yml', %r{username:.*}, "username: #{@options[:database][:username]}")
177
+ find_and_replace('config/database.yml', %r{password:.*}, "password: #{@options[:database][:password]}")
178
+
163
179
  # Specify the correct version of the Refinery CMS gem (may be git source).
164
180
  src = Refinery.version !~ /\.pre$/ ? "'~> #{Refinery.version}'" : ":git => 'git://github.com/resolve/refinerycms.git'"
165
181
  find_and_replace('Gemfile', "gem 'refinerycms', :path => '.'",
@@ -194,9 +210,11 @@ module Refinery
194
210
  puts "Installing gem requirements using bundler..\n"
195
211
  run_command("bundle install")
196
212
 
213
+ # sqlite3 requires we use 'db:migrate' etc instead of 'db:setup'
197
214
  puts "\n\nSetting up your development database..\n"
198
- %w(db:drop db:create db:migrate db:seed).each do |db|
199
- run_command("rake -f \"#{@app_path.join('Rakefile')}\" #{db}")
215
+ tasks = @options[:database][:adapter] == 'sqlite3' ? %w(db:migrate db:seed) : %w(db:setup)
216
+ tasks.each do |task|
217
+ run_command("rake -f \"#{@app_path.join('Rakefile')}\" #{task}")
200
218
  end
201
219
 
202
220
  # Deploy to Heroku
@@ -1,3 +1,8 @@
1
+ ## 0.9.8.8 [16 December 2010]
2
+ * Prevented RefinerySetting from accessing its database table before it is created. [Philip Arndt](https://github.com/parndt)
3
+ * Added more options to ``bin/refinerycms`` like ability to specify database username and password. [Philip Arndt](https://github.com/parndt)
4
+ * [See full list](https://github.com/resolve/refinerycms/compare/0.9.8.7...0.9.8.8)
5
+
1
6
  ## 0.9.8.7 [15 December 2010]
2
7
  * Fixed a problem with migration number clashes. [Philip Arndt](https://github.com/parndt)
3
8
  * Fixed problems with ``db:migrate`` for a new app on Postgres. [Jacob Buys](https://github.com/wjbuys)
@@ -28,7 +28,7 @@ module Refinery
28
28
  @major = 0
29
29
  @minor = 9
30
30
  @tiny = 8
31
- @build = 7
31
+ @build = 8
32
32
 
33
33
  class << self
34
34
  attr_reader :major, :minor, :tiny, :build
@@ -66,13 +66,13 @@ class RefinerySetting < ActiveRecord::Base
66
66
  Rails.cache.delete(self.cache_key)
67
67
 
68
68
  # generate new cache
69
- result = self.to_cache(RefinerySetting.all)
69
+ result = (self.to_cache(self.all) if self.table_exists?)
70
70
 
71
71
  # write cache
72
72
  Rails.cache.write(self.cache_key, result)
73
73
 
74
- # return cache
75
- result
74
+ # return cache, or lack thereof.
75
+ result ||= []
76
76
  end
77
77
 
78
78
  def cache_key
@@ -108,6 +108,8 @@ class RefinerySetting < ActiveRecord::Base
108
108
  alias :[] :get
109
109
 
110
110
  def set(name, value)
111
+ return value unless self.table_exists?
112
+
111
113
  scoping = (value[:scoping] if value.is_a?(Hash) and value.has_key?(:scoping))
112
114
  setting = find_or_initialize_by_name_and_scoping(:name => name.to_s, :scoping => scoping)
113
115
 
metadata CHANGED
@@ -6,8 +6,8 @@ version: !ruby/object:Gem::Version
6
6
  - 0
7
7
  - 9
8
8
  - 8
9
- - 7
10
- version: 0.9.8.7
9
+ - 8
10
+ version: 0.9.8.8
11
11
  platform: ruby
12
12
  authors:
13
13
  - Resolve Digital
@@ -17,7 +17,7 @@ autorequire:
17
17
  bindir: bin
18
18
  cert_chain: []
19
19
 
20
- date: 2010-12-15 00:00:00 +13:00
20
+ date: 2010-12-16 00:00:00 +13:00
21
21
  default_executable:
22
22
  dependencies:
23
23
  - !ruby/object:Gem::Dependency