refinerycms 0.9.7.8 → 0.9.7.9
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +4 -1
- data/Gemfile +1 -1
- data/bin/refinery-upgrade-096-to-097 +30 -13
- data/bin/refinerycms +32 -20
- data/changelog.md +14 -0
- data/db/migrate/20100729221735_remove_page_translations_if_present.rb +12 -0
- data/db/schema.rb +13 -15
- data/features/refinery/create_inquiries.feature +40 -0
- data/features/refinery/dashboard.feature +35 -1
- data/features/refinery/manage_files.feature +42 -1
- data/features/refinery/manage_images.feature +58 -1
- data/features/refinery/manage_inquiries.feature +55 -3
- data/features/refinery/manage_pages.feature +1 -1
- data/features/refinery/manage_refinery_settings.feature +1 -0
- data/features/refinery/manage_users.feature +1 -1
- data/features/refinery/plugin_generator.feature +27 -0
- data/features/refinery/site_bar.feature +4 -3
- data/features/refinery/theme_generator.feature +16 -0
- data/features/step_definitions/refinery/core_steps.rb +4 -0
- data/features/step_definitions/refinery/file_steps.rb +22 -0
- data/features/step_definitions/refinery/generator_steps.rb +11 -0
- data/features/step_definitions/refinery/image_steps.rb +43 -0
- data/features/step_definitions/refinery/inquiry_steps.rb +13 -0
- data/features/step_definitions/refinery/page_steps.rb +4 -6
- data/features/step_definitions/refinery/plugin_generator_steps.rb +16 -0
- data/features/step_definitions/refinery/theme_generator_steps.rb +15 -0
- data/features/step_definitions/refinery/user_steps.rb +1 -1
- data/features/step_definitions/web_steps.rb +18 -18
- data/features/support/env.rb +6 -7
- data/features/support/paths.rb +25 -1
- data/features/uploads/beach.INVALID +0 -0
- data/features/uploads/beach.jpeg +0 -0
- data/features/uploads/id-rather-be-here.jpg +0 -0
- data/features/uploads/refinery_is_awesome.txt +1 -0
- data/public/javascripts/refinery/admin.js +4 -4
- data/public/stylesheets/refinery/refinery.css +4 -1
- data/readme.md +1 -1
- data/todo.md +20 -8
- data/vendor/plugins/authentication/app/models/user.rb +1 -1
- data/vendor/plugins/dashboard/app/views/admin/dashboard/index.rss.builder +26 -0
- data/vendor/plugins/inquiries/app/views/admin/inquiries/_inquiry.html.erb +2 -1
- data/vendor/plugins/inquiries/app/views/admin/inquiry_settings/_confirmation_email_form.html.erb +9 -5
- data/vendor/plugins/inquiries/config/locales/en.yml +2 -2
- data/vendor/plugins/inquiries/config/routes.rb +14 -4
- data/vendor/plugins/pages/app/controllers/pages_controller.rb +3 -1
- data/vendor/plugins/refinery/app/views/shared/_google_analytics.html.erb +2 -2
- data/vendor/plugins/refinery/app/views/shared/_menu.html.erb +18 -13
- data/vendor/plugins/refinery/app/views/shared/admin/_form_actions.html.erb +3 -0
- data/vendor/plugins/refinery/app/views/shared/admin/_search.html.erb +1 -3
- data/vendor/plugins/refinery/config/locales/en.yml +1 -1
- data/vendor/plugins/refinery/lib/crud.rb +4 -1
- data/vendor/plugins/refinery/lib/generators/refinery/refinery_generator.rb +4 -61
- data/vendor/plugins/refinery/lib/generators/refinery_plugin/README +36 -0
- data/vendor/plugins/refinery/lib/generators/{refinery → refinery_plugin}/Rakefile +2 -3
- data/vendor/plugins/refinery/lib/generators/refinery_plugin/USAGE +2 -0
- data/vendor/plugins/refinery/lib/generators/{refinery → refinery_plugin}/install.rb +0 -0
- data/vendor/plugins/refinery/lib/generators/refinery_plugin/refinery_plugin_generator.rb +76 -0
- data/vendor/plugins/refinery/lib/generators/{refinery → refinery_plugin}/templates/MIGRATE +0 -0
- data/vendor/plugins/refinery/lib/generators/{refinery → refinery_plugin}/templates/config/locales/en.yml +4 -1
- data/vendor/plugins/refinery/lib/generators/{refinery → refinery_plugin}/templates/config/locales/nb.yml +4 -1
- data/vendor/plugins/refinery/lib/generators/{refinery → refinery_plugin}/templates/config/locales/nl.yml +4 -1
- data/vendor/plugins/refinery/lib/generators/{refinery → refinery_plugin}/templates/config/routes.rb +0 -0
- data/vendor/plugins/refinery/lib/generators/{refinery → refinery_plugin}/templates/controller.rb +0 -0
- data/vendor/plugins/refinery/lib/generators/{refinery → refinery_plugin}/templates/migration.rb +0 -0
- data/vendor/plugins/refinery/lib/generators/{refinery → refinery_plugin}/templates/model.rb +0 -0
- data/vendor/plugins/refinery/lib/generators/{refinery → refinery_plugin}/templates/public_controller.rb +0 -0
- data/vendor/plugins/refinery/lib/generators/refinery_plugin/templates/rails/init.rb +9 -0
- data/vendor/plugins/refinery/lib/generators/{refinery → refinery_plugin}/templates/seed.rb +0 -0
- data/vendor/plugins/refinery/lib/generators/{refinery → refinery_plugin}/templates/views/admin/_form.html.erb +0 -0
- data/vendor/plugins/refinery/lib/generators/{refinery → refinery_plugin}/templates/views/admin/_singular_name.html.erb +0 -0
- data/vendor/plugins/refinery/lib/generators/{refinery → refinery_plugin}/templates/views/admin/_sortable_list.html.erb +0 -0
- data/vendor/plugins/refinery/lib/generators/{refinery → refinery_plugin}/templates/views/admin/edit.html.erb +0 -0
- data/vendor/plugins/refinery/lib/generators/{refinery → refinery_plugin}/templates/views/admin/index.html.erb +0 -0
- data/vendor/plugins/refinery/lib/generators/{refinery → refinery_plugin}/templates/views/admin/new.html.erb +0 -0
- data/vendor/plugins/refinery/lib/generators/{refinery → refinery_plugin}/templates/views/index.html.erb +0 -0
- data/vendor/plugins/refinery/lib/generators/{refinery → refinery_plugin}/templates/views/show.html.erb +0 -0
- data/vendor/plugins/refinery/lib/refinery.rb +1 -1
- data/vendor/plugins/refinery/lib/refinery/activity.rb +3 -3
- data/vendor/plugins/refinery/lib/refinery/application_controller.rb +1 -1
- data/vendor/plugins/refinery/lib/tasks/refinery.rake +109 -32
- data/vendor/plugins/refinery/plugins.md +3 -3
- data/vendor/plugins/refinery_settings/app/models/refinery_setting.rb +26 -10
- data/vendor/plugins/refinery_settings/app/views/admin/refinery_settings/_form.html.erb +1 -2
- data/vendor/plugins/themes/generators/refinery_theme/README +17 -0
- data/vendor/plugins/themes/generators/refinery_theme/Rakefile +11 -0
- data/vendor/plugins/themes/generators/refinery_theme/USAGE +2 -0
- data/vendor/plugins/themes/generators/refinery_theme/install.rb +2 -0
- data/vendor/plugins/themes/generators/refinery_theme/refinery_theme_generator.rb +41 -0
- data/vendor/plugins/themes/generators/refinery_theme/templates/stylesheets/application.css +5 -0
- data/vendor/plugins/themes/generators/refinery_theme/templates/stylesheets/formatting.css +7 -0
- data/vendor/plugins/themes/generators/refinery_theme/templates/stylesheets/home.css +5 -0
- data/vendor/plugins/themes/generators/refinery_theme/templates/views/layouts/application.html.erb +21 -0
- data/vendor/plugins/themes/generators/refinery_theme/templates/views/pages/home.html.erb +4 -0
- data/vendor/plugins/themes/generators/refinery_theme/templates/views/pages/show.html.erb +4 -0
- data/vendor/plugins/themes/rails/init.rb +0 -1
- data/vendor/plugins/themes/readme.md +7 -2
- metadata +54 -28
- data/db/migrate/20100606173919_create_page_translations.rb +0 -12
- data/vendor/plugins/refinery/lib/generators/refinery/README +0 -30
- data/vendor/plugins/refinery/lib/generators/refinery/USAGE +0 -2
- data/vendor/plugins/refinery/lib/generators/refinery/templates/rails/init.rb +0 -13
@@ -0,0 +1,36 @@
|
|
1
|
+
== Refinery Plugin Generator
|
2
|
+
|
3
|
+
== Description
|
4
|
+
|
5
|
+
Generates a custom plugin for Refinery automatically. It works very similar to the Rails scaffold generator.
|
6
|
+
|
7
|
+
A generated plugin gives you all the basic files needed to manage the model the plugin will be for.
|
8
|
+
|
9
|
+
The first attribute should always be the one which is the title or name of the model.
|
10
|
+
|
11
|
+
There must be at least one attribute.
|
12
|
+
|
13
|
+
== Supported Field Types
|
14
|
+
|
15
|
+
string - standard input box
|
16
|
+
text - text area with a visual editor
|
17
|
+
image - link to an image picker dialogue
|
18
|
+
resource - link to a resource picker dialogue
|
19
|
+
|
20
|
+
== Usage
|
21
|
+
./script/generate refinery_plugin singular_name attribute:type [attribute2:type ...]
|
22
|
+
|
23
|
+
== Example
|
24
|
+
./script/generate refinery_plugin product title:string description:text image:image brochure:resource
|
25
|
+
|
26
|
+
Results in:
|
27
|
+
create /vendor/plugins/products/app/controllers/admin/products_controller.rb
|
28
|
+
create /vendor/plugins/products/app/models/product.rb
|
29
|
+
create /vendor/plugins/products/app/views/admin/products
|
30
|
+
create /vendor/plugins/products/app/views/admin/products/_form.html.erb
|
31
|
+
create /vendor/plugins/products/app/views/admin/products/_list.html.erb
|
32
|
+
create /vendor/plugins/products/app/views/admin/products/_make_sortable.html.erb
|
33
|
+
create /vendor/plugins/products/app/views/admin/products/edit.html.erb
|
34
|
+
create /vendor/plugins/products/app/views/admin/products/index.html.erb
|
35
|
+
create /vendor/plugins/products/app/views/admin/products/new.html.erb
|
36
|
+
create /vendor/plugins/products/app/views/admin/products/reorder.html.erb
|
@@ -2,11 +2,10 @@ require 'rake'
|
|
2
2
|
require 'rake/testtask'
|
3
3
|
require 'rake/rdoctask'
|
4
4
|
|
5
|
-
desc 'Generate documentation for the Refinery Generator plugin.'
|
5
|
+
desc 'Generate documentation for the Refinery Plugin Generator plugin.'
|
6
6
|
Rake::RDocTask.new(:rdoc) do |rdoc|
|
7
7
|
rdoc.rdoc_dir = 'rdoc'
|
8
|
-
rdoc.title = 'Refinery Generator'
|
8
|
+
rdoc.title = 'Refinery Plugin Generator'
|
9
9
|
rdoc.options << '--line-numbers' << '--inline-source'
|
10
10
|
rdoc.rdoc_files.include('README')
|
11
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
12
11
|
end
|
File without changes
|
@@ -0,0 +1,76 @@
|
|
1
|
+
class RefineryPluginGenerator < Rails::Generator::NamedBase
|
2
|
+
|
3
|
+
def initialize(*runtime_args)
|
4
|
+
super(*runtime_args)
|
5
|
+
$title_name = singular_name.gsub("_", " ").gsub(/\b([a-z])/) { $1.capitalize }
|
6
|
+
end
|
7
|
+
|
8
|
+
def banner
|
9
|
+
"Usage: ruby script/generate refinery_plugin singular_model_name attribute:type [attribute2:type ...]"
|
10
|
+
end
|
11
|
+
|
12
|
+
def manifest
|
13
|
+
if @args[0].nil? and @args[1].nil?
|
14
|
+
puts "You must specify a singular model name and a first attribute"
|
15
|
+
puts banner
|
16
|
+
exit
|
17
|
+
end
|
18
|
+
|
19
|
+
record do |m|
|
20
|
+
# Copy controller, model and migration
|
21
|
+
directories = ["#{plural_name}", "#{plural_name}/app", "#{plural_name}/app/controllers",
|
22
|
+
"#{plural_name}/app/controllers/admin", "#{plural_name}/app/models", "#{plural_name}/app/views",
|
23
|
+
"#{plural_name}/app/helpers", "#{plural_name}/app/views", "#{plural_name}/app/views/admin",
|
24
|
+
"#{plural_name}/config", "#{plural_name}/config/locales", "#{plural_name}/rails"].map { |d| "vendor/plugins/#{d}" }
|
25
|
+
|
26
|
+
directories.each do |dir|
|
27
|
+
m.directory dir
|
28
|
+
end
|
29
|
+
|
30
|
+
m.template "controller.rb", "vendor/plugins/#{plural_name}/app/controllers/admin/#{plural_name}_controller.rb"
|
31
|
+
m.template "model.rb", "vendor/plugins/#{plural_name}/app/models/#{singular_name}.rb"
|
32
|
+
m.template "config/routes.rb", "vendor/plugins/#{plural_name}/config/routes.rb"
|
33
|
+
Dir[File.expand_path(File.dirname(__FILE__) + "/templates/config/locales/*.yml")].each do |yml|
|
34
|
+
yml_filename = yml.split(File::SEPARATOR).last
|
35
|
+
m.template "config/locales/#{yml_filename}", "vendor/plugins/#{plural_name}/config/locales/#{yml_filename}"
|
36
|
+
end
|
37
|
+
|
38
|
+
# Create view directory
|
39
|
+
admin_view_dir = File.join("vendor/plugins/#{plural_name}/app/views/admin", plural_name)
|
40
|
+
m.directory admin_view_dir
|
41
|
+
|
42
|
+
# Copy in all views
|
43
|
+
admin_view_files = ['_form.html.erb', '_sortable_list.html.erb', 'edit.html.erb', 'index.html.erb', 'new.html.erb']
|
44
|
+
|
45
|
+
admin_view_files.each do |view_file|
|
46
|
+
m.template "views/admin/#{view_file}", "#{admin_view_dir}/#{view_file}"
|
47
|
+
end
|
48
|
+
|
49
|
+
m.template "views/admin/_singular_name.html.erb", "#{admin_view_dir}/_#{singular_name}.html.erb"
|
50
|
+
|
51
|
+
# Now for the public views and controller
|
52
|
+
public_dir = File.join("vendor/plugins/#{plural_name}/app/views/", plural_name)
|
53
|
+
m.directory public_dir
|
54
|
+
|
55
|
+
view_files = ['index.html.erb', 'show.html.erb']
|
56
|
+
view_files.each do |view_file|
|
57
|
+
m.template "views/#{view_file}", "#{public_dir}/#{view_file}"
|
58
|
+
end
|
59
|
+
|
60
|
+
m.template "public_controller.rb", "vendor/plugins/#{plural_name}/app/controllers/#{plural_name}_controller.rb"
|
61
|
+
|
62
|
+
# Add in the init file that ties the plugin to the app.
|
63
|
+
m.template "rails/init.rb", "vendor/plugins/#{plural_name}/rails/init.rb"
|
64
|
+
|
65
|
+
m.directory 'db/migrate/'
|
66
|
+
m.directory 'db/seeds/'
|
67
|
+
m.template 'seed.rb', "db/seeds/#{plural_name}.rb"
|
68
|
+
m.migration_template 'migration.rb', 'db/migrate',
|
69
|
+
:assigns => {:migration_name => "Create#{class_name.pluralize}"},
|
70
|
+
:migration_file_name => "create_#{singular_name.pluralize}"
|
71
|
+
|
72
|
+
m.readme "MIGRATE" unless RAILS_ENV == "test"
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
end
|
File without changes
|
@@ -1,4 +1,7 @@
|
|
1
1
|
en:
|
2
|
+
plugins:
|
3
|
+
<%= class_name.pluralize.underscore.downcase %>:
|
4
|
+
title: <%= plural_name.titleize %>
|
2
5
|
admin:
|
3
6
|
<%= plural_name %>:
|
4
7
|
index:
|
@@ -6,7 +9,7 @@ en:
|
|
6
9
|
reorder: Reorder <%= $title_name.pluralize %>
|
7
10
|
reorder_done: Done Reordering <%= $title_name.pluralize %>
|
8
11
|
sorry_no_results: Sorry! There are no results found.
|
9
|
-
no_items_yet: There are no <%=
|
12
|
+
no_items_yet: There are no <%= $title_name.pluralize %> yet. Click "Create a new <%= $title_name %>" to add your first <%= $title_name.downcase %>.
|
10
13
|
<%= singular_name %>:
|
11
14
|
view_live: View this <%= $title_name.downcase %> live <br/><em>(opens in a new window)</em>
|
12
15
|
edit: Edit this <%= $title_name.downcase %>
|
@@ -1,4 +1,7 @@
|
|
1
1
|
nb:
|
2
|
+
plugins:
|
3
|
+
<%= class_name.pluralize.underscore.downcase %>:
|
4
|
+
title: <%= plural_name.titleize %>
|
2
5
|
admin:
|
3
6
|
<%= plural_name %>:
|
4
7
|
index:
|
@@ -6,7 +9,7 @@ nb:
|
|
6
9
|
reorder: Endre rekkefølgen på <%= $title_name.pluralize %>
|
7
10
|
reorder_done: Ferdig å endre rekkefølgen <%= $title_name.pluralize %>
|
8
11
|
sorry_no_results: Beklager! Vi fant ikke noen resultater.
|
9
|
-
no_items_yet: Det er ingen <%=
|
12
|
+
no_items_yet: Det er ingen <%= $title_name.pluralize %> enda. Klikk på "Lag en ny <%= $title_name %>" for å legge til din første <%= $title_name.downcase %>.
|
10
13
|
<%= singular_name %>:
|
11
14
|
view_live: Vis hvordan denne <%= $title_name.downcase %> ser ut offentlig <br/><em>(åpner i et nytt vindu)</em>
|
12
15
|
edit: Rediger denne <%= $title_name.downcase %>
|
@@ -1,4 +1,7 @@
|
|
1
1
|
nl:
|
2
|
+
plugins:
|
3
|
+
<%= class_name.pluralize.underscore.downcase %>:
|
4
|
+
title: <%= plural_name.titleize %>
|
2
5
|
admin:
|
3
6
|
<%= plural_name %>:
|
4
7
|
index:
|
@@ -6,7 +9,7 @@ nl:
|
|
6
9
|
reorder: Wijzig de volgorde van de <%= $title_name.pluralize %>
|
7
10
|
reorder_done: Klaar met het wijzingen van de volgorde van de <%= $title_name.pluralize %>
|
8
11
|
sorry_no_results: Helaas! Er zijn geen resultaten gevonden.
|
9
|
-
no_items_yet: Er zijn nog geen <%=
|
12
|
+
no_items_yet: Er zijn nog geen <%= $title_name.pluralize %>. Druk op 'Maak een nieuwe <%= $title_name %>' om de eerste aan te maken.
|
10
13
|
<%= singular_name %>:
|
11
14
|
view_live: Bekijk deze <%= $title_name.downcase %> op de website <br/><em>(opent een nieuw venster)</em>
|
12
15
|
edit: Bewerk deze <%= $title_name.downcase %>
|
data/vendor/plugins/refinery/lib/generators/{refinery → refinery_plugin}/templates/config/routes.rb
RENAMED
File without changes
|
data/vendor/plugins/refinery/lib/generators/{refinery → refinery_plugin}/templates/controller.rb
RENAMED
File without changes
|
data/vendor/plugins/refinery/lib/generators/{refinery → refinery_plugin}/templates/migration.rb
RENAMED
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,9 @@
|
|
1
|
+
Refinery::Plugin.register do |plugin|
|
2
|
+
plugin.name = "<%= class_name.pluralize.underscore.downcase %>"
|
3
|
+
plugin.activity = {
|
4
|
+
:class => <%= class_name %><% if attributes.first.name != "title" %>,
|
5
|
+
:title => '<%= attributes.first.name %>'
|
6
|
+
<% end %>}
|
7
|
+
|
8
|
+
plugin.directory = directory # tell refinery where this plugin is located
|
9
|
+
end
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -11,11 +11,11 @@ module Refinery
|
|
11
11
|
:created_image => "add.png",
|
12
12
|
:limit => 7,
|
13
13
|
:nested_with => [],
|
14
|
-
:order =>
|
15
|
-
:title =>
|
14
|
+
:order => "updated_at DESC",
|
15
|
+
:title => "title",
|
16
16
|
:updated_image => "edit.png",
|
17
17
|
:url => nil,
|
18
|
-
:url_prefix => ""
|
18
|
+
:url_prefix => "edit"
|
19
19
|
}.merge(options).each { |key,value| self.instance_variable_set(:"@#{key}", value) }
|
20
20
|
end
|
21
21
|
|
@@ -86,12 +86,14 @@ namespace :refinery do
|
|
86
86
|
task :fix_image_paths_in_content => :environment do
|
87
87
|
Page.all.each do |p|
|
88
88
|
p.parts.each do |pp|
|
89
|
-
pp.update_attribute(:body,
|
89
|
+
pp.update_attribute(:body,
|
90
|
+
pp.body.gsub(/\/images\/system\//, "/system/images/"))
|
90
91
|
end
|
91
92
|
end
|
92
93
|
|
93
94
|
NewsItem.all.each do |ni|
|
94
|
-
ni.update_attribute(:body,
|
95
|
+
ni.update_attribute(:body,
|
96
|
+
ni.body.gsub(/\/images\/system\//, "/system/images/"))
|
95
97
|
end
|
96
98
|
|
97
99
|
end
|
@@ -106,26 +108,54 @@ namespace :refinery do
|
|
106
108
|
FileUtils::makedirs dirs.map {|dir| File.join(Rails.root, dir) }
|
107
109
|
|
108
110
|
# copy in the new assets.
|
109
|
-
assets = [%w(public stylesheets refinery),
|
111
|
+
assets = [%w(public stylesheets refinery),
|
112
|
+
%w(public javascripts refinery),
|
113
|
+
%w(public javascripts wymeditor),
|
114
|
+
%w(public images wymeditor skins refinery),
|
115
|
+
%w(public images refinery),
|
116
|
+
%w(public stylesheets wymeditor skins refinery),
|
117
|
+
%w(public javascripts jquery),
|
118
|
+
%w(.gitignore)]
|
110
119
|
assets.each do |asset|
|
111
|
-
|
112
|
-
FileUtils::
|
120
|
+
# ensure the destination is clear.
|
121
|
+
FileUtils::rm_rf File.join(Rails.root, asset),
|
122
|
+
:secure => true,
|
123
|
+
:verbose => verbose
|
124
|
+
|
125
|
+
# copy the new assets into the project.
|
126
|
+
FileUtils::cp_r File.join(Refinery.root, asset),
|
127
|
+
File.join(Rails.root, asset),
|
128
|
+
:verbose => verbose
|
113
129
|
end
|
114
130
|
|
115
131
|
# copy in any new migrations.
|
116
|
-
FileUtils::cp Dir[Refinery.root.join("db", "migrate", "*.rb").cleanpath.to_s],
|
132
|
+
FileUtils::cp Dir[Refinery.root.join("db", "migrate", "*.rb").cleanpath.to_s],
|
133
|
+
Rails.root.join("db", "migrate").cleanpath.to_s,
|
134
|
+
:verbose => verbose
|
117
135
|
|
118
136
|
# replace rakefile and gemfile.
|
119
|
-
FileUtils::cp Refinery.root.join("Rakefile").cleanpath.to_s,
|
137
|
+
FileUtils::cp Refinery.root.join("Rakefile").cleanpath.to_s,
|
138
|
+
Rails.root.join("Rakefile").cleanpath.to_s,
|
139
|
+
:verbose => verbose
|
140
|
+
|
120
141
|
unless Rails.root.join("Gemfile").exist?
|
121
|
-
FileUtils::cp Refinery.root.join("Gemfile").cleanpath.to_s,
|
142
|
+
FileUtils::cp Refinery.root.join("Gemfile").cleanpath.to_s,
|
143
|
+
Rails.root.join("Gemfile").cleanpath.to_s,
|
144
|
+
:verbose => verbose
|
122
145
|
else
|
123
146
|
# replace refinery's gem requirements in the Gemfile
|
124
|
-
refinery_gem_requirements = Refinery.root.join('Gemfile').read.to_s.scan(
|
147
|
+
refinery_gem_requirements = Refinery.root.join('Gemfile').read.to_s.scan(
|
148
|
+
/(#===REFINERY REQUIRED GEMS===.+?#===REFINERY END OF REQUIRED GEMS===)/m
|
149
|
+
).first.join('\n')
|
125
150
|
|
126
|
-
rails_gemfile_contents = Rails.root.join("Gemfile").read.to_s.gsub(
|
151
|
+
rails_gemfile_contents = Rails.root.join("Gemfile").read.to_s.gsub(
|
152
|
+
/(#===REFINERY REQUIRED GEMS===.+?#===REFINERY END OF REQUIRED GEMS===)/m,
|
153
|
+
refinery_gem_requirements
|
154
|
+
)
|
127
155
|
|
128
|
-
Rails.root.join("Gemfile").open('w+')
|
156
|
+
Rails.root.join("Gemfile").open('w+') do |f|
|
157
|
+
f.write(rails_gemfile_contents)
|
158
|
+
end
|
129
159
|
end
|
130
160
|
|
131
161
|
# Make cucumber features paths
|
@@ -134,18 +164,36 @@ namespace :refinery do
|
|
134
164
|
Rails.root.join('features', 'support').mkpath
|
135
165
|
|
136
166
|
# copy in cucumber features
|
137
|
-
FileUtils::cp Dir[Refinery.root.join('features', 'refinery', '*.feature').to_s],
|
138
|
-
|
139
|
-
|
140
|
-
|
167
|
+
FileUtils::cp Dir[Refinery.root.join('features', 'refinery', '*.feature').to_s],
|
168
|
+
Rails.root.join('features', 'refinery').to_s,
|
169
|
+
:verbose => verbose
|
170
|
+
|
171
|
+
FileUtils::cp Dir[Refinery.root.join('features', 'step_definitions', 'refinery', '*.rb').to_s],
|
172
|
+
Rails.root.join('features', 'step_definitions', 'refinery').to_s,
|
173
|
+
:verbose => verbose
|
174
|
+
|
175
|
+
FileUtils::cp Dir[Refinery.root.join('features', 'step_definitions', 'web_steps.rb').to_s],
|
176
|
+
Rails.root.join('features', 'step_definitions').to_s,
|
177
|
+
:verbose => verbose
|
178
|
+
|
179
|
+
FileUtils::cp Dir[Refinery.root.join('features', 'support', '*.rb').to_s],
|
180
|
+
Rails.root.join('features', 'support').to_s,
|
181
|
+
:verbose => verbose
|
141
182
|
|
142
183
|
# update the script directory for any fixes that have happened.
|
143
|
-
FileUtils::cp_r Dir[Refinery.root.join('script', '*').to_s],
|
144
|
-
|
184
|
+
FileUtils::cp_r Dir[Refinery.root.join('script', '*').to_s],
|
185
|
+
Rails.root.join('script').to_s,
|
186
|
+
:verbose => verbose
|
187
|
+
|
188
|
+
FileUtils::chmod_R 0755, Rails.root.join('script').to_s,
|
189
|
+
:verbose => verbose
|
145
190
|
|
146
191
|
# add the cucumber environment file if it's not present
|
147
192
|
unless (cucumber_environment_file = Rails.root.join('config', 'environments', 'cucumber.rb')).exist?
|
148
|
-
FileUtils::cp Refinery.root.join('config', 'environments', 'cucumber.rb').to_s,
|
193
|
+
FileUtils::cp Refinery.root.join('config', 'environments', 'cucumber.rb').to_s,
|
194
|
+
cucumber_environment_file.to_s,
|
195
|
+
:verbose => verbose
|
196
|
+
|
149
197
|
# Add cucumber database adapter (link to test)
|
150
198
|
existing_db_config = Rails.root.join('config', 'database.yml').read.to_s
|
151
199
|
Rails.root.join('config', 'database.yml').open('w+') do |f|
|
@@ -154,14 +202,20 @@ namespace :refinery do
|
|
154
202
|
end
|
155
203
|
|
156
204
|
# replace the preinitializer.
|
157
|
-
FileUtils::cp Refinery.root.join("config", "preinitializer.rb").cleanpath.to_s,
|
205
|
+
FileUtils::cp Refinery.root.join("config", "preinitializer.rb").cleanpath.to_s,
|
206
|
+
Rails.root.join("config", "preinitializer.rb").cleanpath.to_s,
|
207
|
+
:verbose => verbose
|
158
208
|
|
159
209
|
# replace the config.ru file
|
160
|
-
FileUtils::cp Refinery.root.join('config.ru').cleanpath.to_s,
|
210
|
+
FileUtils::cp Refinery.root.join('config.ru').cleanpath.to_s,
|
211
|
+
Rails.root.join('config.ru').cleanpath.to_s,
|
212
|
+
:verbose => verbose
|
161
213
|
|
162
214
|
# destroy any lib/refinery directory that we don't need anymore.
|
163
215
|
if Rails.root.join('lib', 'refinery').directory?
|
164
|
-
FileUtils::rm_rf Rails.root.join('lib', 'refinery').cleanpath.to_s,
|
216
|
+
FileUtils::rm_rf Rails.root.join('lib', 'refinery').cleanpath.to_s,
|
217
|
+
:secure => true,
|
218
|
+
:verbose => verbose
|
165
219
|
end
|
166
220
|
|
167
221
|
# copy any initializers
|
@@ -172,7 +226,9 @@ namespace :refinery do
|
|
172
226
|
end
|
173
227
|
|
174
228
|
unless (aai_config_file = Rails.root.join('config', 'acts_as_indexed_config.rb')).exist?
|
175
|
-
FileUtils::cp Refinery.root.join('config', 'acts_as_indexed_config.rb').to_s,
|
229
|
+
FileUtils::cp Refinery.root.join('config', 'acts_as_indexed_config.rb').to_s,
|
230
|
+
aai_config_file.to_s,
|
231
|
+
:verbose => verbose
|
176
232
|
end
|
177
233
|
|
178
234
|
# get current secret key
|
@@ -192,10 +248,14 @@ namespace :refinery do
|
|
192
248
|
|
193
249
|
# read in the config files
|
194
250
|
if Rails.root.join("config", "application.rb").exist?
|
195
|
-
FileUtils::cp Refinery.root.join("config", "environment.rb").cleanpath.to_s,
|
251
|
+
FileUtils::cp Refinery.root.join("config", "environment.rb").cleanpath.to_s,
|
252
|
+
Rails.root.join("config", "environment.rb").cleanpath.to_s,
|
253
|
+
:verbose => verbose
|
196
254
|
else
|
197
255
|
# write the new content into the file.
|
198
|
-
FileUtils::cp Refinery.root.join("config", "application.rb").cleanpath.to_s,
|
256
|
+
FileUtils::cp Refinery.root.join("config", "application.rb").cleanpath.to_s,
|
257
|
+
Rails.root.join("config", "application.rb").cleanpath.to_s,
|
258
|
+
:verbose => verbose
|
199
259
|
|
200
260
|
(app_rb_lines = Rails.root.join("config", "application.rb").read.split('\n')).each do |line|
|
201
261
|
secret_match = line.scan(/(:secret)([^']*)([\'])([^\']*)/).flatten.last
|
@@ -205,11 +265,15 @@ namespace :refinery do
|
|
205
265
|
# write the new content into the file.
|
206
266
|
Rails.root.join("config", "application.rb").open("w").puts(app_rb_lines.join('\n'))
|
207
267
|
|
208
|
-
FileUtils::cp Refinery.root.join('config', 'environment.rb').cleanpath.to_s,
|
268
|
+
FileUtils::cp Refinery.root.join('config', 'environment.rb').cleanpath.to_s,
|
269
|
+
Rails.root.join('config', 'environment.rb').cleanpath.to_s,
|
270
|
+
:verbose => verbose
|
209
271
|
end
|
210
272
|
|
211
273
|
unless Rails.root.join("config", "settings.rb").exist?
|
212
|
-
FileUtils::cp Refinery.root.join('config', 'settings.rb').cleanpath.to_s,
|
274
|
+
FileUtils::cp Refinery.root.join('config', 'settings.rb').cleanpath.to_s,
|
275
|
+
Rails.root.join('config', 'settings.rb').cleanpath.to_s,
|
276
|
+
:verbose => verbose
|
213
277
|
end
|
214
278
|
|
215
279
|
app_config_file = "application.rb"
|
@@ -217,23 +281,36 @@ namespace :refinery do
|
|
217
281
|
app_config = Rails.root.join("config", app_config_file).read
|
218
282
|
|
219
283
|
# copy new jquery javascripts.
|
220
|
-
FileUtils.cp Refinery.root.join('public', 'javascripts', 'jquery.js').cleanpath.to_s,
|
221
|
-
|
222
|
-
|
284
|
+
FileUtils.cp Refinery.root.join('public', 'javascripts', 'jquery.js').cleanpath.to_s,
|
285
|
+
Rails.root.join('public', 'javascripts', 'jquery.js').cleanpath.to_s,
|
286
|
+
:verbose => verbose
|
287
|
+
|
288
|
+
FileUtils.cp Refinery.root.join('public', 'javascripts', 'jquery-min.js').cleanpath.to_s,
|
289
|
+
Rails.root.join('public', 'javascripts', 'jquery-min.js').cleanpath.to_s,
|
290
|
+
:verbose => verbose
|
291
|
+
|
292
|
+
FileUtils.cp Refinery.root.join('public', 'javascripts', 'jquery-ui-custom-min.js').cleanpath.to_s,
|
293
|
+
Rails.root.join('public', 'javascripts', 'jquery-ui-custom-min.js').cleanpath.to_s,
|
294
|
+
:verbose => verbose
|
223
295
|
|
224
296
|
# Test the admin file to see if it's old
|
225
297
|
if ((admin_js_contents = Rails.root.join('public', 'javascripts', 'admin.js').readlines.join('')) == "if (!wymeditorClassesItems) {\n var wymeditorClassesItems = [];\n}\n\nwymeditorClassesItems = $.extend([\n {name: 'text-align', rules:['left', 'center', 'right', 'justify'], join: '-'}\n , {name: 'image-align', rules:['left', 'right'], join: '-'}\n , {name: 'font-size', rules:['small', 'normal', 'large'], join: '-'}\n], wymeditorClassesItems);")
|
226
|
-
FileUtils.cp Refinery.root.join('public', 'javascripts', 'admin.js'),
|
298
|
+
FileUtils.cp Refinery.root.join('public', 'javascripts', 'admin.js'),
|
299
|
+
Rails.root.join('public', 'javascripts', 'admin.js')
|
227
300
|
elsif admin_js_contents !~ Regexp.new("var custom_wymeditor_boot_options \\= \\{")
|
228
301
|
Rails.root.join('public', 'javascripts', 'admin.js').open('a') do |f|
|
229
302
|
f.write "#{Refinery.root.join('public', 'javascripts', 'admin.js').readlines.join()}\n"
|
230
303
|
end
|
231
304
|
end
|
232
305
|
# backup the config file.
|
233
|
-
FileUtils.cp Rails.root.join('config', app_config_file).cleanpath.to_s,
|
306
|
+
FileUtils.cp Rails.root.join('config', app_config_file).cleanpath.to_s,
|
307
|
+
Rails.root.join('config', "#{app_config_file.gsub('.rb', '')}.autobackupbyrefinery.rb").cleanpath.to_s,
|
308
|
+
:verbose => verbose
|
234
309
|
|
235
310
|
# copy the new config file.
|
236
|
-
FileUtils.cp Refinery.root.join('config', app_config_file).cleanpath.to_s,
|
311
|
+
FileUtils.cp Refinery.root.join('config', app_config_file).cleanpath.to_s,
|
312
|
+
Rails.root.join('config', app_config_file).cleanpath.to_s,
|
313
|
+
:verbose => verbose
|
237
314
|
|
238
315
|
puts "\n" if verbose
|
239
316
|
|