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.
-Thanks, and happy coding!
Your Microsoft Graph samples development team
See on GitHub | -Suggest on UserVoice | -Share on Twitter | -
<%= t('login_instructions') %>
- -You may have mistyped the address or the page may have moved.
-If you are the application owner check the logs for more information.
-Maybe you tried to change something you didn't have access to.
-If you are the application owner check the logs for more information.
-If you are the application owner check the logs for more information.
-