summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjessib <jessib@riseup.net>2013-08-27 12:38:16 -0700
committerjessib <jessib@riseup.net>2013-08-27 12:38:16 -0700
commit060e06daa065f02b811dfe12850b101a62c12c8d (patch)
tree8e1e4112371a50870afb9dfa01155116be879af3
parentdc41ae0a3fb0a137e716d8ec63084b0ec3a7299b (diff)
Not ideal way to do it, but was proving complicated to have a config file specify which gems for which environments.
Here, we have the billing gem included for the development and test environments only, hardcoded in the Gemfile. Then we show the links to billing based on a config file setting. The setting itself could be used to specify different types of billing, but isn't yet.
-rw-r--r--Gemfile6
-rw-r--r--app/helpers/application_helper.rb5
-rw-r--r--app/views/layouts/_navigation.html.haml2
-rw-r--r--config/defaults.yml3
-rw-r--r--users/app/views/overviews/show.html.haml2
5 files changed, 10 insertions, 8 deletions
diff --git a/Gemfile b/Gemfile
index bdfd9dd..8ca0eaf 100644
--- a/Gemfile
+++ b/Gemfile
@@ -10,18 +10,22 @@ gem "leap_web_core", :path => 'core'
gem 'leap_web_users', :path => 'users'
gem 'leap_web_certs', :path => 'certs'
gem 'leap_web_help', :path => 'help'
-# gem 'leap_web_billing', :path => 'billing'
+# gem 'leap_web_billing', :path => 'billing' # for now, this gem will be included for development and test environments only
# To use debugger
gem 'debugger', :platforms => :mri_19
# ruby 1.8 is not supported anymore
# gem 'ruby-debug', :platforms => :mri_18
+group :development do
+ gem 'leap_web_billing', :path => 'billing'
+end
group :test do
gem 'fake_braintree', require: false
gem 'capybara', require: false
gem 'launchy' # so save_and_open_page works in integration tests
+ gem 'leap_web_billing', :path => 'billing'
end
# unreleased so far ... but leap_web_certs need it
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index cdc34ea..1e79990 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -37,9 +37,4 @@ module ApplicationHelper
html_escape(msg).gsub('[b]', '<b>').gsub('[/b]', '</b>').html_safe
end
- def engine_enabled(name)
- # to disable engine, comment it out in Gemfile (and make sure to re-run bundle install)
- Rails::Application::Railties.engines.any? {|eng| eng.class.to_s == "#{name}::Engine"}
- end
-
end
diff --git a/app/views/layouts/_navigation.html.haml b/app/views/layouts/_navigation.html.haml
index fb018a9..053c62c 100644
--- a/app/views/layouts/_navigation.html.haml
+++ b/app/views/layouts/_navigation.html.haml
@@ -2,5 +2,5 @@
= link_to_navigation t(:overview), user_overview_path(@user), :active => controller?(:overviews)
= link_to_navigation t(:account_settings), edit_user_path(@user), :active => controller?(:users)
= link_to_navigation t(:support_tickets), auto_tickets_path, :active => controller?(:tickets)
- = link_to_navigation t(:billing_settings), show_or_new_customer_link(@user), :active => controller?(:customer, :payments, :subscriptions, :credit_card_info) if engine_enabled('LeapWebBilling')
+ = link_to_navigation t(:billing_settings), show_or_new_customer_link(@user), :active => controller?(:customer, :payments, :subscriptions, :credit_card_info) if APP_CONFIG[:payment].present?
= link_to_navigation t(:logout), logout_path, :method => :delete
diff --git a/config/defaults.yml b/config/defaults.yml
index 343c3ac..8b17b77 100644
--- a/config/defaults.yml
+++ b/config/defaults.yml
@@ -24,6 +24,7 @@ development:
admins: [blue, admin, admin2]
domain: example.org
secret_token: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
+ payment: []
test:
<<: *dev_ca
@@ -32,9 +33,11 @@ test:
admins: [admin, admin2]
domain: test.me
secret_token: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
+ payment: [billing]
production:
<<: *cert_options
<<: *common
admins: []
domain: example.net
+ payment: []
diff --git a/users/app/views/overviews/show.html.haml b/users/app/views/overviews/show.html.haml
index e43a193..1cdcf02 100644
--- a/users/app/views/overviews/show.html.haml
+++ b/users/app/views/overviews/show.html.haml
@@ -19,4 +19,4 @@
%li= icon('user') + link_to(t(:overview_account), edit_user_path(@user))
%li= icon('envelope') + link_to(t(:overview_email), edit_user_email_settings_path(@user))
%li= icon('question-sign') + link_to(t(:overview_tickets), user_tickets_path(@user))
- %li= icon('shopping-cart') + link_to(t(:overview_billing), show_or_new_customer_link(@user)) if engine_enabled('LeapWebBilling')
+ %li= icon('shopping-cart') + link_to(t(:overview_billing), show_or_new_customer_link(@user)) if APP_CONFIG[:payment].present?