workarea-reviews 3.0.10
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 +7 -0
- data/.editorconfig +20 -0
- data/.eslintignore +2 -0
- data/.eslintrc +24 -0
- data/.github/ISSUE_TEMPLATE/bug_report.md +37 -0
- data/.github/ISSUE_TEMPLATE/documentation-request.md +17 -0
- data/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
- data/.gitignore +16 -0
- data/.scss-lint.yml +188 -0
- data/.yardopts +1 -0
- data/CHANGELOG.md +763 -0
- data/CODE_OF_CONDUCT.md +3 -0
- data/CONTRIBUTING.md +3 -0
- data/Gemfile +6 -0
- data/LICENSE +52 -0
- data/README.md +107 -0
- data/Rakefile +54 -0
- data/app/assets/images/workarea/admin/icons/star.svg +1 -0
- data/app/assets/images/workarea/storefront/icons/empty_star.svg +1 -0
- data/app/assets/images/workarea/storefront/icons/half_star.svg +1 -0
- data/app/assets/images/workarea/storefront/icons/star.svg +1 -0
- data/app/assets/javascripts/workarea/storefront/reviews/modules/product_review_ajax_submit.js +39 -0
- data/app/assets/javascripts/workarea/storefront/reviews/modules/product_reviews_sort_menus.js +82 -0
- data/app/assets/javascripts/workarea/storefront/reviews/modules/rating_buttons.js +103 -0
- data/app/assets/javascripts/workarea/storefront/reviews/templates/sort_by_property.jst.ejs +11 -0
- data/app/assets/stylesheets/workarea/storefront/reviews/components/_rating.scss +28 -0
- data/app/assets/stylesheets/workarea/storefront/reviews/components/_reviews.scss +59 -0
- data/app/assets/stylesheets/workarea/storefront/reviews/components/_reviews_aggregate.scss +38 -0
- data/app/assets/stylesheets/workarea/storefront/reviews/components/_write_review.scss +63 -0
- data/app/controllers/workarea/admin/catalog_products_controller.decorator +9 -0
- data/app/controllers/workarea/admin/import_reviews_controller.rb +35 -0
- data/app/controllers/workarea/admin/reviews_controller.rb +51 -0
- data/app/controllers/workarea/storefront/review_requests_controller.rb +50 -0
- data/app/controllers/workarea/storefront/reviews_controller.rb +53 -0
- data/app/helpers/workarea/admin/reviews_helper.rb +12 -0
- data/app/helpers/workarea/storefront/reviews_helper.rb +24 -0
- data/app/mailers/workarea/admin/status_report_mailer.decorator +8 -0
- data/app/mailers/workarea/storefront/review_mailer.rb +23 -0
- data/app/models/workarea/catalog/product.decorator +15 -0
- data/app/models/workarea/fulfillment.decorator +11 -0
- data/app/models/workarea/review.rb +135 -0
- data/app/models/workarea/review/request.rb +62 -0
- data/app/models/workarea/search/admin/review.rb +72 -0
- data/app/models/workarea/search/storefront/product.decorator +9 -0
- data/app/models/workarea/sort.decorator +17 -0
- data/app/queries/workarea/review_request_params.rb +47 -0
- data/app/queries/workarea/review_summary.rb +11 -0
- data/app/queries/workarea/search/admin_reviews.rb +40 -0
- data/app/queries/workarea/search/category_browse.decorator +9 -0
- data/app/queries/workarea/search/product_search.decorator +9 -0
- data/app/seeds/review_seeds.rb +49 -0
- data/app/services/workarea/create_review.rb +99 -0
- data/app/view_models/workarea/admin/product_view_model.decorator +7 -0
- data/app/view_models/workarea/admin/review_view_model.rb +23 -0
- data/app/view_models/workarea/admin/reviews_search_view_model.rb +46 -0
- data/app/view_models/workarea/storefront/product_view_model.decorator +13 -0
- data/app/view_models/workarea/storefront/review_view_model.rb +14 -0
- data/app/views/workarea/admin/activities/_review_create.html.haml +12 -0
- data/app/views/workarea/admin/activities/_review_destroy.html.haml +10 -0
- data/app/views/workarea/admin/activities/_review_update.html.haml +10 -0
- data/app/views/workarea/admin/reviews/_aux_navigation.html.haml +5 -0
- data/app/views/workarea/admin/reviews/_catalog_products_aux_link.html.haml +5 -0
- data/app/views/workarea/admin/reviews/_dashboard_navigation.html.haml +1 -0
- data/app/views/workarea/admin/reviews/_menu.html.haml +3 -0
- data/app/views/workarea/admin/reviews/_summary.html.haml +12 -0
- data/app/views/workarea/admin/reviews/edit.html.haml +77 -0
- data/app/views/workarea/admin/reviews/index.html.haml +74 -0
- data/app/views/workarea/admin/status_report_mailer/_reviews.html.haml +5 -0
- data/app/views/workarea/storefront/products/_rating.html.haml +10 -0
- data/app/views/workarea/storefront/products/_reviews.html.haml +23 -0
- data/app/views/workarea/storefront/products/_reviews_aggregate.html.haml +22 -0
- data/app/views/workarea/storefront/products/_reviews_summary.html.haml +2 -0
- data/app/views/workarea/storefront/review_mailer/review_request.html.haml +22 -0
- data/app/views/workarea/storefront/review_requests/show.html.haml +44 -0
- data/app/views/workarea/storefront/reviews/new.html.haml +68 -0
- data/app/views/workarea/storefront/style_guides/_reviews_product_summary_docs.html.haml +13 -0
- data/app/views/workarea/storefront/style_guides/components/_reviews.html.haml +17 -0
- data/app/workers/workarea/create_review_requests.rb +33 -0
- data/app/workers/workarea/schedule_review_requests.rb +44 -0
- data/app/workers/workarea/send_review_requests.rb +12 -0
- data/app/workers/workarea/update_product_review_data.rb +26 -0
- data/bin/rails +18 -0
- data/config/initializers/append_points.rb +70 -0
- data/config/initializers/assets.rb +1 -0
- data/config/initializers/configuration.rb +29 -0
- data/config/initializers/rack_attack.rb +11 -0
- data/config/initializers/recaptcha.rb +19 -0
- data/config/initializers/scheduled_jobs.rb +8 -0
- data/config/locales/en.yml +104 -0
- data/config/routes.rb +21 -0
- data/lib/tasks/verify.rake +16 -0
- data/lib/workarea/mailer_previews/storefront/review_mailer_preview.rb +10 -0
- data/lib/workarea/reviews.rb +13 -0
- data/lib/workarea/reviews/engine.rb +12 -0
- data/lib/workarea/reviews/version.rb +5 -0
- data/test/dummy/Rakefile +6 -0
- data/test/dummy/app/assets/config/manifest.js +4 -0
- data/test/dummy/app/assets/images/.keep +0 -0
- data/test/dummy/app/assets/javascripts/application.js +13 -0
- data/test/dummy/app/assets/stylesheets/application.css +15 -0
- data/test/dummy/app/controllers/application_controller.rb +3 -0
- data/test/dummy/app/controllers/concerns/.keep +0 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/jobs/application_job.rb +2 -0
- data/test/dummy/app/mailers/application_mailer.rb +4 -0
- data/test/dummy/app/models/concerns/.keep +0 -0
- data/test/dummy/app/views/layouts/application.html.erb +14 -0
- data/test/dummy/app/views/layouts/mailer.html.erb +13 -0
- data/test/dummy/app/views/layouts/mailer.text.erb +1 -0
- data/test/dummy/bin/bundle +3 -0
- data/test/dummy/bin/rails +4 -0
- data/test/dummy/bin/rake +4 -0
- data/test/dummy/bin/setup +34 -0
- data/test/dummy/bin/update +29 -0
- data/test/dummy/config.ru +5 -0
- data/test/dummy/config/application.rb +25 -0
- data/test/dummy/config/boot.rb +5 -0
- data/test/dummy/config/cable.yml +9 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +55 -0
- data/test/dummy/config/environments/production.rb +86 -0
- data/test/dummy/config/environments/test.rb +43 -0
- data/test/dummy/config/initializers/application_controller_renderer.rb +6 -0
- data/test/dummy/config/initializers/assets.rb +11 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/cookies_serializer.rb +5 -0
- data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/test/dummy/config/initializers/inflections.rb +16 -0
- data/test/dummy/config/initializers/mime_types.rb +4 -0
- data/test/dummy/config/initializers/new_framework_defaults.rb +21 -0
- data/test/dummy/config/initializers/session_store.rb +3 -0
- data/test/dummy/config/initializers/workarea.rb +5 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/en.yml +23 -0
- data/test/dummy/config/puma.rb +47 -0
- data/test/dummy/config/routes.rb +5 -0
- data/test/dummy/config/secrets.yml +22 -0
- data/test/dummy/config/spring.rb +6 -0
- data/test/dummy/db/seeds.rb +2 -0
- data/test/dummy/lib/assets/.keep +0 -0
- data/test/dummy/log/.keep +0 -0
- data/test/factories/reviews.rb +32 -0
- data/test/fixtures/reviews.csv +5 -0
- data/test/helpers/workarea/admin/reviews_helper_test.rb +17 -0
- data/test/helpers/workarea/storefront/reviews_helper_test.rb +19 -0
- data/test/integration/workarea/admin/reviews_integration_test.rb +33 -0
- data/test/integration/workarea/storefront/review_requests_integration_test.rb +63 -0
- data/test/integration/workarea/storefront/reviews_integration_test.rb +82 -0
- data/test/javascripts/fixtures/product_review_ajax_submit.html.haml +4 -0
- data/test/javascripts/product_review_ajax_submit_spec.js +28 -0
- data/test/javascripts/spec_helper.js +23 -0
- data/test/models/workarea/review/request_test.rb +18 -0
- data/test/models/workarea/review_test.rb +94 -0
- data/test/models/workarea/search/storefront/product_test.decorator +14 -0
- data/test/queries/workarea/review_request_params_test.rb +64 -0
- data/test/services/workarea/create_review_test.rb +131 -0
- data/test/system/workarea/admin/review_system_test.rb +96 -0
- data/test/system/workarea/storefront/review_request_system_test.rb +34 -0
- data/test/system/workarea/storefront/review_system_test.rb +113 -0
- data/test/teaspoon_env.rb +10 -0
- data/test/test_helper.rb +11 -0
- data/test/workers/workarea/create_review_requests_test.rb +38 -0
- data/test/workers/workarea/schedule_review_requests_test.rb +115 -0
- data/test/workers/workarea/send_review_requests_test.rb +30 -0
- data/workarea-reviews.gemspec +22 -0
- metadata +241 -0
@@ -0,0 +1 @@
|
|
1
|
+
Rails.application.config.assets.precompile += %w( workarea/**/icons/*.svg )
|
@@ -0,0 +1,29 @@
|
|
1
|
+
Workarea.configure do |config|
|
2
|
+
config.seeds << 'Workarea::ReviewSeeds'
|
3
|
+
|
4
|
+
config.jump_to_navigation.merge!('Product Reviews' => :reviews_path)
|
5
|
+
|
6
|
+
config.product_copy_default_attributes ||= {}
|
7
|
+
config.product_copy_default_attributes.merge!(
|
8
|
+
total_reviews: 0,
|
9
|
+
average_rating: nil
|
10
|
+
)
|
11
|
+
|
12
|
+
config.data_file_ignored_fields << %w(total_reviews average_rating)
|
13
|
+
|
14
|
+
# The amount of time before a Review::Request will auto expire
|
15
|
+
# and be removed from the collection
|
16
|
+
config.review_request_ttl = 6.months
|
17
|
+
|
18
|
+
# The maximum number of review requests to send for each order
|
19
|
+
# Each request will be for a different order item, selected by
|
20
|
+
# most expensive.
|
21
|
+
config.review_requests_per_order = 3
|
22
|
+
|
23
|
+
# The amount of time after an order is shipped before the first review
|
24
|
+
# requests will be sent.
|
25
|
+
config.review_request_initial_delivery_delay = 14.days
|
26
|
+
|
27
|
+
# The amount of time after the last request was sent to send another.
|
28
|
+
config.review_request_secondary_delivery_delay = 5.days
|
29
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
class Rack::Attack
|
2
|
+
# Throttle POST requests to /reviews by email address
|
3
|
+
#
|
4
|
+
# Key: "rack::attack:#{Time.now.to_i/:period}:reviews/email:#{req.email}"
|
5
|
+
throttle('reviews/email', limit: 2, period: 2.minutes) do |req|
|
6
|
+
if req.path == '/reviews' && req.post?
|
7
|
+
# return the email if present, nil otherwise
|
8
|
+
req.params['email'].presence
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
recaptcha =
|
2
|
+
if Rails.application.secrets.recaptcha.present?
|
3
|
+
Rails.application.secrets.recaptcha.symbolize_keys
|
4
|
+
elsif Rails.env.development? || Rails.env.test?
|
5
|
+
# These are keys provided by google for the purpose of testing.
|
6
|
+
# See https://developers.google.com/recaptcha/docs/faq
|
7
|
+
{
|
8
|
+
site_key: '6LeIxAcTAAAAAJcZVRqyHh71UMIEGNQ_MXjiZKhI',
|
9
|
+
secret_key: '6LeIxAcTAAAAAGG-vFI1TnRWxMZNFuojJ4WifJWe'
|
10
|
+
}
|
11
|
+
end
|
12
|
+
|
13
|
+
if recaptcha.present?
|
14
|
+
Recaptcha.configure do |config|
|
15
|
+
config.site_key = recaptcha[:site_key]
|
16
|
+
config.secret_key = recaptcha[:secret_key]
|
17
|
+
config.proxy = ENV.fetch('HTTP_PROXY', (recaptcha[:proxy] if recaptcha[:proxy].present?))
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,104 @@
|
|
1
|
+
en:
|
2
|
+
workarea:
|
3
|
+
admin:
|
4
|
+
activities:
|
5
|
+
review: Review
|
6
|
+
review_create_html: Created a %{name}
|
7
|
+
review_destroy_html: Removed a %{name}
|
8
|
+
review_update_html: updated %{fields} on the %{name} review
|
9
|
+
catalog:
|
10
|
+
dashboard_link: Dashboard link
|
11
|
+
catalog_products:
|
12
|
+
reviews_link: All Reviews
|
13
|
+
pending: (%{pending} Pending)
|
14
|
+
dashboards:
|
15
|
+
marketing:
|
16
|
+
reviews: Product reviews
|
17
|
+
fields:
|
18
|
+
body: Body
|
19
|
+
title: Title
|
20
|
+
rating: Rating
|
21
|
+
approved: Approved
|
22
|
+
auto_approve: Approve All Reviews
|
23
|
+
verified: Verified Purchaser
|
24
|
+
reviews:
|
25
|
+
approved: Approved
|
26
|
+
catalog_products_cards:
|
27
|
+
title: Reviews
|
28
|
+
edit:
|
29
|
+
review: Review
|
30
|
+
review_for_html: Review for %{product_link}
|
31
|
+
save_review: Save Review
|
32
|
+
title: Title
|
33
|
+
view_product: View Product
|
34
|
+
view_user: View User
|
35
|
+
flash_messages:
|
36
|
+
destroyed: Review has been removed.
|
37
|
+
updated: Review has been saved
|
38
|
+
index:
|
39
|
+
dashboard_link: Marketing dashboard
|
40
|
+
heading: Reviews
|
41
|
+
page_title: Reviews
|
42
|
+
review: Review
|
43
|
+
review_for: Review for %{product}
|
44
|
+
menu:
|
45
|
+
product_reviews:
|
46
|
+
one: Product Reviews (%{count})
|
47
|
+
other: Product Reviews (%{count})
|
48
|
+
zero: Product Reviews
|
49
|
+
pending: Pending
|
50
|
+
summary:
|
51
|
+
type: Review
|
52
|
+
unverified: Unverified
|
53
|
+
verified: Verified
|
54
|
+
status_report_mailer:
|
55
|
+
reviews:
|
56
|
+
pending_html: "%{count} awaiting approval."
|
57
|
+
review: review
|
58
|
+
recent_html: "%{count} submitted within the last day."
|
59
|
+
title: Reviews
|
60
|
+
sorts:
|
61
|
+
top_rated: Top Rated
|
62
|
+
highest_rating: Highest Rating
|
63
|
+
lowest_rating: Lowest Rating
|
64
|
+
storefront:
|
65
|
+
email:
|
66
|
+
review_request:
|
67
|
+
subject: Review your recent purchase of %{product}
|
68
|
+
link: Write a review
|
69
|
+
fields:
|
70
|
+
username: Username
|
71
|
+
review_requests:
|
72
|
+
flash_messages:
|
73
|
+
already_submitted: This review has already been submitted.
|
74
|
+
reviews:
|
75
|
+
flash_messages:
|
76
|
+
created: Your review has been submitted. Thanks!
|
77
|
+
failure: There was a problem saving your review.
|
78
|
+
heading: Reviews
|
79
|
+
out_of: out of
|
80
|
+
purchase_requirement: A purchase is required before you can post a review
|
81
|
+
rating: Rating
|
82
|
+
read_reviews: Read Reviews
|
83
|
+
review_for: Review for %{product}
|
84
|
+
review_title: Review Title
|
85
|
+
reviews:
|
86
|
+
one: "%{count} review"
|
87
|
+
other: "%{count} reviews"
|
88
|
+
zero: "%{count} reviews"
|
89
|
+
stars:
|
90
|
+
one: 1 star
|
91
|
+
other: "%{count} stars"
|
92
|
+
submit: Submit Review
|
93
|
+
submit_disabled: Submitting Review...
|
94
|
+
total_spent_validation: must make a purchase before creating a review
|
95
|
+
verified_purchaser: Verified Purchaser
|
96
|
+
write_a_review: Write a Review
|
97
|
+
write_a_review_title: Write a Review for "%{name}"
|
98
|
+
your_review: Your Review
|
99
|
+
notes:
|
100
|
+
display_name: Only the first letter of your name will be displayed.
|
101
|
+
email: Will only be used if we need to get in touch with you.
|
102
|
+
users:
|
103
|
+
first_name: First name
|
104
|
+
last_name: Last name
|
data/config/routes.rb
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
Workarea::Admin::Engine.routes.draw do
|
2
|
+
scope '(:locale)', constraints: Workarea::I18n.routes_constraint do
|
3
|
+
resources :reviews, except: [:new, :create]
|
4
|
+
resources :catalog_products, only: [] do
|
5
|
+
member do
|
6
|
+
get :reviews
|
7
|
+
end
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
Workarea::Storefront::Engine.routes.draw do
|
13
|
+
scope '(:locale)', constraints: Workarea::I18n.routes_constraint do
|
14
|
+
get 'reviews/:product_id/new' => 'reviews#new', as: :new_product_review
|
15
|
+
post 'reviews/:product_id' => 'reviews#create', as: :create_product_review
|
16
|
+
|
17
|
+
resources :review_requests, only: :show do
|
18
|
+
member { post :complete }
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
namespace :workarea do
|
2
|
+
namespace :reviews do
|
3
|
+
desc 'Assign verified to each review based on whether the user has any orders with the product being reviewed'
|
4
|
+
task verify: :environment do
|
5
|
+
Workarea::Review.all.each_by(100) do |review|
|
6
|
+
user = Workarea::User.find(review.user_id) rescue nil
|
7
|
+
|
8
|
+
next unless user.present?
|
9
|
+
|
10
|
+
creator = Workarea::CreateReview.new(review, user: user)
|
11
|
+
|
12
|
+
review.update!(verified: creator.verified?)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
data/test/dummy/Rakefile
ADDED
File without changes
|
@@ -0,0 +1,13 @@
|
|
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_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
|
+
*/
|
File without changes
|
File without changes
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>Dummy</title>
|
5
|
+
<%= csrf_meta_tags %>
|
6
|
+
|
7
|
+
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
|
8
|
+
<%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
|
9
|
+
</head>
|
10
|
+
|
11
|
+
<body>
|
12
|
+
<%= yield %>
|
13
|
+
</body>
|
14
|
+
</html>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= yield %>
|
data/test/dummy/bin/rake
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'pathname'
|
3
|
+
require 'fileutils'
|
4
|
+
include FileUtils
|
5
|
+
|
6
|
+
# path to your application root.
|
7
|
+
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
|
8
|
+
|
9
|
+
def system!(*args)
|
10
|
+
system(*args) || abort("\n== Command #{args} failed ==")
|
11
|
+
end
|
12
|
+
|
13
|
+
chdir APP_ROOT do
|
14
|
+
# This script is a starting point to setup your application.
|
15
|
+
# Add necessary setup steps to this file.
|
16
|
+
|
17
|
+
puts '== Installing dependencies =='
|
18
|
+
system! 'gem install bundler --conservative'
|
19
|
+
system('bundle check') || system!('bundle install')
|
20
|
+
|
21
|
+
# puts "\n== Copying sample files =="
|
22
|
+
# unless File.exist?('config/database.yml')
|
23
|
+
# cp 'config/database.yml.sample', 'config/database.yml'
|
24
|
+
# end
|
25
|
+
|
26
|
+
puts "\n== Preparing database =="
|
27
|
+
system! 'bin/rails db:setup'
|
28
|
+
|
29
|
+
puts "\n== Removing old logs and tempfiles =="
|
30
|
+
system! 'bin/rails log:clear tmp:clear'
|
31
|
+
|
32
|
+
puts "\n== Restarting application server =="
|
33
|
+
system! 'bin/rails restart'
|
34
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'pathname'
|
3
|
+
require 'fileutils'
|
4
|
+
include FileUtils
|
5
|
+
|
6
|
+
# path to your application root.
|
7
|
+
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
|
8
|
+
|
9
|
+
def system!(*args)
|
10
|
+
system(*args) || abort("\n== Command #{args} failed ==")
|
11
|
+
end
|
12
|
+
|
13
|
+
chdir APP_ROOT do
|
14
|
+
# This script is a way to update your development environment automatically.
|
15
|
+
# Add necessary update steps to this file.
|
16
|
+
|
17
|
+
puts '== Installing dependencies =='
|
18
|
+
system! 'gem install bundler --conservative'
|
19
|
+
system('bundle check') || system!('bundle install')
|
20
|
+
|
21
|
+
puts "\n== Updating database =="
|
22
|
+
system! 'bin/rails db:migrate'
|
23
|
+
|
24
|
+
puts "\n== Removing old logs and tempfiles =="
|
25
|
+
system! 'bin/rails log:clear tmp:clear'
|
26
|
+
|
27
|
+
puts "\n== Restarting application server =="
|
28
|
+
system! 'bin/rails restart'
|
29
|
+
end
|