refinerycms-core 2.0.8 → 2.0.9

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.
Files changed (39) hide show
  1. data/app/assets/javascripts/refinery/admin.js.erb +3 -0
  2. data/app/assets/javascripts/wymeditor/functions.js.erb +1 -1
  3. data/app/assets/javascripts/wymeditor/lang/{zh_cn.js → zh-CN.js} +1 -1
  4. data/app/assets/javascripts/wymeditor/prototypes.js.erb +1 -1
  5. data/app/assets/stylesheets/refinery/layout.css.scss +26 -0
  6. data/app/views/refinery/admin/_image_picker.html.erb +1 -1
  7. data/app/views/refinery/admin/_resource_picker.html.erb +19 -21
  8. data/config/locales/es.yml +2 -2
  9. data/config/locales/fr.yml +9 -1
  10. data/lib/generators/refinery/cms/cms_generator.rb +6 -4
  11. data/lib/generators/refinery/core/templates/config/initializers/refinery/core.rb.erb +1 -0
  12. data/lib/generators/refinery/engine/engine_generator.rb +9 -3
  13. data/lib/generators/refinery/engine/templates/Gemfile +1 -0
  14. data/lib/generators/refinery/engine/templates/config/locales/zh-CN.yml +30 -0
  15. data/lib/generators/refinery/form/form_generator.rb +11 -7
  16. data/lib/generators/refinery/form/templates/config/locales/da.yml +60 -63
  17. data/lib/generators/refinery/form/templates/config/locales/de.yml +68 -68
  18. data/lib/generators/refinery/form/templates/config/locales/es.yml +60 -64
  19. data/lib/generators/refinery/form/templates/config/locales/fr.yml +68 -68
  20. data/lib/generators/refinery/form/templates/config/locales/it.yml +60 -62
  21. data/lib/generators/refinery/form/templates/config/locales/lv.yml +67 -67
  22. data/lib/generators/refinery/form/templates/config/locales/nb.yml +68 -71
  23. data/lib/generators/refinery/form/templates/config/locales/nl.yml +65 -64
  24. data/lib/generators/refinery/form/templates/config/locales/pt-BR.yml +68 -68
  25. data/lib/generators/refinery/form/templates/config/locales/ru.yml +70 -73
  26. data/lib/generators/refinery/form/templates/config/locales/sl.yml +61 -63
  27. data/lib/generators/refinery/form/templates/config/locales/zh-CN.yml +77 -3
  28. data/lib/refinery/application_controller.rb +1 -1
  29. data/lib/refinery/cli.rb +1 -1
  30. data/lib/refinery/core/engine.rb +2 -1
  31. data/lib/refinery/crud.rb +1 -1
  32. data/lib/refinery/extension_generation.rb +26 -14
  33. data/lib/refinery/version.rb +1 -1
  34. data/refinerycms-core.gemspec +1 -1
  35. data/spec/lib/generators/refinery/engine/engine_generator_multiple_resources_spec.rb +51 -0
  36. data/spec/lib/generators/refinery/engine/engine_generator_sanity_check_spec.rb +47 -0
  37. data/spec/lib/generators/refinery/engine/engine_generator_spec.rb +0 -12
  38. data/spec/lib/refinery/crud_spec.rb +2 -2
  39. metadata +11 -8
@@ -1,80 +1,77 @@
1
1
  ru:
2
- plugins:
3
- <%= plural_name %>:
4
- title: <%= plural_name.titleize %>
2
+ refinery:
3
+ plugins:
4
+ <%= plural_name %>:
5
+ title: <%= plural_name.titleize %>
6
+ <%= namespacing.underscore %>:
7
+ <%= plural_name %>:
8
+ new:
9
+ header_message: "Упс. Возникла небольшая проблемка."
10
+ message: "Нужно исправить следующие ошибки:"
11
+ send: "Отправить сообщение"
12
+ privacy_policy: "Мы относимся с уважением к вашим личным данным"
13
+ admin:
14
+ <%= plural_name %>:
15
+ <%= singular_name %>:
16
+ move_<%= singular_name %>_to_closed: "Переместить этот запрос в закрытые"
17
+ move_<%= singular_name %>_to_open: "Переместить этот запрос в открытые"
18
+ read_<%= singular_name %>: "Прочитать запрос"
19
+ remove_<%= singular_name %>: "Вы уверены, что хотите удалить запрос от '%{name}'?"
20
+ title: <%= plural_name.titleize %>
21
+ said: "пишет"
22
+ mark_as_spam: "Пометить как спам"
23
+ mark_as_ham: "Переместить во Входящие"
24
+ toggle_status:
25
+ closed: "Запрос '%{<%= singular_name %>}' закрыт"
26
+ reopened: "Запрос '%{<%= singular_name %>}' открыт заново"
27
+ submenu:
28
+ inbox: "Входящие"
29
+ spam: "Спам"
30
+ update_notified: Изменить получателей уведомлений
31
+ edit_confirmation_email: "Редактировать письмо-подтверждение"
32
+ index:
33
+ no_<%= plural_name %>: "Вы еще не получили ни одного запроса."
34
+ spam:
35
+ no_spam: "Ура! Вы не получили спам."
36
+ show:
37
+ details: "Подробности"
38
+ click_to_email: "Нажмите, чтобы отправить"
39
+ status: "Статус"
40
+ open: "Открыт"
41
+ closed: "Закрыт"
42
+ age: "Срок"
43
+ actions: "Действия"
44
+ back_to_all_<%= plural_name %>: "Назад ко всем запросам"
45
+ spam: "Спам"
46
+ spam_yes: 'да'
47
+ <%= singular_name %>: <%= class_name.underscore.titleize %>
48
+ title: <%= plural_name.titleize %>
49
+ settings:
50
+ update:
51
+ updated: "'%{setting}' были успешно обновлены."
52
+ notification_recipients_form:
53
+ settings_value_name: "Отправить уведомления"
54
+ explanation: "Каждый раз, когда кто-то связывается с вами посредством вашего сайта, Refinery CMS отправляет уведомление на электронную почту."
55
+ hint: "Когда поступит новый запрос, Refinery CMS отправит вам уведомление на электронную почту."
56
+ example: "Введите адрес(а) электронной почты через запятую: anna@mail.ru, ivanov@yandex.ru"
57
+ confirmation_email_form:
58
+ to: "Кому"
59
+ from: "От"
60
+ subject: "Тема сообщения"
61
+ click_to_edit_subject: "Редактировать тему сообщения"
62
+ explanation: "Каждый раз, когда кто-то связывается с вами посредством вашего сайта, Refinery CMS отправляет ему письмо, подтверждающее принятие запроса."
63
+ below_edit_email_sent: Ниже вы можете отредактировать отсылаемое письмо
64
+ the_customer_making_<%= singular_name %>: "Клиент, делающий запрос"
65
+ message: "Сообщение"
66
+ note: "Примечание: поместите текст %name% там, где вы хотите, чтобы появилось имя клиента."
67
+ subject_form:
68
+ subject_value_name: "Тема сообщения"
5
69
  activerecord:
6
70
  models:
7
71
  <%= singular_name %>: <%= class_name.underscore.titleize %>
8
72
  setting: "Настройки запроса"
9
73
  attributes:
10
74
  <%= singular_name %>:
11
- to: "Кому"
12
- from: "От"
13
- click_to_email: "Нажмите, чтобы отправить по этому адресу"
14
- phone: "Телефон"
15
- date: "Дата"
16
- message: "Сообщение"
17
- <%= namespacing.underscore %>:
18
- <%= plural_name %>:
19
- new:
20
- header_message: "Упс. Возникла небольшая проблемка."
21
- message: "Нужно исправить следующие ошибки:"
22
- send: "Отправить сообщение"
23
- privacy_policy: "Мы относимся с уважением к вашим личным данным"
24
- admin:
25
- <%= plural_name %>:
26
- <%= singular_name %>:
27
- move_<%= singular_name %>_to_closed: "Переместить этот запрос в закрытые"
28
- move_<%= singular_name %>_to_open: "Переместить этот запрос в открытые"
29
- read_<%= singular_name %>: "Прочитать запрос"
30
- remove_<%= singular_name %>: "Вы уверены, что хотите удалить запрос от '%{name}'?"
31
- title: <%= plural_name.titleize %>
32
- said: "пишет"
33
- mark_as_spam: "Пометить как спам"
34
- mark_as_ham: "Переместить во Входящие"
35
- toggle_status:
36
- closed: "Запрос '%{<%= singular_name %>}' закрыт"
37
- reopened: "Запрос '%{<%= singular_name %>}' открыт заново"
38
- submenu:
39
- inbox: "Входящие"
40
- spam: "Спам"
41
- update_notified: Изменить получателей уведомлений
42
- edit_confirmation_email: "Редактировать письмо-подтверждение"
43
- index:
44
- search_results_for: "Найти результаты для %{query}"
45
- no_<%= plural_name %>: "Вы еще не получили ни одного запроса."
46
- spam:
47
- no_spam: "Ура! Вы не получили спам."
48
- show:
49
- details: "Подробности"
50
- click_to_email: "Нажмите, чтобы отправить"
51
- status: "Статус"
52
- open: "Открыт"
53
- closed: "Закрыт"
54
- age: "Срок"
55
- actions: "Действия"
56
- back_to_all_<%= plural_name %>: "Назад ко всем запросам"
57
- spam: "Спам"
58
- spam_yes: 'да'
59
- <%= singular_name %>: <%= class_name.underscore.titleize %>
60
- title: <%= plural_name.titleize %>
61
- settings:
62
- update:
63
- updated: "'%{setting}' были успешно обновлены."
64
- notification_recipients_form:
65
- settings_value_name: "Отправить уведомления"
66
- explanation: "Каждый раз, когда кто-то связывается с вами посредством вашего сайта, Refinery CMS отправляет уведомление на электронную почту."
67
- hint: "Когда поступит новый запрос, Refinery CMS отправит вам уведомление на электронную почту."
68
- example: "Введите адрес(а) электронной почты через запятую: anna@mail.ru, ivanov@yandex.ru"
69
- confirmation_email_form:
70
- to: "Кому"
71
- from: "От"
72
- subject: "Тема сообщения"
73
- click_to_edit_subject: "Редактировать тему сообщения"
74
- explanation: "Каждый раз, когда кто-то связывается с вами посредством вашего сайта, Refinery CMS отправляет ему письмо, подтверждающее принятие запроса."
75
- below_edit_email_sent: Ниже вы можете отредактировать отсылаемое письмо
76
- the_customer_making_<%= singular_name %>: "Клиент, делающий запрос"
77
- message: "Сообщение"
78
- note: "Примечание: поместите текст %name% там, где вы хотите, чтобы появилось имя клиента."
79
- subject_form:
80
- subject_value_name: "Тема сообщения"
75
+ <% attributes.each do |a| -%>
76
+ <%= a.name %>: <%= a.name.humanize %>
77
+ <% end -%>
@@ -1,69 +1,67 @@
1
1
  sl:
2
- plugins:
3
- <%= plural_name %>:
4
- title: <%= plural_name.titleize %>
2
+ refinery:
3
+ plugins:
4
+ <%= plural_name %>:
5
+ title: <%= plural_name.titleize %>
6
+ <%= namespacing.underscore %>:
7
+ <%= plural_name %>:
8
+ new:
9
+ header_message: "Ups prišlo je do majhnega problema"
10
+ message: "Prosimo odpravite sledeče napake:"
11
+ send: Pošlji sporočilo
12
+ privacy_policy: "Cenimo vašo zasebnost"
13
+ admin:
14
+ <%= plural_name %>:
15
+ <%= singular_name %>:
16
+ said: pravi
17
+ move_<%= singular_name %>_to_closed: Premakni povpraševanje v zaprto
18
+ move_<%= singular_name %>_to_open: Premakni povpraševanje v odprto
19
+ read_<%= singular_name %>: Preberi povpraševanje
20
+ remove_<%= singular_name %>: "Ali ste prepričani da želite odstraniti povpraševanje od '%{name}'?"
21
+ title: <%= plural_name.titleize %>
22
+ toggle_status:
23
+ closed: "Povpraševanje '%{<%= singular_name %>}' je zaprto"
24
+ reopened: "Povpraševanje '%{<%= singular_name %>}' je ponovno odprto"
25
+ index:
26
+ no_<%= plural_name %>: Trenutno še ni nobenega povpraševanja.
27
+ submenu:
28
+ update_notified: Uredi prejemnike obvestila
29
+ edit_confirmation_email: Uredni potrditveni email
30
+ show:
31
+ details: Podrobnosti
32
+ click_to_email: Pošlji email sporočilo
33
+ status: Status
34
+ open: Odprto
35
+ closed: Zaprto
36
+ age: Starost
37
+ actions: Možnosti
38
+ back_to_all_<%= plural_name %>: Nazaj na vsa povpraševanja
39
+ <%= singular_name %>: <%= class_name.underscore.titleize %>
40
+ settings:
41
+ update:
42
+ updated: "'%{setting}' je bila uspešno posodobljena."
43
+ notification_recipients_form:
44
+ settings_value_name: Pošlji obvestilo na
45
+ explanation: "Vedno ko vas nekdo kontaktira na vaši spletni strani, vam Refinery pošlje email obvestilo o novem povpraševanju."
46
+ hint: "V zgornje polje vnesite email naslov. Želite da obvestila prejme več oseb? Vnesite več email naslovov ločenih z vejicami."
47
+ example: "Primer: jaz@domena.com, prijatelj@msn.com, sodelavec@work.com"
48
+ confirmation_email_form:
49
+ to: Za
50
+ from: Od
51
+ subject: Zadeva
52
+ click_to_edit_subject: Uredi zadevo
53
+ explanation: "Vedno ko vas nekdo kontaktira na vaši spletni strani mu Refinery pošlje email obvestilo o prejetem povpraševanju."
54
+ below_edit_email_sent: Spodaj lahko uredite vsebino email sporočila.
55
+ the_customer_making_<%= singular_name %>: Stranka, ki je poslala povpraševanje
56
+ message: Sporočilo
57
+ note: "Opomba: vstavite tekst %name% kjer želite, da se pojavi ime stranke v email sporočilu."
58
+ subject_form:
59
+ subject_value_name: Zadeva
5
60
  activerecord:
6
61
  models:
7
62
  <%= singular_name %>: <%= class_name.underscore.titleize %>
8
63
  attributes:
9
64
  <%= singular_name %>:
10
- to: Za
11
- from: Od
12
- click_to_email: Pošlji email sporočilo
13
- phone: Telefon
14
- date: Datum
15
- message: Sporočilo
16
- <%= namespacing.underscore %>:
17
- <%= plural_name %>:
18
- new:
19
- header_message: "Ups prišlo je do majhnega problema"
20
- message: "Prosimo odpravite sledeče napake:"
21
- send: Pošlji sporočilo
22
- privacy_policy: "Cenimo vašo zasebnost"
23
- admin:
24
- <%= plural_name %>:
25
- <%= singular_name %>:
26
- said: pravi
27
- move_<%= singular_name %>_to_closed: Premakni povpraševanje v zaprto
28
- move_<%= singular_name %>_to_open: Premakni povpraševanje v odprto
29
- read_<%= singular_name %>: Preberi povpraševanje
30
- remove_<%= singular_name %>: "Ali ste prepričani da želite odstraniti povpraševanje od '%{name}'?"
31
- title: <%= plural_name.titleize %>
32
- toggle_status:
33
- closed: "Povpraševanje '%{<%= singular_name %>}' je zaprto"
34
- reopened: "Povpraševanje '%{<%= singular_name %>}' je ponovno odprto"
35
- index:
36
- no_<%= plural_name %>: Trenutno še ni nobenega povpraševanja.
37
- submenu:
38
- update_notified: Uredi prejemnike obvestila
39
- edit_confirmation_email: Uredni potrditveni email
40
- show:
41
- details: Podrobnosti
42
- click_to_email: Pošlji email sporočilo
43
- status: Status
44
- open: Odprto
45
- closed: Zaprto
46
- age: Starost
47
- actions: Možnosti
48
- back_to_all_<%= plural_name %>: Nazaj na vsa povpraševanja
49
- <%= singular_name %>: <%= class_name.underscore.titleize %>
50
- settings:
51
- update:
52
- updated: "'%{setting}' je bila uspešno posodobljena."
53
- notification_recipients_form:
54
- settings_value_name: Pošlji obvestilo na
55
- explanation: "Vedno ko vas nekdo kontaktira na vaši spletni strani, vam Refinery pošlje email obvestilo o novem povpraševanju."
56
- hint: "V zgornje polje vnesite email naslov. Želite da obvestila prejme več oseb? Vnesite več email naslovov ločenih z vejicami."
57
- example: "Primer: jaz@domena.com, prijatelj@msn.com, sodelavec@work.com"
58
- confirmation_email_form:
59
- to: Za
60
- from: Od
61
- subject: Zadeva
62
- click_to_edit_subject: Uredi zadevo
63
- explanation: "Vedno ko vas nekdo kontaktira na vaši spletni strani mu Refinery pošlje email obvestilo o prejetem povpraševanju."
64
- below_edit_email_sent: Spodaj lahko uredite vsebino email sporočila.
65
- the_customer_making_<%= singular_name %>: Stranka, ki je poslala povpraševanje
66
- message: Sporočilo
67
- note: "Opomba: vstavite tekst %name% kjer želite, da se pojavi ime stranke v email sporočilu."
68
- subject_form:
69
- subject_value_name: Zadeva
65
+ <% attributes.each do |a| -%>
66
+ <%= a.name %>: <%= a.name.humanize %>
67
+ <% end -%>
@@ -1,4 +1,78 @@
1
1
  zh-CN:
2
- plugins:
3
- <%= plural_name %>:
4
- title: <%= plural_name.titleize %>
2
+ refinery:
3
+ plugins:
4
+ <%= plural_name %>:
5
+ title: <%= plural_name.titleize %>
6
+ description: 提供联系方式表格来存放 <%= plural_name.humanize.downcase %>
7
+ <%= namespacing.underscore %>:
8
+ <%= plural_name %>:
9
+ new:
10
+ send: 发送邮件
11
+ privacy_policy: 我们重视您的隐私
12
+ admin:
13
+ <%= plural_name %>:
14
+ delete: 永久删除 <%= singular_name.humanize.downcase %>
15
+ <%= singular_name %>:
16
+ read_<%= singular_name %>: 阅读这个 <%= singular_name.humanize.downcase %>
17
+ said: 说
18
+ mark_as_spam: 标记为垃圾邮件
19
+ mark_as_ham: 移动到收件箱
20
+ submenu:
21
+ inbox: 收件箱
22
+ spam: 垃圾邮件
23
+ update_notified: 通知相关人员
24
+ edit_confirmation_email: 编辑确认邮件
25
+ index:
26
+ no_<%= plural_name %>: 您尚未收到任何 <%= plural_name.humanize.downcase %>
27
+ spam:
28
+ no_spam: 太棒了!一封垃圾邮件都没有~
29
+ show:
30
+ details: 详细
31
+ age: 岁
32
+ actions: 操作
33
+ back_to_all_<%= plural_name %>: 返回到全部 <%= plural_name.humanize.downcase %>
34
+ spam: 垃圾信息
35
+ spam_yes: 是
36
+ <%= singular_name %>: <%= class_name.underscore.titleize %>
37
+ to: 收件人(To)
38
+ from: 发件人(From)
39
+ click_to_email: 点击来发送
40
+ phone: 电话
41
+ date: 日期
42
+ message: 信息
43
+ settings:
44
+ notification_recipients_form:
45
+ settings_value_name: 发通知给
46
+ explanation: 每当有人联系您时, Refinery都会发邮件给您.
47
+ hint: 当有新的 <%= singular_name.humanize.downcase %> 被提交时, Refinery 会发邮件告知您。
48
+ example: "输入您的Email地址, 形如: jack@work.com, jill@office.com"
49
+ confirmation_email_form:
50
+ to: 收件人
51
+ from: 发件人
52
+ subject: 主题
53
+ click_to_edit_subject: 点击编辑主题
54
+ explanation: 当有人试图联系您时,Refinery 都会发邮件跟他(拥有<%= singular_name.humanize.downcase %> 的人)进行确认
55
+ below_edit_email_sent: 您可以在下面编辑邮件内容
56
+ the_customer_making_<%= singular_name %>: 建立 <%= singular_name.humanize.downcase %> 的顾客
57
+ message: 邮件
58
+ note: "提示: 您可以在希望出现对方姓名的地方,使用%name%"
59
+ mailer:
60
+ notification:
61
+ greeting: 你好
62
+ you_recieved_new_<%= singular_name %>: 您刚刚收到了一封新 <%= singular_name.humanize.downcase %>.
63
+ <%= singular_name %>_starts: --- <%= singular_name.humanize.downcase %> 开始---
64
+ <%= singular_name %>_ends: --- <%= singular_name.humanize.downcase %> 结束---
65
+ from: 发件人
66
+ email: Email
67
+ phone: 电话
68
+ message: 正文
69
+ closing_line: 此致,
70
+ ps_html: 注:所有您的<%= plural_name.humanize.downcase %>都会保存在"<%= plural_name.titleize %>"里。这样您可以在任何时间查看它们。
71
+ activerecord:
72
+ models:
73
+ <%= singular_name %>: <%= class_name.underscore.titleize %>
74
+ attributes:
75
+ <%= singular_name %>:
76
+ <% attributes.each do |a| -%>
77
+ <%= a.name %>: <%= a.name.humanize %>
78
+ <% end -%>
@@ -24,7 +24,7 @@ module Refinery
24
24
 
25
25
  if Refinery::Core.rescue_not_found
26
26
  send :rescue_from, ActiveRecord::RecordNotFound,
27
- ActionController::UnknownAction,
27
+ ::AbstractController::ActionNotFound,
28
28
  ActionView::MissingTemplate,
29
29
  :with => :error_404
30
30
  end
@@ -48,7 +48,7 @@ module Refinery
48
48
  puts "You didn't specify anything valid to override. Here are some examples:"
49
49
  {
50
50
  :view => ['pages/home', 'refinery/pages/home', '**/*menu', '_menu_branch'],
51
- :javascript => %w(admin refinery/site_bar),
51
+ :javascript => %w(admin refinery/site_bar wymeditor**/{**/}*),
52
52
  :stylesheet => %w(home refinery/site_bar),
53
53
  :controller => %w(pages),
54
54
  :model => %w(page refinery/page),
@@ -108,7 +108,8 @@ module Refinery
108
108
  "wymeditor/skins/refinery/*",
109
109
  "wymeditor/skins/refinery/**/*",
110
110
  "modernizr-min.js",
111
- "dd_belatedpng.js"
111
+ "dd_belatedpng.js",
112
+ "admin.js"
112
113
  ]
113
114
  end
114
115
 
@@ -268,7 +268,7 @@ module Refinery
268
268
  params[:ul].each do |_, list|
269
269
  # After we drop Ruby 1.8.x support the following line can be changed back to
270
270
  # list.each do |index, hash|
271
- # because there won't be an ordering issue (see https://github.com/resolve/refinerycms/issues/1585)
271
+ # because there won't be an ordering issue (see https://github.com/refinery/refinerycms/issues/1585)
272
272
  list.sort_by {|k, v| k.to_i}.map { |item| item[1] }.each_with_index do |hash, index|
273
273
  moved_item_id = hash['id'].split(/#{singular_name}\_?/).reject(&:empty?).first
274
274
  @current_#{singular_name} = #{class_name}.find_by_id(moved_item_id)
@@ -122,7 +122,7 @@ module Refinery
122
122
  if options[:namespace].present? || options[:extension].present?
123
123
  # Increment the migration file leading number
124
124
  # Only relevant for nested or namespaced extensions, where a previous migration exists
125
- if %r{/migrate/\d+\w*.rb\z} === path
125
+ if %r{/migrate/\d+.*\.rb.erb\z} === path
126
126
  if last_migration = Dir["#{destination_pathname.join(path.split(File::SEPARATOR)[0..-2].join(File::SEPARATOR), '*.rb')}"].sort.last
127
127
  path.gsub!(%r{\d+_}) { |m| "#{last_migration.match(%r{migrate/(\d+)_})[1].to_i + 1}_" }
128
128
  end
@@ -130,10 +130,12 @@ module Refinery
130
130
 
131
131
  # Detect whether this is a special file that needs to get merged not overwritten.
132
132
  # This is important only when nesting extensions.
133
- if extension.present? && File.exist?(path)
133
+ # Routes and #{gem_name}\.rb have an .erb extension as path points to the generator template
134
+ # We have to exclude it when checking if the file already exists and include it in the regexps
135
+ if extension.present? && File.exist?(path.gsub(/\.erb$/, ""))
134
136
  if %r{/locales/.*\.yml$} === path ||
135
- %r{/routes.rb$} === path ||
136
- %r{/#{gem_name}.rb$} === path
137
+ %r{/routes\.rb\.erb$} === path ||
138
+ %r{/#{gem_name}\.rb\.erb$} === path
137
139
  # put new translations into a tmp directory
138
140
  if apply_tmp
139
141
  path = path.split(File::SEPARATOR).insert(-2, "tmp").
@@ -178,12 +180,14 @@ module Refinery
178
180
  end
179
181
 
180
182
  def exit_with_message!(message)
181
- puts ""
182
- puts message
183
- puts ""
183
+ STDERR.puts "\n#{message}\n\n"
184
184
  exit 1
185
185
  end
186
186
 
187
+ def extension_in_gemfile?
188
+ gemfile.read.scan(%r{#{gem_name}}).any?
189
+ end
190
+
187
191
  def finalize_extension!
188
192
  if self.behavior != :revoke and !self.options['pretend']
189
193
  puts_instructions!
@@ -202,21 +206,23 @@ module Refinery
202
206
  end
203
207
  end
204
208
 
205
- def extension_in_gemfile?
206
- gemfile.read.scan(%r{#{gem_name}}).any?
209
+ def generator_command
210
+ raise "You must override the method 'generator_command' in your generator."
207
211
  end
208
212
 
209
213
  def merge_locales!
210
214
  if existing_extension?
211
215
  # go through all of the temporary files and merge what we need into the current files.
212
216
  tmp_directories = []
213
- Dir.glob(source_pathname.join("{config/locales/*.yml,config/routes.rb,lib/refinerycms-extension_plural_name.rb}"), File::FNM_DOTMATCH).sort.each do |path|
217
+ Dir.glob(source_pathname.join("{config/locales/*.yml,config/routes.rb.erb,lib/refinerycms-extension_plural_name.rb.erb}"), File::FNM_DOTMATCH).sort.each do |path|
214
218
  # get the path to the current tmp file.
215
- new_file_path = extension_path_for(path, extension_name)
219
+ # Both the new and current paths need to strip the .erb portion from the generator template
220
+ new_file_path = Pathname.new extension_path_for(path, extension_name).to_s.gsub(/\.erb$/, "")
216
221
  tmp_directories << Pathname.new(new_file_path.to_s.split(File::SEPARATOR)[0..-2].join(File::SEPARATOR)) # save for later
217
222
  # get the path to the existing file and perform a deep hash merge.
218
- current_path = extension_path_for(path, extension_name, false)
223
+ current_path = Pathname.new extension_path_for(path, extension_name, false).to_s.gsub(/\.erb$/, "")
219
224
  new_contents = nil
225
+
220
226
  if File.exist?(new_file_path) && %r{.yml$} === new_file_path.to_s
221
227
  # merge translation files together.
222
228
  new_contents = YAML::load(new_file_path.read).deep_merge(
@@ -300,11 +306,17 @@ module Refinery
300
306
  else
301
307
  "Please specify the singular name '#{singular_name.singularize}' instead of '#{plural_name}'."
302
308
  end
303
- exit_with_message!(message)
309
+ exit_with_message! message
304
310
  end
305
311
 
306
312
  if attributes.empty? && self.behavior != :revoke
307
- exit_with_message!("You must specify a name and at least one field. For help: #{generator_command}")
313
+ exit_with_message! "You must specify a name and at least one field." \
314
+ "\nFor help, run: #{generator_command}"
315
+ end
316
+
317
+ if options[:extension].present? && !extension_pathname.directory?
318
+ exit_with_message! "You can't use '--extension #{options[:extension]}' option because" \
319
+ " extension with name #{options[:extension]} doesn't exist."
308
320
  end
309
321
  end
310
322