diff --git a/.rubocop.yml b/.rubocop.yml index 6e2bc2b..3f04662 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -12,3 +12,12 @@ Lint/HandleExceptions: Exclude: - 'bin/rails' - 'bin/rake' + +Naming/FileName: + Enabled: false + +Style/FrozenStringLiteralComment: + Enabled: false + +Style/MutableConstant: + Enabled: false diff --git a/.ruby-version b/.ruby-version new file mode 100644 index 0000000..8e8299d --- /dev/null +++ b/.ruby-version @@ -0,0 +1 @@ +2.4.2 diff --git a/.travis.yml b/.travis.yml index 623c4fb..a4e75dc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,6 @@ language: ruby rvm: - - 2.2.1 + - 2.4.2 # use container builds sudo: false before_install: gem update --remote bundler diff --git a/Gemfile b/Gemfile index f08c6dd..4607a5f 100644 --- a/Gemfile +++ b/Gemfile @@ -1,54 +1,38 @@ source 'https://rubygems.org' +ruby '2.4.2' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' -gem 'rails', '4.2.3' +gem 'rails', '5.1.4' +# Use a legacy version of Rack which supports Ruby 2.1.9 +gem 'rack', '2.0.3' # Use sqlite3 as the database for Active Record gem 'sqlite3' -# Use SCSS for stylesheets -gem 'sass-rails', '~> 5.0' -# Use Uglifier as compressor for JavaScript assets -gem 'uglifier', '>= 1.3.0' -# Use CoffeeScript for .coffee assets and views -gem 'coffee-rails', '~> 4.1.0' -# See https://github.com/rails/execjs#readme for more supported runtimes -# gem 'therubyracer', platforms: :ruby - -# Use jquery as the JavaScript library -gem 'jquery-rails' -# Turbolinks makes following links in your web application faster. -# Read more: https://github.com/rails/turbolinks -gem 'turbolinks' -# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder -gem 'jbuilder', '~> 2.0' +# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks +gem 'turbolinks', '5' # bundle exec rake doc:rails generates the API under doc/api. -gem 'sdoc', '~> 0.4.0', group: :doc - -# Use ActiveModel has_secure_password -# gem 'bcrypt', '~> 3.1.7' - -# Use Unicorn as the app server -# gem 'unicorn' - -# Use Capistrano for deployment -# gem 'capistrano-rails', group: :development +gem 'sdoc', group: :doc group :development, :test do # Call 'byebug' anywhere in the code to stop execution and get a debugger # console - gem 'byebug' + gem 'byebug', platforms: %i[mri mingw x64_mingw] - # Access an IRB console on exception pages or by using <%= console %> in views - gem 'web-console', '~> 2.0' + gem 'listen', '>= 3.0.5', '< 3.2' + + gem 'rubocop', '0.50.0', require: false # Spring speeds up development by keeping your application running in the # background. Read more: https://github.com/rails/spring gem 'spring' + gem 'spring-watcher-listen', '~> 2.0.0' + + # Access an IRB console on exception pages or by using <%= console %> in views + gem 'web-console', '>= 3.3.0' end # Authentication resources -gem 'omniauth-microsoft_v2_auth', :git => "git://github.com/cbales/omniauth-microsoft_graph" +omniauth_src = 'git://github.com/cbales/omniauth-microsoft_graph' +gem 'omniauth-microsoft_v2_auth', git: omniauth_src # On Windows systems we need tzinfo-data -gem 'tzinfo-data' - -gem 'rubocop', '0.34.2' +gem 'tzinfo-data', platforms: %i[mingw mswin x64_mingw jruby] diff --git a/Gemfile.lock b/Gemfile.lock index e5e3103..95436ca 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -8,181 +8,177 @@ GIT GEM remote: https://rubygems.org/ specs: - actionmailer (4.2.3) - actionpack (= 4.2.3) - actionview (= 4.2.3) - activejob (= 4.2.3) + actioncable (5.1.4) + actionpack (= 5.1.4) + nio4r (~> 2.0) + websocket-driver (~> 0.6.1) + actionmailer (5.1.4) + actionpack (= 5.1.4) + actionview (= 5.1.4) + activejob (= 5.1.4) mail (~> 2.5, >= 2.5.4) - rails-dom-testing (~> 1.0, >= 1.0.5) - actionpack (4.2.3) - actionview (= 4.2.3) - activesupport (= 4.2.3) - rack (~> 1.6) - rack-test (~> 0.6.2) - rails-dom-testing (~> 1.0, >= 1.0.5) + rails-dom-testing (~> 2.0) + actionpack (5.1.4) + actionview (= 5.1.4) + activesupport (= 5.1.4) + rack (~> 2.0) + rack-test (>= 0.6.3) + rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.2) - actionview (4.2.3) - activesupport (= 4.2.3) + actionview (5.1.4) + activesupport (= 5.1.4) builder (~> 3.1) - erubis (~> 2.7.0) - rails-dom-testing (~> 1.0, >= 1.0.5) - rails-html-sanitizer (~> 1.0, >= 1.0.2) - activejob (4.2.3) - activesupport (= 4.2.3) - globalid (>= 0.3.0) - activemodel (4.2.3) - activesupport (= 4.2.3) - builder (~> 3.1) - activerecord (4.2.3) - activemodel (= 4.2.3) - activesupport (= 4.2.3) - arel (~> 6.0) - activesupport (4.2.3) + erubi (~> 1.4) + rails-dom-testing (~> 2.0) + rails-html-sanitizer (~> 1.0, >= 1.0.3) + activejob (5.1.4) + activesupport (= 5.1.4) + globalid (>= 0.3.6) + activemodel (5.1.4) + activesupport (= 5.1.4) + activerecord (5.1.4) + activemodel (= 5.1.4) + activesupport (= 5.1.4) + arel (~> 8.0) + activesupport (5.1.4) + concurrent-ruby (~> 1.0, >= 1.0.2) i18n (~> 0.7) - json (~> 1.7, >= 1.7.7) minitest (~> 5.1) - thread_safe (~> 0.3, >= 0.3.4) tzinfo (~> 1.1) - arel (6.0.3) + arel (8.0.0) ast (2.3.0) - astrolabe (1.3.1) - parser (~> 2.2) - binding_of_caller (0.7.2) - debug_inspector (>= 0.0.1) - builder (3.2.2) - byebug (9.0.5) - coffee-rails (4.1.1) - coffee-script (>= 2.2.0) - railties (>= 4.0.0, < 5.1.x) - coffee-script (2.4.1) - coffee-script-source - execjs - coffee-script-source (1.10.0) - concurrent-ruby (1.0.2) - debug_inspector (0.0.2) - erubis (2.7.0) - execjs (2.7.0) + bindex (0.5.0) + builder (3.2.3) + byebug (9.1.0) + concurrent-ruby (1.0.5) + crass (1.0.2) + erubi (1.6.1) faraday (0.12.2) multipart-post (>= 1.2, < 3) - globalid (0.3.7) - activesupport (>= 4.1.0) + ffi (1.9.18) + ffi (1.9.18-x86-mingw32) + globalid (0.4.0) + activesupport (>= 4.2.0) hashie (3.5.6) - i18n (0.7.0) - jbuilder (2.6.0) - activesupport (>= 3.0.0, < 5.1) - multi_json (~> 1.2) - jquery-rails (4.2.1) - rails-dom-testing (>= 1, < 3) - railties (>= 4.2.0) - thor (>= 0.14, < 2.0) - json (1.8.3) + i18n (0.8.6) + json (1.8.6) jwt (1.5.6) - loofah (2.0.3) + listen (3.1.5) + rb-fsevent (~> 0.9, >= 0.9.4) + rb-inotify (~> 0.9, >= 0.9.7) + ruby_dep (~> 1.2) + loofah (2.1.1) + crass (~> 1.0.2) nokogiri (>= 1.5.9) - mail (2.6.4) + mail (2.6.6) mime-types (>= 1.16, < 4) + method_source (0.9.0) mime-types (3.1) mime-types-data (~> 3.2015) mime-types-data (3.2016.0521) - mini_portile2 (2.0.0) - minitest (5.9.0) - multi_json (1.12.1) + mini_portile2 (2.3.0) + minitest (5.10.3) + multi_json (1.12.2) multi_xml (0.6.0) multipart-post (2.0.0) - nokogiri (1.6.7.2) - mini_portile2 (~> 2.0.0.rc2) - nokogiri (1.6.7.2-x86-mingw32) - mini_portile2 (~> 2.0.0.rc2) + nio4r (2.1.0) + nokogiri (1.8.1) + mini_portile2 (~> 2.3.0) + nokogiri (1.8.1-x86-mingw32) + mini_portile2 (~> 2.3.0) oauth2 (1.4.0) faraday (>= 0.8, < 0.13) jwt (~> 1.0) multi_json (~> 1.3) multi_xml (~> 0.5) rack (>= 1.2, < 3) - omniauth (1.6.1) + omniauth (1.7.1) hashie (>= 3.4.6, < 3.6.0) rack (>= 1.6.2, < 3) omniauth-oauth2 (1.4.0) oauth2 (~> 1.0) omniauth (~> 1.2) - parser (2.3.1.2) + parallel (1.12.0) + parser (2.4.0.0) ast (~> 2.2) powerpack (0.1.1) - rack (1.6.4) - rack-test (0.6.3) - rack (>= 1.0) - rails (4.2.3) - actionmailer (= 4.2.3) - actionpack (= 4.2.3) - actionview (= 4.2.3) - activejob (= 4.2.3) - activemodel (= 4.2.3) - activerecord (= 4.2.3) - activesupport (= 4.2.3) - bundler (>= 1.3.0, < 2.0) - railties (= 4.2.3) - sprockets-rails - rails-deprecated_sanitizer (1.0.3) - activesupport (>= 4.2.0.alpha) - rails-dom-testing (1.0.7) - activesupport (>= 4.2.0.beta, < 5.0) - nokogiri (~> 1.6.0) - rails-deprecated_sanitizer (>= 1.0.1) + rack (2.0.3) + rack-test (0.7.0) + rack (>= 1.0, < 3) + rails (5.1.4) + actioncable (= 5.1.4) + actionmailer (= 5.1.4) + actionpack (= 5.1.4) + actionview (= 5.1.4) + activejob (= 5.1.4) + activemodel (= 5.1.4) + activerecord (= 5.1.4) + activesupport (= 5.1.4) + bundler (>= 1.3.0) + railties (= 5.1.4) + sprockets-rails (>= 2.0.0) + rails-dom-testing (2.0.3) + activesupport (>= 4.2.0) + nokogiri (>= 1.6) rails-html-sanitizer (1.0.3) loofah (~> 2.0) - railties (4.2.3) - actionpack (= 4.2.3) - activesupport (= 4.2.3) + railties (5.1.4) + actionpack (= 5.1.4) + activesupport (= 5.1.4) + method_source rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) - rainbow (2.1.0) - rake (11.2.2) - rdoc (4.2.2) - json (~> 1.4) - rubocop (0.34.2) - astrolabe (~> 1.3) - parser (>= 2.2.2.5, < 3.0) + rainbow (2.2.2) + rake + rake (12.1.0) + rb-fsevent (0.10.2) + rb-inotify (0.9.10) + ffi (>= 0.5.0, < 2) + rdoc (4.3.0) + rubocop (0.50.0) + parallel (~> 1.10) + parser (>= 2.3.3.1, < 3.0) powerpack (~> 0.1) - rainbow (>= 1.99.1, < 3.0) - ruby-progressbar (~> 1.4) - ruby-progressbar (1.8.1) - sass (3.4.22) - sass-rails (5.0.6) - railties (>= 4.0.0, < 6) - sass (~> 3.1) - sprockets (>= 2.8, < 4.0) - sprockets-rails (>= 2.0, < 4.0) - tilt (>= 1.1, < 3) - sdoc (0.4.1) + rainbow (>= 2.2.2, < 3.0) + ruby-progressbar (~> 1.7) + unicode-display_width (~> 1.0, >= 1.0.1) + ruby-progressbar (1.9.0) + ruby_dep (1.5.0) + sdoc (0.4.2) json (~> 1.7, >= 1.7.7) rdoc (~> 4.0) - spring (1.7.2) - sprockets (3.7.0) + spring (2.0.2) + activesupport (>= 4.2) + spring-watcher-listen (2.0.1) + listen (>= 2.7, < 4.0) + spring (>= 1.2, < 3.0) + sprockets (3.7.1) concurrent-ruby (~> 1.0) rack (> 1, < 3) - sprockets-rails (3.1.1) + sprockets-rails (3.2.1) actionpack (>= 4.0) activesupport (>= 4.0) sprockets (>= 3.0.0) - sqlite3 (1.3.11) - sqlite3 (1.3.11-x86-mingw32) - thor (0.19.1) - thread_safe (0.3.5) - tilt (2.0.5) - turbolinks (5.0.1) + sqlite3 (1.3.13) + sqlite3 (1.3.13-x86-mingw32) + thor (0.20.0) + thread_safe (0.3.6) + turbolinks (5.0.0) turbolinks-source (~> 5) - turbolinks-source (5.0.0) - tzinfo (1.2.2) + turbolinks-source (5.0.3) + tzinfo (1.2.3) thread_safe (~> 0.1) - tzinfo-data (1.2016.6) + tzinfo-data (1.2017.2) tzinfo (>= 1.0.0) - uglifier (3.0.2) - execjs (>= 0.3.0, < 3) - web-console (2.3.0) - activemodel (>= 4.0) - binding_of_caller (>= 0.7.2) - railties (>= 4.0) - sprockets-rails (>= 2.0, < 4.0) + unicode-display_width (1.3.0) + web-console (3.5.1) + actionview (>= 5.0) + activemodel (>= 5.0) + bindex (>= 0.4.0) + railties (>= 5.0) + websocket-driver (0.6.5) + websocket-extensions (>= 0.1.0) + websocket-extensions (0.1.2) PLATFORMS ruby @@ -190,20 +186,21 @@ PLATFORMS DEPENDENCIES byebug - coffee-rails (~> 4.1.0) - jbuilder (~> 2.0) - jquery-rails + listen (>= 3.0.5, < 3.2) omniauth-microsoft_v2_auth! - rails (= 4.2.3) - rubocop (= 0.34.2) - sass-rails (~> 5.0) - sdoc (~> 0.4.0) + rack (= 2.0.3) + rails (= 5.1.4) + rubocop (= 0.50.0) + sdoc spring + spring-watcher-listen (~> 2.0.0) sqlite3 - turbolinks + turbolinks (= 5) tzinfo-data - uglifier (>= 1.3.0) - web-console (~> 2.0) + web-console (>= 3.3.0) + +RUBY VERSION + ruby 2.4.2p198 BUNDLED WITH - 1.12.5 + 1.15.4 diff --git a/README-Localized/README-de-de.md b/README-Localized/README-de-de.md index 2c4c5e0..7d0051a 100644 --- a/README-Localized/README-de-de.md +++ b/README-Localized/README-de-de.md @@ -14,10 +14,8 @@ Im Beispiel wird auch die Office-Fabric-UI zum Entwerfen und Formatieren der Ben Um dieses Beispiel verwenden zu können, ist Folgendes erforderlich: -- Ruby 2.1 zum Ausführen des Beispiels auf einem Entwicklungsserver. -- Rails-Framework (das Beispiel wurde auf Rails 4.2 getestet). +- Ruby 2.4.2 zum Ausführen des Beispiels auf einem Entwicklungsserver. - Bundler Dependency Manager. -- Rack-Webserveroberfläche für Ruby. - Ein [Microsoft-Konto](https://www.outlook.com/) oder ein [Office 365 for Business](https://msdn.microsoft.com/en-us/office/office365/howto/setup-development-environment#bk_Office365Account)-Konto. ## Registrieren der App diff --git a/README-Localized/README-es-es.md b/README-Localized/README-es-es.md index 873ba22..e0b0d5d 100644 --- a/README-Localized/README-es-es.md +++ b/README-Localized/README-es-es.md @@ -14,10 +14,8 @@ El ejemplo también usa la UI de Office Fabric para aplicar estilos y formatos a Para usar este ejemplo de código, se requiere lo siguiente: -- Ruby 2.1 para ejecutar el ejemplo en un servidor de desarrollo. -- Marco Rails (el ejemplo se probó con Rails 4.2). +- Ruby 2.4.2 para ejecutar el ejemplo en un servidor de desarrollo. - Administrador de dependencias Bundler. -- Interfaz de servidor web Rack para Ruby. - Una [cuenta de Microsoft](https://www.outlook.com/) o una [cuenta de Office 365 para empresas](https://msdn.microsoft.com/en-us/office/office365/howto/setup-development-environment#bk_Office365Account) ## Registrar la aplicación diff --git a/README-Localized/README-fr-fr.md b/README-Localized/README-fr-fr.md index 28f4ca0..9757df5 100644 --- a/README-Localized/README-fr-fr.md +++ b/README-Localized/README-fr-fr.md @@ -14,10 +14,8 @@ L’exemple utilise également la structure d’interface utilisateur Office pou Pour utiliser cet exemple, les éléments suivants sont requis : -- Ruby 2.1 pour exécuter l’exemple sur un serveur de développement. -- La structure Rails (l’exemple a été testé sur Rails 4.2). +- Ruby 2.4.2 pour exécuter l’exemple sur un serveur de développement. - Le gestionnaire de dépendances Bundler. -- L’interface de serveur web Rack pour Ruby. - Un [compte Microsoft](https://www.outlook.com/) ou un [compte Office 365 pour les entreprises](https://msdn.microsoft.com/en-us/office/office365/howto/setup-development-environment#bk_Office365Account) ## Inscription de l’application diff --git a/README-Localized/README-ja-jp.md b/README-Localized/README-ja-jp.md index 7a6250d..236340a 100644 --- a/README-Localized/README-ja-jp.md +++ b/README-Localized/README-ja-jp.md @@ -14,10 +14,8 @@ Microsoft Graph を使用して、Ruby on Rails の Web アプリケーション このサンプルを使用するには、以下が必要です。 -- 開発サーバー上でサンプルを実行する Ruby 2.1。 -- Rails フレームワーク (このサンプルは Rails 4.2 でテストされています)。 +- 開発サーバー上でサンプルを実行する Ruby 2.4.2。 - Bundler 依存関係マネージャー。 -- Ruby 用の Rack Web サーバー インターフェイス。 - [Microsoft アカウント](https://www.outlook.com/)または [ビジネス向けの Office 365 アカウント](https://msdn.microsoft.com/en-us/office/office365/howto/setup-development-environment#bk_Office365Account) ## アプリケーションの登録 diff --git a/README-Localized/README-pt-br.md b/README-Localized/README-pt-br.md index 8699d32..59334d6 100644 --- a/README-Localized/README-pt-br.md +++ b/README-Localized/README-pt-br.md @@ -14,10 +14,8 @@ O exemplo também usa a interface do usuário do Office Fabric para definir o es Para utilizar este exemplo, são necessários: -- Ruby 2.1 para executar o exemplo em um servidor de desenvolvimento. -- Estrutura do Rails (o exemplo foi testado nos Rails 4.2). +- Ruby 2.4.2 para executar o exemplo em um servidor de desenvolvimento. - Gerenciador de dependências do Bundler. -- Interface de servidor Web Rack para Ruby. - Uma [Conta da Microsoft](https://www.outlook.com/) ou uma [Conta do Office 365 para empresas](https://msdn.microsoft.com/en-us/office/office365/howto/setup-development-environment#bk_Office365Account) ## Registrar o aplicativo diff --git a/README-Localized/README-ru-ru.md b/README-Localized/README-ru-ru.md index 8c23005..b786521 100644 --- a/README-Localized/README-ru-ru.md +++ b/README-Localized/README-ru-ru.md @@ -14,10 +14,8 @@ Чтобы воспользоваться этим примером, необходимо следующее: -- Ruby 2.1 для запуска примера на сервере разработки; -- платформа Rails (пример протестирован на платформе Rails 4.2); +- Ruby 2.4.2 для запуска примера на сервере разработки; - диспетчер зависимостей Bundler; -- интерфейс веб-сервера для Ruby (Rack); - [учетная запись Майкрософт](https://www.outlook.com/) или [учетная запись Office 365 для бизнеса](https://msdn.microsoft.com/en-us/office/office365/howto/setup-development-environment#bk_Office365Account). ## Регистрация приложения diff --git a/README-Localized/README-zh-cn.md b/README-Localized/README-zh-cn.md index 8d1126a..7c8d202 100644 --- a/README-Localized/README-zh-cn.md +++ b/README-Localized/README-zh-cn.md @@ -14,10 +14,8 @@ 必须符合以下条件才能使用此示例: -- Ruby 2.1,用于在开发服务器上运行该示例。 -- Rails 框架(该示例已经过 Rails 4.2 测试)。 +- Ruby 2.4.2,用于在开发服务器上运行该示例。 - 捆绑程序依存关系管理器 -- 用于 Ruby 的 Rack Web 服务器界面。 - 一个 [Microsoft 帐户](https://www.outlook.com/) 或 [Office 365 商业版帐户](https://msdn.microsoft.com/en-us/office/office365/howto/setup-development-environment#bk_Office365Account) ## 注册应用程序 diff --git a/README-Localized/README-zh-tw.md b/README-Localized/README-zh-tw.md index 427d3b0..bd2d326 100644 --- a/README-Localized/README-zh-tw.md +++ b/README-Localized/README-zh-tw.md @@ -14,10 +14,8 @@ 若要使用此範例,需要有下列各項: -- Ruby 2.1 用以在開發伺服器上執行範例。 -- Rails 架構 (已在 Rails 4.2 上測試此範例)。 +- Ruby 2.4.2 用以在開發伺服器上執行範例。 - Bundler 相依性管理員。 -- 適用於 Ruby 的 Rack Web 伺服器介面。 - [Microsoft 帳戶](https://www.outlook.com/)或[ 商務用 Office 365 帳戶](https://msdn.microsoft.com/en-us/office/office365/howto/setup-development-environment#bk_Office365Account) ## 註冊應用程式 diff --git a/README.md b/README.md index cd202ac..1fe9650 100644 --- a/README.md +++ b/README.md @@ -14,10 +14,8 @@ The sample also uses the Office Fabric UI for styling and formatting the user ex To use this sample, the following are required: -- Ruby 2.1 to run the sample on a development server. -- Rails framework (the sample has been tested on Rails 4.2). +- Ruby 2.4.2 to run the sample on a development server (a `.ruby-version` file is supplied for Ruby version managers like [rbenv](https://github.com/rbenv/rbenv#choosing-the-ruby-version), [chruby](https://github.com/postmodern/chruby#auto-switching), and [rvm](https://rvm.io/workflow/projects)). - Bundler dependency manager. -- Rack web server interface for Ruby. - A [Microsoft account](https://www.outlook.com/) or an [Office 365 for business account](https://msdn.microsoft.com/en-us/office/office365/howto/setup-development-environment#bk_Office365Account) ## Register the application @@ -51,10 +49,10 @@ Register an app on the Microsoft App Registration Portal. This generates the app ## Build and run the sample 1. Download or clone the sample and open it in the editor of your choice. -1. If you don't already have bundler and rack, you can install them with the following command. +1. If you don't already have [bundler](http://bundler.io/), you can install it with the following command. ``` - gem install bundler rack + gem install bundler ``` 2. In the [config/environment.rb](config/environment.rb) file do the following. 1. Replace *ENTER_YOUR_CLIENT_ID* with the app ID of your registered application. diff --git a/app/controllers/pages_controller.rb b/app/controllers/pages_controller.rb index 78dc094..9d80007 100644 --- a/app/controllers/pages_controller.rb +++ b/app/controllers/pages_controller.rb @@ -21,9 +21,10 @@ class PagesController < ApplicationController # Delegates the browser to the v2 authentication OmniAuth module # which takes the user to a sign-in page, if we don't have tokens already - # This sample uses an open source OAuth 2.0 library that is compatible with the Azure AD v2.0 endpoint. + # This sample uses an open source OAuth 2.0 library that is compatible with + # the Azure AD v2.0 endpoint. # Microsoft does not provide fixes or direct support for this library. - # Refer to the library’s repository to file issues or for other support. + # Refer to the library's repository to file issues or for other support. # For more information about auth libraries see: https://azure.microsoft.com/documentation/articles/active-directory-v2-libraries/ # omniauth-oauth2 repo: https://github.com/intridea/omniauth-oauth2 @@ -34,7 +35,7 @@ def login # If the user had to sign-in, the browser will redirect to this callback # with the authorization tokens attached - def callback + def callback # rubocop:disable AbcSize # Access the authentication hash for omniauth # and extract the auth token, user name, and email data = request.env['omniauth.auth'] diff --git a/bin/rails b/bin/rails index 62687aa..0739660 100755 --- a/bin/rails +++ b/bin/rails @@ -1,8 +1,4 @@ #!/usr/bin/env ruby -begin - load File.expand_path('../spring', __FILE__) -rescue LoadError -end -APP_PATH = File.expand_path('../../config/application', __FILE__) +APP_PATH = File.expand_path('../config/application', __dir__) require_relative '../config/boot' require 'rails/commands' diff --git a/bin/rake b/bin/rake index 2e9ece4..1724048 100755 --- a/bin/rake +++ b/bin/rake @@ -1,8 +1,4 @@ #!/usr/bin/env ruby -begin - load File.expand_path('../spring', __FILE__) -rescue LoadError -end require_relative '../config/boot' require 'rake' Rake.application.run diff --git a/bin/setup b/bin/setup index eb347f9..78c4e86 100755 --- a/bin/setup +++ b/bin/setup @@ -1,29 +1,38 @@ #!/usr/bin/env ruby require 'pathname' +require 'fileutils' +include FileUtils # path to your application root. APP_ROOT = Pathname.new File.expand_path('../../', __FILE__) -Dir.chdir APP_ROOT do +def system!(*args) + system(*args) || abort("\n== Command #{args} failed ==") +end + +chdir APP_ROOT do # This script is a starting point to setup your application. - # Add necessary setup steps to this file: + # Add necessary setup steps to this file. puts '== Installing dependencies ==' - system 'gem install bundler --conservative' - system 'bundle check || bundle install' + system! 'gem install bundler --conservative' + system('bundle check') || system!('bundle install') + + # Install JavaScript dependencies if using Yarn + # system('bin/yarn') + # puts "\n== Copying sample files ==" - # unless File.exist?("config/database.yml") - # system "cp config/database.yml.sample config/database.yml" + # unless File.exist?('config/database.yml') + # cp 'config/database.yml.sample', 'config/database.yml' # end puts "\n== Preparing database ==" - system 'bin/rake db:setup' + system! 'bin/rails db:setup' puts "\n== Removing old logs and tempfiles ==" - system 'rm -f log/*' - system 'rm -rf tmp/cache' + system! 'bin/rails log:clear tmp:clear' puts "\n== Restarting application server ==" - system 'touch tmp/restart.txt' + system! 'bin/rails restart' end diff --git a/bin/update b/bin/update new file mode 100755 index 0000000..a8e4462 --- /dev/null +++ b/bin/update @@ -0,0 +1,29 @@ +#!/usr/bin/env ruby +require 'pathname' +require 'fileutils' +include FileUtils + +# path to your application root. +APP_ROOT = Pathname.new File.expand_path('../../', __FILE__) + +def system!(*args) + system(*args) || abort("\n== Command #{args} failed ==") +end + +chdir APP_ROOT do + # This script is a way to update your development environment automatically. + # Add necessary update steps to this file. + + puts '== Installing dependencies ==' + system! 'gem install bundler --conservative' + system('bundle check') || system!('bundle install') + + puts "\n== Updating database ==" + system! 'bin/rails db:migrate' + + puts "\n== Removing old logs and tempfiles ==" + system! 'bin/rails log:clear tmp:clear' + + puts "\n== Restarting application server ==" + system! 'bin/rails restart' +end diff --git a/bin/yarn b/bin/yarn new file mode 100755 index 0000000..c2bacef --- /dev/null +++ b/bin/yarn @@ -0,0 +1,11 @@ +#!/usr/bin/env ruby +VENDOR_PATH = File.expand_path('..', __dir__) +Dir.chdir(VENDOR_PATH) do + begin + exec "yarnpkg #{ARGV.join(" ")}" + rescue Errno::ENOENT + $stderr.puts "Yarn executable was not detected in the system." + $stderr.puts "Download Yarn at https://yarnpkg.com/en/docs/install" + exit 1 + end +end diff --git a/config/application.rb b/config/application.rb index da1195d..45900d5 100644 --- a/config/application.rb +++ b/config/application.rb @@ -1,9 +1,4 @@ -### -# Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. -# See LICENSE in the project root for license information. -## - -require File.expand_path('../boot', __FILE__) +require_relative 'boot' require 'rails/all' @@ -13,6 +8,12 @@ module O365RailsUnifiedApiConnect class Application < Rails::Application - config.active_record.raise_in_transactional_callbacks = true + # Initialize configuration defaults for originally generated Rails version. + config.load_defaults 5.1 + + # Settings in config/environments/* take precedence over those specified + # here. + # Application configuration should go into files in config/initializers + # -- all .rb files in that directory are automatically loaded. end end diff --git a/config/boot.rb b/config/boot.rb index 6b750f0..30f5120 100644 --- a/config/boot.rb +++ b/config/boot.rb @@ -1,3 +1,3 @@ -ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) +ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__) require 'bundler/setup' # Set up gems listed in the Gemfile. diff --git a/config/cable.yml b/config/cable.yml new file mode 100644 index 0000000..f2da3f6 --- /dev/null +++ b/config/cable.yml @@ -0,0 +1,10 @@ +development: + adapter: async + +test: + adapter: async + +production: + adapter: redis + url: redis://localhost:6379/1 + channel_prefix: o365_rails_unified_api_connect_production diff --git a/config/environment.rb b/config/environment.rb index 0be6c41..626561f 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -1,7 +1,5 @@ -### -# Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. -# See LICENSE in the project root for license information. -## +# Load the Rails application. +require_relative 'application' # The following values must match the client ID, secret, and reply URL # in your Microsoft App Registration Portal entry for your app. @@ -9,10 +7,5 @@ ENV['CLIENT_SECRET'] = 'ENTER_YOUR_SECRET' ENV['SCOPE'] = 'openid email profile https://graph.microsoft.com/User.Read https://graph.microsoft.com/Mail.Send' -# Load the Rails application. -require File.expand_path('../application', __FILE__) - -Rails.logger = Logger.new(STDOUT) - # Initialize the Rails application. Rails.application.initialize! diff --git a/config/environments/development.rb b/config/environments/development.rb index cd391ac..fd09094 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -10,13 +10,28 @@ # Do not eager load code on boot. config.eager_load = false - # Show full error reports and disable caching. - config.consider_all_requests_local = true - config.action_controller.perform_caching = false + # Show full error reports. + config.consider_all_requests_local = true + + # Enable/disable caching. By default caching is disabled. + if Rails.root.join('tmp/caching-dev.txt').exist? + config.action_controller.perform_caching = true + + config.cache_store = :memory_store + config.public_file_server.headers = { + 'Cache-Control' => "public, max-age=#{2.days.seconds.to_i}" + } + else + config.action_controller.perform_caching = false + + config.cache_store = :null_store + end # Don't care if the mailer can't send. config.action_mailer.raise_delivery_errors = false + config.action_mailer.perform_caching = false + # Print deprecation notices to the Rails logger. config.active_support.deprecation = :log @@ -28,15 +43,13 @@ # number of complex assets. config.assets.debug = true - # Asset digests allow you to set far-future HTTP expiration dates on all - # assets, yet still be able to expire them through the digest params. - config.assets.digest = true - - # Adds additional error checking when serving assets at runtime. - # Checks for improperly declared sprockets dependencies. - # Raises helpful error messages. - config.assets.raise_runtime_errors = true + # Suppress logger output for asset requests. + config.assets.quiet = true # Raises error for missing translations # config.action_view.raise_on_missing_translations = true + + # Use an evented file watcher to asynchronously detect changes in source + # code, routes, locales, etc. This feature depends on the listen gem. + config.file_watcher = ActiveSupport::EventedFileUpdateChecker end diff --git a/config/environments/production.rb b/config/environments/production.rb index d3efaef..8bb3320 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -15,15 +15,14 @@ config.consider_all_requests_local = false config.action_controller.perform_caching = true - # Enable Rack::Cache to put a simple HTTP cache in front of your application - # Add `rack-cache` to your Gemfile before enabling this. - # For large-scale production use, consider using a caching reverse proxy like - # NGINX, varnish or squid. - # config.action_dispatch.rack_cache = true + # Attempt to read encrypted secrets from `config/secrets.yml.enc`. + # Requires an encryption key in `ENV["RAILS_MASTER_KEY"]` or + # `config/secrets.yml.key`. + config.read_encrypted_secrets = true # Disable serving static files from the `/public` folder by default since # Apache or NGINX already handles this. - config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present? + config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present? # Compress JavaScripts and CSS. config.assets.js_compressor = :uglifier @@ -32,19 +31,26 @@ # Do not fallback to assets pipeline if a precompiled asset is missed. config.assets.compile = false - # Asset digests allow you to set far-future HTTP expiration dates on all - # assets, yet still be able to expire them through the digest params. - config.assets.digest = true - # `config.assets.precompile` and `config.assets.version` have moved to # config/initializers/assets.rb + # Enable serving of images, stylesheets, and JavaScripts from an asset server. + # config.action_controller.asset_host = 'http://assets.example.com' + # Specifies the header that your server uses for sending files. # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX - # Force all access to the app over SSL, use Strict-Transport-Security, and use - # secure cookies. + # Mount Action Cable outside main process or domain + # config.action_cable.mount_path = nil + # config.action_cable.url = 'wss://example.com/cable' + # config.action_cable.allowed_request_origins = [ + # 'http://example.com', + # /http:\/\/example.*/ + # ] + + # Force all access to the app over SSL, use Strict-Transport-Security, and + # use secure cookies. # config.force_ssl = true # Use the lowest log level to ensure availability of diagnostic information @@ -52,16 +58,17 @@ config.log_level = :debug # Prepend all log lines with the following tags. - # config.log_tags = [ :subdomain, :uuid ] - - # Use a different logger for distributed setups. - # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new) + config.log_tags = [:request_id] # Use a different cache store in production. # config.cache_store = :mem_cache_store - # Enable serving of images, stylesheets, and JavaScripts from an asset server. - # config.action_controller.asset_host = 'http://assets.example.com' + # Use a real queuing backend for Active Job (and separate queues per + # environment) + # config.active_job.queue_adapter = :resque + # config.active_job.queue_name_prefix = + # "o365_rails_unified_api_connect_#{Rails.env}" + config.action_mailer.perform_caching = false # Ignore bad email addresses and do not raise email delivery errors. # Set this to true and configure the email server for immediate delivery to @@ -78,6 +85,18 @@ # Use default logging formatter so that PID and timestamp are not suppressed. config.log_formatter = ::Logger::Formatter.new + # Use a different logger for distributed setups. + # require 'syslog/logger' + # config.logger = ActiveSupport::TaggedLogging.new( + # Syslog::Logger.new 'app-name' + # ) + + if ENV['RAILS_LOG_TO_STDOUT'].present? + logger = ActiveSupport::Logger.new(STDOUT) + logger.formatter = config.log_formatter + config.logger = ActiveSupport::TaggedLogging.new(logger) + end + # Do not dump schema after migrations. config.active_record.dump_schema_after_migration = false end diff --git a/config/environments/test.rb b/config/environments/test.rb index 7ac80d3..8b646ab 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -13,9 +13,11 @@ # preloads Rails for running tests, you may have to set it to true. config.eager_load = false - # Configure static file server for tests with Cache-Control for performance. - config.serve_static_files = true - config.static_cache_control = 'public, max-age=3600' + # Configure public file server for tests with Cache-Control for performance. + config.public_file_server.enabled = true + config.public_file_server.headers = { + 'Cache-Control' => "public, max-age=#{1.hour.seconds.to_i}" + } # Show full error reports and disable caching. config.consider_all_requests_local = true @@ -26,15 +28,13 @@ # Disable request forgery protection in test environment. config.action_controller.allow_forgery_protection = false + config.action_mailer.perform_caching = false # Tell Action Mailer not to deliver emails to the real world. # The :test delivery method accumulates sent emails in the # ActionMailer::Base.deliveries array. config.action_mailer.delivery_method = :test - # Randomize the order test cases are executed. - config.active_support.test_order = :random - # Print deprecation notices to the stderr. config.active_support.deprecation = :stderr diff --git a/config/initializers/application_controller_renderer.rb b/config/initializers/application_controller_renderer.rb new file mode 100644 index 0000000..89d2efa --- /dev/null +++ b/config/initializers/application_controller_renderer.rb @@ -0,0 +1,8 @@ +# Be sure to restart your server when you modify this file. + +# ActiveSupport::Reloader.to_prepare do +# ApplicationController.renderer.defaults.merge!( +# http_host: 'example.org', +# https: false +# ) +# end diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb index af3aa1a..4b828e8 100644 --- a/config/initializers/assets.rb +++ b/config/initializers/assets.rb @@ -3,10 +3,12 @@ # Version of your assets, change this if you want to expire all your assets. Rails.application.config.assets.version = '1.0' -# Add additional assets to the asset load path +# Add additional assets to the asset load path. # Rails.application.config.assets.paths << Emoji.images_path +# Add Yarn node_modules folder to the asset load path. +Rails.application.config.assets.paths << Rails.root.join('node_modules') # Precompile additional assets. -# application.js, application.css, and all non-JS/CSS in app/assets folder -# are already added. -# Rails.application.config.assets.precompile += %w( search.js ) +# application.js, application.css, and all non-JS/CSS in the app/assets +# folder are already added. +# Rails.application.config.assets.precompile += %w( admin.js admin.css ) diff --git a/config/initializers/backtrace_silencers.rb b/config/initializers/backtrace_silencers.rb index 6413347..cf74fe3 100644 --- a/config/initializers/backtrace_silencers.rb +++ b/config/initializers/backtrace_silencers.rb @@ -1,9 +1,9 @@ # 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. +# 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. +# 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/config/initializers/cookies_serializer.rb b/config/initializers/cookies_serializer.rb index 7f70458..5a6a32d 100644 --- a/config/initializers/cookies_serializer.rb +++ b/config/initializers/cookies_serializer.rb @@ -1,3 +1,5 @@ # Be sure to restart your server when you modify this file. +# Specify a serializer for the signed and encrypted cookie jars. +# Valid options are :json, :marshal, and :hybrid. Rails.application.config.action_dispatch.cookies_serializer = :json diff --git a/config/initializers/new_framework_defaults_5_1.rb b/config/initializers/new_framework_defaults_5_1.rb new file mode 100644 index 0000000..9010abd --- /dev/null +++ b/config/initializers/new_framework_defaults_5_1.rb @@ -0,0 +1,14 @@ +# Be sure to restart your server when you modify this file. +# +# This file contains migration options to ease your Rails 5.1 upgrade. +# +# Once upgraded flip defaults one by one to migrate to the new default. +# +# Read the Guide for Upgrading Ruby on Rails for more info on each option. + +# Make `form_with` generate non-remote forms. +Rails.application.config.action_view.form_with_generates_remote_forms = false + +# Unknown asset fallback will return the path passed in when the given +# asset is not present in the asset pipeline. +# Rails.application.config.assets.unknown_asset_fallback = false diff --git a/config/initializers/omniauth-microsoft-v2-auth.rb b/config/initializers/omniauth-microsoft-v2-auth.rb index d6c04cf..bfb22ac 100644 --- a/config/initializers/omniauth-microsoft-v2-auth.rb +++ b/config/initializers/omniauth-microsoft-v2-auth.rb @@ -3,7 +3,7 @@ Rails.application.config.middleware.use OmniAuth::Builder do provider :microsoft_v2_auth, - ENV['CLIENT_ID'], - ENV['CLIENT_SECRET'], - :scope => ENV['SCOPE'] + ENV['CLIENT_ID'], + ENV['CLIENT_SECRET'], + scope: ENV['SCOPE'] end diff --git a/config/initializers/wrap_parameters.rb b/config/initializers/wrap_parameters.rb index f45c358..091d95a 100644 --- a/config/initializers/wrap_parameters.rb +++ b/config/initializers/wrap_parameters.rb @@ -3,13 +3,13 @@ # 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. +# 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] if respond_to?(:wrap_parameters) + wrap_parameters format: [:json] end # To enable root element in JSON for ActiveRecord objects. # ActiveSupport.on_load(:active_record) do -# self.include_root_in_json = true +# self.include_root_in_json = true # end diff --git a/config/locales/en.yml b/config/locales/en.yml index 4121467..238eaa6 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -16,6 +16,16 @@ # # This would use the information in config/locales/es.yml. # +# The following keys must be escaped otherwise they will not be retrieved by +# the default I18n backend: +# +# true, false, on, off, yes, no +# +# Instead, surround them with single quotes. +# +# en: +# 'true': 'foo' +# # To learn more, please read the Rails Internationalization guide # available at http://guides.rubyonrails.org/i18n.html. diff --git a/config/routes.rb b/config/routes.rb index 40a006a..afd32a4 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,22 +1,14 @@ -### -# Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. -# See LICENSE in the project root for license information. -## - Rails.application.routes.draw do - # The priority is based upon order of creation: - # first created -> highest priority. - # See how all your routes lay out with "rake routes". - + # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html # You can have the root of your site routed with "root" root 'pages#index' get '/login', to: 'pages#login' # This is where we are redirected if OmniAuth successfully authenticates # the user. - match '/auth/:provider/callback', to: 'pages#callback', via: [:get, :post] - - match '/send_mail', to: 'pages#send_mail', via: [:post] + match '/auth/:provider/callback', to: 'pages#callback', via: %i[get post] + + match '/send_mail', to: 'pages#send_mail', via: %i[post] - match '/disconnect', to: 'pages#disconnect', via: [:get] + match '/disconnect', to: 'pages#disconnect', via: %i[get] end diff --git a/config/secrets.yml b/config/secrets.yml index 7e26095..0e27882 100644 --- a/config/secrets.yml +++ b/config/secrets.yml @@ -5,18 +5,28 @@ # Make sure the secret is at least 30 characters and all random, # no regular words or you'll be exposed to dictionary attacks. -# You can use `rake secret` to generate a secure secret key. +# You can use `rails secret` to generate a secure secret key. # Make sure the secrets in this file are kept private # if you're sharing your code publicly. +# Shared secrets are available across all environments. + +# shared: +# api_key: a1B2c3D4e5F6 + +# Environmental secrets are only available for that specific environment. + development: - secret_key_base: 1e80735aeee97eaa8f7fe754d7caec18f88bd08a8e816642784f9e4a908e9fbb26d4d773f2840ecdd880f88fba36b4bdba14cc3e49a662773237e0f8e747fbe7 + secret_key_base: 61871a769e826a24a9646dc46797be76c95432789a1a970566db846b02b029b1be0fc4ee617d9b92d95d641fd199b2cc005d65c5a720274f751d4006744fdd50 test: - secret_key_base: 19ee6bbdcd41c44b593afd073e429d892ca394eba6dd2f6910234d4bea8c0d04b43a437a2445447250f5959ef01d4a2043f3a2a7d7534c3ed65f2a1b797fa880 + secret_key_base: 79ae7b1b2870f0a2e348df70774eeea1f564ff7bf85649f750a0a8bc0edb3e55300b3090306adec782a338993dd5aca10172d21900ce4457390825eea8deccac + +# Do not keep production secrets in the unencrypted secrets file. +# Instead, either read values from the environment. +# Or, use `bin/rails secrets:setup` to configure encrypted secrets +# and move the `production:` environment over there. -# Do not keep production secrets in the repository, -# instead read values from the environment. production: secret_key_base: <%= ENV["SECRET_KEY_BASE"] %> diff --git a/config/spring.rb b/config/spring.rb new file mode 100644 index 0000000..9fa7863 --- /dev/null +++ b/config/spring.rb @@ -0,0 +1,6 @@ +%w[ + .ruby-version + .rbenv-vars + tmp/restart.txt + tmp/caching-dev.txt +].each { |path| Spring.watch(path) } diff --git a/starter/.gitignore b/starter/.gitignore deleted file mode 100644 index fb00322..0000000 --- a/starter/.gitignore +++ /dev/null @@ -1,145 +0,0 @@ -# From: https://raw.githubusercontent.com/github/gitignore/master/Rails.gitignore -*.rbc -capybara-*.html -.rspec -/log/* -!/log/.keep -/tmp -/db/*.sqlite3 -/db/*.sqlite3-journal -/public/system -/coverage/ -/spec/tmp -**.orig -rerun.txt -pickle-email-*.html - -# TODO Comment out these rules if you are OK with secrets being uploaded to the repo -config/initializers/secret_token.rb -config/secrets.yml - -## Environment normalisation: -/.bundle -/vendor/bundle - -# these should all be checked in to normalise the environment: -# Gemfile.lock, .ruby-version, .ruby-gemset - -# unless supporting rvm < 1.11.0 or doing something fancy, ignore this: -.rvmrc - -# if using bower-rails ignore default bower_components path bower.json files -/vendor/assets/bower_components -*.bowerrc -bower.json - -# Ignore pow environment settings -.powenv - -# Emacs -# From https://raw.githubusercontent.com/github/gitignore/master/Global/Emacs.gitignore - -# -*- mode: gitignore; -*- -*~ -\#*\# -/.emacs.desktop -/.emacs.desktop.lock -*.elc -auto-save-list -tramp -.\#* - -# Org-mode -.org-id-locations -*_archive - -# flymake-mode -*_flymake.* - -# eshell files -/eshell/history -/eshell/lastdir - -# elpa packages -/elpa/ - -# reftex files -*.rel - -# AUCTeX auto folder -/auto/ - -# cask packages -.cask/ - -# Vim -# From: https://raw.githubusercontent.com/github/gitignore/master/Global/Vim.gitignore -[._]*.s[a-w][a-z] -[._]s[a-w][a-z] -*.un~ -Session.vim -.netrwhist -*~ - -# Vscode -# From: https://raw.githubusercontent.com/github/gitignore/master/Global/VisualStudioCode.gitignore -.vscode - -# OSX -# From: https://raw.githubusercontent.com/github/gitignore/master/Global/OSX.gitignore -.DS_Store -.AppleDouble -.LSOverride - -# Icon must end with two \r -Icon - - -# Thumbnails -._* - -# Files that might appear in the root of a volume -.DocumentRevisions-V100 -.fseventsd -.Spotlight-V100 -.TemporaryItems -.Trashes -.VolumeIcon.icns - -# Directories potentially created on remote AFP share -.AppleDB -.AppleDesktop -Network Trash Folder -Temporary Items -.apdisk - -# Windows -# From: https://raw.githubusercontent.com/github/gitignore/master/Global/Windows.gitignore -# Windows image file caches -Thumbs.db -ehthumbs.db - -# Folder config file -Desktop.ini - -# Recycle Bin used on file shares -$RECYCLE.BIN/ - -# Windows Installer files -*.cab -*.msi -*.msm -*.msp - -# Windows shortcuts -*.lnk - -# Linux -# From: https://raw.githubusercontent.com/github/gitignore/master/Global/Linux.gitignore -*~ - -# KDE directory preferences -.directory - -# Linux trash folder which might appear on any partition or disk -.Trash-* diff --git a/starter/.rubocop.yml b/starter/.rubocop.yml deleted file mode 100644 index 6e2bc2b..0000000 --- a/starter/.rubocop.yml +++ /dev/null @@ -1,14 +0,0 @@ -AllCops: - Exclude: - - 'bin/**' - -Documentation: - Enabled: false - -Metrics/MethodLength: - Enabled: false - -Lint/HandleExceptions: - Exclude: - - 'bin/rails' - - 'bin/rake' diff --git a/starter/.rubocop_todo.yml b/starter/.rubocop_todo.yml deleted file mode 100644 index f7d9d12..0000000 --- a/starter/.rubocop_todo.yml +++ /dev/null @@ -1,7 +0,0 @@ -# This configuration was generated by -# `rubocop --auto-gen-config` -# on 2015-10-06 15:31:49 -0700 using RuboCop version 0.34.2. -# The point is for the user to remove these configuration records -# one by one as the offenses are removed from the code base. -# Note that changes in the inspected code, or installation of new -# versions of RuboCop, may require this file to be generated again. diff --git a/starter/.travis.yml b/starter/.travis.yml deleted file mode 100644 index 623c4fb..0000000 --- a/starter/.travis.yml +++ /dev/null @@ -1,10 +0,0 @@ -language: ruby -rvm: - - 2.2.1 -# use container builds -sudo: false -before_install: gem update --remote bundler -install: - - bundle install --retry=3 -script: - - bundle exec rubocop diff --git a/starter/Gemfile b/starter/Gemfile deleted file mode 100644 index b9a3f9d..0000000 --- a/starter/Gemfile +++ /dev/null @@ -1,56 +0,0 @@ -source 'https://rubygems.org' - -# Bundle edge Rails instead: gem 'rails', github: 'rails/rails' -gem 'rails', '4.2.3' -# Use sqlite3 as the database for Active Record -gem 'sqlite3' -# Use SCSS for stylesheets -gem 'sass-rails', '~> 5.0' -# Use Uglifier as compressor for JavaScript assets -gem 'uglifier', '>= 1.3.0' -# Use CoffeeScript for .coffee assets and views -gem 'coffee-rails', '~> 4.1.0' -# See https://github.com/rails/execjs#readme for more supported runtimes -# gem 'therubyracer', platforms: :ruby - -# Use jquery as the JavaScript library -gem 'jquery-rails' -# Turbolinks makes following links in your web application faster. -# Read more: https://github.com/rails/turbolinks -gem 'turbolinks' -# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder -gem 'jbuilder', '~> 2.0' -# bundle exec rake doc:rails generates the API under doc/api. -gem 'sdoc', '~> 0.4.0', group: :doc - -# Use ActiveModel has_secure_password -# gem 'bcrypt', '~> 3.1.7' - -# Use Unicorn as the app server -# gem 'unicorn' - -# Use Capistrano for deployment -# gem 'capistrano-rails', group: :development - -group :development, :test do - # Call 'byebug' anywhere in the code to stop execution and get a debugger - # console - gem 'byebug' - - # Access an IRB console on exception pages or by using <%= console %> in views - gem 'web-console', '~> 2.0' - - # Spring speeds up development by keeping your application running in the - # background. Read more: https://github.com/rails/spring - gem 'spring' -end - -# Authentication resources -# gem 'omniauth' -# gem 'omniauth-oauth2' -# gem 'omniauth-microsoft_v2_auth', path: './omniauth-microsoft_v2_auth' - -# On Windows systems we need tzinfo-data -gem 'tzinfo-data' - -gem 'rubocop', '0.34.2' diff --git a/starter/Gemfile.lock b/starter/Gemfile.lock deleted file mode 100644 index 62a5ba3..0000000 --- a/starter/Gemfile.lock +++ /dev/null @@ -1,183 +0,0 @@ -GEM - remote: https://rubygems.org/ - specs: - actionmailer (4.2.3) - actionpack (= 4.2.3) - actionview (= 4.2.3) - activejob (= 4.2.3) - mail (~> 2.5, >= 2.5.4) - rails-dom-testing (~> 1.0, >= 1.0.5) - actionpack (4.2.3) - actionview (= 4.2.3) - activesupport (= 4.2.3) - rack (~> 1.6) - rack-test (~> 0.6.2) - rails-dom-testing (~> 1.0, >= 1.0.5) - rails-html-sanitizer (~> 1.0, >= 1.0.2) - actionview (4.2.3) - activesupport (= 4.2.3) - builder (~> 3.1) - erubis (~> 2.7.0) - rails-dom-testing (~> 1.0, >= 1.0.5) - rails-html-sanitizer (~> 1.0, >= 1.0.2) - activejob (4.2.3) - activesupport (= 4.2.3) - globalid (>= 0.3.0) - activemodel (4.2.3) - activesupport (= 4.2.3) - builder (~> 3.1) - activerecord (4.2.3) - activemodel (= 4.2.3) - activesupport (= 4.2.3) - arel (~> 6.0) - activesupport (4.2.3) - i18n (~> 0.7) - json (~> 1.7, >= 1.7.7) - minitest (~> 5.1) - thread_safe (~> 0.3, >= 0.3.4) - tzinfo (~> 1.1) - arel (6.0.3) - ast (2.3.0) - astrolabe (1.3.1) - parser (~> 2.2) - binding_of_caller (0.7.2) - debug_inspector (>= 0.0.1) - builder (3.2.2) - byebug (9.0.5) - coffee-rails (4.1.1) - coffee-script (>= 2.2.0) - railties (>= 4.0.0, < 5.1.x) - coffee-script (2.4.1) - coffee-script-source - execjs - coffee-script-source (1.10.0) - concurrent-ruby (1.0.2) - debug_inspector (0.0.2) - erubis (2.7.0) - execjs (2.7.0) - globalid (0.3.7) - activesupport (>= 4.1.0) - i18n (0.7.0) - jbuilder (2.6.0) - activesupport (>= 3.0.0, < 5.1) - multi_json (~> 1.2) - jquery-rails (4.2.1) - rails-dom-testing (>= 1, < 3) - railties (>= 4.2.0) - thor (>= 0.14, < 2.0) - json (1.8.3) - loofah (2.0.3) - nokogiri (>= 1.5.9) - mail (2.6.4) - mime-types (>= 1.16, < 4) - mime-types (3.1) - mime-types-data (~> 3.2015) - mime-types-data (3.2016.0521) - mini_portile2 (2.0.0) - minitest (5.9.0) - multi_json (1.12.1) - nokogiri (1.6.7.2) - mini_portile2 (~> 2.0.0.rc2) - nokogiri (1.6.7.2-x86-mingw32) - mini_portile2 (~> 2.0.0.rc2) - parser (2.3.1.2) - ast (~> 2.2) - powerpack (0.1.1) - rack (1.6.4) - rack-test (0.6.3) - rack (>= 1.0) - rails (4.2.3) - actionmailer (= 4.2.3) - actionpack (= 4.2.3) - actionview (= 4.2.3) - activejob (= 4.2.3) - activemodel (= 4.2.3) - activerecord (= 4.2.3) - activesupport (= 4.2.3) - bundler (>= 1.3.0, < 2.0) - railties (= 4.2.3) - sprockets-rails - rails-deprecated_sanitizer (1.0.3) - activesupport (>= 4.2.0.alpha) - rails-dom-testing (1.0.7) - activesupport (>= 4.2.0.beta, < 5.0) - nokogiri (~> 1.6.0) - rails-deprecated_sanitizer (>= 1.0.1) - rails-html-sanitizer (1.0.3) - loofah (~> 2.0) - railties (4.2.3) - actionpack (= 4.2.3) - activesupport (= 4.2.3) - rake (>= 0.8.7) - thor (>= 0.18.1, < 2.0) - rainbow (2.1.0) - rake (11.2.2) - rdoc (4.2.2) - json (~> 1.4) - rubocop (0.34.2) - astrolabe (~> 1.3) - parser (>= 2.2.2.5, < 3.0) - powerpack (~> 0.1) - rainbow (>= 1.99.1, < 3.0) - ruby-progressbar (~> 1.4) - ruby-progressbar (1.8.1) - sass (3.4.22) - sass-rails (5.0.6) - railties (>= 4.0.0, < 6) - sass (~> 3.1) - sprockets (>= 2.8, < 4.0) - sprockets-rails (>= 2.0, < 4.0) - tilt (>= 1.1, < 3) - sdoc (0.4.1) - json (~> 1.7, >= 1.7.7) - rdoc (~> 4.0) - spring (1.7.2) - sprockets (3.7.0) - concurrent-ruby (~> 1.0) - rack (> 1, < 3) - sprockets-rails (3.1.1) - actionpack (>= 4.0) - activesupport (>= 4.0) - sprockets (>= 3.0.0) - sqlite3 (1.3.11) - sqlite3 (1.3.11-x86-mingw32) - thor (0.19.1) - thread_safe (0.3.5) - tilt (2.0.5) - turbolinks (5.0.1) - turbolinks-source (~> 5) - turbolinks-source (5.0.0) - tzinfo (1.2.2) - thread_safe (~> 0.1) - tzinfo-data (1.2016.6) - tzinfo (>= 1.0.0) - uglifier (3.0.2) - execjs (>= 0.3.0, < 3) - web-console (2.3.0) - activemodel (>= 4.0) - binding_of_caller (>= 0.7.2) - railties (>= 4.0) - sprockets-rails (>= 2.0, < 4.0) - -PLATFORMS - ruby - x86-mingw32 - -DEPENDENCIES - byebug - coffee-rails (~> 4.1.0) - jbuilder (~> 2.0) - jquery-rails - rails (= 4.2.3) - rubocop (= 0.34.2) - sass-rails (~> 5.0) - sdoc (~> 0.4.0) - spring - sqlite3 - turbolinks - tzinfo-data - uglifier (>= 1.3.0) - web-console (~> 2.0) - -BUNDLED WITH - 1.12.5 diff --git a/starter/LICENSE.txt b/starter/LICENSE.txt deleted file mode 100644 index d8d98a8..0000000 --- a/starter/LICENSE.txt +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2015 Microsoft Corporation - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. \ No newline at end of file diff --git a/starter/NOTICES.md b/starter/NOTICES.md deleted file mode 100644 index 9ca203b..0000000 --- a/starter/NOTICES.md +++ /dev/null @@ -1,7 +0,0 @@ -This project uses the following third-party components: - -Ruby, which is copyright (c) free software by [Yukihiro Matsumoto](matz@netlab.jp), and is available under the terms of the [2-clause BSD License](https://opensource.org/licenses/BSD-2-Clause). - -Ruby on Rails, which is a registered trademark (TM) of David Heinemeier Hansson, and is available under the [MIT License](http://www.opensource.org/licenses/mit-license.php). - -Rack, which is copyright (c) Christian Neukirchen, and is available under the [MIT License](http://www.opensource.org/licenses/mit-license.php). \ No newline at end of file diff --git a/starter/README.md b/starter/README.md deleted file mode 100644 index dc7a4ba..0000000 --- a/starter/README.md +++ /dev/null @@ -1,16 +0,0 @@ -## Microsoft Graph Ruby on Rails Connect Sample (Starter project) - -This project provides a starting point for building the finished Microsoft Graph Ruby on Rails Connect sample. For instructions on how to complete the project, see [Getting Started](http://graph.microsoft.io/en-us/docs/platform/get-started) on [graph.microsoft.io](http://graph.microsoft.io). - -The completed Connect sample is contained in the top-level project in this sample. - -## Additional resources - -- [Other Microsoft Graph Connect samples](https://github.com/MicrosoftGraph?utf8=%E2%9C%93&query=-Connect) -- [Microsoft Graph overview](http://graph.microsoft.io) -- [Office developer code samples](http://dev.office.com/code-samples) -- [Office dev center](http://dev.office.com/) -- [Office UI Fabric](https://github.com/OfficeDev/Office-UI-Fabric) - -## Copyright -Copyright (c) 2016 Microsoft. All rights reserved. diff --git a/starter/Rakefile b/starter/Rakefile deleted file mode 100644 index dfa3aa4..0000000 --- a/starter/Rakefile +++ /dev/null @@ -1,7 +0,0 @@ -# Add your own tasks in files placed in lib/tasks ending in .rake, -# for example lib/tasks/capistrano.rake, and they will automatically be -# available to Rake. - -require File.expand_path('../config/application', __FILE__) - -Rails.application.load_tasks diff --git a/starter/app/assets/MailTemplate.html b/starter/app/assets/MailTemplate.html deleted file mode 100644 index 114300d..0000000 --- a/starter/app/assets/MailTemplate.html +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - -

Congratulations {given_name},

-

This is a message from the Microsoft Graph Connect Sample. You are well on your way to incorporating Microsoft Graph endpoints in your apps.

-

What’s next?

- -

Give us feedback

- -

Thanks, and happy coding!
Your Microsoft Graph samples development team

-
- - - - - - - - -
See on GitHubSuggest on UserVoiceShare on Twitter
-
- - diff --git a/starter/app/assets/stylesheets/application.css b/starter/app/assets/stylesheets/application.css deleted file mode 100644 index ffb181b..0000000 --- a/starter/app/assets/stylesheets/application.css +++ /dev/null @@ -1,41 +0,0 @@ -/** - * Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. - * See LICENSE in the project root for license information. - */ - -.navbar-header { - box-sizing: border-box; - display: block; - height: 40px; - line-height: 40px; - font-family: 'Segoe UI Semilight WestEuropean', 'Segoe UI Semilight', 'Segoe WP Semilight', 'Segoe UI', 'Segoe WP', Tahoma, Arial, sans-serif; - font-size: 17px; - padding-left: 20px; - position: relative; - font-weight: bold; -} - -@media (min-width: 480px) { - .navbar-header { - float: left; - margin-right: 20px; - font-size: 20px; - padding: 0; - } -} - -.ms-TextField { - width: 300px; - display: inline-block; -} - -.icon-holder { - display: inline-block; - width: 30px; -} - -.big-icon { - font-size: 30px; - top: 5px; - position: relative; -} \ No newline at end of file diff --git a/starter/app/controllers/application_controller.rb b/starter/app/controllers/application_controller.rb deleted file mode 100644 index f845ec5..0000000 --- a/starter/app/controllers/application_controller.rb +++ /dev/null @@ -1,13 +0,0 @@ -class ApplicationController < ActionController::Base - # Prevent CSRF attacks by raising an exception. - # For APIs, you may want to use :null_session instead. - protect_from_forgery with: :exception - - # Sets the locale, if something other than the default - # is specified in the URL parameters - before_action :set_locale - - def set_locale - I18n.locale = params[:locale] || I18n.default_locale - end -end diff --git a/starter/app/controllers/concerns/.keep b/starter/app/controllers/concerns/.keep deleted file mode 100644 index e69de29..0000000 diff --git a/starter/app/controllers/pages_controller.rb b/starter/app/controllers/pages_controller.rb deleted file mode 100644 index f499ce1..0000000 --- a/starter/app/controllers/pages_controller.rb +++ /dev/null @@ -1,135 +0,0 @@ -### -# Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. -# See LICENSE in the project root for license information. -## - -# The controller manages the interaction of the pages with -# the v2 authentication endpoint and the Microsoft Graph -# To see how to get tokens for your app look at login and callback -# To see how to send an email using the graph.microsoft.com -# endpoint see send_mail -# To see how to get rid of the tokens and finish the session -# in your app, see disconnect - -class PagesController < ApplicationController - skip_before_action :verify_authenticity_token - - # Specifies endpoint for connecting to the Microsoft Graph - GRAPH_RESOURCE = 'https://graph.microsoft.com' - SENDMAIL_ENDPOINT = '/v1.0/me/microsoft.graph.sendmail' - CONTENT_TYPE = 'application/json;odata.metadata=minimal;odata.streaming=true' - - # Delegates the browser to the v2 authentication OmniAuth module - # which takes the user to a sign-in page, if we don't have tokens already - def login - redirect_to '/auth/microsoft_v2_auth' - end - - # If the user had to sign-in, the browser will redirect to this callback - # with the authorization tokens attached - - def callback - # # Access the authentication hash for omniauth - # # and extract the auth token, user name, and email - # data = request.env['omniauth.auth'] - # token = data['credentials']['token'] - # - # @email = data[:extra][:raw_info][:userPrincipalName] - # @name = data[:extra][:raw_info][:displayName] - # - # # Associate token/user values to the session - # session[:access_token] = data['credentials']['token'] - # session[:name] = @name - # session[:email] = @email - # - # # Debug logging - # logger.info "Name: #{@name}" - # logger.info "Email: #{@email}" - # logger.info "[callback] - Access token: #{session[:access_token]}" - end - - def auth_hash - request.env['omniauth.auth'] - end - - # Sends an authenticated request to the sendmail endpoint in - # graph.microsoft.com - # Stuff to consider: - # - The email message is attached to the body of the request - # - The access token must be appended to the authorization initheader - # - Content type must be at least application/json - # rubocop:disable Metrics/AbcSize - def send_mail - # logger.debug "[send_mail] - Access token: #{session[:access_token]}" - # - # # Used in the template - # @name = session[:name] - # @email = params[:specified_email] - # @recipient = params[:specified_email] - # @mail_sent = false - # - # send_mail_endpoint = URI("#{GRAPH_RESOURCE}#{SENDMAIL_ENDPOINT}") - # content_type = CONTENT_TYPE - # http = Net::HTTP.new(send_mail_endpoint.host, send_mail_endpoint.port) - # http.use_ssl = true - # - # # If you want to use a sniffer tool, like Fiddler, to see the request - # # you might need to add this line to tell the engine not to verify the - # # certificate or you might see a "certificate verify failed" error - # # http.verify_mode = OpenSSL::SSL::VERIFY_NONE - # - # email_body = File.read('app/assets/MailTemplate.html') - # email_body.sub! '{given_name}', @name - # email_subject = t('email_subject') - # - # logger.debug email_body - # - # email_message = "{ - # Message: { - # Subject: '#{email_subject}', - # Body: { - # ContentType: 'HTML', - # Content: '#{email_body}' - # }, - # ToRecipients: [ - # { - # EmailAddress: { - # Address: '#{@recipient}' - # } - # } - # ] - # }, - # SaveToSentItems: true - # }" - # - # response = http.post( - # SENDMAIL_ENDPOINT, - # email_message, - # 'Authorization' => "Bearer #{session[:access_token]}", - # 'Content-Type' => content_type - # ) - # - # logger.debug "Code: #{response.code}" - # logger.debug "Message: #{response.message}" - # - # # The send mail endpoint returns a 202 - Accepted code on success - # if response.code == '202' - # @mail_sent = true - # else - # @mail_sent = false - # flash[:httpError] = "#{response.code} - #{response.message}" - # end - # - # render 'callback' - end - # rubocop:enable Metrics/AbcSize - - # Deletes the local session and redirects to root - # the v2 endpoint doesn't currently support a logout endpoint - # so we can't call it for a v2 logout flow - def disconnect - reset_session - logger.info 'LOGOUT' - redirect_to '/' - end -end diff --git a/starter/app/helpers/application_helper.rb b/starter/app/helpers/application_helper.rb deleted file mode 100644 index de6be79..0000000 --- a/starter/app/helpers/application_helper.rb +++ /dev/null @@ -1,2 +0,0 @@ -module ApplicationHelper -end diff --git a/starter/app/helpers/pages_helper.rb b/starter/app/helpers/pages_helper.rb deleted file mode 100644 index 2c057fd..0000000 --- a/starter/app/helpers/pages_helper.rb +++ /dev/null @@ -1,2 +0,0 @@ -module PagesHelper -end diff --git a/starter/app/views/layouts/application.html.erb b/starter/app/views/layouts/application.html.erb deleted file mode 100644 index 40f6fc4..0000000 --- a/starter/app/views/layouts/application.html.erb +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - <%= t('app_title') %> - <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %> - <%= csrf_meta_tags %> - - - - - - -<%= yield %> - - - diff --git a/starter/app/views/pages/callback.html.erb b/starter/app/views/pages/callback.html.erb deleted file mode 100644 index 9f426a8..0000000 --- a/starter/app/views/pages/callback.html.erb +++ /dev/null @@ -1,40 +0,0 @@ - - -
- -
- -
- -
-
-
-

<%=t 'greet_username', user: @name %>

-

<%= t('connect_message') %>

-
- -
- - - -
- <%if @mail_sent %> -

<%= t('email_success', recipient: @recipient ) %>

- <% elsif !@mail_sent && flash[:httpError] %> -

<%= t('email_error') %><%= flash[:httpError] %>

- <% end %> -
-
-
-
-
-
-
diff --git a/starter/app/views/pages/index.html.erb b/starter/app/views/pages/index.html.erb deleted file mode 100644 index 372957b..0000000 --- a/starter/app/views/pages/index.html.erb +++ /dev/null @@ -1,25 +0,0 @@ - - -
-
- -
-
    - -
-
- - -
-
-

<%= t('login_instructions') %>

- -
-
-
-
diff --git a/starter/bin/bundle b/starter/bin/bundle deleted file mode 100644 index 66e9889..0000000 --- a/starter/bin/bundle +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env ruby -ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) -load Gem.bin_path('bundler', 'bundle') diff --git a/starter/bin/rails b/starter/bin/rails deleted file mode 100644 index 62687aa..0000000 --- a/starter/bin/rails +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env ruby -begin - load File.expand_path('../spring', __FILE__) -rescue LoadError -end -APP_PATH = File.expand_path('../../config/application', __FILE__) -require_relative '../config/boot' -require 'rails/commands' diff --git a/starter/bin/rake b/starter/bin/rake deleted file mode 100644 index 2e9ece4..0000000 --- a/starter/bin/rake +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env ruby -begin - load File.expand_path('../spring', __FILE__) -rescue LoadError -end -require_relative '../config/boot' -require 'rake' -Rake.application.run diff --git a/starter/bin/setup b/starter/bin/setup deleted file mode 100644 index eb347f9..0000000 --- a/starter/bin/setup +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env ruby -require 'pathname' - -# path to your application root. -APP_ROOT = Pathname.new File.expand_path('../../', __FILE__) - -Dir.chdir APP_ROOT do - # This script is a starting point to setup your application. - # Add necessary setup steps to this file: - - puts '== Installing dependencies ==' - system 'gem install bundler --conservative' - system 'bundle check || bundle install' - - # puts "\n== Copying sample files ==" - # unless File.exist?("config/database.yml") - # system "cp config/database.yml.sample config/database.yml" - # end - - puts "\n== Preparing database ==" - system 'bin/rake db:setup' - - puts "\n== Removing old logs and tempfiles ==" - system 'rm -f log/*' - system 'rm -rf tmp/cache' - - puts "\n== Restarting application server ==" - system 'touch tmp/restart.txt' -end diff --git a/starter/bin/spring b/starter/bin/spring deleted file mode 100644 index 62ec28f..0000000 --- a/starter/bin/spring +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env ruby - -# This file loads spring without using Bundler, in order to be fast. -# It gets overwritten when you run the `spring binstub` command. - -unless defined?(Spring) - require 'rubygems' - require 'bundler' - - if (match = Bundler.default_lockfile.read.match(/^GEM$.*?^ (?: )*spring \((.*?)\)$.*?^$/m)) - Gem.paths = { 'GEM_PATH' => [Bundler.bundle_path.to_s, *Gem.path].uniq } - gem 'spring', match[1] - require 'spring/binstub' - end -end diff --git a/starter/config.ru b/starter/config.ru deleted file mode 100644 index bd83b25..0000000 --- a/starter/config.ru +++ /dev/null @@ -1,4 +0,0 @@ -# This file is used by Rack-based servers to start the application. - -require ::File.expand_path('../config/environment', __FILE__) -run Rails.application diff --git a/starter/config/application.rb b/starter/config/application.rb deleted file mode 100644 index da1195d..0000000 --- a/starter/config/application.rb +++ /dev/null @@ -1,18 +0,0 @@ -### -# Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. -# See LICENSE in the project root for license information. -## - -require File.expand_path('../boot', __FILE__) - -require 'rails/all' - -# Require the gems listed in Gemfile, including any gems -# you've limited to :test, :development, or :production. -Bundler.require(*Rails.groups) - -module O365RailsUnifiedApiConnect - class Application < Rails::Application - config.active_record.raise_in_transactional_callbacks = true - end -end diff --git a/starter/config/boot.rb b/starter/config/boot.rb deleted file mode 100644 index 6b750f0..0000000 --- a/starter/config/boot.rb +++ /dev/null @@ -1,3 +0,0 @@ -ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) - -require 'bundler/setup' # Set up gems listed in the Gemfile. diff --git a/starter/config/database.yml b/starter/config/database.yml deleted file mode 100644 index 1c1a37c..0000000 --- a/starter/config/database.yml +++ /dev/null @@ -1,25 +0,0 @@ -# SQLite version 3.x -# gem install sqlite3 -# -# Ensure the SQLite 3 gem is defined in your Gemfile -# gem 'sqlite3' -# -default: &default - adapter: sqlite3 - pool: 5 - timeout: 5000 - -development: - <<: *default - database: db/development.sqlite3 - -# Warning: The database defined as "test" will be erased and -# re-generated from your development database when you run "rake". -# Do not set this db to the same as development or production. -test: - <<: *default - database: db/test.sqlite3 - -production: - <<: *default - database: db/production.sqlite3 diff --git a/starter/config/environment.rb b/starter/config/environment.rb deleted file mode 100644 index 0be6c41..0000000 --- a/starter/config/environment.rb +++ /dev/null @@ -1,18 +0,0 @@ -### -# Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. -# See LICENSE in the project root for license information. -## - -# The following values must match the client ID, secret, and reply URL -# in your Microsoft App Registration Portal entry for your app. -ENV['CLIENT_ID'] = 'ENTER_YOUR_CLIENT_ID' -ENV['CLIENT_SECRET'] = 'ENTER_YOUR_SECRET' -ENV['SCOPE'] = 'openid email profile https://graph.microsoft.com/User.Read https://graph.microsoft.com/Mail.Send' - -# Load the Rails application. -require File.expand_path('../application', __FILE__) - -Rails.logger = Logger.new(STDOUT) - -# Initialize the Rails application. -Rails.application.initialize! diff --git a/starter/config/environments/development.rb b/starter/config/environments/development.rb deleted file mode 100644 index cd391ac..0000000 --- a/starter/config/environments/development.rb +++ /dev/null @@ -1,42 +0,0 @@ -Rails.application.configure do - # Settings specified here will take precedence over those in - # config/application.rb. - - # In the development environment your application's code is reloaded on - # every request. This slows down response time but is perfect for development - # since you don't have to restart the web server when you make code changes. - config.cache_classes = false - - # Do not eager load code on boot. - config.eager_load = false - - # Show full error reports and disable caching. - config.consider_all_requests_local = true - config.action_controller.perform_caching = false - - # Don't care if the mailer can't send. - config.action_mailer.raise_delivery_errors = false - - # Print deprecation notices to the Rails logger. - config.active_support.deprecation = :log - - # Raise an error on page load if there are pending migrations. - config.active_record.migration_error = :page_load - - # Debug mode disables concatenation and preprocessing of assets. - # This option may cause significant delays in view rendering with a large - # number of complex assets. - config.assets.debug = true - - # Asset digests allow you to set far-future HTTP expiration dates on all - # assets, yet still be able to expire them through the digest params. - config.assets.digest = true - - # Adds additional error checking when serving assets at runtime. - # Checks for improperly declared sprockets dependencies. - # Raises helpful error messages. - config.assets.raise_runtime_errors = true - - # Raises error for missing translations - # config.action_view.raise_on_missing_translations = true -end diff --git a/starter/config/environments/production.rb b/starter/config/environments/production.rb deleted file mode 100644 index d3efaef..0000000 --- a/starter/config/environments/production.rb +++ /dev/null @@ -1,83 +0,0 @@ -Rails.application.configure do - # Settings specified here will take precedence over those in - # config/application.rb. - - # Code is not reloaded between requests. - config.cache_classes = true - - # Eager load code on boot. This eager loads most of Rails and - # your application in memory, allowing both threaded web servers - # and those relying on copy on write to perform better. - # Rake tasks automatically ignore this option for performance. - config.eager_load = true - - # Full error reports are disabled and caching is turned on. - config.consider_all_requests_local = false - config.action_controller.perform_caching = true - - # Enable Rack::Cache to put a simple HTTP cache in front of your application - # Add `rack-cache` to your Gemfile before enabling this. - # For large-scale production use, consider using a caching reverse proxy like - # NGINX, varnish or squid. - # config.action_dispatch.rack_cache = true - - # Disable serving static files from the `/public` folder by default since - # Apache or NGINX already handles this. - config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present? - - # Compress JavaScripts and CSS. - config.assets.js_compressor = :uglifier - # config.assets.css_compressor = :sass - - # Do not fallback to assets pipeline if a precompiled asset is missed. - config.assets.compile = false - - # Asset digests allow you to set far-future HTTP expiration dates on all - # assets, yet still be able to expire them through the digest params. - config.assets.digest = true - - # `config.assets.precompile` and `config.assets.version` have moved to - # config/initializers/assets.rb - - # Specifies the header that your server uses for sending files. - # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache - # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX - - # Force all access to the app over SSL, use Strict-Transport-Security, and use - # secure cookies. - # config.force_ssl = true - - # Use the lowest log level to ensure availability of diagnostic information - # when problems arise. - config.log_level = :debug - - # Prepend all log lines with the following tags. - # config.log_tags = [ :subdomain, :uuid ] - - # Use a different logger for distributed setups. - # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new) - - # Use a different cache store in production. - # config.cache_store = :mem_cache_store - - # Enable serving of images, stylesheets, and JavaScripts from an asset server. - # config.action_controller.asset_host = 'http://assets.example.com' - - # Ignore bad email addresses and do not raise email delivery errors. - # Set this to true and configure the email server for immediate delivery to - # raise delivery errors. - # config.action_mailer.raise_delivery_errors = false - - # Enable locale fallbacks for I18n (makes lookups for any locale fall back to - # the I18n.default_locale when a translation cannot be found). - config.i18n.fallbacks = true - - # Send deprecation notices to registered listeners. - config.active_support.deprecation = :notify - - # Use default logging formatter so that PID and timestamp are not suppressed. - config.log_formatter = ::Logger::Formatter.new - - # Do not dump schema after migrations. - config.active_record.dump_schema_after_migration = false -end diff --git a/starter/config/environments/test.rb b/starter/config/environments/test.rb deleted file mode 100644 index 7ac80d3..0000000 --- a/starter/config/environments/test.rb +++ /dev/null @@ -1,43 +0,0 @@ -Rails.application.configure do - # Settings specified here will take precedence over those in - # config/application.rb. - - # The test environment is used exclusively to run your application's - # test suite. You never need to work with it otherwise. Remember that - # your test database is "scratch space" for the test suite and is wiped - # and recreated between test runs. Don't rely on the data there! - config.cache_classes = true - - # Do not eager load code on boot. This avoids loading your whole application - # just for the purpose of running a single test. If you are using a tool that - # preloads Rails for running tests, you may have to set it to true. - config.eager_load = false - - # Configure static file server for tests with Cache-Control for performance. - config.serve_static_files = true - config.static_cache_control = 'public, max-age=3600' - - # Show full error reports and disable caching. - config.consider_all_requests_local = true - config.action_controller.perform_caching = false - - # Raise exceptions instead of rendering exception templates. - config.action_dispatch.show_exceptions = false - - # Disable request forgery protection in test environment. - config.action_controller.allow_forgery_protection = false - - # Tell Action Mailer not to deliver emails to the real world. - # The :test delivery method accumulates sent emails in the - # ActionMailer::Base.deliveries array. - config.action_mailer.delivery_method = :test - - # Randomize the order test cases are executed. - config.active_support.test_order = :random - - # Print deprecation notices to the stderr. - config.active_support.deprecation = :stderr - - # Raises error for missing translations - # config.action_view.raise_on_missing_translations = true -end diff --git a/starter/config/initializers/assets.rb b/starter/config/initializers/assets.rb deleted file mode 100644 index af3aa1a..0000000 --- a/starter/config/initializers/assets.rb +++ /dev/null @@ -1,12 +0,0 @@ -# Be sure to restart your server when you modify this file. - -# Version of your assets, change this if you want to expire all your assets. -Rails.application.config.assets.version = '1.0' - -# Add additional assets to the asset load path -# Rails.application.config.assets.paths << Emoji.images_path - -# Precompile additional assets. -# application.js, application.css, and all non-JS/CSS in app/assets folder -# are already added. -# Rails.application.config.assets.precompile += %w( search.js ) diff --git a/starter/config/initializers/backtrace_silencers.rb b/starter/config/initializers/backtrace_silencers.rb deleted file mode 100644 index 6413347..0000000 --- a/starter/config/initializers/backtrace_silencers.rb +++ /dev/null @@ -1,9 +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/starter/config/initializers/cookies_serializer.rb b/starter/config/initializers/cookies_serializer.rb deleted file mode 100644 index 7f70458..0000000 --- a/starter/config/initializers/cookies_serializer.rb +++ /dev/null @@ -1,3 +0,0 @@ -# Be sure to restart your server when you modify this file. - -Rails.application.config.action_dispatch.cookies_serializer = :json diff --git a/starter/config/initializers/filter_parameter_logging.rb b/starter/config/initializers/filter_parameter_logging.rb deleted file mode 100644 index 4a994e1..0000000 --- a/starter/config/initializers/filter_parameter_logging.rb +++ /dev/null @@ -1,4 +0,0 @@ -# Be sure to restart your server when you modify this file. - -# Configure sensitive parameters which will be filtered from the log file. -Rails.application.config.filter_parameters += [:password] diff --git a/starter/config/initializers/inflections.rb b/starter/config/initializers/inflections.rb deleted file mode 100644 index ac033bf..0000000 --- a/starter/config/initializers/inflections.rb +++ /dev/null @@ -1,16 +0,0 @@ -# Be sure to restart your server when you modify this file. - -# Add new inflection rules using the following format. Inflections -# are locale specific, and you may define rules for as many different -# locales as you wish. All of these examples are active by default: -# ActiveSupport::Inflector.inflections(:en) 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(:en) do |inflect| -# inflect.acronym 'RESTful' -# end diff --git a/starter/config/initializers/mime_types.rb b/starter/config/initializers/mime_types.rb deleted file mode 100644 index dc18996..0000000 --- a/starter/config/initializers/mime_types.rb +++ /dev/null @@ -1,4 +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 diff --git a/starter/config/initializers/omniauth-microsoft-v2-auth.rb b/starter/config/initializers/omniauth-microsoft-v2-auth.rb deleted file mode 100644 index 6f006a7..0000000 --- a/starter/config/initializers/omniauth-microsoft-v2-auth.rb +++ /dev/null @@ -1,9 +0,0 @@ -require 'openssl' -OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE - -# Rails.application.config.middleware.use OmniAuth::Builder do -# provider :microsoft_v2_auth, -# ENV['CLIENT_ID'], -# ENV['CLIENT_SECRET'], -# :scope => ENV['SCOPE'] -# end diff --git a/starter/config/initializers/session_store.rb b/starter/config/initializers/session_store.rb deleted file mode 100644 index 95da621..0000000 --- a/starter/config/initializers/session_store.rb +++ /dev/null @@ -1,5 +0,0 @@ -# Be sure to restart your server when you modify this file. - -# rubocop:disable Metrics/LineLength -Rails.application.config.session_store :cookie_store, key: '_o365-ruby-unified-api-connect_session' -# rubocop:enable Metrics/LineLength diff --git a/starter/config/initializers/wrap_parameters.rb b/starter/config/initializers/wrap_parameters.rb deleted file mode 100644 index f45c358..0000000 --- a/starter/config/initializers/wrap_parameters.rb +++ /dev/null @@ -1,15 +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] if respond_to?(:wrap_parameters) -end - -# To enable root element in JSON for ActiveRecord objects. -# ActiveSupport.on_load(:active_record) do -# self.include_root_in_json = true -# end diff --git a/starter/config/locales/en.yml b/starter/config/locales/en.yml deleted file mode 100644 index 4121467..0000000 --- a/starter/config/locales/en.yml +++ /dev/null @@ -1,33 +0,0 @@ -# Files in the config/locales directory are used for internationalization -# and are automatically loaded by Rails. If you want to use locales other -# than English, add the necessary files in this directory. -# -# To use the locales, use `I18n.t`: -# -# I18n.t 'hello' -# -# In views, this is aliased to just `t`: -# -# <%= t('hello') %> -# -# To use a different locale, set it with `I18n.locale`: -# -# I18n.locale = :es -# -# This would use the information in config/locales/es.yml. -# -# To learn more, please read the Rails Internationalization guide -# available at http://guides.rubyonrails.org/i18n.html. - -en: - hello: "Hello world" - app_title: "Microsoft Graph Connect Sample" - login_instructions: "Use the button below to connect to Microsoft Graph." - connect_button: "Connect to Microsoft Graph" - disconnect_button: "Disconnect" - connect_message: "You're now connected to the Microsoft Graph. Click the mail icon below to send a message from your Microsoft account." - email_success: "Successfully sent an email to %{recipient}." - email_error: "Something went wrong, couldn't send an email. " - greet_username: "Hello %{user}!" - send_mail_button: " send mail" - email_subject: "Welcome to Microsoft Graph development with Ruby on Rails" diff --git a/starter/config/routes.rb b/starter/config/routes.rb deleted file mode 100644 index 41b58d4..0000000 --- a/starter/config/routes.rb +++ /dev/null @@ -1,22 +0,0 @@ -### -# Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. -# See LICENSE in the project root for license information. -## - -Rails.application.routes.draw do - # The priority is based upon order of creation: - # first created -> highest priority. - # See how all your routes lay out with "rake routes". - - # You can have the root of your site routed with "root" - root 'pages#index' - # get '/login', to: 'pages#login' - - # This is where we are redirected if OmniAuth successfully authenticates - # the user. - # match '/auth/:provider/callback', to: 'pages#callback', via: [:get, :post] - - match '/send_mail', to: 'pages#send_mail', via: [:post] - - match '/disconnect', to: 'pages#disconnect', via: [:get] -end diff --git a/starter/log/.keep b/starter/log/.keep deleted file mode 100644 index e69de29..0000000 diff --git a/starter/omniauth-microsoft_v2_auth/.travis.yml b/starter/omniauth-microsoft_v2_auth/.travis.yml deleted file mode 100644 index 1ef14aa..0000000 --- a/starter/omniauth-microsoft_v2_auth/.travis.yml +++ /dev/null @@ -1,5 +0,0 @@ -language: ruby -rvm: - - 2.2 - - jruby - - rbx-2 diff --git a/starter/omniauth-microsoft_v2_auth/Gemfile b/starter/omniauth-microsoft_v2_auth/Gemfile deleted file mode 100644 index 7f193f1..0000000 --- a/starter/omniauth-microsoft_v2_auth/Gemfile +++ /dev/null @@ -1,4 +0,0 @@ -source 'https://rubygems.org' - -# Specify your gem's dependencies in omniauth-office365.gemspec -gemspec diff --git a/starter/omniauth-microsoft_v2_auth/Gemfile.lock b/starter/omniauth-microsoft_v2_auth/Gemfile.lock deleted file mode 100644 index 4e0efb6..0000000 --- a/starter/omniauth-microsoft_v2_auth/Gemfile.lock +++ /dev/null @@ -1,38 +0,0 @@ -PATH - remote: . - specs: - omniauth-microsoft_v2_auth (0.1.0) - omniauth-oauth2 - -GEM - remote: https://rubygems.org/ - specs: - faraday (0.9.2) - multipart-post (>= 1.2, < 3) - hashie (3.4.4) - jwt (1.5.4) - multi_json (1.12.1) - multi_xml (0.5.5) - multipart-post (2.0.0) - oauth2 (1.2.0) - faraday (>= 0.8, < 0.10) - jwt (~> 1.0) - multi_json (~> 1.3) - multi_xml (~> 0.5) - rack (>= 1.2, < 3) - omniauth (1.3.1) - hashie (>= 1.2, < 4) - rack (>= 1.0, < 3) - omniauth-oauth2 (1.4.0) - oauth2 (~> 1.0) - omniauth (~> 1.2) - rack (2.0.1) - -PLATFORMS - x86-mingw32 - -DEPENDENCIES - omniauth-microsoft_v2_auth! - -BUNDLED WITH - 1.12.5 diff --git a/starter/omniauth-microsoft_v2_auth/LICENSE.txt b/starter/omniauth-microsoft_v2_auth/LICENSE.txt deleted file mode 100644 index 42dbb9f..0000000 --- a/starter/omniauth-microsoft_v2_auth/LICENSE.txt +++ /dev/null @@ -1,10 +0,0 @@ -omniauth-microsoft_v2_auth - -Copyright (c) Microsoft Corporation - -All rights reserved. - -MIT License -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ""Software""), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. -THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/starter/omniauth-microsoft_v2_auth/README.md b/starter/omniauth-microsoft_v2_auth/README.md deleted file mode 100644 index 9f78818..0000000 --- a/starter/omniauth-microsoft_v2_auth/README.md +++ /dev/null @@ -1,28 +0,0 @@ -# Omniauth::MicrosoftV2Auth - -Microsoft V2 OAuth2 Strategy for OmniAuth. -Can be used to authenticate with Microsoft Services and get a token for the Microsoft Graph Api. - -## Installation - -Add this line to your application's Gemfile: - -```ruby -gem 'omniauth-microsoft_v2_auth' -``` - -And then execute: - - $ bundle - -Or install it yourself as: - - $ gem install omniauth-microsoft_v2_auth - -## Usage - -```ruby -Rails.application.config.middleware.use OmniAuth::Builder do - provider :microsoft_v2_auth, ENV['AZURE_APPLICATION_CLIENT_ID'], ENV['AZURE_APPLICATION_CLIENT_SECRET'] -end -``` \ No newline at end of file diff --git a/starter/omniauth-microsoft_v2_auth/Rakefile b/starter/omniauth-microsoft_v2_auth/Rakefile deleted file mode 100644 index 2995527..0000000 --- a/starter/omniauth-microsoft_v2_auth/Rakefile +++ /dev/null @@ -1 +0,0 @@ -require "bundler/gem_tasks" diff --git a/starter/omniauth-microsoft_v2_auth/lib/microsoft_v2_auth.rb b/starter/omniauth-microsoft_v2_auth/lib/microsoft_v2_auth.rb deleted file mode 100644 index 99f3bb8..0000000 --- a/starter/omniauth-microsoft_v2_auth/lib/microsoft_v2_auth.rb +++ /dev/null @@ -1 +0,0 @@ -require 'omniauth/microsoft_v2_auth' diff --git a/starter/omniauth-microsoft_v2_auth/lib/omniauth/microsoft_v2_auth.rb b/starter/omniauth-microsoft_v2_auth/lib/omniauth/microsoft_v2_auth.rb deleted file mode 100644 index 152ac8f..0000000 --- a/starter/omniauth-microsoft_v2_auth/lib/omniauth/microsoft_v2_auth.rb +++ /dev/null @@ -1,2 +0,0 @@ -require "omniauth/microsoft_v2_auth/version" -require "omniauth/strategies/microsoft_v2_auth" diff --git a/starter/omniauth-microsoft_v2_auth/lib/omniauth/microsoft_v2_auth/version.rb b/starter/omniauth-microsoft_v2_auth/lib/omniauth/microsoft_v2_auth/version.rb deleted file mode 100644 index 6bbf352..0000000 --- a/starter/omniauth-microsoft_v2_auth/lib/omniauth/microsoft_v2_auth/version.rb +++ /dev/null @@ -1,5 +0,0 @@ -module Omniauth - module MicrosoftV2Auth - VERSION = "0.1.0" - end -end diff --git a/starter/omniauth-microsoft_v2_auth/lib/omniauth/strategies/microsoft_v2_auth.rb b/starter/omniauth-microsoft_v2_auth/lib/omniauth/strategies/microsoft_v2_auth.rb deleted file mode 100644 index c98651d..0000000 --- a/starter/omniauth-microsoft_v2_auth/lib/omniauth/strategies/microsoft_v2_auth.rb +++ /dev/null @@ -1,48 +0,0 @@ -require 'omniauth/strategies/oauth2' - -module OmniAuth - module Strategies - class MicrosoftV2Auth < OmniAuth::Strategies::OAuth2 - option :name, :microsoft_v2_auth - - DEFAULT_SCOPE = "openid email profile https://graph.microsoft.com/User.Read" - - option :client_options, { - site: 'https://login.microsoftonline.com', - authorize_url: '/common/oauth2/v2.0/authorize', - token_url: '/common/oauth2/v2.0/token' - } - - option :authorize_options, [:scope] - - uid { raw_info["id"] } - - extra do - { - 'raw_info' => raw_info - } - end - - def raw_info - @raw_info ||= access_token.get('https://graph.microsoft.com/v1.0/me').parsed - end - - def authorize_params - super.tap do |params| - %w[display score auth_type].each do |v| - if request.params[v] - params[v.to_sym] = request.params[v] - end - end - - params[:scope] ||= DEFAULT_SCOPE - end - end - - def callback_url - options[:redirect_uri] || (full_host + script_name + callback_path) - end - - end - end -end diff --git a/starter/omniauth-microsoft_v2_auth/omniauth-microsoft_v2_auth.gemspec b/starter/omniauth-microsoft_v2_auth/omniauth-microsoft_v2_auth.gemspec deleted file mode 100644 index dcc76cd..0000000 --- a/starter/omniauth-microsoft_v2_auth/omniauth-microsoft_v2_auth.gemspec +++ /dev/null @@ -1,21 +0,0 @@ -# coding: utf-8 -lib = File.expand_path('../lib', __FILE__) -$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) -require 'omniauth/microsoft_v2_auth/version' - -Gem::Specification.new do |spec| - spec.name = "omniauth-microsoft_v2_auth" - spec.version = Omniauth::MicrosoftV2Auth::VERSION - spec.authors = ["Caitlin Bales"] - spec.email = ["c.bales@outlook.com"] - spec.summary = %q{omniauth provider for Microsoft V2 Authentication} - spec.description = %q{omniauth provider for Microsoft V2 Authentication} - spec.homepage = "https://github.com/cbales/omniauth-microsoft_v2_auth" - spec.license = "MIT" - - spec.files = `git ls-files -z`.split("\x0") - spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } - spec.require_paths = ["lib"] - - spec.add_runtime_dependency "omniauth-oauth2" -end diff --git a/starter/public/404.html b/starter/public/404.html deleted file mode 100644 index b612547..0000000 --- a/starter/public/404.html +++ /dev/null @@ -1,67 +0,0 @@ - - - - The page you were looking for doesn't exist (404) - - - - - - -
-
-

The page you were looking for doesn't exist.

-

You may have mistyped the address or the page may have moved.

-
-

If you are the application owner check the logs for more information.

-
- - diff --git a/starter/public/422.html b/starter/public/422.html deleted file mode 100644 index a21f82b..0000000 --- a/starter/public/422.html +++ /dev/null @@ -1,67 +0,0 @@ - - - - The change you wanted was rejected (422) - - - - - - -
-
-

The change you wanted was rejected.

-

Maybe you tried to change something you didn't have access to.

-
-

If you are the application owner check the logs for more information.

-
- - diff --git a/starter/public/500.html b/starter/public/500.html deleted file mode 100644 index 061abc5..0000000 --- a/starter/public/500.html +++ /dev/null @@ -1,66 +0,0 @@ - - - - We're sorry, but something went wrong (500) - - - - - - -
-
-

We're sorry, but something went wrong.

-
-

If you are the application owner check the logs for more information.

-
- - diff --git a/starter/public/favicon.ico b/starter/public/favicon.ico deleted file mode 100644 index e69de29..0000000 diff --git a/starter/public/robots.txt b/starter/public/robots.txt deleted file mode 100644 index 3c9c7c0..0000000 --- a/starter/public/robots.txt +++ /dev/null @@ -1,5 +0,0 @@ -# See http://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file -# -# To ban all spiders from the entire site uncomment the next two lines: -# User-agent: * -# Disallow: /