peak_flow_utils 0.0.1 → 0.1.6
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.
- checksums.yaml +5 -5
- data/{LICENSE.txt → MIT-LICENSE} +1 -1
- data/README.md +22 -13
- data/Rakefile +20 -30
- data/app/assets/config/peak_flow_utils_manifest.js +2 -0
- data/app/assets/javascripts/peak_flow_utils/application.js +14 -0
- data/app/assets/stylesheets/peak_flow_utils/application.css +15 -0
- data/app/controllers/peak_flow_utils/application_controller.rb +13 -0
- data/app/controllers/peak_flow_utils/pings/sidekiq_pings_controller.rb +10 -0
- data/app/handlers/peak_flow_utils/application_handler.rb +36 -0
- data/app/handlers/peak_flow_utils/devise_handler.rb +126 -0
- data/app/handlers/peak_flow_utils/file_handler.rb +42 -0
- data/app/handlers/peak_flow_utils/model_handler.rb +123 -0
- data/app/handlers/peak_flow_utils/rails_handler.rb +206 -0
- data/app/handlers/peak_flow_utils/simple_form_handler.rb +76 -0
- data/app/handlers/peak_flow_utils/validations_handler.rb +85 -0
- data/app/handlers/peak_flow_utils/will_paginate_handler.rb +59 -0
- data/app/helpers/peak_flow_utils/application_helper.rb +2 -0
- data/app/jobs/peak_flow_utils/application_job.rb +2 -0
- data/app/mailers/peak_flow_utils/application_mailer.rb +4 -0
- data/app/migrations/20150902155200_create_translation_keys.rb +8 -0
- data/app/migrations/20150907070909_create_groups.rb +12 -0
- data/app/migrations/20150907090900_create_handlers.rb +9 -0
- data/app/migrations/20150908085500_create_translation_values.rb +13 -0
- data/app/migrations/20150908090800_create_handler_texts.rb +22 -0
- data/app/migrations/20160411190500_create_scanned_files.rb +10 -0
- data/app/migrations/peak_flow_utils/application_migration.rb +5 -0
- data/app/models/peak_flow_utils/application_record.rb +9 -0
- data/app/models/peak_flow_utils/group.rb +22 -0
- data/app/models/peak_flow_utils/handler.rb +14 -0
- data/app/models/peak_flow_utils/handler_text.rb +46 -0
- data/app/models/peak_flow_utils/scanned_file.rb +2 -0
- data/app/models/peak_flow_utils/translation_key.rb +8 -0
- data/app/models/peak_flow_utils/translation_value.rb +24 -0
- data/app/services/peak_flow_utils/application_service.rb +2 -0
- data/app/services/peak_flow_utils/attribute_service.rb +32 -0
- data/app/services/peak_flow_utils/configuration_service.rb +11 -0
- data/app/services/peak_flow_utils/database_initializer_service.rb +39 -0
- data/app/services/peak_flow_utils/erb_inspector.rb +71 -0
- data/app/services/peak_flow_utils/erb_inspector/file_inspector.rb +137 -0
- data/app/services/peak_flow_utils/erb_inspector/translation_inspector.rb +100 -0
- data/app/services/peak_flow_utils/group_service.rb +50 -0
- data/app/services/peak_flow_utils/handlers_finder_service.rb +25 -0
- data/app/services/peak_flow_utils/model_inspector.rb +133 -0
- data/app/services/peak_flow_utils/translation_service.rb +138 -0
- data/app/services/peak_flow_utils/translations_parser_service.rb +211 -0
- data/app/views/layouts/peak_flow_utils/application.html.erb +14 -0
- data/bin/peak_flow_rspec_files +4 -2
- data/config/routes.rb +2 -0
- data/lib/peak_flow_utils.rb +10 -2
- data/lib/peak_flow_utils/engine.rb +7 -0
- data/lib/peak_flow_utils/handler_helper.rb +39 -0
- data/lib/peak_flow_utils/rspec_helper.rb +162 -25
- data/lib/peak_flow_utils/version.rb +3 -0
- data/lib/tasks/peak_flow_utils_tasks.rake +6 -0
- metadata +121 -42
- data/.document +0 -5
- data/.rspec +0 -1
- data/.rubocop.yml +0 -83
- data/Gemfile +0 -20
- data/Gemfile.lock +0 -93
- data/VERSION +0 -1
- data/peak_flow_utils.gemspec +0 -65
- data/spec/peak_flow_utils_spec.rb +0 -7
- data/spec/spec_helper.rb +0 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 8331268ab7ca65fe644bc7c0cb9e883117c99b01fe6e3d34daf9dec4af27d06b
|
4
|
+
data.tar.gz: 34e18fd3e3ce075b58bbc1c2fdec0609f129a66be36c56a6e8b1505440af24a4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0edc2059a781d7ae3f826a798961b324a72dde0d82e509416b6088c4536b91d19fddfce6eeae9a7fd486db8a472941ac479d861ff34e1b97220ff7597fa9dd37
|
7
|
+
data.tar.gz: 5178465585583b4c21cf76ab9c1cd7d928e08fcfe564df2a35a81543ec26a6650f8f5af10dd8987e00242bdacc63125bcf95f3d6afc74c7d94e30e5b0026a25e
|
data/{LICENSE.txt → MIT-LICENSE}
RENAMED
data/README.md
CHANGED
@@ -1,19 +1,28 @@
|
|
1
|
-
#
|
1
|
+
# PeakFlowUtils
|
2
|
+
Short description and motivation.
|
2
3
|
|
3
|
-
|
4
|
+
## Usage
|
5
|
+
How to use my plugin.
|
4
6
|
|
5
|
-
##
|
7
|
+
## Installation
|
8
|
+
Add this line to your application's Gemfile:
|
6
9
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
* Start a feature/bugfix branch.
|
11
|
-
* Commit and push until you are happy with your contribution.
|
12
|
-
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
13
|
-
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
10
|
+
```ruby
|
11
|
+
gem 'peak_flow_utils'
|
12
|
+
```
|
14
13
|
|
15
|
-
|
14
|
+
And then execute:
|
15
|
+
```bash
|
16
|
+
$ bundle
|
17
|
+
```
|
16
18
|
|
17
|
-
|
18
|
-
|
19
|
+
Or install it yourself as:
|
20
|
+
```bash
|
21
|
+
$ gem install peak_flow_utils
|
22
|
+
```
|
19
23
|
|
24
|
+
## Contributing
|
25
|
+
Contribution directions go here.
|
26
|
+
|
27
|
+
## License
|
28
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
CHANGED
@@ -1,37 +1,27 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
require "rubygems"
|
4
|
-
require "bundler"
|
5
1
|
begin
|
6
|
-
|
7
|
-
rescue
|
8
|
-
|
9
|
-
$stderr.puts "Run `bundle install` to install missing gems"
|
10
|
-
exit e.status_code
|
2
|
+
require "bundler/setup"
|
3
|
+
rescue LoadError
|
4
|
+
puts "You must `gem install bundler` and `bundle install` to run rake tasks"
|
11
5
|
end
|
12
|
-
require "rake"
|
13
6
|
|
14
|
-
require "
|
15
|
-
Jeweler::Tasks.new do |gem|
|
16
|
-
# gem is a Gem::Specification... see http://guides.rubygems.org/specification-reference/ for more options
|
17
|
-
gem.name = "peak_flow_utils"
|
18
|
-
gem.homepage = "http://github.com/kaspernj/peak_flow_utils"
|
19
|
-
gem.license = "MIT"
|
20
|
-
gem.summary = %(Various utilities to help with building on PeakFlow)
|
21
|
-
gem.description = %(Various utilities to help with building on PeakFlow)
|
22
|
-
gem.email = "k@spernj.org"
|
23
|
-
gem.authors = ["kaspernj"]
|
24
|
-
# dependencies defined in Gemfile
|
25
|
-
end
|
26
|
-
Jeweler::RubygemsDotOrgTasks.new
|
7
|
+
require "rdoc/task"
|
27
8
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
9
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
10
|
+
rdoc.rdoc_dir = "rdoc"
|
11
|
+
rdoc.title = "PeakFlowUtils"
|
12
|
+
rdoc.options << "--line-numbers"
|
13
|
+
rdoc.rdoc_files.include("README.md")
|
14
|
+
rdoc.rdoc_files.include("lib/**/*.rb")
|
32
15
|
end
|
33
16
|
|
34
|
-
|
35
|
-
|
17
|
+
APP_RAKEFILE = File.expand_path("spec/dummy/Rakefile", __dir__)
|
18
|
+
load "rails/tasks/engine.rake"
|
19
|
+
|
20
|
+
load "rails/tasks/statistics.rake"
|
36
21
|
|
37
|
-
|
22
|
+
require "bundler/gem_tasks"
|
23
|
+
|
24
|
+
if Rails.env.development? || Rails.env.test?
|
25
|
+
require "best_practice_project"
|
26
|
+
BestPracticeProject.load_tasks
|
27
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
2
|
+
// listed below.
|
3
|
+
//
|
4
|
+
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
5
|
+
// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
|
6
|
+
//
|
7
|
+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
8
|
+
// compiled file. JavaScript code in this file should be added after the last require_* statement.
|
9
|
+
//
|
10
|
+
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
|
11
|
+
// about supported directives.
|
12
|
+
//
|
13
|
+
//= require activestorage
|
14
|
+
//= require_tree .
|
@@ -0,0 +1,15 @@
|
|
1
|
+
/*
|
2
|
+
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
3
|
+
* listed below.
|
4
|
+
*
|
5
|
+
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
6
|
+
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
|
7
|
+
*
|
8
|
+
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
|
9
|
+
* compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
|
10
|
+
* files in this directory. Styles in this file should be added after the last require_* statement.
|
11
|
+
* It is generally better to create a new file per style scope.
|
12
|
+
*
|
13
|
+
*= require_tree .
|
14
|
+
*= require_self
|
15
|
+
*/
|
@@ -0,0 +1,13 @@
|
|
1
|
+
class PeakFlowUtils::ApplicationController < ActionController::Base
|
2
|
+
protect_from_forgery with: :exception
|
3
|
+
|
4
|
+
before_action :authenticate
|
5
|
+
|
6
|
+
private
|
7
|
+
|
8
|
+
def authenticate
|
9
|
+
authenticate_or_request_with_http_basic do |username, password|
|
10
|
+
username == ENV.fetch("PEAK_FLOW_PINGS_USERNAME") && password == ENV.fetch("PEAK_FLOW_PINGS_PASSWORD")
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
class PeakFlowUtils::ApplicationHandler
|
2
|
+
def add_translations_for_hash(dir, _group, yielder, hash)
|
3
|
+
translations_for_hash_recursive(dir, hash[:translations], yielder, [])
|
4
|
+
end
|
5
|
+
|
6
|
+
def translations_for_hash_recursive(dir, hash, yielder, current_keys)
|
7
|
+
hash.each do |key, value|
|
8
|
+
current_keys << key
|
9
|
+
|
10
|
+
if value.is_a?(Hash)
|
11
|
+
translations_for_hash_recursive(dir, value, yielder, current_keys)
|
12
|
+
elsif value.is_a?(Array)
|
13
|
+
value.each_index do |index|
|
14
|
+
yielder << PeakFlowUtils::TranslationService.new(
|
15
|
+
dir: dir,
|
16
|
+
key: "#{current_keys.join('.')}[#{index}]",
|
17
|
+
key_show: "#{current_keys.join('.')}[#{index}]"
|
18
|
+
)
|
19
|
+
end
|
20
|
+
else
|
21
|
+
yielder << PeakFlowUtils::TranslationService.new(
|
22
|
+
dir: dir,
|
23
|
+
key: current_keys.join("."),
|
24
|
+
key_show: current_keys.join("."),
|
25
|
+
default: value
|
26
|
+
)
|
27
|
+
end
|
28
|
+
|
29
|
+
current_keys.pop
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def enabled?
|
34
|
+
true
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,126 @@
|
|
1
|
+
# rubocop:disable Metrics/LineLength
|
2
|
+
class PeakFlowUtils::DeviseHandler < PeakFlowUtils::ApplicationHandler
|
3
|
+
def enabled?
|
4
|
+
::Object.const_defined?(:Devise)
|
5
|
+
end
|
6
|
+
|
7
|
+
def groups
|
8
|
+
ArrayEnumerator.new do |yielder|
|
9
|
+
groups = ["devise"]
|
10
|
+
|
11
|
+
groups.each do |group|
|
12
|
+
yielder << PeakFlowUtils::GroupService.new(
|
13
|
+
id: group,
|
14
|
+
handler: self,
|
15
|
+
data: {
|
16
|
+
name: group.humanize
|
17
|
+
}
|
18
|
+
)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def translations_for_group(group)
|
24
|
+
ArrayEnumerator.new do |yielder|
|
25
|
+
dir = Rails.root.join("config", "locales", "awesome_translations", group.id).to_s
|
26
|
+
__send__("translations_for_#{group.id}", dir, group, yielder)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
private
|
31
|
+
|
32
|
+
def translations_for_devise(dir, group, yielder)
|
33
|
+
add_translations_for_hash(
|
34
|
+
dir,
|
35
|
+
group,
|
36
|
+
yielder,
|
37
|
+
translations: {
|
38
|
+
devise: {
|
39
|
+
confirmations: {
|
40
|
+
confirmed: "Your email address has been successfully confirmed.",
|
41
|
+
send_instructions: "You will receive an email with instructions for how to confirm your email address in a few minutes.",
|
42
|
+
send_paranoid_instructions: "If your email address exists in our database, you will receive an email with instructions for how to confirm your email address in a few minutes."
|
43
|
+
},
|
44
|
+
failure: failure,
|
45
|
+
mailer: {
|
46
|
+
confirmation_instructions: {
|
47
|
+
subject: "Confirmation instructions"
|
48
|
+
},
|
49
|
+
reset_password_instructions: {
|
50
|
+
subject: "Reset password instructions"
|
51
|
+
},
|
52
|
+
unlock_instructions: {
|
53
|
+
subject: "Unlock instructions"
|
54
|
+
}
|
55
|
+
},
|
56
|
+
omniauth_callbacks: {
|
57
|
+
failure: "Could not authenticate you from %{kind} because \"%{reason}\".",
|
58
|
+
success: "Successfully authenticated from %{kind} account."
|
59
|
+
},
|
60
|
+
passwords: {
|
61
|
+
no_token: "You can't access this page without coming from a password reset email. If you do come from a password reset email, please make sure you used the full URL provided.",
|
62
|
+
send_instructions: "You will receive an email with instructions on how to reset your password in a few minutes.",
|
63
|
+
send_paranoid_instructions: "If your email address exists in our database, you will receive a password recovery link at your email address in a few minutes.",
|
64
|
+
updated: "Your password has been changed successfully. You are now signed in.",
|
65
|
+
updated_not_active: "Your password has been changed successfully."
|
66
|
+
},
|
67
|
+
registrations: registrations,
|
68
|
+
sessions: {
|
69
|
+
signed_in: "Signed in successfully.",
|
70
|
+
signed_out: "Signed out successfully.",
|
71
|
+
already_signed_out: "Signed out successfully."
|
72
|
+
},
|
73
|
+
unlocks: {
|
74
|
+
send_instructions: "You will receive an email with instructions for how to unlock your account in a few minutes.",
|
75
|
+
send_paranoid_instructions: "If your account exists, you will receive an email with instructions for how to unlock it in a few minutes.",
|
76
|
+
unlocked: "Your account has been unlocked successfully. Please sign in to continue."
|
77
|
+
}
|
78
|
+
},
|
79
|
+
errors: errors
|
80
|
+
}
|
81
|
+
)
|
82
|
+
end
|
83
|
+
|
84
|
+
def failure
|
85
|
+
{
|
86
|
+
already_authenticated: "You are already signed in.",
|
87
|
+
inactive: "Your account is not activated yet.",
|
88
|
+
invalid: "Invalid %{authentication_keys} or password.",
|
89
|
+
locked: "Your account is locked.",
|
90
|
+
last_attempt: "You have one more attempt before your account is locked.",
|
91
|
+
not_found_in_database: "Invalid %{authentication_keys} or password.",
|
92
|
+
timeout: "Your session expired. Please sign in again to continue.",
|
93
|
+
unauthenticated: "You need to sign in or sign up before continuing.",
|
94
|
+
unconfirmed: "You have to confirm your email address before continuing."
|
95
|
+
}
|
96
|
+
end
|
97
|
+
|
98
|
+
def registrations
|
99
|
+
{
|
100
|
+
destroyed: "Bye! Your account has been successfully cancelled. We hope to see you again soon.",
|
101
|
+
signed_up: "Welcome! You have signed up successfully.",
|
102
|
+
signed_up_but_inactive: "You have signed up successfully. However, we could not sign you in because your account is not yet activated.",
|
103
|
+
signed_up_but_locked: "You have signed up successfully. However, we could not sign you in because your account is locked.",
|
104
|
+
signed_up_but_unconfirmed: "A message with a confirmation link has been sent to your email address. Please follow the link to activate your account.",
|
105
|
+
update_needs_confirmation: "You updated your account successfully, but we need to verify your new email address. Please check your email and follow the confirm link to confirm your new email address.",
|
106
|
+
updated: "Your account has been updated successfully."
|
107
|
+
}
|
108
|
+
end
|
109
|
+
|
110
|
+
def errors
|
111
|
+
{
|
112
|
+
messages: {
|
113
|
+
already_confirmed: "was already confirmed, please try signing in",
|
114
|
+
confirmation_period_expired: "needs to be confirmed within %{period}, please request a new one",
|
115
|
+
expired: "has expired, please request a new one",
|
116
|
+
not_found: "not found",
|
117
|
+
not_locked: "was not locked",
|
118
|
+
not_saved: {
|
119
|
+
one: "1 error prohibited this %{resource} from being saved:",
|
120
|
+
other: "%{count} errors prohibited this %{resource} from being saved:"
|
121
|
+
}
|
122
|
+
}
|
123
|
+
}
|
124
|
+
end
|
125
|
+
end
|
126
|
+
# rubocop:enable Metrics/LineLength
|
@@ -0,0 +1,42 @@
|
|
1
|
+
class PeakFlowUtils::FileHandler < PeakFlowUtils::ApplicationHandler
|
2
|
+
def groups
|
3
|
+
ArrayEnumerator.new do |yielder|
|
4
|
+
erb_inspector.files.each do |file|
|
5
|
+
id = file.file_path.gsub(/[^A-z0-9]/, "_")
|
6
|
+
|
7
|
+
group = PeakFlowUtils::GroupService.new(
|
8
|
+
id: id,
|
9
|
+
handler: self,
|
10
|
+
data: {
|
11
|
+
name: file.file_path,
|
12
|
+
root_path: file.root_path,
|
13
|
+
full_path: file.full_path,
|
14
|
+
file_path: file.file_path
|
15
|
+
}
|
16
|
+
)
|
17
|
+
|
18
|
+
yielder << group if translations_for_group(group).any?
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def translations_for_group(group)
|
24
|
+
ArrayEnumerator.new do |yielder|
|
25
|
+
translations_found = {}
|
26
|
+
|
27
|
+
file = erb_inspector.file(group.data.fetch(:root_path), group.data.fetch(:file_path))
|
28
|
+
file.translations.each do |translation|
|
29
|
+
next if translations_found.key?(translation.full_key)
|
30
|
+
|
31
|
+
translations_found[translation.full_key] = true
|
32
|
+
yielder << translation.model
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
private
|
38
|
+
|
39
|
+
def erb_inspector
|
40
|
+
@erb_inspector ||= PeakFlowUtils::ErbInspector.new
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,123 @@
|
|
1
|
+
class PeakFlowUtils::ModelHandler < PeakFlowUtils::ApplicationHandler
|
2
|
+
def groups
|
3
|
+
ArrayEnumerator.new do |yielder|
|
4
|
+
PeakFlowUtils::ModelInspector.model_classes.each do |model_inspector|
|
5
|
+
yielder << PeakFlowUtils::GroupService.new(
|
6
|
+
id: model_inspector.clazz.name,
|
7
|
+
handler: self
|
8
|
+
)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def translations_for_group(group)
|
14
|
+
ArrayEnumerator.new do |yielder|
|
15
|
+
model_inspector = PeakFlowUtils::ModelInspector.model_classes.find { |model_inspector_i| model_inspector_i.clazz.name == group.name }
|
16
|
+
raise "No inspector by that name: #{group.name}" unless model_inspector
|
17
|
+
|
18
|
+
model_names(model_inspector).each { |translation| yielder << translation }
|
19
|
+
active_record_attributes(model_inspector).each { |translation| yielder << translation }
|
20
|
+
paperclip_attachments(model_inspector).each { |translation| yielder << translation }
|
21
|
+
relationships(model_inspector).each { |translation| yielder << translation }
|
22
|
+
monetized_attributes(model_inspector).each { |translation| yielder << translation }
|
23
|
+
globalize_attributes(model_inspector).each { |translation| yielder << translation }
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
private
|
28
|
+
|
29
|
+
def dir_path(model_inspector)
|
30
|
+
class_name = model_inspector.clazz.name
|
31
|
+
class_name = class_name.gsub("::", "_")
|
32
|
+
class_name = class_name.underscore
|
33
|
+
|
34
|
+
dir_path = Rails.root.join("config", "locales", "awesome_translations", "models", class_name)
|
35
|
+
|
36
|
+
dir_path.to_s
|
37
|
+
end
|
38
|
+
|
39
|
+
def active_record_attributes(model_inspector)
|
40
|
+
result = []
|
41
|
+
|
42
|
+
model_inspector.attributes.each do |attribute|
|
43
|
+
translations = {}
|
44
|
+
|
45
|
+
I18n.available_locales.each do |locale|
|
46
|
+
translations[locale] = I18n.t(attribute.i18n_key, locale: locale)
|
47
|
+
end
|
48
|
+
|
49
|
+
result << PeakFlowUtils::TranslationService.new(
|
50
|
+
key: attribute.i18n_key,
|
51
|
+
dir: dir_path(model_inspector)
|
52
|
+
)
|
53
|
+
end
|
54
|
+
|
55
|
+
result
|
56
|
+
end
|
57
|
+
|
58
|
+
def paperclip_attachments(model_inspector)
|
59
|
+
result = []
|
60
|
+
|
61
|
+
model_inspector.paperclip_attachments do |name|
|
62
|
+
result << PeakFlowUtils::TranslationService.new(
|
63
|
+
key: model_inspector.attribute_key(name),
|
64
|
+
dir: dir_path(model_inspector)
|
65
|
+
)
|
66
|
+
end
|
67
|
+
|
68
|
+
result
|
69
|
+
end
|
70
|
+
|
71
|
+
def model_names(model_inspector)
|
72
|
+
result = []
|
73
|
+
result << PeakFlowUtils::TranslationService.new(
|
74
|
+
key: model_inspector.class_key_one,
|
75
|
+
dir: dir_path(model_inspector)
|
76
|
+
)
|
77
|
+
result << PeakFlowUtils::TranslationService.new(
|
78
|
+
key: model_inspector.class_key_other,
|
79
|
+
dir: dir_path(model_inspector)
|
80
|
+
)
|
81
|
+
|
82
|
+
result
|
83
|
+
end
|
84
|
+
|
85
|
+
def relationships(model_inspector)
|
86
|
+
result = []
|
87
|
+
|
88
|
+
model_inspector.relationships do |_key, reflection|
|
89
|
+
result << PeakFlowUtils::TranslationService.new(
|
90
|
+
key: model_inspector.attribute_key(reflection.name),
|
91
|
+
dir: dir_path(model_inspector)
|
92
|
+
)
|
93
|
+
end
|
94
|
+
|
95
|
+
result
|
96
|
+
end
|
97
|
+
|
98
|
+
def monetized_attributes(model_inspector)
|
99
|
+
result = []
|
100
|
+
|
101
|
+
model_inspector.money_attributes do |name|
|
102
|
+
result << PeakFlowUtils::TranslationService.new(
|
103
|
+
key: model_inspector.attribute_key(name),
|
104
|
+
dir: dir_path(model_inspector)
|
105
|
+
)
|
106
|
+
end
|
107
|
+
|
108
|
+
result
|
109
|
+
end
|
110
|
+
|
111
|
+
def globalize_attributes(model_inspector)
|
112
|
+
result = []
|
113
|
+
|
114
|
+
model_inspector.globalize_attributes do |name|
|
115
|
+
result << PeakFlowUtils::TranslationService.new(
|
116
|
+
key: model_inspector.attribute_key(name),
|
117
|
+
dir: dir_path(model_inspector)
|
118
|
+
)
|
119
|
+
end
|
120
|
+
|
121
|
+
result
|
122
|
+
end
|
123
|
+
end
|