diff --git a/.travis.yml b/.travis.yml index 5a01b8bc..4eb81446 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,6 @@ sudo: false language: ruby rvm: - - 2.4.2 + - 2.5.1 before_install: gem install bundler after_success: bundle exec codeclimate-test-reporter diff --git a/Gemfile b/Gemfile index cf6c1a7b..851fabc2 100644 --- a/Gemfile +++ b/Gemfile @@ -1,4 +1,2 @@ source 'https://rubygems.org' gemspec - -gem 'rails-controller-testing' diff --git a/Gemfile.lock b/Gemfile.lock index 472b25c4..f0356a0d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -3,151 +3,153 @@ PATH specs: sail (0.1.0) jquery-rails (~> 4.3.1) - rails (~> 5.1.4) + rails (~> 5.2.0) sass-rails (~> 5.0.6) GEM remote: https://rubygems.org/ specs: - actioncable (5.1.4) - actionpack (= 5.1.4) + actioncable (5.2.1) + actionpack (= 5.2.1) nio4r (~> 2.0) - websocket-driver (~> 0.6.1) - actionmailer (5.1.4) - actionpack (= 5.1.4) - actionview (= 5.1.4) - activejob (= 5.1.4) + websocket-driver (>= 0.6.1) + actionmailer (5.2.1) + actionpack (= 5.2.1) + actionview (= 5.2.1) + activejob (= 5.2.1) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 2.0) - actionpack (5.1.4) - actionview (= 5.1.4) - activesupport (= 5.1.4) + actionpack (5.2.1) + actionview (= 5.2.1) + activesupport (= 5.2.1) rack (~> 2.0) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.2) - actionview (5.1.4) - activesupport (= 5.1.4) + actionview (5.2.1) + activesupport (= 5.2.1) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.3) - activejob (5.1.4) - activesupport (= 5.1.4) + activejob (5.2.1) + activesupport (= 5.2.1) 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) + activemodel (5.2.1) + activesupport (= 5.2.1) + activerecord (5.2.1) + activemodel (= 5.2.1) + activesupport (= 5.2.1) + arel (>= 9.0) + activestorage (5.2.1) + actionpack (= 5.2.1) + activerecord (= 5.2.1) + marcel (~> 0.3.1) + activesupport (5.2.1) concurrent-ruby (~> 1.0, >= 1.0.2) - i18n (~> 0.7) + i18n (>= 0.7, < 2) minitest (~> 5.1) tzinfo (~> 1.1) - arel (8.0.0) + arel (9.0.0) builder (3.2.3) - byebug (9.1.0) + byebug (10.0.2) codeclimate-test-reporter (1.0.7) simplecov concurrent-ruby (1.0.5) - crass (1.0.2) + crass (1.0.4) diff-lcs (1.3) - docile (1.1.5) - erubi (1.7.0) - ffi (1.9.18) + docile (1.3.1) + erubi (1.7.1) + ffi (1.9.25) globalid (0.4.1) activesupport (>= 4.2.0) - i18n (0.9.0) + i18n (1.1.0) concurrent-ruby (~> 1.0) - jquery-rails (4.3.1) + jquery-rails (4.3.3) rails-dom-testing (>= 1, < 3) railties (>= 4.2.0) thor (>= 0.14, < 2.0) json (2.1.0) - loofah (2.1.1) + loofah (2.2.2) crass (~> 1.0.2) nokogiri (>= 1.5.9) - mail (2.6.6) - mime-types (>= 1.16, < 4) + mail (2.7.0) + mini_mime (>= 0.1.1) + marcel (0.3.2) + mimemagic (~> 0.3.2) method_source (0.9.0) - mime-types (3.1) - mime-types-data (~> 3.2015) - mime-types-data (3.2016.0521) + mimemagic (0.3.2) + mini_mime (1.0.1) mini_portile2 (2.3.0) - minitest (5.10.3) - nio4r (2.1.0) - nokogiri (1.8.1) + minitest (5.11.3) + nio4r (2.3.1) + nokogiri (1.8.4) mini_portile2 (~> 2.3.0) - rack (2.0.3) - rack-test (0.7.0) + rack (2.0.5) + rack-test (1.1.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) + rails (5.2.1) + actioncable (= 5.2.1) + actionmailer (= 5.2.1) + actionpack (= 5.2.1) + actionview (= 5.2.1) + activejob (= 5.2.1) + activemodel (= 5.2.1) + activerecord (= 5.2.1) + activestorage (= 5.2.1) + activesupport (= 5.2.1) bundler (>= 1.3.0) - railties (= 5.1.4) + railties (= 5.2.1) sprockets-rails (>= 2.0.0) - rails-controller-testing (1.0.2) - actionpack (~> 5.x, >= 5.0.1) - actionview (~> 5.x, >= 5.0.1) - activesupport (~> 5.x) rails-dom-testing (2.0.3) activesupport (>= 4.2.0) nokogiri (>= 1.6) - rails-html-sanitizer (1.0.3) - loofah (~> 2.0) - railties (5.1.4) - actionpack (= 5.1.4) - activesupport (= 5.1.4) + rails-html-sanitizer (1.0.4) + loofah (~> 2.2, >= 2.2.2) + railties (5.2.1) + actionpack (= 5.2.1) + activesupport (= 5.2.1) method_source rake (>= 0.8.7) - thor (>= 0.18.1, < 2.0) - rake (12.2.1) - rb-fsevent (0.10.2) + thor (>= 0.19.0, < 2.0) + rake (12.3.1) + rb-fsevent (0.10.3) rb-inotify (0.9.10) ffi (>= 0.5.0, < 2) - rspec-core (3.7.0) - rspec-support (~> 3.7.0) - rspec-expectations (3.7.0) + rspec-core (3.8.0) + rspec-support (~> 3.8.0) + rspec-expectations (3.8.1) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.7.0) - rspec-mocks (3.7.0) + rspec-support (~> 3.8.0) + rspec-mocks (3.8.0) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.7.0) - rspec-rails (3.7.1) + rspec-support (~> 3.8.0) + rspec-rails (3.8.0) actionpack (>= 3.0) activesupport (>= 3.0) railties (>= 3.0) - rspec-core (~> 3.7.0) - rspec-expectations (~> 3.7.0) - rspec-mocks (~> 3.7.0) - rspec-support (~> 3.7.0) - rspec-support (3.7.0) - sass (3.5.2) + rspec-core (~> 3.8.0) + rspec-expectations (~> 3.8.0) + rspec-mocks (~> 3.8.0) + rspec-support (~> 3.8.0) + rspec-support (3.8.0) + sass (3.5.7) sass-listen (~> 4.0.0) sass-listen (4.0.0) rb-fsevent (~> 0.9, >= 0.9.4) rb-inotify (~> 0.9, >= 0.9.7) - sass-rails (5.0.6) + sass-rails (5.0.7) railties (>= 4.0.0, < 6) sass (~> 3.1) sprockets (>= 2.8, < 4.0) sprockets-rails (>= 2.0, < 4.0) tilt (>= 1.1, < 3) - simplecov (0.15.1) - docile (~> 1.1.0) + simplecov (0.16.1) + docile (~> 1.1) json (>= 1.8, < 3) simplecov-html (~> 0.10.0) simplecov-html (0.10.2) - sprockets (3.7.1) + sprockets (3.7.2) concurrent-ruby (~> 1.0) rack (> 1, < 3) sprockets-rails (3.2.1) @@ -158,24 +160,23 @@ GEM thor (0.20.0) thread_safe (0.3.6) tilt (2.0.8) - tzinfo (1.2.3) + tzinfo (1.2.5) thread_safe (~> 0.1) - websocket-driver (0.6.5) + websocket-driver (0.7.0) websocket-extensions (>= 0.1.0) - websocket-extensions (0.1.2) + websocket-extensions (0.1.3) PLATFORMS ruby DEPENDENCIES - bundler (~> 1.15) - byebug (~> 9.0) + bundler (~> 1.16.4) + byebug (~> 10.0.2) codeclimate-test-reporter (~> 1.0) - rails-controller-testing - rspec-rails (~> 3.7.1) + rspec-rails (~> 3.8.0) sail! - simplecov (~> 0.14) + simplecov (~> 0.16.1) sqlite3 BUNDLED WITH - 1.15.4 + 1.16.4 diff --git a/Rakefile b/Rakefile index bdf0fbec..9f654733 100644 --- a/Rakefile +++ b/Rakefile @@ -17,5 +17,5 @@ Dir[File.join(File.dirname(__FILE__), 'tasks/**/*.rake')].each {|f| load f } require 'rspec/core' require 'rspec/core/rake_task' -RSpec::Core::RakeTask.new(:spec => 'app:db:test:prepare') -task :default => :spec +RSpec::Core::RakeTask.new(spec: 'app:db:test:prepare') +task default: :spec diff --git a/app/assets/javascripts/sail/clusters.js b/app/assets/javascripts/sail/clusters.js deleted file mode 100644 index 08a859cd..00000000 --- a/app/assets/javascripts/sail/clusters.js +++ /dev/null @@ -1,32 +0,0 @@ -(function () { - "use strict"; - $(document).ready(function() { - if ($("#controller-picker").hasClass("clusters-controller")) { - setupClustersPage(); - } - }); - - function setupClustersPage () { - $("#model").change(getColumns); - } - - function getColumns () { - $.ajax({ - url: '/sail/clusters/columns', - data: { model: $(this).val() }, - method: 'GET', - success: renderColumns - }); - - function renderColumns (data) { - var html = ""; - $("#column-for-labels").html(html); - } - } -})(); diff --git a/app/assets/stylesheets/sail/application.scss b/app/assets/stylesheets/sail/application.scss index 2b2e1229..0427aedd 100644 --- a/app/assets/stylesheets/sail/application.scss +++ b/app/assets/stylesheets/sail/application.scss @@ -15,6 +15,5 @@ */ body { - margin: 0; height: 100vh; } diff --git a/app/assets/stylesheets/sail/clusters.scss b/app/assets/stylesheets/sail/clusters.scss deleted file mode 100644 index dbb56986..00000000 --- a/app/assets/stylesheets/sail/clusters.scss +++ /dev/null @@ -1,9 +0,0 @@ -#cluster-analysis-page { - .main-title { - text-align: center; - background-color: darkgray; - margin-top: 0; - padding-top: 20px; - padding-bottom: 20px; - } -} diff --git a/app/controllers/sail/clusters_controller.rb b/app/controllers/sail/clusters_controller.rb deleted file mode 100644 index f3d5dea9..00000000 --- a/app/controllers/sail/clusters_controller.rb +++ /dev/null @@ -1,47 +0,0 @@ -# frozen_string_literal: true -module Sail - class ClustersController < ApplicationController - before_action :set_all_models, only: %i(new) - rescue_from ActionController::ParameterMissing do |e| - render plain: e.message, status: :bad_request - end - - def new - end - - def report - render(partial: 'report') - end - - def columns - columns = columns_params[:model].classify.safe_constantize&.column_names - %w(id) - - respond_to do |f| - f.json { render json: columns.map(&:capitalize), status: :ok } - end - end - - private - - def set_all_models - @models = Dir["#{Rails.root}/app/models/**/*"] - .reject { |path| path.include?('concerns') || path.include?('application_record') || File.directory?(path) } - .flat_map do |model_path| - - - model_path - .gsub("#{Rails.root}/app/models/", '') - .gsub('.rb', '') - .titleize - .gsub('/', '::') - .delete(' ') - end.sort - end - - def columns_params - params.permit(:model).tap do |p| - p.require(:model) - end - end - end -end diff --git a/app/views/sail/clusters/_report.html.erb b/app/views/sail/clusters/_report.html.erb deleted file mode 100644 index e69de29b..00000000 diff --git a/app/views/sail/clusters/new.html.erb b/app/views/sail/clusters/new.html.erb deleted file mode 100644 index d9f7f0ff..00000000 --- a/app/views/sail/clusters/new.html.erb +++ /dev/null @@ -1,20 +0,0 @@ -
-
-

Cluster analysis

- - <%= form_tag(clusters_report_path, method: :get) do %> -
- - -
- -
- - - <% end %> -
-
diff --git a/config/routes.rb b/config/routes.rb index 63c3f8b5..ef0f14bd 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,5 +1,2 @@ Sail::Engine.routes.draw do - get 'clusters/new' => 'clusters#new' - get 'clusters/report' => 'clusters#report' - get 'clusters/columns' => 'clusters#columns' end diff --git a/sail.gemspec b/sail.gemspec index 50f23820..89e6d42f 100644 --- a/sail.gemspec +++ b/sail.gemspec @@ -9,22 +9,21 @@ Gem::Specification.new do |s| s.authors = ['Vinicius Stock'] s.email = ['vinicius.stock@outlook.com'] s.homepage = 'https://github.com/vinistock/sail' - s.summary = 'Sail is a Rails engine for data visualization.' - s.description = 'Sails is a Rails engine for data visualization.' + s.summary = 'Sail will help you navigate your Rails application.' + s.description = 'Sail brings application settings into your Rails application for controlling features.' s.license = 'MIT' s.files = Dir['{app,config,lib}/**/*', 'MIT-LICENSE', 'Rakefile', 'README.md'] s.test_files = Dir['spec/**/*'] - s.add_dependency 'rails', '~> 5.1.4' + s.add_dependency 'rails', '~> 5.2.0' s.add_dependency 'sass-rails', '~> 5.0.6' s.add_dependency 'jquery-rails', '~> 4.3.1' s.add_development_dependency 'sqlite3' - s.add_development_dependency 'rspec-rails', '~> 3.7.1' - s.add_development_dependency 'simplecov', '~> 0.14' + s.add_development_dependency 'rspec-rails', '~> 3.8.0' + s.add_development_dependency 'simplecov', '~> 0.16.1' s.add_development_dependency 'codeclimate-test-reporter', '~> 1.0' - s.add_development_dependency 'byebug', '~> 9.0' - s.add_development_dependency 'bundler', '~> 1.15' - s.add_development_dependency 'rails-controller-testing', '~> 1.0.2' + s.add_development_dependency 'byebug', '~> 10.0.2' + s.add_development_dependency 'bundler', '~> 1.16.4' end diff --git a/spec/controllers/sail/clusters_controller_spec.rb b/spec/controllers/sail/clusters_controller_spec.rb deleted file mode 100644 index ecd6cb28..00000000 --- a/spec/controllers/sail/clusters_controller_spec.rb +++ /dev/null @@ -1,47 +0,0 @@ -# frozen_string_literal: true -describe Sail::ClustersController, type: :controller do - routes { Sail::Engine.routes } - - describe 'GET new' do - subject { get :new } - - it 'returns status ok and sets models' do - subject - expect(response).to have_http_status(:ok) - expect(assigns(:models)).to eq(%w(Namespace::MyModel Test)) - end - end - - describe 'GET report' do - subject { get :report } - - it 'returns status ok' do - subject - expect(response).to have_http_status(:ok) - end - end - - describe 'GET columns' do - subject { get :columns, params: params, format: :json } - - context 'when not passing a model' do - let(:params) { { } } - - it 'returns bad request with error message' do - subject - expect(response).to have_http_status(:bad_request) - expect(response.body). to eq('param is missing or the value is empty: model') - end - end - - context 'when passing a model' do - let(:params) { { model: 'Test' } } - - it 'returns status ok' do - subject - expect(response).to have_http_status(:ok) - expect(response.body).to eq("[\"Name\",\"Value\",\"Real\",\"Content\"]") - end - end - end -end diff --git a/spec/dummy/config/application.rb b/spec/dummy/config/application.rb index 833b58d2..a439dffd 100644 --- a/spec/dummy/config/application.rb +++ b/spec/dummy/config/application.rb @@ -13,6 +13,7 @@ class Application < Rails::Application # 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. + config.active_record.sqlite3.represent_boolean_as_integer = true end end diff --git a/spec/dummy/db/test.sqlite3 b/spec/dummy/db/test.sqlite3 index daf1730f..a84f335b 100644 Binary files a/spec/dummy/db/test.sqlite3 and b/spec/dummy/db/test.sqlite3 differ