diff --git a/.gitmodules b/.gitmodules index 7884a42dc65c11e7d5390739a3f547fbc6867d01..0c28cd5e1e5bb9b1c10265545d4dc2ae0269c8db 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ -[submodule "users/app/assets/javascripts/srp"] - path = users/app/assets/javascripts/srp +[submodule "app/assets/javascripts/srp"] + path = app/assets/javascripts/srp url = https://leap.se/git/srp_js diff --git a/CUSTOM.md b/CUSTOM.md index 8671323e5bf80edad58109236b4f0986391abb5b..53e4d88dd616d2b7ec5d2bacc22a023d8d818efb 100644 --- a/CUSTOM.md +++ b/CUSTOM.md @@ -9,6 +9,6 @@ See config/customization/README.md Engines --------------------- -Leap Web is based on Engines. All things in `app` will overwrite the default behaviour. You can either create a new rails app and include the leap_web gem or clone the leap web repository and add your customizations to the `app` directory. +Leap Web includes some Engines. All things in `app` will overwrite the engine behaviour. You can clone the leap web repository and add your customizations to the `app` directory. Including leap_web as a gem is currently not supported. It should not require too much work though and we would be happy to include the changes required. -If you have no use for one of the engines you can remove it from the Gemfile. Not however that your app might still need to provide some functionality for the other engines to work. For example the users engine provides `current_user` and other methods. +If you have no use for one of the engines you can remove it from the Gemfile. Engines should really be plugins - no other engines should depend upon them. If you need functionality in different engines it should probably go into the toplevel. The 'users' engine will soon become part of the main webapp for that reason. diff --git a/DEVELOP.md b/DEVELOP.md index 6aeccfffbb88b8e3d2e8d90014fd6d5db6422813..0bc20312052dffa82bc9788f52bb0eaae68de013 100644 --- a/DEVELOP.md +++ b/DEVELOP.md @@ -5,21 +5,21 @@ Some tips on modifying the views: * Many of the forms use [simple_form gem](https://github.com/plataformatec/simple_form) +* We still use client_side_validations for the validation code but since it is not maintained anymore we want to drop it asap. ## Engines ## -Leap Web consists of different Engines. They live in their own subdirectory and are included through bundler via their path. This way changes to the engines immediately affect the server as if they were in the main `app` directory. +Leap Web contains some. They live in their own subdirectory and are included through bundler via their path. This way changes to the engines immediately affect the server as if they were in the main `app` directory. -Currently Leap Web consists of 5 Engines: +Currently Leap Web includes 2 Engines: -* [core](https://github.com/leapcode/leap_web/blob/master/core) - ships some dependencies that are used accross all engines. This might be removed at some point. -* [users](https://github.com/leapcode/leap_web/blob/master/users) - user registration and authorization -* [certs](https://github.com/leapcode/leap_web/blob/master/certs) - Cert distribution for the EIP client -* [help](https://github.com/leapcode/leap_web/blob/master/help) - Help ticket management -* [billing](https://github.com/leapcode/leap_web/blob/master/billing) - Billing System +* [support](https://github.com/leapcode/leap_web/blob/master/engines/support) - Help ticket management +* [billing](https://github.com/leapcode/leap_web/blob/master/engines/billing) - Billing System ## Creating a new engine ## +If you want to add functionality to the webapp but keep it easy to remove you might consider adding an engine. This only makes sense if your engine really is a plugin - so no other pieces of code depend on it. + ### Rails plugin new ### Create the basic tree structure for an engine using @@ -32,28 +32,10 @@ rails plugin new ENGINE_NAME -O --full See http://guides.rubyonrails.org/engines.html for more general info about engines. -### Require Leap Web Core and dependencies ### - -Leap Web Core provides a common set of dependencies for the engines with CouchRest Model etc. -It also comes with an optional set of UI gems like haml, sass, coffeescript, uglifier, bootstrap-sass, jquery and simple_form. +You need to require engine specific gems in lib/my_engine/engine.rb: -In order to use the core dependencies you need to add leap_web_core to your .gemspec: ```ruby -# make sure LeapWeb::VERSION is available -require File.expand_path('../../lib/leap_web/version.rb', __FILE__) -# ... - Gem::Specification.new do |s| - # ... - s.add_dependency "rails" - s.add_dependency "leap_web_core", LeapWeb::Version - end -``` - -You also need to require it before you define your engine in lib/my_engine/engine.rb: -```ruby -require "leap_web_core" -# uncomment if you want the ui gems: -# require "leap_web_core/ui_dependencies" +require "my_dependency" module MyEngine class Engine < ::Rails::Engine @@ -62,17 +44,9 @@ module MyEngine end ``` -Some development and UI dependencies can not be loaded via leap_web_core. To make them available add the following lines to your engines Gemfile - -```ruby - eval(File.read(File.dirname(__FILE__) + '/../common_dependencies.rb')) - # uncomment if you want the ui gems: - # eval(File.read(File.dirname(__FILE__) + '/../ui_dependencies.rb')) -``` - ## Creating Models ## -You can use the normal rails generators to create models. Since you required the leap_web_core gem you will be using CouchRest::Model. So your models inherit from CouchRest::Model::Base. +You can use the normal rails generators to create models. You probably want to require couchrest_model so your models inherit from CouchRest::Model::Base. http://www.couchrest.info/model/definition.html has some good first steps for setting up the model. CouchRest Model behaved strangely when using a model without a design block. So make sure to define an initial view: http://www.couchrest.info/model/view_objects.html . diff --git a/Gemfile b/Gemfile index 1d6c43204e5b6e195889d9421ddbc10ac426a949..b8b4568fe03533bbccf97c4438203c81650ffc5e 100644 --- a/Gemfile +++ b/Gemfile @@ -1,16 +1,17 @@ source 'https://rubygems.org' -eval(File.read(File.dirname(__FILE__) + '/common_dependencies.rb')) -eval(File.read(File.dirname(__FILE__) + '/ui_dependencies.rb')) - -# EITHER fetch all of the leap_web gems in one go -# gem 'leap_web' -# OR use the local versions for development instead: -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 "rails", "~> 3.2.11" +gem "couchrest", "~> 1.1.3" +gem "couchrest_model", "~> 2.0.0" +gem "couchrest_session_store", "~> 0.2.4" +gem "json" + +# user management +gem "ruby-srp", "~> 0.2.1" +gem "rails_warden" + +gem 'leap_web_help', :path => 'engines/support' +gem 'leap_web_billing', :path => 'engines/billing' gem 'http_accept_language' @@ -19,12 +20,62 @@ gem 'debugger', :platforms => :mri_19 # ruby 1.8 is not supported anymore # gem 'ruby-debug', :platforms => :mri_18 +gem "haml", "~> 3.1.7" +gem "bootstrap-sass", "= 2.3.2.2" +gem "jquery-rails" +gem "simple_form" +gem 'client_side_validations' +gem 'client_side_validations-simple_form' +gem "bootswatch-rails", "~> 0.5.0" + +gem 'kaminari', "0.13.0" # for pagination. trying 0.13.0 as there seem to be + # issues with 0.14.0 when using couchrest + +gem 'rails-i18n' # locale files for built-in validation messages and times + # https://github.com/svenfuchs/rails-i18n + # for a list of keys: + # https://github.com/svenfuchs/rails-i18n/blob/master/rails/locale/en.yml + +gem 'rdiscount' # for rendering .md templates + group :test do - gem 'fake_braintree', require: false + + # integration testing gem 'capybara', require: false - gem 'launchy' # so save_and_open_page works in integration tests - gem 'phantomjs-binaries' - gem 'minitest-stub-const' + gem 'poltergeist' # headless js + gem 'launchy' # save_and_open_page + gem 'phantomjs-binaries' # binaries specific to the os + + # moching and stubbing + gem 'mocha', '~> 0.13.0', :require => false + gem 'minitest-stub-const' # why? + + # generating test data + gem 'factory_girl_rails' # test data factories + gem 'faker' # names and numbers for test data + + # billing tests + gem 'fake_braintree', require: false +end + +group :test, :development do + gem 'thin' +end + +group :assets do + gem "haml-rails", "~> 0.3.4" + gem "sass-rails", "~> 3.2.5" + gem "coffee-rails", "~> 3.2.2" + gem "uglifier", "~> 1.2.7" + + # See https://github.com/sstephenson/execjs#readme for more supported runtimes + gem 'therubyracer', "~> 0.10.2", :platforms => :ruby + gem 'quiet_assets' # stops logging all the asset requests +end + + +group :production do + gem 'SyslogLogger', '~> 2.0' end # unreleased so far ... but leap_web_certs need it diff --git a/Gemfile.lock b/Gemfile.lock index 0c7486f50c2796ac143dc6ac546f6239760028fe..a2a1785380e2b8088d3b41143e7ace8a9bb2dec3 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -6,42 +6,15 @@ GIT activemodel (>= 3.0.6) PATH - remote: billing + remote: engines/billing specs: leap_web_billing (0.5.0) braintree - leap_web_core (= 0.5.0) PATH - remote: certs - specs: - leap_web_certs (0.5.0) - certificate_authority (>= 0.2.0) - leap_web_core (= 0.5.0) - -PATH - remote: core - specs: - leap_web_core (0.5.0) - couchrest (~> 1.1.3) - couchrest_model (~> 2.0.0) - couchrest_session_store (~> 0.2.4) - json - rails (~> 3.2.11) - -PATH - remote: help + remote: engines/support specs: leap_web_help (0.5.0) - leap_web_core (= 0.5.0) - -PATH - remote: users - specs: - leap_web_users (0.5.0) - leap_web_core (= 0.5.0) - rails_warden - ruby-srp (~> 0.2.1) GEM remote: https://rubygems.org/ @@ -271,6 +244,9 @@ DEPENDENCIES client_side_validations client_side_validations-simple_form coffee-rails (~> 3.2.2) + couchrest (~> 1.1.3) + couchrest_model (~> 2.0.0) + couchrest_session_store (~> 0.2.4) debugger factory_girl_rails fake_braintree @@ -279,20 +255,21 @@ DEPENDENCIES haml-rails (~> 0.3.4) http_accept_language jquery-rails + json kaminari (= 0.13.0) launchy leap_web_billing! - leap_web_certs! - leap_web_core! leap_web_help! - leap_web_users! minitest-stub-const mocha (~> 0.13.0) phantomjs-binaries poltergeist quiet_assets + rails (~> 3.2.11) rails-i18n + rails_warden rdiscount + ruby-srp (~> 0.2.1) sass-rails (~> 3.2.5) simple_form therubyracer (~> 0.10.2) diff --git a/certs/app/assets/images/leap_web_certs/.gitkeep b/app/assets/images/leap_web_users/.gitkeep similarity index 100% rename from certs/app/assets/images/leap_web_certs/.gitkeep rename to app/assets/images/leap_web_users/.gitkeep diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index 03a40da6a96892b9e265db3ddd52811811fc46ba..ab07e1f98ac15860c02d1298f82121e6ea820d91 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -20,4 +20,3 @@ //= require platform //= require tickets //= require users -//= require_tree . diff --git a/core/app/assets/javascripts/leap.js b/app/assets/javascripts/leap.js similarity index 100% rename from core/app/assets/javascripts/leap.js rename to app/assets/javascripts/leap.js diff --git a/core/app/assets/javascripts/platform.js b/app/assets/javascripts/platform.js similarity index 100% rename from core/app/assets/javascripts/platform.js rename to app/assets/javascripts/platform.js diff --git a/users/app/assets/javascripts/srp b/app/assets/javascripts/srp similarity index 100% rename from users/app/assets/javascripts/srp rename to app/assets/javascripts/srp diff --git a/users/app/assets/javascripts/users.js b/app/assets/javascripts/users.js similarity index 100% rename from users/app/assets/javascripts/users.js rename to app/assets/javascripts/users.js diff --git a/certs/app/assets/javascripts/leap_web_certs/.gitkeep b/app/assets/stylesheets/leap_web_users/.gitkeep similarity index 100% rename from certs/app/assets/javascripts/leap_web_certs/.gitkeep rename to app/assets/stylesheets/leap_web_users/.gitkeep diff --git a/certs/app/assets/stylesheets/leap_web_certs/.gitkeep b/app/controllers/.gitkeep similarity index 100% rename from certs/app/assets/stylesheets/leap_web_certs/.gitkeep rename to app/controllers/.gitkeep diff --git a/users/app/controllers/account_settings_controller.rb b/app/controllers/account_settings_controller.rb similarity index 100% rename from users/app/controllers/account_settings_controller.rb rename to app/controllers/account_settings_controller.rb diff --git a/users/app/controllers/controller_extension/authentication.rb b/app/controllers/controller_extension/authentication.rb similarity index 100% rename from users/app/controllers/controller_extension/authentication.rb rename to app/controllers/controller_extension/authentication.rb diff --git a/users/app/controllers/controller_extension/token_authentication.rb b/app/controllers/controller_extension/token_authentication.rb similarity index 100% rename from users/app/controllers/controller_extension/token_authentication.rb rename to app/controllers/controller_extension/token_authentication.rb diff --git a/users/app/controllers/keys_controller.rb b/app/controllers/keys_controller.rb similarity index 100% rename from users/app/controllers/keys_controller.rb rename to app/controllers/keys_controller.rb diff --git a/users/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb similarity index 100% rename from users/app/controllers/sessions_controller.rb rename to app/controllers/sessions_controller.rb diff --git a/users/app/controllers/users_base_controller.rb b/app/controllers/users_base_controller.rb similarity index 100% rename from users/app/controllers/users_base_controller.rb rename to app/controllers/users_base_controller.rb diff --git a/users/app/controllers/users_controller.rb b/app/controllers/users_controller.rb similarity index 100% rename from users/app/controllers/users_controller.rb rename to app/controllers/users_controller.rb diff --git a/certs/app/controllers/certs_controller.rb b/app/controllers/v1/certs_controller.rb similarity index 95% rename from certs/app/controllers/certs_controller.rb rename to app/controllers/v1/certs_controller.rb index 82cbc44c78413e646c96944702b28edfaebe1816..64cfa7fb7d5fa6fff84c2a2cdfeae11994cd72e9 100644 --- a/certs/app/controllers/certs_controller.rb +++ b/app/controllers/v1/certs_controller.rb @@ -1,4 +1,4 @@ -class CertsController < ApplicationController +class V1::CertsController < ApplicationController before_filter :require_login, :unless => :anonymous_certs_allowed? diff --git a/users/app/controllers/v1/messages_controller.rb b/app/controllers/v1/messages_controller.rb similarity index 100% rename from users/app/controllers/v1/messages_controller.rb rename to app/controllers/v1/messages_controller.rb diff --git a/users/app/controllers/v1/sessions_controller.rb b/app/controllers/v1/sessions_controller.rb similarity index 100% rename from users/app/controllers/v1/sessions_controller.rb rename to app/controllers/v1/sessions_controller.rb diff --git a/users/app/controllers/v1/users_controller.rb b/app/controllers/v1/users_controller.rb similarity index 100% rename from users/app/controllers/v1/users_controller.rb rename to app/controllers/v1/users_controller.rb diff --git a/users/app/controllers/webfinger_controller.rb b/app/controllers/webfinger_controller.rb similarity index 100% rename from users/app/controllers/webfinger_controller.rb rename to app/controllers/webfinger_controller.rb diff --git a/users/app/designs/message/by_user_ids_to_show.js b/app/designs/message/by_user_ids_to_show.js similarity index 100% rename from users/app/designs/message/by_user_ids_to_show.js rename to app/designs/message/by_user_ids_to_show.js diff --git a/users/app/designs/message/by_user_ids_to_show_and_created_at.js b/app/designs/message/by_user_ids_to_show_and_created_at.js similarity index 100% rename from users/app/designs/message/by_user_ids_to_show_and_created_at.js rename to app/designs/message/by_user_ids_to_show_and_created_at.js diff --git a/users/app/designs/user/by_created_at_and_one_month_warning_not_sent.js b/app/designs/user/by_created_at_and_one_month_warning_not_sent.js similarity index 100% rename from users/app/designs/user/by_created_at_and_one_month_warning_not_sent.js rename to app/designs/user/by_created_at_and_one_month_warning_not_sent.js diff --git a/certs/app/controllers/.gitkeep b/app/helpers/.gitkeep similarity index 100% rename from certs/app/controllers/.gitkeep rename to app/helpers/.gitkeep diff --git a/core/app/helpers/core_helper.rb b/app/helpers/core_helper.rb similarity index 100% rename from core/app/helpers/core_helper.rb rename to app/helpers/core_helper.rb diff --git a/core/app/helpers/download_helper.rb b/app/helpers/download_helper.rb similarity index 100% rename from core/app/helpers/download_helper.rb rename to app/helpers/download_helper.rb diff --git a/users/app/helpers/email_aliases_helper.rb b/app/helpers/email_aliases_helper.rb similarity index 100% rename from users/app/helpers/email_aliases_helper.rb rename to app/helpers/email_aliases_helper.rb diff --git a/core/app/helpers/navigation_helper.rb b/app/helpers/navigation_helper.rb similarity index 100% rename from core/app/helpers/navigation_helper.rb rename to app/helpers/navigation_helper.rb diff --git a/users/app/helpers/sessions_helper.rb b/app/helpers/sessions_helper.rb similarity index 100% rename from users/app/helpers/sessions_helper.rb rename to app/helpers/sessions_helper.rb diff --git a/users/app/helpers/users_helper.rb b/app/helpers/users_helper.rb similarity index 100% rename from users/app/helpers/users_helper.rb rename to app/helpers/users_helper.rb diff --git a/users/app/models/account.rb b/app/models/account.rb similarity index 100% rename from users/app/models/account.rb rename to app/models/account.rb diff --git a/certs/app/models/client_certificate.rb b/app/models/client_certificate.rb similarity index 100% rename from certs/app/models/client_certificate.rb rename to app/models/client_certificate.rb diff --git a/users/app/models/email.rb b/app/models/email.rb similarity index 100% rename from users/app/models/email.rb rename to app/models/email.rb diff --git a/users/app/models/identity.rb b/app/models/identity.rb similarity index 100% rename from users/app/models/identity.rb rename to app/models/identity.rb diff --git a/users/app/models/local_email.rb b/app/models/local_email.rb similarity index 100% rename from users/app/models/local_email.rb rename to app/models/local_email.rb diff --git a/users/app/models/login_format_validation.rb b/app/models/login_format_validation.rb similarity index 100% rename from users/app/models/login_format_validation.rb rename to app/models/login_format_validation.rb diff --git a/users/app/models/message.rb b/app/models/message.rb similarity index 100% rename from users/app/models/message.rb rename to app/models/message.rb diff --git a/users/app/models/pgp_key.rb b/app/models/pgp_key.rb similarity index 100% rename from users/app/models/pgp_key.rb rename to app/models/pgp_key.rb diff --git a/users/app/models/service_level.rb b/app/models/service_level.rb similarity index 100% rename from users/app/models/service_level.rb rename to app/models/service_level.rb diff --git a/users/app/models/session.rb b/app/models/session.rb similarity index 100% rename from users/app/models/session.rb rename to app/models/session.rb diff --git a/users/app/models/token.rb b/app/models/token.rb similarity index 100% rename from users/app/models/token.rb rename to app/models/token.rb diff --git a/users/app/models/unauthenticated_user.rb b/app/models/unauthenticated_user.rb similarity index 100% rename from users/app/models/unauthenticated_user.rb rename to app/models/unauthenticated_user.rb diff --git a/users/app/models/user.rb b/app/models/user.rb similarity index 100% rename from users/app/models/user.rb rename to app/models/user.rb diff --git a/certs/app/helpers/.gitkeep b/app/views/.gitkeep similarity index 100% rename from certs/app/helpers/.gitkeep rename to app/views/.gitkeep diff --git a/core/app/views/common/_download_for_os.html.haml b/app/views/common/_download_for_os.html.haml similarity index 100% rename from core/app/views/common/_download_for_os.html.haml rename to app/views/common/_download_for_os.html.haml diff --git a/core/app/views/common/_home_page_buttons.html.haml b/app/views/common/_home_page_buttons.html.haml similarity index 100% rename from core/app/views/common/_home_page_buttons.html.haml rename to app/views/common/_home_page_buttons.html.haml diff --git a/users/app/views/emails/_email.html.haml b/app/views/emails/_email.html.haml similarity index 100% rename from users/app/views/emails/_email.html.haml rename to app/views/emails/_email.html.haml diff --git a/core/app/views/kaminari/_first_page.html.haml b/app/views/kaminari/_first_page.html.haml similarity index 100% rename from core/app/views/kaminari/_first_page.html.haml rename to app/views/kaminari/_first_page.html.haml diff --git a/core/app/views/kaminari/_gap.html.haml b/app/views/kaminari/_gap.html.haml similarity index 100% rename from core/app/views/kaminari/_gap.html.haml rename to app/views/kaminari/_gap.html.haml diff --git a/core/app/views/kaminari/_last_page.html.haml b/app/views/kaminari/_last_page.html.haml similarity index 100% rename from core/app/views/kaminari/_last_page.html.haml rename to app/views/kaminari/_last_page.html.haml diff --git a/core/app/views/kaminari/_next_page.html.haml b/app/views/kaminari/_next_page.html.haml similarity index 100% rename from core/app/views/kaminari/_next_page.html.haml rename to app/views/kaminari/_next_page.html.haml diff --git a/core/app/views/kaminari/_page.html.haml b/app/views/kaminari/_page.html.haml similarity index 100% rename from core/app/views/kaminari/_page.html.haml rename to app/views/kaminari/_page.html.haml diff --git a/core/app/views/kaminari/_paginator.html.haml b/app/views/kaminari/_paginator.html.haml similarity index 100% rename from core/app/views/kaminari/_paginator.html.haml rename to app/views/kaminari/_paginator.html.haml diff --git a/core/app/views/kaminari/_prev_page.html.haml b/app/views/kaminari/_prev_page.html.haml similarity index 100% rename from core/app/views/kaminari/_prev_page.html.haml rename to app/views/kaminari/_prev_page.html.haml diff --git a/users/app/views/sessions/new.html.haml b/app/views/sessions/new.html.haml similarity index 100% rename from users/app/views/sessions/new.html.haml rename to app/views/sessions/new.html.haml diff --git a/users/app/views/sessions/new.json.erb b/app/views/sessions/new.json.erb similarity index 100% rename from users/app/views/sessions/new.json.erb rename to app/views/sessions/new.json.erb diff --git a/users/app/views/users/_change_password.html.haml b/app/views/users/_change_password.html.haml similarity index 100% rename from users/app/views/users/_change_password.html.haml rename to app/views/users/_change_password.html.haml diff --git a/users/app/views/users/_change_pgp_key.html.haml b/app/views/users/_change_pgp_key.html.haml similarity index 100% rename from users/app/views/users/_change_pgp_key.html.haml rename to app/views/users/_change_pgp_key.html.haml diff --git a/users/app/views/users/_change_service_level.html.haml b/app/views/users/_change_service_level.html.haml similarity index 100% rename from users/app/views/users/_change_service_level.html.haml rename to app/views/users/_change_service_level.html.haml diff --git a/users/app/views/users/_destroy_account.html.haml b/app/views/users/_destroy_account.html.haml similarity index 100% rename from users/app/views/users/_destroy_account.html.haml rename to app/views/users/_destroy_account.html.haml diff --git a/users/app/views/users/_edit.html.haml b/app/views/users/_edit.html.haml similarity index 100% rename from users/app/views/users/_edit.html.haml rename to app/views/users/_edit.html.haml diff --git a/users/app/views/users/_user.html.haml b/app/views/users/_user.html.haml similarity index 100% rename from users/app/views/users/_user.html.haml rename to app/views/users/_user.html.haml diff --git a/users/app/views/users/_warnings.html.haml b/app/views/users/_warnings.html.haml similarity index 100% rename from users/app/views/users/_warnings.html.haml rename to app/views/users/_warnings.html.haml diff --git a/users/app/views/users/edit.html.haml b/app/views/users/edit.html.haml similarity index 100% rename from users/app/views/users/edit.html.haml rename to app/views/users/edit.html.haml diff --git a/users/app/views/users/index.html.haml b/app/views/users/index.html.haml similarity index 100% rename from users/app/views/users/index.html.haml rename to app/views/users/index.html.haml diff --git a/users/app/views/users/new.html.haml b/app/views/users/new.html.haml similarity index 100% rename from users/app/views/users/new.html.haml rename to app/views/users/new.html.haml diff --git a/users/app/views/users/show.html.haml b/app/views/users/show.html.haml similarity index 100% rename from users/app/views/users/show.html.haml rename to app/views/users/show.html.haml diff --git a/users/app/views/v1/sessions/new.json.erb b/app/views/v1/sessions/new.json.erb similarity index 100% rename from users/app/views/v1/sessions/new.json.erb rename to app/views/v1/sessions/new.json.erb diff --git a/users/app/views/webfinger/host_meta.xml.erb b/app/views/webfinger/host_meta.xml.erb similarity index 100% rename from users/app/views/webfinger/host_meta.xml.erb rename to app/views/webfinger/host_meta.xml.erb diff --git a/users/app/views/webfinger/search.xml.erb b/app/views/webfinger/search.xml.erb similarity index 100% rename from users/app/views/webfinger/search.xml.erb rename to app/views/webfinger/search.xml.erb diff --git a/certs/Gemfile b/certs/Gemfile deleted file mode 100644 index 992f2360d85037dc7c905f76287712639a380e9b..0000000000000000000000000000000000000000 --- a/certs/Gemfile +++ /dev/null @@ -1,14 +0,0 @@ -source "https://rubygems.org" - -eval(File.read(File.dirname(__FILE__) + '/../common_dependencies.rb')) - -# We require leap_web_core from here so we can use the path option. -gem "leap_web_core", :path => '../core' - -# Declare your gem's dependencies in leap_web_users.gemspec. -# Bundler will treat runtime dependencies like base dependencies, and -# development dependencies will be added by default to the :development group. -gemspec - -# To use debugger -# gem 'ruby-debug' diff --git a/certs/Rakefile b/certs/Rakefile deleted file mode 100644 index 54ed86db506148695ffec9e3170e0152909e60cb..0000000000000000000000000000000000000000 --- a/certs/Rakefile +++ /dev/null @@ -1,44 +0,0 @@ -#!/usr/bin/env rake - -require 'rake/packagetask' -require 'rubygems/package_task' - -begin - require 'bundler/setup' -rescue LoadError - puts 'You must `gem install bundler` and `bundle install` to run rake tasks' -end -begin - require 'rdoc/task' -rescue LoadError - require 'rdoc/rdoc' - require 'rake/rdoctask' - RDoc::Task = Rake::RDocTask -end - -RDoc::Task.new(:rdoc) do |rdoc| - rdoc.rdoc_dir = 'rdoc' - rdoc.title = 'LeapWebCerts' - rdoc.options << '--line-numbers' - rdoc.rdoc_files.include('README.rdoc') - rdoc.rdoc_files.include('lib/**/*.rb') -end - -spec = eval(File.read('leap_web_certs.gemspec')) -Gem::PackageTask.new(spec) do |p| - p.gem_spec = spec -end - -Bundler::GemHelper.install_tasks - -require 'rake/testtask' - -Rake::TestTask.new(:test) do |t| - t.libs << 'lib' - t.libs << 'test' - t.pattern = 'test/**/*_test.rb' - t.verbose = false -end - - -task :default => :test diff --git a/certs/Readme.md b/certs/Readme.md deleted file mode 100644 index 4ea8d9da394745cff1a806ef8adc55f499afc1bb..0000000000000000000000000000000000000000 --- a/certs/Readme.md +++ /dev/null @@ -1,9 +0,0 @@ -LeapWebCerts -========= - - -Configuration -------------- - - -Currently LeapWebCerts falls back to handing out a cert in /config/cert if the cert pool is empty. You need to add that file in the application that includes this engine. diff --git a/certs/app/helpers/certs_helper.rb b/certs/app/helpers/certs_helper.rb deleted file mode 100644 index 94e76b8eb7fa88ea462234b1e2614de101a990da..0000000000000000000000000000000000000000 --- a/certs/app/helpers/certs_helper.rb +++ /dev/null @@ -1,2 +0,0 @@ -module CertsHelper -end diff --git a/certs/app/mailers/.gitkeep b/certs/app/mailers/.gitkeep deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/certs/app/models/.gitkeep b/certs/app/models/.gitkeep deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/certs/app/views/.gitkeep b/certs/app/views/.gitkeep deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/certs/config/locales/en.yml b/certs/config/locales/en.yml deleted file mode 100644 index 18e4f47f23cba785ecfd8e14cf1e89dab3d86825..0000000000000000000000000000000000000000 --- a/certs/config/locales/en.yml +++ /dev/null @@ -1,2 +0,0 @@ -en: - cert_pool_empty: "Sorry the Cert pool is empty, please check back later." diff --git a/certs/config/routes.rb b/certs/config/routes.rb deleted file mode 100644 index cb97757c658daafe0c9f06e5c33919f2f5613b41..0000000000000000000000000000000000000000 --- a/certs/config/routes.rb +++ /dev/null @@ -1,5 +0,0 @@ -Rails.application.routes.draw do - scope '/1' do - resource :cert, :only => [:show] - end -end diff --git a/certs/leap_web_certs.gemspec b/certs/leap_web_certs.gemspec deleted file mode 100644 index 21be09d9bda63aff7ac379dd3e913ed9a09c169e..0000000000000000000000000000000000000000 --- a/certs/leap_web_certs.gemspec +++ /dev/null @@ -1,21 +0,0 @@ -$:.push File.expand_path("../lib", __FILE__) - -require File.expand_path('../../lib/leap_web/version.rb', __FILE__) - -# Describe your gem and declare its dependencies: -Gem::Specification.new do |s| - s.name = "leap_web_certs" - s.version = LeapWeb::VERSION - s.authors = ["Azul"] - s.email = ["azul@leap.se"] - s.homepage = "http://www.leap.se" - s.summary = "Cert distribution for the leap platform" - s.description = "This plugin for the leap platform distributes certs for the EIP client. It fetches the certs from a pool in CouchDB that is filled by leap-ca." - - s.files = Dir["{app,config,db,lib}/**/*"] + ["Rakefile", "Readme.md"] - s.test_files = Dir["test/**/*"] - - s.add_dependency "leap_web_core", LeapWeb::VERSION - s.add_dependency "certificate_authority", [">= 0.2.0"] - -end diff --git a/certs/lib/leap_web_certs.rb b/certs/lib/leap_web_certs.rb deleted file mode 100644 index beb683d94b18a04888d46e06704e3d1166da8ca6..0000000000000000000000000000000000000000 --- a/certs/lib/leap_web_certs.rb +++ /dev/null @@ -1,4 +0,0 @@ -require "leap_web_certs/engine" - -module LeapWebCerts -end diff --git a/certs/lib/leap_web_certs/engine.rb b/certs/lib/leap_web_certs/engine.rb deleted file mode 100644 index 3c8948a0d84ee364f89911ff7a406c1760840b78..0000000000000000000000000000000000000000 --- a/certs/lib/leap_web_certs/engine.rb +++ /dev/null @@ -1,7 +0,0 @@ -require "leap_web_core" - -module LeapWebCerts - class Engine < ::Rails::Engine - - end -end diff --git a/certs/lib/tasks/leap_web_certs_tasks.rake b/certs/lib/tasks/leap_web_certs_tasks.rake deleted file mode 100644 index e8fb7ffc57f2459f4b5c8c999a09900d6a5207e3..0000000000000000000000000000000000000000 --- a/certs/lib/tasks/leap_web_certs_tasks.rake +++ /dev/null @@ -1,4 +0,0 @@ -# desc "Explaining what the task does" -# task :leap_web_certs do -# # Task goes here -# end diff --git a/certs/script/rails b/certs/script/rails deleted file mode 100755 index 616d3c933f9dbbcd0d5d331d54a61ee6b23138b8..0000000000000000000000000000000000000000 --- a/certs/script/rails +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env ruby1.8 -# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application. - -ENGINE_ROOT = File.expand_path('../..', __FILE__) -ENGINE_PATH = File.expand_path('../../lib/leap_web_certs/engine', __FILE__) - -require 'rails/all' -require 'rails/engine/commands' diff --git a/certs/test/leap_web_certs_test.rb b/certs/test/leap_web_certs_test.rb deleted file mode 100644 index ee2058be12fe3c8e2ff4047d07acdda4852c07e2..0000000000000000000000000000000000000000 --- a/certs/test/leap_web_certs_test.rb +++ /dev/null @@ -1,7 +0,0 @@ -require 'test_helper' - -class LeapWebCertsTest < ActiveSupport::TestCase - test "truth" do - assert_kind_of Module, LeapWebCerts - end -end diff --git a/certs/test/test_helper.rb b/certs/test/test_helper.rb deleted file mode 100644 index f6b4eb830e3c12741a760b6237542d9607321687..0000000000000000000000000000000000000000 --- a/certs/test/test_helper.rb +++ /dev/null @@ -1,10 +0,0 @@ -ENV["RAILS_ENV"] = "test" -require File.expand_path('../../../test/dummy/config/environment', __FILE__) -require 'rails/test_help' -require 'mocha/setup' - -Rails.backtrace_cleaner.remove_silencers! - -# Load support files -Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f } - diff --git a/common_dependencies.rb b/common_dependencies.rb deleted file mode 100644 index 2225613d4be561a315b2e1e93b319e574a871d15..0000000000000000000000000000000000000000 --- a/common_dependencies.rb +++ /dev/null @@ -1,22 +0,0 @@ -group :test do - # moching and stubing - gem 'mocha', '~> 0.13.0', :require => false - # integration testing - gem 'capybara' - # headless js integration testing - gem 'poltergeist' - # required for save_and_open_page in integration tests - # gem 'launchy' - gem 'fake_braintree' #depends on rspec? - gem 'faker' - gem 'factory_girl_rails' -end - -group :test, :development do - gem 'thin' - gem 'quiet_assets' -end - -group :production do - gem 'SyslogLogger', '~> 2.0' -end diff --git a/config/defaults.yml b/config/defaults.yml index cb1879544d339c5dd60cafe9be52758869d2f2f0..e7d0f5e9a7316e4b8786f813f0217ecdcb8a1d84 100644 --- a/config/defaults.yml +++ b/config/defaults.yml @@ -1,6 +1,6 @@ dev_ca: &dev_ca - client_ca_key: "./certs/test/files/ca.key" - client_ca_cert: "./certs/test/files/ca.crt" + client_ca_key: "./test/files/ca.key" + client_ca_cert: "./test/files/ca.crt" ca_key_password: nil cert_options: &cert_options diff --git a/users/config/initializers/add_controller_methods.rb b/config/initializers/add_controller_methods.rb similarity index 100% rename from users/config/initializers/add_controller_methods.rb rename to config/initializers/add_controller_methods.rb diff --git a/core/config/initializers/couchrest_model.rb b/config/initializers/couchrest_model.rb similarity index 73% rename from core/config/initializers/couchrest_model.rb rename to config/initializers/couchrest_model.rb index ce4f41a249c7e83b0bb95df88dc1d7c55410865f..1a3e921114c5bf9245bf19e0b6c5d392dee0a1f5 100644 --- a/core/config/initializers/couchrest_model.rb +++ b/config/initializers/couchrest_model.rb @@ -1,3 +1,5 @@ +require 'extensions/couchrest' + CouchRest::Model::Base.configure do |config| config.auto_update_design_doc = false end diff --git a/users/config/initializers/error_constants.rb b/config/initializers/error_constants.rb similarity index 64% rename from users/config/initializers/error_constants.rb rename to config/initializers/error_constants.rb index d4a0f527c05eb1553b68cd04e40edaa85fe4eaf1..fdd3624591f50261811211f690e4afde477b3de7 100644 --- a/users/config/initializers/error_constants.rb +++ b/config/initializers/error_constants.rb @@ -1 +1,3 @@ +require 'ruby-srp' + WRONG_PASSWORD = SRP::WrongPassword diff --git a/core/config/initializers/simple_form.rb b/config/initializers/simple_form.rb similarity index 100% rename from core/config/initializers/simple_form.rb rename to config/initializers/simple_form.rb diff --git a/core/config/initializers/simple_form_bootstrap.rb b/config/initializers/simple_form_bootstrap.rb similarity index 100% rename from core/config/initializers/simple_form_bootstrap.rb rename to config/initializers/simple_form_bootstrap.rb diff --git a/core/config/initializers/validations.rb b/config/initializers/validations.rb similarity index 100% rename from core/config/initializers/validations.rb rename to config/initializers/validations.rb diff --git a/users/config/initializers/warden.rb b/config/initializers/warden.rb similarity index 70% rename from users/config/initializers/warden.rb rename to config/initializers/warden.rb index 45feb6cc28b37e6dca2715b59afc7c5738a4908e..22892b3538f9d4bb0a51d7140a718ea1f13a22a9 100644 --- a/users/config/initializers/warden.rb +++ b/config/initializers/warden.rb @@ -1,3 +1,6 @@ +require "warden/session_serializer" +require "warden/strategies/secure_remote_password" + Rails.configuration.middleware.use RailsWarden::Manager do |config| config.default_strategies :secure_remote_password config.failure_app = SessionsController diff --git a/config/initializers/webfinger.rb b/config/initializers/webfinger.rb new file mode 100644 index 0000000000000000000000000000000000000000..197062ce2a89c7b301f24a7e0089f1f86a42de80 --- /dev/null +++ b/config/initializers/webfinger.rb @@ -0,0 +1 @@ +require 'webfinger' diff --git a/config/locales/en.yml b/config/locales/en.yml index 96c47ca85bfdf7e8c4fb76c14336e61170419fd8..ac154d685c21f29bc45879757a3e2d3957214f35 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -3,4 +3,44 @@ en: terms_of_service: Terms of Service pricing: Pricing about: About Us - contact: Contact \ No newline at end of file + contact: Contact + no_such_thing: "No such %{thing}." + thing_was_successfully_created: "%{thing} was successfully created." + create_thing: "Create %{thing}" + + overview: "Overview" + user_control_panel: "user control panel" + + created: "Created" + created_by_on: "Created by %{user} on %{time}" + updated: "Updated" + + none: "None" + unknown: "Unknown" + admin: "Admin" + anonymous: "Anonymous" + save: "Save" + add: "Add" + remove: "Remove" + changes_saved: "Changes saved successfully." + are_you_sure: "Are you sure? This change cannot be undone." + + download_client: "Download Bitmask" + client_info: "The Bitmask application allows you to use %{provider} services." + all_downloads_info: "It is available for %{clients}." + other_downloads_info: "Bitmask is also available for %{clients}." + login_info: "Log in to change your account settings, create support tickets, and manage payments." + signup_info: "Sign up for a new user account via this website (it is better if you use the Bitmask application to sign up, but this website works too)." + welcome: "Welcome to %{provider}." + get_help: "Get Help" + help_info: "Can't login? Create a new support ticket anonymously." + example_email: 'user@domain.org' + os: + linux32: "Linux (32 bit)" + linux64: "Linux (64 bit)" + linux: "GNU/Linux" + windows: "Windows" + android: "Android" + osx: "Mac OS" + other: "(not available for your OS)" + diff --git a/core/config/locales/simple_form.en.yml b/config/locales/simple_form.en.yml similarity index 100% rename from core/config/locales/simple_form.en.yml rename to config/locales/simple_form.en.yml diff --git a/users/config/locales/en.yml b/config/locales/users.en.yml similarity index 100% rename from users/config/locales/en.yml rename to config/locales/users.en.yml diff --git a/config/routes.rb b/config/routes.rb index f8bb8fbf35f0a34c89e38732a10f9d17462bf483..b930bd1cbd065907496ac9162b755fc3bc673b8f 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -16,4 +16,32 @@ LeapWeb::Application.routes.draw do end get '/provider.json' => 'static_config#provider' + + namespace "api", { module: "v1", + path: "/1/", + defaults: {format: 'json'} } do + resources :sessions, :only => [:new, :create, :update] + delete "logout" => "sessions#destroy", :as => "logout" + resources :users, :only => [:create, :update, :destroy, :index] + resources :messages, :only => [:index, :update] + resource :cert, :only => [:show] + end + + scope "(:locale)", :locale => MATCH_LOCALE do + get "login" => "sessions#new", :as => "login" + delete "logout" => "sessions#destroy", :as => "logout" + + get "signup" => "users#new", :as => "signup" + resources :users, :except => [:create, :update] do + # resource :email_settings, :only => [:edit, :update] + # resources :email_aliases, :only => [:destroy], :id => /.*/ + post 'deactivate', on: :member + post 'enable', on: :member + end + end + + get "/.well-known/host-meta" => 'webfinger#host_meta' + get "/webfinger" => 'webfinger#search' + get "/key/:login" => 'keys#show' + end diff --git a/core/Gemfile b/core/Gemfile deleted file mode 100644 index b552dc586bf6b33dc64646cce51c83ade4afeaf8..0000000000000000000000000000000000000000 --- a/core/Gemfile +++ /dev/null @@ -1,17 +0,0 @@ -source "https://rubygems.org" - -# Declare your gem's dependencies in leap_web_core.gemspec. -# Bundler will treat runtime dependencies like base dependencies, and -# development dependencies will be added by default to the :development group. -gemspec - -# jquery-rails is used by the dummy application -gem "jquery-rails" - -# Declare any dependencies that are still in development here instead of in -# your gemspec. These might include edge Rails or gems from your path or -# Git. Remember to move these dependencies to your gemspec before releasing -# your gem to rubygems.org. - -# To use debugger -# gem 'ruby-debug' diff --git a/core/Rakefile b/core/Rakefile deleted file mode 100644 index 3c6539ce230d8efdf22b357fd785f401df297d44..0000000000000000000000000000000000000000 --- a/core/Rakefile +++ /dev/null @@ -1,44 +0,0 @@ -#!/usr/bin/env rake - -require 'rake/packagetask' -require 'rubygems/package_task' - -begin - require 'bundler/setup' -rescue LoadError - puts 'You must `gem install bundler` and `bundle install` to run rake tasks' -end -begin - require 'rdoc/task' -rescue LoadError - require 'rdoc/rdoc' - require 'rake/rdoctask' - RDoc::Task = Rake::RDocTask -end - -RDoc::Task.new(:rdoc) do |rdoc| - rdoc.rdoc_dir = 'rdoc' - rdoc.title = 'LeapWebCore' - rdoc.options << '--line-numbers' - rdoc.rdoc_files.include('README.rdoc') - rdoc.rdoc_files.include('lib/**/*.rb') -end - -spec = eval(File.read('leap_web_core.gemspec')) -Gem::PackageTask.new(spec) do |p| - p.gem_spec = spec -end - -Bundler::GemHelper.install_tasks - -require 'rake/testtask' - -Rake::TestTask.new(:test) do |t| - t.libs << 'lib' - t.libs << 'test' - t.pattern = 'test/**/*_test.rb' - t.verbose = false -end - - -task :default => :test diff --git a/core/Readme.md b/core/Readme.md deleted file mode 100644 index 795c0a49dce0cf15e954761ae4dfe226629eb534..0000000000000000000000000000000000000000 --- a/core/Readme.md +++ /dev/null @@ -1,6 +0,0 @@ -Leap Web Core -=== - -[Leap](http://www.leap.se) is the Leap Encryption Access Project and this is the rails app for its web interface. - -This is the its core gem. Currently it only serves to load shared dependencies. diff --git a/core/config/initializers/backtrace_silencers.rb b/core/config/initializers/backtrace_silencers.rb deleted file mode 100644 index 59385cdf379bd06a8d2326dcd4de6d5cd5d3f5b0..0000000000000000000000000000000000000000 --- a/core/config/initializers/backtrace_silencers.rb +++ /dev/null @@ -1,7 +0,0 @@ -# Be sure to restart your server when you modify this file. - -# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. -# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ } - -# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code. -# Rails.backtrace_cleaner.remove_silencers! diff --git a/core/config/initializers/inflections.rb b/core/config/initializers/inflections.rb deleted file mode 100644 index 5d8d9be237b28d4ebdad9cec9510764ab88154e6..0000000000000000000000000000000000000000 --- a/core/config/initializers/inflections.rb +++ /dev/null @@ -1,15 +0,0 @@ -# Be sure to restart your server when you modify this file. - -# Add new inflection rules using the following format -# (all these examples are active by default): -# ActiveSupport::Inflector.inflections do |inflect| -# inflect.plural /^(ox)$/i, '\1en' -# inflect.singular /^(ox)en/i, '\1' -# inflect.irregular 'person', 'people' -# inflect.uncountable %w( fish sheep ) -# end -# -# These inflection rules are supported but not enabled by default: -# ActiveSupport::Inflector.inflections do |inflect| -# inflect.acronym 'RESTful' -# end diff --git a/core/config/initializers/mime_types.rb b/core/config/initializers/mime_types.rb deleted file mode 100644 index 72aca7e441e1855f8c7a7ac1f1cbe5d42cd1235b..0000000000000000000000000000000000000000 --- a/core/config/initializers/mime_types.rb +++ /dev/null @@ -1,5 +0,0 @@ -# Be sure to restart your server when you modify this file. - -# Add new mime types for use in respond_to blocks: -# Mime::Type.register "text/richtext", :rtf -# Mime::Type.register_alias "text/html", :iphone diff --git a/core/config/initializers/wrap_parameters.rb b/core/config/initializers/wrap_parameters.rb deleted file mode 100644 index 5fe232e2ad1dd3ff6afb34bdd2eaed119374c0d4..0000000000000000000000000000000000000000 --- a/core/config/initializers/wrap_parameters.rb +++ /dev/null @@ -1,10 +0,0 @@ -# Be sure to restart your server when you modify this file. -# -# This file contains settings for ActionController::ParamsWrapper which -# is enabled by default. - -# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. -ActiveSupport.on_load(:action_controller) do - wrap_parameters :format => [:json] -end - diff --git a/core/config/locales/en.yml b/core/config/locales/en.yml deleted file mode 100644 index bb510d4af7e4a1f2a46acdb5ca1c4def43ba7b41..0000000000000000000000000000000000000000 --- a/core/config/locales/en.yml +++ /dev/null @@ -1,41 +0,0 @@ -en: - no_such_thing: "No such %{thing}." - thing_was_successfully_created: "%{thing} was successfully created." - create_thing: "Create %{thing}" - - overview: "Overview" - user_control_panel: "user control panel" - - created: "Created" - created_by_on: "Created by %{user} on %{time}" - updated: "Updated" - - none: "None" - unknown: "Unknown" - admin: "Admin" - anonymous: "Anonymous" - save: "Save" - add: "Add" - remove: "Remove" - changes_saved: "Changes saved successfully." - are_you_sure: "Are you sure? This change cannot be undone." - - download_client: "Download Bitmask" - client_info: "The Bitmask application allows you to use %{provider} services." - all_downloads_info: "It is available for %{clients}." - other_downloads_info: "Bitmask is also available for %{clients}." - login_info: "Log in to change your account settings, create support tickets, and manage payments." - signup_info: "Sign up for a new user account via this website (it is better if you use the Bitmask application to sign up, but this website works too)." - welcome: "Welcome to %{provider}." - get_help: "Get Help" - help_info: "Can't login? Create a new support ticket anonymously." - example_email: 'user@domain.org' - os: - linux32: "Linux (32 bit)" - linux64: "Linux (64 bit)" - linux: "GNU/Linux" - windows: "Windows" - android: "Android" - osx: "Mac OS" - other: "(not available for your OS)" - diff --git a/core/config/routes.rb b/core/config/routes.rb deleted file mode 100644 index 1daf9a4121a8bcf72094c3164d96a8deea47be66..0000000000000000000000000000000000000000 --- a/core/config/routes.rb +++ /dev/null @@ -1,2 +0,0 @@ -Rails.application.routes.draw do -end diff --git a/core/leap_web_core.gemspec b/core/leap_web_core.gemspec deleted file mode 100644 index 7ca4d90380aff79025d4f1e57dd87ace74ff627f..0000000000000000000000000000000000000000 --- a/core/leap_web_core.gemspec +++ /dev/null @@ -1,25 +0,0 @@ -$:.push File.expand_path("../lib", __FILE__) - -require File.expand_path('../../lib/leap_web/version.rb', __FILE__) - -# Describe your gem and declare its dependencies: -Gem::Specification.new do |s| - s.name = "leap_web_core" - s.version = LeapWeb::VERSION - s.authors = ["Azul"] - s.email = ["azul@leap.se"] - s.homepage = "http://www.leap.se" - s.summary = "Web interface to the leap platform - core engine" - s.description = "This web interface provides various administrative tools for the leap platform through plugins. Currently it manages user accounts and certificates." - - s.files = Dir["{app,config,db,lib}/**/*"] + ["Rakefile", "Readme.md"] - s.test_files = Dir["test/**/*"] - - s.add_dependency "rails", "~> 3.2.11" - - s.add_dependency "couchrest", "~> 1.1.3" - s.add_dependency "couchrest_model", "~> 2.0.0" - s.add_dependency "couchrest_session_store", "~> 0.2.4" - - s.add_dependency "json" -end diff --git a/core/lib/extensions/testing.rb b/core/lib/extensions/testing.rb deleted file mode 100644 index 8f7e73c3ceca271a0516682760f23db7443ec7f0..0000000000000000000000000000000000000000 --- a/core/lib/extensions/testing.rb +++ /dev/null @@ -1,48 +0,0 @@ -module LeapWebCore - module AssertResponses - - # response that works with different TestCases: - # ActionController::TestCase has @response - # ActionDispatch::IntegrationTest has @response - # Rack::Test::Methods defines last_response - def get_response - @response || last_response - end - - def assert_attachement_filename(name) - assert_equal %Q(attachment; filename="#{name}"), - get_response.headers["Content-Disposition"] - end - - def json_response - response = JSON.parse(get_response.body) - response.respond_to?(:with_indifferent_access) ? - response.with_indifferent_access : - response - end - - def assert_json_response(object) - assert_equal 'application/json', - get_response.content_type.to_s.split(';').first - if object.is_a? Hash - object.stringify_keys! if object.respond_to? :stringify_keys! - assert_equal object, json_response - else - assert_equal object.to_json, get_response.body - end - end - - def assert_json_error(object) - object.stringify_keys! if object.respond_to? :stringify_keys! - assert_json_response :errors => object - end - end -end - -class ::ActionController::TestCase - include LeapWebCore::AssertResponses -end - -class ::ActionDispatch::IntegrationTest - include LeapWebCore::AssertResponses -end diff --git a/core/lib/leap_web_core.rb b/core/lib/leap_web_core.rb deleted file mode 100644 index a58d140d38fb9032f8f2f7a0f769c2f9d76c798b..0000000000000000000000000000000000000000 --- a/core/lib/leap_web_core.rb +++ /dev/null @@ -1,14 +0,0 @@ -require "rails" - -require "couchrest" -require "couchrest_model" -require "couchrest_session_store" - -require "json" - -require "extensions/testing" -require "extensions/couchrest" -require "leap_web_core/engine" - -module LeapWebCore -end diff --git a/core/lib/leap_web_core/dependencies.rb b/core/lib/leap_web_core/dependencies.rb deleted file mode 100644 index 877e3d1fe4d57021e7fe437f6e4f84dba31f42b5..0000000000000000000000000000000000000000 --- a/core/lib/leap_web_core/dependencies.rb +++ /dev/null @@ -1,40 +0,0 @@ -module LeapWebCore - class Dependencies - UI_DEV = { - "haml-rails" => "~> 0.3.4", - "sass-rails" => "~> 3.2.5", - "coffee-rails" => "~> 3.2.2", - "uglifier" => "~> 1.2.7" - } - - UI = { - "haml" => "~> 3.1.7", - "jquery-rails" => nil, - "simple_form" => nil, - "bootswatch-rails", "~> 0.5.0" - } - - def self.require_ui_gems - UI.keys.each {|dep| require dep} - if Rails.env == "development" - # This will be run in the app including plugins that run it. - # However not all development_dependencies might be present. - # So we better only require those that are. - available = Bundler.definition.specs.map(&:name) - gems_to_require = available & UI_DEV.keys - gems_to_require.each {|dep| require dep} - end - end - - def self.add_ui_gems_to_spec(spec) - UI.each do |dep, version| - spec.add_dependency dep, version - end - - UI_DEV.each do |dep, version| - spec.add_development_dependency dep, version - end - end - - end -end diff --git a/core/lib/leap_web_core/engine.rb b/core/lib/leap_web_core/engine.rb deleted file mode 100644 index 940b5e2f7e0e436c40f54a06c6ef8d404f70c375..0000000000000000000000000000000000000000 --- a/core/lib/leap_web_core/engine.rb +++ /dev/null @@ -1,9 +0,0 @@ -# thou shall require all your dependencies in an engine. -require "couchrest" -require "couchrest_model" - -module LeapWebCore - class Engine < ::Rails::Engine - - end -end diff --git a/core/lib/leap_web_core/ui_dependencies.rb b/core/lib/leap_web_core/ui_dependencies.rb deleted file mode 100644 index 2daee375cb749fae44721aafc5ea2ad0de62f35b..0000000000000000000000000000000000000000 --- a/core/lib/leap_web_core/ui_dependencies.rb +++ /dev/null @@ -1,11 +0,0 @@ -require "haml" -require "jquery-rails" -require "simple_form" -require "bootswatch-rails" - -if Rails.env == "development" - require "haml-rails" - require "sass-rails" - require "coffee-rails" - require "uglifier" -end diff --git a/core/script/rails b/core/script/rails deleted file mode 100755 index c2ad53860af7d4952cffd515d8cb60eac8ba4e9e..0000000000000000000000000000000000000000 --- a/core/script/rails +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env ruby1.8 -# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application. - -ENGINE_ROOT = File.expand_path('../..', __FILE__) -ENGINE_PATH = File.expand_path('../../lib/leap_web_core/engine', __FILE__) - -require 'rails/all' -require 'rails/engine/commands' diff --git a/billing/Gemfile b/engines/billing/Gemfile similarity index 100% rename from billing/Gemfile rename to engines/billing/Gemfile diff --git a/billing/README.md b/engines/billing/README.md similarity index 100% rename from billing/README.md rename to engines/billing/README.md diff --git a/billing/Rakefile b/engines/billing/Rakefile similarity index 100% rename from billing/Rakefile rename to engines/billing/Rakefile diff --git a/billing/app/controllers/billing_admin_controller.rb b/engines/billing/app/controllers/billing_admin_controller.rb similarity index 100% rename from billing/app/controllers/billing_admin_controller.rb rename to engines/billing/app/controllers/billing_admin_controller.rb diff --git a/billing/app/controllers/billing_base_controller.rb b/engines/billing/app/controllers/billing_base_controller.rb similarity index 100% rename from billing/app/controllers/billing_base_controller.rb rename to engines/billing/app/controllers/billing_base_controller.rb diff --git a/billing/app/controllers/credit_card_info_controller.rb b/engines/billing/app/controllers/credit_card_info_controller.rb similarity index 100% rename from billing/app/controllers/credit_card_info_controller.rb rename to engines/billing/app/controllers/credit_card_info_controller.rb diff --git a/billing/app/controllers/customer_controller.rb b/engines/billing/app/controllers/customer_controller.rb similarity index 100% rename from billing/app/controllers/customer_controller.rb rename to engines/billing/app/controllers/customer_controller.rb diff --git a/billing/app/controllers/payments_controller.rb b/engines/billing/app/controllers/payments_controller.rb similarity index 100% rename from billing/app/controllers/payments_controller.rb rename to engines/billing/app/controllers/payments_controller.rb diff --git a/billing/app/controllers/subscriptions_controller.rb b/engines/billing/app/controllers/subscriptions_controller.rb similarity index 100% rename from billing/app/controllers/subscriptions_controller.rb rename to engines/billing/app/controllers/subscriptions_controller.rb diff --git a/billing/app/helpers/billing_helper.rb b/engines/billing/app/helpers/billing_helper.rb similarity index 100% rename from billing/app/helpers/billing_helper.rb rename to engines/billing/app/helpers/billing_helper.rb diff --git a/billing/app/helpers/braintree_form_helper.rb b/engines/billing/app/helpers/braintree_form_helper.rb similarity index 100% rename from billing/app/helpers/braintree_form_helper.rb rename to engines/billing/app/helpers/braintree_form_helper.rb diff --git a/billing/app/helpers/braintree_helper.rb b/engines/billing/app/helpers/braintree_helper.rb similarity index 100% rename from billing/app/helpers/braintree_helper.rb rename to engines/billing/app/helpers/braintree_helper.rb diff --git a/billing/app/models/customer.rb b/engines/billing/app/models/customer.rb similarity index 100% rename from billing/app/models/customer.rb rename to engines/billing/app/models/customer.rb diff --git a/billing/app/views/billing_admin/show.html.haml b/engines/billing/app/views/billing_admin/show.html.haml similarity index 100% rename from billing/app/views/billing_admin/show.html.haml rename to engines/billing/app/views/billing_admin/show.html.haml diff --git a/billing/app/views/credit_card_info/confirm.html.haml b/engines/billing/app/views/credit_card_info/confirm.html.haml similarity index 100% rename from billing/app/views/credit_card_info/confirm.html.haml rename to engines/billing/app/views/credit_card_info/confirm.html.haml diff --git a/billing/app/views/credit_card_info/edit.html.haml b/engines/billing/app/views/credit_card_info/edit.html.haml similarity index 100% rename from billing/app/views/credit_card_info/edit.html.haml rename to engines/billing/app/views/credit_card_info/edit.html.haml diff --git a/billing/app/views/customer/_customer_data.html.haml b/engines/billing/app/views/customer/_customer_data.html.haml similarity index 100% rename from billing/app/views/customer/_customer_data.html.haml rename to engines/billing/app/views/customer/_customer_data.html.haml diff --git a/billing/app/views/customer/_transaction.html.haml b/engines/billing/app/views/customer/_transaction.html.haml similarity index 100% rename from billing/app/views/customer/_transaction.html.haml rename to engines/billing/app/views/customer/_transaction.html.haml diff --git a/billing/app/views/customer/confirm.html.haml b/engines/billing/app/views/customer/confirm.html.haml similarity index 100% rename from billing/app/views/customer/confirm.html.haml rename to engines/billing/app/views/customer/confirm.html.haml diff --git a/billing/app/views/customer/edit.html.haml b/engines/billing/app/views/customer/edit.html.haml similarity index 100% rename from billing/app/views/customer/edit.html.haml rename to engines/billing/app/views/customer/edit.html.haml diff --git a/billing/app/views/customer/new.html.haml b/engines/billing/app/views/customer/new.html.haml similarity index 100% rename from billing/app/views/customer/new.html.haml rename to engines/billing/app/views/customer/new.html.haml diff --git a/billing/app/views/customer/show.html.haml b/engines/billing/app/views/customer/show.html.haml similarity index 100% rename from billing/app/views/customer/show.html.haml rename to engines/billing/app/views/customer/show.html.haml diff --git a/billing/app/views/payments/_non_customer_fields.html.haml b/engines/billing/app/views/payments/_non_customer_fields.html.haml similarity index 100% rename from billing/app/views/payments/_non_customer_fields.html.haml rename to engines/billing/app/views/payments/_non_customer_fields.html.haml diff --git a/billing/app/views/payments/_transaction_details.html.haml b/engines/billing/app/views/payments/_transaction_details.html.haml similarity index 100% rename from billing/app/views/payments/_transaction_details.html.haml rename to engines/billing/app/views/payments/_transaction_details.html.haml diff --git a/billing/app/views/payments/confirm.html.haml b/engines/billing/app/views/payments/confirm.html.haml similarity index 100% rename from billing/app/views/payments/confirm.html.haml rename to engines/billing/app/views/payments/confirm.html.haml diff --git a/billing/app/views/payments/index.html.haml b/engines/billing/app/views/payments/index.html.haml similarity index 100% rename from billing/app/views/payments/index.html.haml rename to engines/billing/app/views/payments/index.html.haml diff --git a/billing/app/views/payments/new.html.haml b/engines/billing/app/views/payments/new.html.haml similarity index 100% rename from billing/app/views/payments/new.html.haml rename to engines/billing/app/views/payments/new.html.haml diff --git a/billing/app/views/subscriptions/_subscription_details.html.haml b/engines/billing/app/views/subscriptions/_subscription_details.html.haml similarity index 100% rename from billing/app/views/subscriptions/_subscription_details.html.haml rename to engines/billing/app/views/subscriptions/_subscription_details.html.haml diff --git a/billing/app/views/subscriptions/create.html.haml b/engines/billing/app/views/subscriptions/create.html.haml similarity index 100% rename from billing/app/views/subscriptions/create.html.haml rename to engines/billing/app/views/subscriptions/create.html.haml diff --git a/billing/app/views/subscriptions/destroy.html.haml b/engines/billing/app/views/subscriptions/destroy.html.haml similarity index 100% rename from billing/app/views/subscriptions/destroy.html.haml rename to engines/billing/app/views/subscriptions/destroy.html.haml diff --git a/billing/app/views/subscriptions/index.html.haml b/engines/billing/app/views/subscriptions/index.html.haml similarity index 100% rename from billing/app/views/subscriptions/index.html.haml rename to engines/billing/app/views/subscriptions/index.html.haml diff --git a/billing/app/views/subscriptions/new.html.haml b/engines/billing/app/views/subscriptions/new.html.haml similarity index 100% rename from billing/app/views/subscriptions/new.html.haml rename to engines/billing/app/views/subscriptions/new.html.haml diff --git a/billing/app/views/subscriptions/show.html.haml b/engines/billing/app/views/subscriptions/show.html.haml similarity index 100% rename from billing/app/views/subscriptions/show.html.haml rename to engines/billing/app/views/subscriptions/show.html.haml diff --git a/billing/config/initializers/braintree.rb b/engines/billing/config/initializers/braintree.rb similarity index 83% rename from billing/config/initializers/braintree.rb rename to engines/billing/config/initializers/braintree.rb index c0c89e29418659dc0b6983aaaaf9f104b756ff6f..3d87f4c55f8b2d9fbb76321e646f73fbbaae643e 100644 --- a/billing/config/initializers/braintree.rb +++ b/engines/billing/config/initializers/braintree.rb @@ -8,14 +8,6 @@ else Braintree::Configuration.logger = Logger.new('log/braintree.log') end -# -# we use fake braintree in tests -# -if Rails.env.test? - require 'braintree_test_app' - Rails.application.config.middleware.use BraintreeTestApp -end - # # You can set these per environment in config/config.yml: # diff --git a/billing/config/locales/en.yml b/engines/billing/config/locales/en.yml similarity index 100% rename from billing/config/locales/en.yml rename to engines/billing/config/locales/en.yml diff --git a/billing/config/routes.rb b/engines/billing/config/routes.rb similarity index 100% rename from billing/config/routes.rb rename to engines/billing/config/routes.rb diff --git a/billing/leap_web_billing.gemspec b/engines/billing/leap_web_billing.gemspec similarity index 74% rename from billing/leap_web_billing.gemspec rename to engines/billing/leap_web_billing.gemspec index 94d92e0a87c587116bbd530a038f004c18a2f9c1..ff11c98409232532267205aa5979cc944b265ce6 100644 --- a/billing/leap_web_billing.gemspec +++ b/engines/billing/leap_web_billing.gemspec @@ -1,6 +1,6 @@ $:.push File.expand_path("../lib", __FILE__) -require File.expand_path('../../lib/leap_web/version.rb', __FILE__) +require File.expand_path('../../../lib/leap_web/version.rb', __FILE__) # Describe your gem and declare its dependencies: Gem::Specification.new do |s| @@ -12,10 +12,9 @@ Gem::Specification.new do |s| s.summary = "Billing for LeapWeb" s.description = "Billing System for a Leap provider" - s.files = Dir["{app,config,db,lib}/**/*"] + ["Rakefile", "README.md"] + s.files = Dir["{app,config,lib}/**/*"] + ["Rakefile", "README.md"] s.test_files = Dir["test/**/*"] - s.add_dependency "leap_web_core", LeapWeb::VERSION # s.add_dependency "braintree-rails", "~> 0.4.5" s.add_dependency "braintree" #s.add_dependency "carmen-rails" diff --git a/billing/lib/braintree_test_app.rb b/engines/billing/lib/braintree_test_app.rb similarity index 100% rename from billing/lib/braintree_test_app.rb rename to engines/billing/lib/braintree_test_app.rb diff --git a/billing/lib/leap_web_billing.rb b/engines/billing/lib/leap_web_billing.rb similarity index 100% rename from billing/lib/leap_web_billing.rb rename to engines/billing/lib/leap_web_billing.rb diff --git a/billing/lib/leap_web_billing/engine.rb b/engines/billing/lib/leap_web_billing/engine.rb similarity index 75% rename from billing/lib/leap_web_billing/engine.rb rename to engines/billing/lib/leap_web_billing/engine.rb index 6d76addc1dddd56325ca9dc42f80179a732f9f22..ab574f2c18e29306b42b16d6b7507d101f092e87 100644 --- a/billing/lib/leap_web_billing/engine.rb +++ b/engines/billing/lib/leap_web_billing/engine.rb @@ -1,7 +1,4 @@ # thou shall require all your dependencies in an engine. -require "leap_web_core" -require "leap_web_core/ui_dependencies" - #require "braintree-rails" require "braintree" #require "carmen-rails" diff --git a/billing/script/rails b/engines/billing/script/rails similarity index 100% rename from billing/script/rails rename to engines/billing/script/rails diff --git a/billing/test/integration/admin_customer_test.rb b/engines/billing/test/broken/admin_customer_test.rb similarity index 81% rename from billing/test/integration/admin_customer_test.rb rename to engines/billing/test/broken/admin_customer_test.rb index 1b9953fc8567a69077eefd50649f5f761aca38b4..df92a0d708739e3b4488f7cfd7338c315e87ab9d 100644 --- a/billing/test/integration/admin_customer_test.rb +++ b/engines/billing/test/broken/admin_customer_test.rb @@ -1,19 +1,14 @@ require 'test_helper' require 'fake_braintree' -require 'capybara/rails' -class AdminCustomerTest < ActionDispatch::IntegrationTest - include Warden::Test::Helpers - include Capybara::DSL +class AdminCustomerTest < BraintreeIntegrationTest setup do - Warden.test_mode! @admin = User.find_by_login('admin') || FactoryGirl.create(:user, login: 'admin') @user = FactoryGirl.create(:user) end teardown do - Warden.test_reset! @user.destroy if @user @admin.destroy if @admin end diff --git a/billing/test/integration/customer_creation_test.rb b/engines/billing/test/broken/customer_creation_test.rb similarity index 93% rename from billing/test/integration/customer_creation_test.rb rename to engines/billing/test/broken/customer_creation_test.rb index aabd9b6c1b4ce729d340e317035f62c6947cd02f..90319a9689bb07d6a43343bea769e4087a633b1b 100644 --- a/billing/test/integration/customer_creation_test.rb +++ b/engines/billing/test/broken/customer_creation_test.rb @@ -1,20 +1,15 @@ require 'test_helper' require 'fake_braintree' -require 'capybara/rails' -class CustomerCreationTest < ActionDispatch::IntegrationTest - include Warden::Test::Helpers - include Capybara::DSL +class CustomerCreationTest < BraintreeIntegrationTest setup do - Warden.test_mode! @user = FactoryGirl.create(:user) login_as @user end teardown do @user.destroy - Warden.test_reset! end # Let's test both steps together with capybara diff --git a/billing/test/integration/subscription_test.rb b/engines/billing/test/broken/subscription_test.rb similarity index 89% rename from billing/test/integration/subscription_test.rb rename to engines/billing/test/broken/subscription_test.rb index 1473eb00af5754e9576cca986aa6340d85d405a7..cd010bde849ebf9dc95722627dec6de5bc91acb8 100644 --- a/billing/test/integration/subscription_test.rb +++ b/engines/billing/test/broken/subscription_test.rb @@ -1,14 +1,11 @@ require 'test_helper' require 'fake_braintree' -require 'capybara/rails' -class SubscriptionTest < BrowserIntegrationTest - include Warden::Test::Helpers +class SubscriptionTest < BraintreeIntegrationTest include CustomerTestHelper include StubRecordHelper setup do - Warden.test_mode! @admin = User.find_by_login('admin') || FactoryGirl.create(:user, login: 'admin') @customer = stub_customer @braintree_customer = @customer.braintree_customer @@ -19,7 +16,6 @@ class SubscriptionTest < BrowserIntegrationTest end teardown do - Warden.test_reset! @admin.destroy end diff --git a/billing/test/factories.rb b/engines/billing/test/factories.rb similarity index 100% rename from billing/test/factories.rb rename to engines/billing/test/factories.rb diff --git a/billing/test/functional/customer_controller_test.rb b/engines/billing/test/functional/customer_controller_test.rb similarity index 100% rename from billing/test/functional/customer_controller_test.rb rename to engines/billing/test/functional/customer_controller_test.rb diff --git a/billing/test/functional/customers_controller_test.rb b/engines/billing/test/functional/customers_controller_test.rb similarity index 100% rename from billing/test/functional/customers_controller_test.rb rename to engines/billing/test/functional/customers_controller_test.rb diff --git a/billing/test/functional/payments_controller_test.rb b/engines/billing/test/functional/payments_controller_test.rb similarity index 100% rename from billing/test/functional/payments_controller_test.rb rename to engines/billing/test/functional/payments_controller_test.rb diff --git a/billing/test/functional/subscriptions_controller_test.rb b/engines/billing/test/functional/subscriptions_controller_test.rb similarity index 100% rename from billing/test/functional/subscriptions_controller_test.rb rename to engines/billing/test/functional/subscriptions_controller_test.rb diff --git a/engines/billing/test/support/braintree_integration_test.rb b/engines/billing/test/support/braintree_integration_test.rb new file mode 100644 index 0000000000000000000000000000000000000000..976c5a2e87ee1011923586586f1ee2d2807b97bd --- /dev/null +++ b/engines/billing/test/support/braintree_integration_test.rb @@ -0,0 +1,18 @@ +require 'capybara/rails' +# require 'fake_braintree' - messes up other integration tests +require 'braintree_test_app' + +class BraintreeIntegrationTest < BrowserIntegrationTest + include Warden::Test::Helpers + + setup do + Warden.test_mode! + Rails.application.config.middleware.use BraintreeTestApp + end + + teardown do + Warden.test_reset! + Rails.application.config.middleware.delete "BraintreeTestApp" + end + +end diff --git a/billing/test/support/customer_test_helper.rb b/engines/billing/test/support/customer_test_helper.rb similarity index 100% rename from billing/test/support/customer_test_helper.rb rename to engines/billing/test/support/customer_test_helper.rb diff --git a/help/test/test_helper.rb b/engines/billing/test/test_helper.rb similarity index 83% rename from help/test/test_helper.rb rename to engines/billing/test/test_helper.rb index 3381f44411e8a3eeb3d5faade6521727df00af7c..7ad3869a8a2817481069c25d46e5f20595ba035e 100644 --- a/help/test/test_helper.rb +++ b/engines/billing/test/test_helper.rb @@ -1,7 +1,7 @@ # Configure Rails Environment ENV["RAILS_ENV"] = "test" -require File.expand_path('../../../test/dummy/config/environment', __FILE__) +require File.expand_path("../../../../dummy/config/environment.rb", __FILE__) require "rails/test_help" Rails.backtrace_cleaner.remove_silencers! diff --git a/billing/test/unit/customer_test.rb b/engines/billing/test/unit/customer_test.rb similarity index 100% rename from billing/test/unit/customer_test.rb rename to engines/billing/test/unit/customer_test.rb diff --git a/billing/test/unit/customer_with_payment_info_test.rb b/engines/billing/test/unit/customer_with_payment_info_test.rb similarity index 100% rename from billing/test/unit/customer_with_payment_info_test.rb rename to engines/billing/test/unit/customer_with_payment_info_test.rb diff --git a/help/Gemfile b/engines/support/Gemfile similarity index 100% rename from help/Gemfile rename to engines/support/Gemfile diff --git a/help/README.md b/engines/support/README.md similarity index 100% rename from help/README.md rename to engines/support/README.md diff --git a/help/Rakefile b/engines/support/Rakefile similarity index 100% rename from help/Rakefile rename to engines/support/Rakefile diff --git a/help/app/assets/javascripts/tickets.js b/engines/support/app/assets/javascripts/tickets.js similarity index 100% rename from help/app/assets/javascripts/tickets.js rename to engines/support/app/assets/javascripts/tickets.js diff --git a/help/app/controllers/tickets_controller.rb b/engines/support/app/controllers/tickets_controller.rb similarity index 100% rename from help/app/controllers/tickets_controller.rb rename to engines/support/app/controllers/tickets_controller.rb diff --git a/help/app/designs/ticket/by_includes_post_by.js b/engines/support/app/designs/ticket/by_includes_post_by.js similarity index 100% rename from help/app/designs/ticket/by_includes_post_by.js rename to engines/support/app/designs/ticket/by_includes_post_by.js diff --git a/help/app/designs/ticket/by_includes_post_by_and_created_at.js b/engines/support/app/designs/ticket/by_includes_post_by_and_created_at.js similarity index 100% rename from help/app/designs/ticket/by_includes_post_by_and_created_at.js rename to engines/support/app/designs/ticket/by_includes_post_by_and_created_at.js diff --git a/help/app/designs/ticket/by_includes_post_by_and_is_open_and_created_at.js b/engines/support/app/designs/ticket/by_includes_post_by_and_is_open_and_created_at.js similarity index 100% rename from help/app/designs/ticket/by_includes_post_by_and_is_open_and_created_at.js rename to engines/support/app/designs/ticket/by_includes_post_by_and_is_open_and_created_at.js diff --git a/help/app/designs/ticket/by_includes_post_by_and_is_open_and_updated_at.js b/engines/support/app/designs/ticket/by_includes_post_by_and_is_open_and_updated_at.js similarity index 100% rename from help/app/designs/ticket/by_includes_post_by_and_is_open_and_updated_at.js rename to engines/support/app/designs/ticket/by_includes_post_by_and_is_open_and_updated_at.js diff --git a/help/app/designs/ticket/by_includes_post_by_and_updated_at.js b/engines/support/app/designs/ticket/by_includes_post_by_and_updated_at.js similarity index 100% rename from help/app/designs/ticket/by_includes_post_by_and_updated_at.js rename to engines/support/app/designs/ticket/by_includes_post_by_and_updated_at.js diff --git a/help/app/helpers/auto_tickets_path_helper.rb b/engines/support/app/helpers/auto_tickets_path_helper.rb similarity index 100% rename from help/app/helpers/auto_tickets_path_helper.rb rename to engines/support/app/helpers/auto_tickets_path_helper.rb diff --git a/help/app/helpers/tickets_helper.rb b/engines/support/app/helpers/tickets_helper.rb similarity index 100% rename from help/app/helpers/tickets_helper.rb rename to engines/support/app/helpers/tickets_helper.rb diff --git a/help/app/models/account_extension/tickets.rb b/engines/support/app/models/account_extension/tickets.rb similarity index 100% rename from help/app/models/account_extension/tickets.rb rename to engines/support/app/models/account_extension/tickets.rb diff --git a/help/app/models/ticket.rb b/engines/support/app/models/ticket.rb similarity index 100% rename from help/app/models/ticket.rb rename to engines/support/app/models/ticket.rb diff --git a/help/app/models/ticket_comment.rb b/engines/support/app/models/ticket_comment.rb similarity index 100% rename from help/app/models/ticket_comment.rb rename to engines/support/app/models/ticket_comment.rb diff --git a/help/app/models/ticket_selection.rb b/engines/support/app/models/ticket_selection.rb similarity index 100% rename from help/app/models/ticket_selection.rb rename to engines/support/app/models/ticket_selection.rb diff --git a/help/app/views/tickets/_comment.html.haml b/engines/support/app/views/tickets/_comment.html.haml similarity index 100% rename from help/app/views/tickets/_comment.html.haml rename to engines/support/app/views/tickets/_comment.html.haml diff --git a/help/app/views/tickets/_edit_form.html.haml b/engines/support/app/views/tickets/_edit_form.html.haml similarity index 100% rename from help/app/views/tickets/_edit_form.html.haml rename to engines/support/app/views/tickets/_edit_form.html.haml diff --git a/help/app/views/tickets/_new_comment_form.html.haml b/engines/support/app/views/tickets/_new_comment_form.html.haml similarity index 100% rename from help/app/views/tickets/_new_comment_form.html.haml rename to engines/support/app/views/tickets/_new_comment_form.html.haml diff --git a/help/app/views/tickets/_tabs.html.haml b/engines/support/app/views/tickets/_tabs.html.haml similarity index 100% rename from help/app/views/tickets/_tabs.html.haml rename to engines/support/app/views/tickets/_tabs.html.haml diff --git a/help/app/views/tickets/_ticket.html.haml b/engines/support/app/views/tickets/_ticket.html.haml similarity index 100% rename from help/app/views/tickets/_ticket.html.haml rename to engines/support/app/views/tickets/_ticket.html.haml diff --git a/help/app/views/tickets/index.html.haml b/engines/support/app/views/tickets/index.html.haml similarity index 100% rename from help/app/views/tickets/index.html.haml rename to engines/support/app/views/tickets/index.html.haml diff --git a/help/app/views/tickets/new.html.haml b/engines/support/app/views/tickets/new.html.haml similarity index 100% rename from help/app/views/tickets/new.html.haml rename to engines/support/app/views/tickets/new.html.haml diff --git a/help/app/views/tickets/show.html.haml b/engines/support/app/views/tickets/show.html.haml similarity index 100% rename from help/app/views/tickets/show.html.haml rename to engines/support/app/views/tickets/show.html.haml diff --git a/help/config/initializers/account_lifecycle.rb b/engines/support/config/initializers/account_lifecycle.rb similarity index 100% rename from help/config/initializers/account_lifecycle.rb rename to engines/support/config/initializers/account_lifecycle.rb diff --git a/help/config/locales/en.yml b/engines/support/config/locales/en.yml similarity index 100% rename from help/config/locales/en.yml rename to engines/support/config/locales/en.yml diff --git a/help/config/routes.rb b/engines/support/config/routes.rb similarity index 100% rename from help/config/routes.rb rename to engines/support/config/routes.rb diff --git a/help/leap_web_help.gemspec b/engines/support/leap_web_help.gemspec similarity index 62% rename from help/leap_web_help.gemspec rename to engines/support/leap_web_help.gemspec index 49146945ab95d3026914ee6789d0d7157ad20f88..7b668d539cb3d1f545c327fed879444cebfc1c2f 100644 --- a/help/leap_web_help.gemspec +++ b/engines/support/leap_web_help.gemspec @@ -1,6 +1,6 @@ -$:.push File.expand_path("../lib", __FILE__) +$:.push File.expand_path("../../lib", __FILE__) -require File.expand_path('../../lib/leap_web/version.rb', __FILE__) +require File.expand_path('../../../lib/leap_web/version.rb', __FILE__) # Describe your gem and declare its dependencies: Gem::Specification.new do |s| @@ -12,8 +12,7 @@ Gem::Specification.new do |s| s.summary = "Help Desk for LeapWeb" s.description = "Managing Tickets for a Leap provider" - s.files = Dir["{app,config,db,lib}/**/*"] + ["Rakefile", "README.md"] + s.files = Dir["{app,config,lib}/**/*"] + ["Rakefile", "README.md"] s.test_files = Dir["test/**/*"] - s.add_dependency "leap_web_core", LeapWeb::VERSION end diff --git a/help/lib/leap_web_help.rb b/engines/support/lib/leap_web_help.rb similarity index 100% rename from help/lib/leap_web_help.rb rename to engines/support/lib/leap_web_help.rb diff --git a/engines/support/lib/leap_web_help/engine.rb b/engines/support/lib/leap_web_help/engine.rb new file mode 100644 index 0000000000000000000000000000000000000000..dfa763fd9e81ae175d33bdcff0718f35d1b7f8ce --- /dev/null +++ b/engines/support/lib/leap_web_help/engine.rb @@ -0,0 +1,4 @@ +module LeapWebHelp + class Engine < ::Rails::Engine + end +end diff --git a/help/lib/tasks/leap_web_help_tasks.rake b/engines/support/lib/tasks/leap_web_help_tasks.rake similarity index 100% rename from help/lib/tasks/leap_web_help_tasks.rake rename to engines/support/lib/tasks/leap_web_help_tasks.rake diff --git a/help/script/rails b/engines/support/script/rails similarity index 100% rename from help/script/rails rename to engines/support/script/rails diff --git a/help/test/factories.rb b/engines/support/test/factories.rb similarity index 100% rename from help/test/factories.rb rename to engines/support/test/factories.rb diff --git a/help/test/functional/tickets_controller_test.rb b/engines/support/test/functional/tickets_controller_test.rb similarity index 100% rename from help/test/functional/tickets_controller_test.rb rename to engines/support/test/functional/tickets_controller_test.rb diff --git a/certs/test/integration/navigation_test.rb b/engines/support/test/integration/navigation_test.rb similarity index 100% rename from certs/test/integration/navigation_test.rb rename to engines/support/test/integration/navigation_test.rb diff --git a/help/test/leap_web_help_test.rb b/engines/support/test/leap_web_help_test.rb similarity index 100% rename from help/test/leap_web_help_test.rb rename to engines/support/test/leap_web_help_test.rb diff --git a/billing/test/test_helper.rb b/engines/support/test/test_helper.rb similarity index 83% rename from billing/test/test_helper.rb rename to engines/support/test/test_helper.rb index 1e26a313cdcb35faa6dc58d2da694c80fcafbb9c..fff9173a516cc91c799160f89ffb39d60545c07a 100644 --- a/billing/test/test_helper.rb +++ b/engines/support/test/test_helper.rb @@ -1,7 +1,7 @@ # Configure Rails Environment ENV["RAILS_ENV"] = "test" -require File.expand_path("../dummy/config/environment.rb", __FILE__) +require File.expand_path('../../../../test/dummy/config/environment', __FILE__) require "rails/test_help" Rails.backtrace_cleaner.remove_silencers! diff --git a/help/test/unit/account_extension_test.rb b/engines/support/test/unit/account_extension_test.rb similarity index 100% rename from help/test/unit/account_extension_test.rb rename to engines/support/test/unit/account_extension_test.rb diff --git a/help/test/unit/ticket_comment_test.rb b/engines/support/test/unit/ticket_comment_test.rb similarity index 100% rename from help/test/unit/ticket_comment_test.rb rename to engines/support/test/unit/ticket_comment_test.rb diff --git a/help/test/unit/ticket_test.rb b/engines/support/test/unit/ticket_test.rb similarity index 100% rename from help/test/unit/ticket_test.rb rename to engines/support/test/unit/ticket_test.rb diff --git a/help/lib/leap_web_help/engine.rb b/help/lib/leap_web_help/engine.rb deleted file mode 100644 index 4146dfc0311f2304f9ba43f1f06a5534b81117a6..0000000000000000000000000000000000000000 --- a/help/lib/leap_web_help/engine.rb +++ /dev/null @@ -1,8 +0,0 @@ -# thou shall require all your dependencies in an engine. -require "leap_web_core" -require "leap_web_core/ui_dependencies" - -module LeapWebHelp - class Engine < ::Rails::Engine - end -end diff --git a/leap_web.gemspec b/leap_web.gemspec index 44a30e0715d6ed1600135254cb8e574d6cfda849..125c93013db46b5b99619582ed60b0e9bb93916e 100644 --- a/leap_web.gemspec +++ b/leap_web.gemspec @@ -19,7 +19,4 @@ Gem::Specification.new do |s| s.email = 'azul@leap.se' s.homepage = 'http://leap.se' - # s.add_dependency 'leap_web_core' - s.add_dependency 'leap_web_certs', LeapWeb::VERSION - s.add_dependency 'leap_web_users', LeapWeb::VERSION end diff --git a/core/lib/extensions/couchrest.rb b/lib/extensions/couchrest.rb similarity index 96% rename from core/lib/extensions/couchrest.rb rename to lib/extensions/couchrest.rb index a9a195e4ab49838c6eb72a20ed7462c71f3ce04f..95f5d92ea2c97afa73bbf1ee5c11719ea2f199b3 100644 --- a/core/lib/extensions/couchrest.rb +++ b/lib/extensions/couchrest.rb @@ -45,7 +45,7 @@ module CouchRest def self.load_all_models_with_engines self.load_all_models_without_engines return unless defined?(Rails) - Dir[Rails.root + '*/app/models/**/*.rb'].each do |path| + Dir[Rails.root + 'engines/*/app/models/**/*.rb'].each do |path| require path end end diff --git a/lib/leap_web.rb b/lib/leap_web.rb deleted file mode 100644 index 9495fc6ced8b1a5573e968135bf28aa153865d47..0000000000000000000000000000000000000000 --- a/lib/leap_web.rb +++ /dev/null @@ -1,4 +0,0 @@ -require 'leap_web_core' -require 'leap_web_certs' -require 'leap_web_users' -# do we want billing and help here? diff --git a/core/lib/tasks/leap_web_core_tasks.rake b/lib/tasks/leap_web_core_tasks.rake similarity index 100% rename from core/lib/tasks/leap_web_core_tasks.rake rename to lib/tasks/leap_web_core_tasks.rake diff --git a/users/lib/tasks/leap_web_users_tasks.rake b/lib/tasks/leap_web_users_tasks.rake similarity index 100% rename from users/lib/tasks/leap_web_users_tasks.rake rename to lib/tasks/leap_web_users_tasks.rake diff --git a/lib/tasks/test.rake b/lib/tasks/test.rake index 3c87b4538ddddcf374368915daa0b3970ddbebd4..d96b6258199b4139873d658d18829ba95512ee76 100644 --- a/lib/tasks/test.rake +++ b/lib/tasks/test.rake @@ -1,18 +1,11 @@ namespace :test do - Rails::SubTestTask.new(:units => "test:prepare") do |t| - t.libs << "test" - t.pattern = '*/test/unit/**/*_test.rb' - end - - Rails::SubTestTask.new(:functionals => "test:prepare") do |t| - t.libs << "test" - t.pattern = '*/test/functional/**/*_test.rb' - end - - Rails::SubTestTask.new(:integration => "test:prepare") do |t| - t.libs << "test" - t.pattern = '*/test/integration/**/*_test.rb' + [:units, :functionals, :integration].each do |type| + Rails::SubTestTask.new(type => "test:prepare") do |t| + t.libs << "test" + subdir = type.to_s.singularize + t.pattern = "engines/*/test/#{subdir}/**/*_test.rb" + end end end diff --git a/users/lib/warden/session_serializer.rb b/lib/warden/session_serializer.rb similarity index 100% rename from users/lib/warden/session_serializer.rb rename to lib/warden/session_serializer.rb diff --git a/users/lib/warden/strategies/secure_remote_password.rb b/lib/warden/strategies/secure_remote_password.rb similarity index 100% rename from users/lib/warden/strategies/secure_remote_password.rb rename to lib/warden/strategies/secure_remote_password.rb diff --git a/users/lib/webfinger.rb b/lib/webfinger.rb similarity index 100% rename from users/lib/webfinger.rb rename to lib/webfinger.rb diff --git a/users/lib/webfinger/host_meta_presenter.rb b/lib/webfinger/host_meta_presenter.rb similarity index 100% rename from users/lib/webfinger/host_meta_presenter.rb rename to lib/webfinger/host_meta_presenter.rb diff --git a/users/lib/webfinger/user_presenter.rb b/lib/webfinger/user_presenter.rb similarity index 100% rename from users/lib/webfinger/user_presenter.rb rename to lib/webfinger/user_presenter.rb diff --git a/test/factories.rb b/test/factories.rb index 6c671f82c76ad932640a24c2148ed0150e15006d..ac9333c8b08f1f90ebee3a090ecf48fddc21cf9e 100644 --- a/test/factories.rb +++ b/test/factories.rb @@ -1,3 +1,39 @@ -Dir.glob(Rails.root.join('**','test','factories.rb')) do |factory_file| +ENGINE_FACTORY_FILES = Rails.root.join('engines','*','test','factories.rb') +Dir.glob(ENGINE_FACTORY_FILES) do |factory_file| require factory_file end + +FactoryGirl.define do + + factory :user do + login { Faker::Internet.user_name } + password_verifier "1234ABCD" + password_salt "4321AB" + + factory :user_with_settings do + email_forward { Faker::Internet.email } + email_aliases_attributes do + {:a => Faker::Internet.user_name + '@' + APP_CONFIG[:domain]} + end + end + + factory :admin_user do + after(:build) do |admin| + admin.stubs(:is_admin?).returns(true) + end + end + end + + factory :token do + user + end + + factory :pgp_key do + keyblock <<-EOPGP +-----BEGIN PGP PUBLIC KEY BLOCK----- ++Dummy+PGP+KEY+++Dummy+PGP+KEY+++Dummy+PGP+KEY+++Dummy+PGP+KEY+ +#{SecureRandom.base64(4032)} +-----END PGP PUBLIC KEY BLOCK----- + EOPGP + end +end diff --git a/certs/test/files/ca.crt b/test/files/ca.crt similarity index 100% rename from certs/test/files/ca.crt rename to test/files/ca.crt diff --git a/certs/test/files/ca.key b/test/files/ca.key similarity index 100% rename from certs/test/files/ca.key rename to test/files/ca.key diff --git a/users/test/functional/application_controller_test.rb b/test/functional/application_controller_test.rb similarity index 100% rename from users/test/functional/application_controller_test.rb rename to test/functional/application_controller_test.rb diff --git a/users/test/functional/helper_methods_test.rb b/test/functional/helper_methods_test.rb similarity index 100% rename from users/test/functional/helper_methods_test.rb rename to test/functional/helper_methods_test.rb diff --git a/users/test/functional/keys_controller_test.rb b/test/functional/keys_controller_test.rb similarity index 100% rename from users/test/functional/keys_controller_test.rb rename to test/functional/keys_controller_test.rb diff --git a/users/test/functional/sessions_controller_test.rb b/test/functional/sessions_controller_test.rb similarity index 100% rename from users/test/functional/sessions_controller_test.rb rename to test/functional/sessions_controller_test.rb diff --git a/users/test/functional/test_helpers_test.rb b/test/functional/test_helpers_test.rb similarity index 100% rename from users/test/functional/test_helpers_test.rb rename to test/functional/test_helpers_test.rb diff --git a/users/test/functional/users_controller_test.rb b/test/functional/users_controller_test.rb similarity index 100% rename from users/test/functional/users_controller_test.rb rename to test/functional/users_controller_test.rb diff --git a/certs/test/functional/certs_controller_test.rb b/test/functional/v1/certs_controller_test.rb similarity index 95% rename from certs/test/functional/certs_controller_test.rb rename to test/functional/v1/certs_controller_test.rb index 503e74b9c9a18c4cf4d90d7045678b1ef18239d0..2c70e52b2d48384ac451d1c60e3936652d0b0bcb 100644 --- a/certs/test/functional/certs_controller_test.rb +++ b/test/functional/v1/certs_controller_test.rb @@ -1,6 +1,6 @@ require 'test_helper' -class CertsControllerTest < ActionController::TestCase +class V1::CertsControllerTest < ActionController::TestCase test "send limited cert without login" do with_config allow_limited_certs: true, allow_anonymous_certs: true do diff --git a/users/test/functional/v1/messages_controller_test.rb b/test/functional/v1/messages_controller_test.rb similarity index 100% rename from users/test/functional/v1/messages_controller_test.rb rename to test/functional/v1/messages_controller_test.rb diff --git a/users/test/functional/v1/sessions_controller_test.rb b/test/functional/v1/sessions_controller_test.rb similarity index 100% rename from users/test/functional/v1/sessions_controller_test.rb rename to test/functional/v1/sessions_controller_test.rb diff --git a/users/test/functional/v1/users_controller_test.rb b/test/functional/v1/users_controller_test.rb similarity index 100% rename from users/test/functional/v1/users_controller_test.rb rename to test/functional/v1/users_controller_test.rb diff --git a/users/test/functional/webfinger_controller_test.rb b/test/functional/webfinger_controller_test.rb similarity index 100% rename from users/test/functional/webfinger_controller_test.rb rename to test/functional/webfinger_controller_test.rb diff --git a/users/test/integration/api/Readme.md b/test/integration/api/Readme.md similarity index 100% rename from users/test/integration/api/Readme.md rename to test/integration/api/Readme.md diff --git a/users/test/integration/api/login_test.rb b/test/integration/api/login_test.rb similarity index 100% rename from users/test/integration/api/login_test.rb rename to test/integration/api/login_test.rb diff --git a/users/test/integration/api/pgp_key_test.rb b/test/integration/api/pgp_key_test.rb similarity index 100% rename from users/test/integration/api/pgp_key_test.rb rename to test/integration/api/pgp_key_test.rb diff --git a/users/test/integration/api/python/flow_with_srp.py b/test/integration/api/python/flow_with_srp.py similarity index 100% rename from users/test/integration/api/python/flow_with_srp.py rename to test/integration/api/python/flow_with_srp.py diff --git a/users/test/integration/api/python/login_wrong_username.py b/test/integration/api/python/login_wrong_username.py similarity index 100% rename from users/test/integration/api/python/login_wrong_username.py rename to test/integration/api/python/login_wrong_username.py diff --git a/users/test/integration/api/python/signup.py b/test/integration/api/python/signup.py similarity index 100% rename from users/test/integration/api/python/signup.py rename to test/integration/api/python/signup.py diff --git a/users/test/integration/api/python/signup_and_login.py b/test/integration/api/python/signup_and_login.py similarity index 100% rename from users/test/integration/api/python/signup_and_login.py rename to test/integration/api/python/signup_and_login.py diff --git a/users/test/integration/api/python/signup_and_login_wrong_password.py b/test/integration/api/python/signup_and_login_wrong_password.py similarity index 100% rename from users/test/integration/api/python/signup_and_login_wrong_password.py rename to test/integration/api/python/signup_and_login_wrong_password.py diff --git a/users/test/integration/api/python/umlauts.py b/test/integration/api/python/umlauts.py similarity index 100% rename from users/test/integration/api/python/umlauts.py rename to test/integration/api/python/umlauts.py diff --git a/users/test/integration/api/signup_test.rb b/test/integration/api/signup_test.rb similarity index 100% rename from users/test/integration/api/signup_test.rb rename to test/integration/api/signup_test.rb diff --git a/users/test/integration/api/srp_test.rb b/test/integration/api/srp_test.rb similarity index 98% rename from users/test/integration/api/srp_test.rb rename to test/integration/api/srp_test.rb index 946450e632ae7e86611dcde20a3dc90fa2a1d65a..26adc8c89e623f9edb2b4627360b45aac49f99ee 100644 --- a/users/test/integration/api/srp_test.rb +++ b/test/integration/api/srp_test.rb @@ -1,4 +1,5 @@ class SrpTest < RackTest + include AssertResponses teardown do if @user diff --git a/users/test/integration/api/update_account_test.rb b/test/integration/api/update_account_test.rb similarity index 100% rename from users/test/integration/api/update_account_test.rb rename to test/integration/api/update_account_test.rb diff --git a/users/test/integration/browser/account_test.rb b/test/integration/browser/account_test.rb similarity index 100% rename from users/test/integration/browser/account_test.rb rename to test/integration/browser/account_test.rb diff --git a/users/test/integration/browser/session_test.rb b/test/integration/browser/session_test.rb similarity index 100% rename from users/test/integration/browser/session_test.rb rename to test/integration/browser/session_test.rb diff --git a/help/test/integration/navigation_test.rb b/test/integration/navigation_test.rb similarity index 100% rename from help/test/integration/navigation_test.rb rename to test/integration/navigation_test.rb diff --git a/users/test/leap_web_users_test.rb b/test/leap_web_users_test.rb similarity index 100% rename from users/test/leap_web_users_test.rb rename to test/leap_web_users_test.rb diff --git a/test/support/assert_responses.rb b/test/support/assert_responses.rb new file mode 100644 index 0000000000000000000000000000000000000000..b01166f139ac8d5dd86ade40725a35da50650331 --- /dev/null +++ b/test/support/assert_responses.rb @@ -0,0 +1,46 @@ +module AssertResponses + + # response that works with different TestCases: + # ActionController::TestCase has @response + # ActionDispatch::IntegrationTest has @response + # Rack::Test::Methods defines last_response + def get_response + @response || last_response + end + + def assert_attachement_filename(name) + assert_equal %Q(attachment; filename="#{name}"), + get_response.headers["Content-Disposition"] + end + + def json_response + response = JSON.parse(get_response.body) + response.respond_to?(:with_indifferent_access) ? + response.with_indifferent_access : + response + end + + def assert_json_response(object) + assert_equal 'application/json', + get_response.content_type.to_s.split(';').first + if object.is_a? Hash + object.stringify_keys! if object.respond_to? :stringify_keys! + assert_equal object, json_response + else + assert_equal object.to_json, get_response.body + end + end + + def assert_json_error(object) + object.stringify_keys! if object.respond_to? :stringify_keys! + assert_json_response :errors => object + end +end + +class ::ActionController::TestCase + include AssertResponses +end + +class ::ActionDispatch::IntegrationTest + include AssertResponses +end diff --git a/users/test/support/auth_test_helper.rb b/test/support/auth_test_helper.rb similarity index 100% rename from users/test/support/auth_test_helper.rb rename to test/support/auth_test_helper.rb diff --git a/core/test/support/browser_integration_test.rb b/test/support/browser_integration_test.rb similarity index 100% rename from core/test/support/browser_integration_test.rb rename to test/support/browser_integration_test.rb diff --git a/core/test/support/rack_test.rb b/test/support/rack_test.rb similarity index 96% rename from core/test/support/rack_test.rb rename to test/support/rack_test.rb index 2d8e5c4fe736c3c9c6c3b7c71045f1182e765942..806339ac9983bd34e8d050defed3fef02b41d7e8 100644 --- a/core/test/support/rack_test.rb +++ b/test/support/rack_test.rb @@ -1,7 +1,8 @@ +require_relative 'assert_responses' + class RackTest < ActiveSupport::TestCase include Rack::Test::Methods include Warden::Test::Helpers - include LeapWebCore::AssertResponses CONFIG_RU = (Rails.root + 'config.ru').to_s OUTER_APP = Rack::Builder.parse_file(CONFIG_RU).first diff --git a/users/test/support/stub_record_helper.rb b/test/support/stub_record_helper.rb similarity index 100% rename from users/test/support/stub_record_helper.rb rename to test/support/stub_record_helper.rb diff --git a/users/test/support/time_test_helper.rb b/test/support/time_test_helper.rb similarity index 100% rename from users/test/support/time_test_helper.rb rename to test/support/time_test_helper.rb diff --git a/core/test/support/with_config_helper.rb b/test/support/with_config_helper.rb similarity index 100% rename from core/test/support/with_config_helper.rb rename to test/support/with_config_helper.rb diff --git a/test/test_helper.rb b/test/test_helper.rb index f63591f89b01aaf2c7134960aa0516942a2a7390..d001ac7eeaed9126fd9debecac5c260e2414b848 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -4,8 +4,11 @@ require 'rails/test_help' require 'mocha/setup' +# Load support files from toplevel +Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f } + # Load support files from all engines -Dir["#{File.dirname(__FILE__)}/../*/test/support/**/*.rb"].each { |f| require f } +Dir["#{File.dirname(__FILE__)}/../engines/*/test/support/**/*.rb"].each { |f| require f } class ActiveSupport::TestCase # Add more helper methods to be used by all tests here... diff --git a/users/test/unit/account_test.rb b/test/unit/account_test.rb similarity index 100% rename from users/test/unit/account_test.rb rename to test/unit/account_test.rb diff --git a/certs/test/unit/client_certificate_test.rb b/test/unit/client_certificate_test.rb similarity index 100% rename from certs/test/unit/client_certificate_test.rb rename to test/unit/client_certificate_test.rb diff --git a/users/test/unit/helpers/session_helper_test.rb b/test/unit/helpers/session_helper_test.rb similarity index 100% rename from users/test/unit/helpers/session_helper_test.rb rename to test/unit/helpers/session_helper_test.rb diff --git a/users/test/unit/helpers/users_helper_test.rb b/test/unit/helpers/users_helper_test.rb similarity index 100% rename from users/test/unit/helpers/users_helper_test.rb rename to test/unit/helpers/users_helper_test.rb diff --git a/users/test/unit/identity_test.rb b/test/unit/identity_test.rb similarity index 100% rename from users/test/unit/identity_test.rb rename to test/unit/identity_test.rb diff --git a/users/test/unit/local_email_test.rb b/test/unit/local_email_test.rb similarity index 100% rename from users/test/unit/local_email_test.rb rename to test/unit/local_email_test.rb diff --git a/users/test/unit/token_test.rb b/test/unit/token_test.rb similarity index 100% rename from users/test/unit/token_test.rb rename to test/unit/token_test.rb diff --git a/users/test/unit/unauthenticated_user_test.rb b/test/unit/unauthenticated_user_test.rb similarity index 100% rename from users/test/unit/unauthenticated_user_test.rb rename to test/unit/unauthenticated_user_test.rb diff --git a/users/test/unit/user_test.rb b/test/unit/user_test.rb similarity index 100% rename from users/test/unit/user_test.rb rename to test/unit/user_test.rb diff --git a/users/test/unit/warden_strategy_secure_remote_password_test.rb b/test/unit/warden_strategy_secure_remote_password_test.rb similarity index 100% rename from users/test/unit/warden_strategy_secure_remote_password_test.rb rename to test/unit/warden_strategy_secure_remote_password_test.rb diff --git a/users/test/unit/webfinger/host_meta_presenter_test.rb b/test/unit/webfinger/host_meta_presenter_test.rb similarity index 100% rename from users/test/unit/webfinger/host_meta_presenter_test.rb rename to test/unit/webfinger/host_meta_presenter_test.rb diff --git a/users/test/unit/webfinger/user_presenter_test.rb b/test/unit/webfinger/user_presenter_test.rb similarity index 100% rename from users/test/unit/webfinger/user_presenter_test.rb rename to test/unit/webfinger/user_presenter_test.rb diff --git a/ui_dependencies.rb b/ui_dependencies.rb deleted file mode 100644 index 4b5d70627ab9fd47aa30918573541d1a723c5cdb..0000000000000000000000000000000000000000 --- a/ui_dependencies.rb +++ /dev/null @@ -1,28 +0,0 @@ -gem "haml", "~> 3.1.7" -gem "bootstrap-sass", "= 2.3.2.2" -gem "jquery-rails" -gem "simple_form" -gem 'client_side_validations' -gem 'client_side_validations-simple_form' -gem "bootswatch-rails", "~> 0.5.0" - -gem 'kaminari', "0.13.0" # for pagination. trying 0.13.0 as there seem to be - # issues with 0.14.0 when using couchrest - -gem 'rails-i18n' # locale files for built-in validation messages and times - # https://github.com/svenfuchs/rails-i18n - # for a list of keys: - # https://github.com/svenfuchs/rails-i18n/blob/master/rails/locale/en.yml - -gem 'rdiscount' # for rendering .md templates - -group :assets do - gem "haml-rails", "~> 0.3.4" - gem "sass-rails", "~> 3.2.5" - gem "coffee-rails", "~> 3.2.2" - gem "uglifier", "~> 1.2.7" - - # See https://github.com/sstephenson/execjs#readme for more supported runtimes - gem 'therubyracer', "~> 0.10.2", :platforms => :ruby - -end diff --git a/users/Gemfile b/users/Gemfile deleted file mode 100644 index 4101ead2e8484c366485da8421e3bfdd064bb164..0000000000000000000000000000000000000000 --- a/users/Gemfile +++ /dev/null @@ -1,15 +0,0 @@ -source "https://rubygems.org" - -eval(File.read(File.dirname(__FILE__) + '/../common_dependencies.rb')) -eval(File.read(File.dirname(__FILE__) + '/../ui_dependencies.rb')) - -# We require leap_web_core from here so we can use the path option. -gem "leap_web_core", :path => '../core' - -# Declare your gem's dependencies in leap_web_users.gemspec. -# Bundler will treat runtime dependencies like base dependencies, and -# development dependencies will be added by default to the :development group. -gemspec - -# To use debugger -# gem 'ruby-debug' diff --git a/users/Rakefile b/users/Rakefile deleted file mode 100644 index 38da5fcc853df78540a5f92b06aeece4cc574f18..0000000000000000000000000000000000000000 --- a/users/Rakefile +++ /dev/null @@ -1,44 +0,0 @@ -#!/usr/bin/env rake - -require 'rake/packagetask' -require 'rubygems/package_task' - -begin - require 'bundler/setup' -rescue LoadError - puts 'You must `gem install bundler` and `bundle install` to run rake tasks' -end -begin - require 'rdoc/task' -rescue LoadError - require 'rdoc/rdoc' - require 'rake/rdoctask' - RDoc::Task = Rake::RDocTask -end - -RDoc::Task.new(:rdoc) do |rdoc| - rdoc.rdoc_dir = 'rdoc' - rdoc.title = 'LeapWebUsers' - rdoc.options << '--line-numbers' - rdoc.rdoc_files.include('README.rdoc') - rdoc.rdoc_files.include('lib/**/*.rb') -end - -spec = eval(File.read('leap_web_users.gemspec')) -Gem::PackageTask.new(spec) do |p| - p.gem_spec = spec -end - -Bundler::GemHelper.install_tasks - -require 'rake/testtask' - -Rake::TestTask.new(:test) do |t| - t.libs << 'lib' - t.libs << 'test' - t.pattern = 'test/**/*_test.rb' - t.verbose = false -end - - -task :default => :test diff --git a/users/app/assets/images/leap_web_users/.gitkeep b/users/app/assets/images/leap_web_users/.gitkeep deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/users/app/assets/javascripts/leap_web_users/.gitkeep b/users/app/assets/javascripts/leap_web_users/.gitkeep deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/users/app/assets/stylesheets/leap_web_users/.gitkeep b/users/app/assets/stylesheets/leap_web_users/.gitkeep deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/users/app/controllers/.gitkeep b/users/app/controllers/.gitkeep deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/users/app/helpers/.gitkeep b/users/app/helpers/.gitkeep deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/users/app/mailers/.gitkeep b/users/app/mailers/.gitkeep deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/users/app/models/.gitkeep b/users/app/models/.gitkeep deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/users/app/views/.gitkeep b/users/app/views/.gitkeep deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/users/config/routes.rb b/users/config/routes.rb deleted file mode 100644 index 2819fa92ccc961093a2ffe50d41e8b825cd15127..0000000000000000000000000000000000000000 --- a/users/config/routes.rb +++ /dev/null @@ -1,29 +0,0 @@ -Rails.application.routes.draw do - - namespace "api", { module: "v1", - path: "/1/", - defaults: {format: 'json'} } do - resources :sessions, :only => [:new, :create, :update] - delete "logout" => "sessions#destroy", :as => "logout" - resources :users, :only => [:create, :update, :destroy, :index] - resources :messages, :only => [:index, :update] - end - - scope "(:locale)", :locale => MATCH_LOCALE do - get "login" => "sessions#new", :as => "login" - delete "logout" => "sessions#destroy", :as => "logout" - - get "signup" => "users#new", :as => "signup" - resources :users, :except => [:create, :update] do - # resource :email_settings, :only => [:edit, :update] - # resources :email_aliases, :only => [:destroy], :id => /.*/ - post 'deactivate', on: :member - post 'enable', on: :member - end - end - - get "/.well-known/host-meta" => 'webfinger#host_meta' - get "/webfinger" => 'webfinger#search' - get "/key/:login" => 'keys#show' - -end diff --git a/users/leap_web_users.gemspec b/users/leap_web_users.gemspec deleted file mode 100644 index 7d1f220abf1e4e39721f14e243c83ec0ce3baad2..0000000000000000000000000000000000000000 --- a/users/leap_web_users.gemspec +++ /dev/null @@ -1,22 +0,0 @@ -$:.push File.expand_path("../lib", __FILE__) - -require File.expand_path('../../lib/leap_web/version.rb', __FILE__) - -# Describe your gem and declare its dependencies: -Gem::Specification.new do |s| - s.name = "leap_web_users" - s.version = LeapWeb::VERSION - s.authors = ["Azul"] - s.email = ["azul@leap.se"] - s.homepage = "http://www.leap.se" - s.summary = "User registration and authorization for the leap platform" - s.description = "This this plugin for the leap platform provides user signup and login. It uses Secure Remote Password for the authentication." - - s.files = Dir["{app,config,db,lib}/**/*"] + ["Rakefile"] - s.test_files = Dir["test/**/*"] - - s.add_dependency "leap_web_core", LeapWeb::VERSION - - s.add_dependency "ruby-srp", "~> 0.2.1" - s.add_dependency "rails_warden" -end diff --git a/users/lib/leap_web_users.rb b/users/lib/leap_web_users.rb deleted file mode 100644 index e1b7b1f8fcd710fbd3b728c5d26180f827636631..0000000000000000000000000000000000000000 --- a/users/lib/leap_web_users.rb +++ /dev/null @@ -1,4 +0,0 @@ -require "leap_web_users/engine" - -module LeapWebUsers -end diff --git a/users/lib/leap_web_users/engine.rb b/users/lib/leap_web_users/engine.rb deleted file mode 100644 index f8ed71cf56ee0d8e69b4950530a35b0beb47e11a..0000000000000000000000000000000000000000 --- a/users/lib/leap_web_users/engine.rb +++ /dev/null @@ -1,16 +0,0 @@ -# thou shall require all your dependencies in an engine. -require "leap_web_core" -require "leap_web_core/ui_dependencies" -require "rails_warden" -require "ruby-srp" - -require "warden/session_serializer" -require "warden/strategies/secure_remote_password" - -require "webfinger" - -module LeapWebUsers - class Engine < ::Rails::Engine - - end -end diff --git a/users/script/rails b/users/script/rails deleted file mode 100755 index ee08520d0c91eacdd63a9b49bec4da6ccdb2e583..0000000000000000000000000000000000000000 --- a/users/script/rails +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env ruby1.8 -# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application. - -ENGINE_ROOT = File.expand_path('../..', __FILE__) -ENGINE_PATH = File.expand_path('../../lib/leap_web_users/engine', __FILE__) - -require 'rails/all' -require 'rails/engine/commands' diff --git a/users/test/factories.rb b/users/test/factories.rb deleted file mode 100644 index ae00d43020d922f31b645049b9790822c837786e..0000000000000000000000000000000000000000 --- a/users/test/factories.rb +++ /dev/null @@ -1,34 +0,0 @@ -FactoryGirl.define do - - factory :user do - login { Faker::Internet.user_name } - password_verifier "1234ABCD" - password_salt "4321AB" - - factory :user_with_settings do - email_forward { Faker::Internet.email } - email_aliases_attributes do - {:a => Faker::Internet.user_name + '@' + APP_CONFIG[:domain]} - end - end - - factory :admin_user do - after(:build) do |admin| - admin.stubs(:is_admin?).returns(true) - end - end - end - - factory :token do - user - end - - factory :pgp_key do - keyblock <<-EOPGP ------BEGIN PGP PUBLIC KEY BLOCK----- -+Dummy+PGP+KEY+++Dummy+PGP+KEY+++Dummy+PGP+KEY+++Dummy+PGP+KEY+ -#{SecureRandom.base64(4032)} ------END PGP PUBLIC KEY BLOCK----- - EOPGP - end -end diff --git a/users/test/fixtures/.gitkeep b/users/test/fixtures/.gitkeep deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/users/test/functional/.gitkeep b/users/test/functional/.gitkeep deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/users/test/integration/.gitkeep b/users/test/integration/.gitkeep deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/users/test/integration/navigation_test.rb b/users/test/integration/navigation_test.rb deleted file mode 100644 index eec8c0efdd1ea802fc26146fe84b6bfdd964ed19..0000000000000000000000000000000000000000 --- a/users/test/integration/navigation_test.rb +++ /dev/null @@ -1,9 +0,0 @@ -require 'test_helper' - -class NavigationTest < ActionDispatch::IntegrationTest - - # test "the truth" do - # assert true - # end -end - diff --git a/users/test/test_helper.rb b/users/test/test_helper.rb deleted file mode 100644 index 52dff539993c5c455c4acdc7c3c49cdb8720b641..0000000000000000000000000000000000000000 --- a/users/test/test_helper.rb +++ /dev/null @@ -1,9 +0,0 @@ -ENV["RAILS_ENV"] = "test" -require File.expand_path('../../../test/dummy/config/environment', __FILE__) -require 'rails/test_help' -require 'mocha/setup' - -Rails.backtrace_cleaner.remove_silencers! - -# Load support files -Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f } diff --git a/users/test/unit/.gitkeep b/users/test/unit/.gitkeep deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/users/test/unit/email_test.rb b/users/test/unit/email_test.rb deleted file mode 100644 index 7cfbc846dbeb3128040280933cc5bab9db7ab036..0000000000000000000000000000000000000000 --- a/users/test/unit/email_test.rb +++ /dev/null @@ -1,19 +0,0 @@ -require 'test_helper' - -class EmailTest < ActiveSupport::TestCase - - test "valid format" do - email = Email.new(email_string) - assert email.valid? - end - - test "validates format" do - email = Email.new("email") - assert !email.valid? - assert_equal ["needs to be a valid email address"], email.errors[:email] - end - - def email_string - @email_string ||= Faker::Internet.email - end -end