diff --git a/.gitignore b/.gitignore
index bab620d..0efc7f0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,21 +1,10 @@
-# See https://help.github.com/articles/ignoring-files for more about ignoring files.
-#
-# If you find yourself ignoring temporary files generated by your text editor
-# or operating system, you probably want to add a global ignore instead:
-# git config --global core.excludesfile '~/.gitignore_global'
-
-# Ignore bundler config.
-/.bundle
-
-# Ignore the default SQLite database.
-/db/*.sqlite3
-/db/*.sqlite3-journal
-
-# Ignore all logfiles and tempfiles.
-/log/*
-/tmp/*
-!/log/.keep
-!/tmp/.keep
-
-# Ignore Byebug command history file.
-.byebug_history
+.bundle/
+log/*.log
+pkg/
+test/dummy/db/*.sqlite3
+test/dummy/db/*.sqlite3-journal
+test/dummy/log/*.log
+test/dummy/node_modules/
+test/dummy/yarn-error.log
+test/dummy/storage/
+test/dummy/tmp/
diff --git a/Dockerfile b/Dockerfile
deleted file mode 100644
index 0d2b638..0000000
--- a/Dockerfile
+++ /dev/null
@@ -1,20 +0,0 @@
-FROM ubuntu:16.04
-
-RUN apt-get update && apt-get install -y --no-install-recommends git ca-certificates libssl-dev curl wget bzip2 gcc g++ make libreadline-dev npm && \
- apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
-RUN cd /root && git clone https://github.com/rbenv/rbenv.git ~/.rbenv && \
- git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
-ENV PATH /root/.rbenv/plugins/ruby-build/bin:/root/.rbenv/bin:$PATH
-
-RUN rbenv install 2.4.0
-RUN rbenv global 2.4.0
-ENV PATH /root/.rbenv/shims:$PATH
-RUN ruby -v
-RUN gem install bundler
-RUN mkdir /file-explorer
-RUN git clone https://github.com/adrientoub/file-explorer
-WORKDIR /file-explorer
-RUN bundle install --deployment --without development --without test
-ENV RAILS_ENV=production
-RUN bundle exec rails assets:precompile
-EXPOSE 3000
diff --git a/Gemfile b/Gemfile
index 5e69a87..ab79def 100644
--- a/Gemfile
+++ b/Gemfile
@@ -1,44 +1,17 @@
source 'https://rubygems.org'
+git_source(:github) { |repo| "https://github.com/#{repo}.git" }
-git_source(:github) do |repo_name|
- repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?('/')
- "https://github.com/#{repo_name}.git"
-end
+# Declare your gem's dependencies in file_explorer.gemspec.
+# Bundler will treat runtime dependencies like base dependencies, and
+# development dependencies will be added by default to the :development group.
+gemspec
-# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
-gem 'rails', '~> 5.1.2'
-# Use Puma as the app server
-gem 'puma', '~> 3.0'
-# 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.2'
+# Declare any dependencies that are still in development here instead of in
+# your gemspec. These might include edge Rails or gems from your path or
+# Git. Remember to move these dependencies to your gemspec before releasing
+# your gem to rubygems.org.
-# Use jquery as the JavaScript library
-gem 'jquery-rails'
-# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
-gem 'turbolinks', '~> 5'
+# To use a debugger
+# gem 'byebug', group: [:development, :test]
-gem 'bootsnap', require: false
-
-# 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', platform: :mri
-end
-
-group :development do
- # Access an IRB console on exception pages or by using <%= console %> anywhere in the code.
- gem 'web-console', '>= 3.3.0'
- gem 'listen', '~> 3.0.5'
- # 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'
-end
-
-gem 'tzinfo-data'
-gem 'wdm', '>= 0.1.0' if Gem.win_platform?
+gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
diff --git a/Gemfile.lock b/Gemfile.lock
index cdf1c1d..af3271a 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -1,136 +1,105 @@
+PATH
+ remote: .
+ specs:
+ file_explorer (0.1.0)
+ rails (~> 5.2.1)
+
GEM
remote: https://rubygems.org/
specs:
- actioncable (5.1.6)
- actionpack (= 5.1.6)
+ actioncable (5.2.1.1)
+ actionpack (= 5.2.1.1)
nio4r (~> 2.0)
- websocket-driver (~> 0.6.1)
- actionmailer (5.1.6)
- actionpack (= 5.1.6)
- actionview (= 5.1.6)
- activejob (= 5.1.6)
+ websocket-driver (>= 0.6.1)
+ actionmailer (5.2.1.1)
+ actionpack (= 5.2.1.1)
+ actionview (= 5.2.1.1)
+ activejob (= 5.2.1.1)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 2.0)
- actionpack (5.1.6)
- actionview (= 5.1.6)
- activesupport (= 5.1.6)
+ actionpack (5.2.1.1)
+ actionview (= 5.2.1.1)
+ activesupport (= 5.2.1.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.6)
- activesupport (= 5.1.6)
+ actionview (5.2.1.1)
+ activesupport (= 5.2.1.1)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.3)
- activejob (5.1.6)
- activesupport (= 5.1.6)
+ activejob (5.2.1.1)
+ activesupport (= 5.2.1.1)
globalid (>= 0.3.6)
- activemodel (5.1.6)
- activesupport (= 5.1.6)
- activerecord (5.1.6)
- activemodel (= 5.1.6)
- activesupport (= 5.1.6)
- arel (~> 8.0)
- activesupport (5.1.6)
+ activemodel (5.2.1.1)
+ activesupport (= 5.2.1.1)
+ activerecord (5.2.1.1)
+ activemodel (= 5.2.1.1)
+ activesupport (= 5.2.1.1)
+ arel (>= 9.0)
+ activestorage (5.2.1.1)
+ actionpack (= 5.2.1.1)
+ activerecord (= 5.2.1.1)
+ marcel (~> 0.3.1)
+ activesupport (5.2.1.1)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 0.7, < 2)
minitest (~> 5.1)
tzinfo (~> 1.1)
- arel (8.0.0)
- bindex (0.5.0)
- bootsnap (1.3.2)
- msgpack (~> 1.0)
+ arel (9.0.0)
builder (3.2.3)
- byebug (10.0.2)
- coffee-rails (4.2.2)
- coffee-script (>= 2.2.0)
- railties (>= 4.0.0)
- coffee-script (2.4.1)
- coffee-script-source
- execjs
- coffee-script-source (1.12.2)
concurrent-ruby (1.1.3)
crass (1.0.4)
erubi (1.7.1)
- execjs (2.7.0)
- ffi (1.9.25)
- ffi (1.9.25-x86-mingw32)
globalid (0.4.1)
activesupport (>= 4.2.0)
i18n (1.1.1)
concurrent-ruby (~> 1.0)
- jquery-rails (4.3.3)
- rails-dom-testing (>= 1, < 3)
- railties (>= 4.2.0)
- thor (>= 0.14, < 2.0)
- listen (3.0.8)
- rb-fsevent (~> 0.9, >= 0.9.4)
- rb-inotify (~> 0.9, >= 0.9.7)
loofah (2.2.3)
crass (~> 1.0.2)
nokogiri (>= 1.5.9)
mail (2.7.1)
mini_mime (>= 0.1.1)
- method_source (0.9.1)
+ marcel (0.3.3)
+ mimemagic (~> 0.3.2)
+ method_source (0.9.2)
+ mimemagic (0.3.2)
mini_mime (1.0.1)
mini_portile2 (2.3.0)
minitest (5.11.3)
- msgpack (1.2.4)
- msgpack (1.2.4-x86-mingw32)
nio4r (2.3.1)
- nokogiri (1.8.5)
- mini_portile2 (~> 2.3.0)
nokogiri (1.8.5-x86-mingw32)
mini_portile2 (~> 2.3.0)
- puma (3.12.0)
rack (2.0.6)
rack-test (1.1.0)
rack (>= 1.0, < 3)
- rails (5.1.6)
- actioncable (= 5.1.6)
- actionmailer (= 5.1.6)
- actionpack (= 5.1.6)
- actionview (= 5.1.6)
- activejob (= 5.1.6)
- activemodel (= 5.1.6)
- activerecord (= 5.1.6)
- activesupport (= 5.1.6)
+ rails (5.2.1.1)
+ actioncable (= 5.2.1.1)
+ actionmailer (= 5.2.1.1)
+ actionpack (= 5.2.1.1)
+ actionview (= 5.2.1.1)
+ activejob (= 5.2.1.1)
+ activemodel (= 5.2.1.1)
+ activerecord (= 5.2.1.1)
+ activestorage (= 5.2.1.1)
+ activesupport (= 5.2.1.1)
bundler (>= 1.3.0)
- railties (= 5.1.6)
+ railties (= 5.2.1.1)
sprockets-rails (>= 2.0.0)
rails-dom-testing (2.0.3)
activesupport (>= 4.2.0)
nokogiri (>= 1.6)
rails-html-sanitizer (1.0.4)
loofah (~> 2.2, >= 2.2.2)
- railties (5.1.6)
- actionpack (= 5.1.6)
- activesupport (= 5.1.6)
+ railties (5.2.1.1)
+ actionpack (= 5.2.1.1)
+ activesupport (= 5.2.1.1)
method_source
rake (>= 0.8.7)
- thor (>= 0.18.1, < 2.0)
+ 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)
- sass (3.7.1)
- 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.7)
- railties (>= 4.0.0, < 6)
- sass (~> 3.1)
- sprockets (>= 2.8, < 4.0)
- sprockets-rails (>= 2.0, < 4.0)
- tilt (>= 1.1, < 3)
- 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.2)
concurrent-ruby (~> 1.0)
rack (> 1, < 3)
@@ -138,48 +107,24 @@ GEM
actionpack (>= 4.0)
activesupport (>= 4.0)
sprockets (>= 3.0.0)
- thor (0.20.0)
+ sqlite3 (1.3.13-x86-mingw32)
+ thor (0.20.3)
thread_safe (0.3.6)
- tilt (2.0.8)
- turbolinks (5.2.0)
- turbolinks-source (~> 5.2)
- turbolinks-source (5.2.0)
tzinfo (1.2.5)
thread_safe (~> 0.1)
tzinfo-data (1.2018.7)
tzinfo (>= 1.0.0)
- uglifier (4.1.19)
- execjs (>= 0.3.0, < 3)
- wdm (0.1.1)
- web-console (3.7.0)
- actionview (>= 5.0)
- activemodel (>= 5.0)
- bindex (>= 0.4.0)
- railties (>= 5.0)
- websocket-driver (0.6.5)
+ websocket-driver (0.7.0)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.3)
PLATFORMS
- ruby
x86-mingw32
DEPENDENCIES
- bootsnap
- byebug
- coffee-rails (~> 4.2)
- jquery-rails
- listen (~> 3.0.5)
- puma (~> 3.0)
- rails (~> 5.1.2)
- sass-rails (~> 5.0)
- spring
- spring-watcher-listen (~> 2.0.0)
- turbolinks (~> 5)
+ file_explorer!
+ sqlite3
tzinfo-data
- uglifier (>= 1.3.0)
- wdm (>= 0.1.0)
- web-console (>= 3.3.0)
BUNDLED WITH
1.16.1
diff --git a/MIT-LICENSE b/MIT-LICENSE
new file mode 100644
index 0000000..e9f2262
--- /dev/null
+++ b/MIT-LICENSE
@@ -0,0 +1,20 @@
+Copyright 2018 odion ohio
+
+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/README.md b/README.md
index b95171d..9b19f8d 100644
--- a/README.md
+++ b/README.md
@@ -1,76 +1,28 @@
-# File Explorer
+# FileExplorer
+Short description and motivation.
-## Overview
+## Usage
+How to use my plugin.
-This project offers a very simple file explorer to see files in a directory, it
-allows to display small files and download bigger ones. The limit between small
-and big is currently set to 250 kB.
-
-This also allows to delete files and directories simply by clicking a delete
-button.
-
-This project was quickly created to simplify the management of files on a web
-server.
-
-## Security
-
-You should protect the access to this application at least by adding a
-Basic Auth in your Apache or Nginx configuration, indeed there is no permission
-system implemented and anyone having access to this could delete all your
-files easily.
-
-## Setup
-
-We provide 2 ways to install this project on your server, using your server
-directly or using Docker.
-
-### Directly
-
-To configure and launch it you need a few things:
-
-* Install a recent ruby version on your computer
-* `gem install bundler`
-* `bundle install`
-
-After that you should be all done and ready to work.
-
-To launch the Rails server you can just use:
+## Installation
+Add this line to your application's Gemfile:
```ruby
-bundle exec rails s -b 0.0.0.0
+gem 'file_explorer'
```
-You can also specify the folder in which you want it to be launched (defaults
-to the current directory) by setting the BASE\_DIRECTORY environment variable
-before launching the server.
-
-```ruby
-BASE_DIRECTORY=PATH_TO_YOUR_DIRECTORY bundle exec rails s -b 0.0.0.0
+And then execute:
+```bash
+$ bundle
```
-### Using Docker
-
-If you want to launch this project in a Docker it is easy. We provide a
-Dockerfile in the repository to enable the usage of this project.
-
-You should create a Rails secret and replace "RAILS_SECRET" by it. To generate
-a Rails secret just launch `bundle exec rails secret` and use the value
-generated.
-
-Base directory is the directory you want the file explorer to explore. If you
-choose a directory, you should ensure that your docker has the right to write
-in it. You can mount any directory in your docker using the `-v` Docker
-parameter.
-
-You must launch the following commands as root on Unix or as Administrator on
-Windows:
-
+Or install it yourself as:
```bash
-docker build -t fileexplorer .
-docker create --name fileexplorer -p 127.0.0.1:8689:3000 -e SECRET_KEY_BASE=RAILS_SECRET -e BASE_DIRECTORY=/ fileexplorer bundle exec rails s -b 0.0.0.0
-docker start -a fileexplorer
+$ gem install file_explorer
```
-## Tests
+## Contributing
+Contribution directions go here.
-There are no tests for this project currently because of its simplicity.
+## License
+The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
diff --git a/Rakefile b/Rakefile
index e85f913..5ee45f5 100644
--- a/Rakefile
+++ b/Rakefile
@@ -1,6 +1,32 @@
-# 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.
+begin
+ require 'bundler/setup'
+rescue LoadError
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
+end
-require_relative 'config/application'
+require 'rdoc/task'
-Rails.application.load_tasks
+RDoc::Task.new(:rdoc) do |rdoc|
+ rdoc.rdoc_dir = 'rdoc'
+ rdoc.title = 'FileExplorer'
+ rdoc.options << '--line-numbers'
+ rdoc.rdoc_files.include('README.md')
+ rdoc.rdoc_files.include('lib/**/*.rb')
+end
+
+APP_RAKEFILE = File.expand_path("test/dummy/Rakefile", __dir__)
+load 'rails/tasks/engine.rake'
+
+load 'rails/tasks/statistics.rake'
+
+require 'bundler/gem_tasks'
+
+require 'rake/testtask'
+
+Rake::TestTask.new(:test) do |t|
+ t.libs << 'test'
+ t.pattern = 'test/**/*_test.rb'
+ t.verbose = false
+end
+
+task default: :test
diff --git a/app/assets/config/file_explorer_manifest.js b/app/assets/config/file_explorer_manifest.js
new file mode 100644
index 0000000..09f2e80
--- /dev/null
+++ b/app/assets/config/file_explorer_manifest.js
@@ -0,0 +1,2 @@
+//= link_directory ../javascripts/file_explorer .js
+//= link_directory ../stylesheets/file_explorer .css
diff --git a/app/assets/images/.keep b/app/assets/images/file_explorer/.keep
similarity index 100%
rename from app/assets/images/.keep
rename to app/assets/images/file_explorer/.keep
diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/file_explorer/application.js
similarity index 91%
rename from app/assets/javascripts/application.js
rename to app/assets/javascripts/file_explorer/application.js
index b12018d..67ce467 100644
--- a/app/assets/javascripts/application.js
+++ b/app/assets/javascripts/file_explorer/application.js
@@ -10,7 +10,6 @@
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
// about supported directives.
//
-//= require jquery
-//= require jquery_ujs
-//= require turbolinks
+//= require rails-ujs
+//= require activestorage
//= require_tree .
diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/file_explorer/application.css
similarity index 77%
rename from app/assets/stylesheets/application.css
rename to app/assets/stylesheets/file_explorer/application.css
index ae969b7..8db8517 100644
--- a/app/assets/stylesheets/application.css
+++ b/app/assets/stylesheets/file_explorer/application.css
@@ -13,9 +13,11 @@
*= require_tree .
*= require_self
*/
- body {
- background-color: #2A2A2A;
+
+body {
+ background-color: #00001a;
color: rgba(249, 249, 250, 0.8);
+ text-shadow: 1px 1px 2px black, 0 0 25px white, 0 0 5px white;
}
.file {
color: rgb(64, 224, 208);
@@ -36,3 +38,12 @@ a:hover {
a:visited {
color: rgb(110, 110, 170);
}
+
+#notice {
+ background-color: #F0FFFF;
+ color: #483D8B;
+ float: center;
+ font-size: 20px;
+ margin: 0px 300px 0px 100px;
+ text-shadow: 1px 1px 2px black, 0 0 25px #FF7F50, 0 0 5px darkred;
+}
diff --git a/app/controllers/file_explorer/application_controller.rb b/app/controllers/file_explorer/application_controller.rb
new file mode 100644
index 0000000..e15948c
--- /dev/null
+++ b/app/controllers/file_explorer/application_controller.rb
@@ -0,0 +1,5 @@
+module FileExplorer
+ class ApplicationController < ActionController::Base
+ protect_from_forgery with: :exception
+ end
+end
diff --git a/app/controllers/file_explorer/index_controller.rb b/app/controllers/file_explorer/index_controller.rb
new file mode 100644
index 0000000..67bb97e
--- /dev/null
+++ b/app/controllers/file_explorer/index_controller.rb
@@ -0,0 +1,85 @@
+require_dependency "file_explorer/application_controller"
+
+module FileExplorer
+ class IndexController < ApplicationController
+ BASE_DIRECTORY = ENV['BASE_DIRECTORY'] || '.'
+
+ include ActionView::Helpers::NumberHelper
+
+ def index
+ populate_directory(BASE_DIRECTORY, '')
+ @absolute_path = BASE_DIRECTORY
+ end
+
+ def path
+ absolute_path = check_path(params[:path])
+
+ if File.directory?(absolute_path)
+ populate_directory(absolute_path, "#{params[:path]}/")
+ render :index
+ elsif File.file?(absolute_path)
+ if File.size(absolute_path) > 2500_000
+ #send_file absolute_path
+ redirect_to '/', notice: "Not Loadable. . . Way to big!"
+ else
+ @file = File.read(absolute_path)
+ render :file, formats: :html
+ end
+ end
+ end
+
+ def delete
+ absolute_path = check_path(params[:path])
+ if File.directory?(absolute_path)
+ redirect_to absolute_path, notice: "DELETED!! DELETED!!!"
+ FileUtils.rm_rf(absolute_path)
+ else
+ redirect_to absolute_path, notice: "DELETED!! DELETED!!!"
+ FileUtils.rm(absolute_path)
+ end
+ head 204
+ end
+
+ private
+
+ def my_escape(string)
+ string.gsub(/([^ a-zA-Z0-9_.-]+)/) do
+ '%' + $1.unpack('H2' * $1.bytesize).join('%').upcase
+ end
+ end
+
+ def populate_directory(current_directory, current_url)
+ if Gem.win_platform?
+ directory = Dir.chdir("C:/")
+ else
+ directory = Dir.chdir("/")
+ end
+ directory = Dir.entries(current_directory)
+ @directory = directory.map do |file|
+ real_path_absolute = "#{current_directory}/#{file}"
+ stat = File.stat(real_path_absolute)
+ is_file = stat.file?
+
+ {
+ size: (is_file ? (number_to_human_size stat.size rescue '-'): '-'),
+ type: (is_file ? :file : :directory),
+ date: (stat.mtime.to_formatted_s(:short) rescue '-'),
+ relative: my_escape("#{current_url}#{file}").gsub('%2F', '/'),
+ entry: "#{file}#{is_file ? '': '/'}",
+ absolute: real_path_absolute
+ }
+ end.sort_by { |entry| "#{entry[:type]}#{entry[:relative]}" }
+ end
+
+ def check_path(path)
+ current_directory = File.expand_path(BASE_DIRECTORY)
+ @absolute_path = File.expand_path(path, BASE_DIRECTORY)
+ raise ActionController::RoutingError, 'Not Found' unless File.exists?(@absolute_path)
+
+ unless @absolute_path.starts_with?(current_directory)
+ raise ArgumentError, 'Should not be parent of root'
+ end
+ @absolute_path
+ end
+ end
+end
diff --git a/app/controllers/index_controller.rb b/app/controllers/index_controller.rb
deleted file mode 100644
index 9c2ac5c..0000000
--- a/app/controllers/index_controller.rb
+++ /dev/null
@@ -1,74 +0,0 @@
-class IndexController < ApplicationController
- BASE_DIRECTORY = ENV['BASE_DIRECTORY'] || '.'
-
- include ActionView::Helpers::NumberHelper
-
- def index
- populate_directory(BASE_DIRECTORY, '')
- @absolute_path = BASE_DIRECTORY
- end
-
- def path
- absolute_path = check_path(params[:path])
-
- if File.directory?(absolute_path)
- populate_directory(absolute_path, "#{params[:path]}/")
- render :index
- elsif File.file?(absolute_path)
- if File.size(absolute_path) > 250_000
- send_file absolute_path
- else
- @file = File.read(absolute_path)
- render :file, formats: :html
- end
- end
- end
-
- def delete
- absolute_path = check_path(params[:path])
-
- if File.directory?(absolute_path)
- FileUtils.rm_rf(absolute_path)
- else
- FileUtils.rm(absolute_path)
- end
- head 204
- end
-
- private
-
- def my_escape(string)
- string.gsub(/([^ a-zA-Z0-9_.-]+)/) do
- '%' + $1.unpack('H2' * $1.bytesize).join('%').upcase
- end
- end
-
- def populate_directory(current_directory, current_url)
- directory = Dir.entries(current_directory)
- @directory = directory.map do |file|
- real_path_absolute = "#{current_directory}/#{file}"
- stat = File.stat(real_path_absolute)
- is_file = stat.file?
-
- {
- size: (is_file ? (number_to_human_size stat.size rescue '-'): '-'),
- type: (is_file ? :file : :directory),
- date: (stat.mtime.to_formatted_s(:short) rescue '-'),
- relative: my_escape("#{current_url}#{file}").gsub('%2F', '/'),
- entry: "#{file}#{is_file ? '': '/'}",
- absolute: real_path_absolute
- }
- end.sort_by { |entry| "#{entry[:type]}#{entry[:relative]}" }
- end
-
- def check_path(path)
- current_directory = File.expand_path(BASE_DIRECTORY)
- @absolute_path = File.expand_path(path, BASE_DIRECTORY)
- raise ActionController::RoutingError, 'Not Found' unless File.exists?(@absolute_path)
-
- unless @absolute_path.starts_with?(current_directory)
- raise ArgumentError, 'Should not be parent of root'
- end
- @absolute_path
- end
-end
diff --git a/app/helpers/file_explorer/application_helper.rb b/app/helpers/file_explorer/application_helper.rb
new file mode 100644
index 0000000..21779ec
--- /dev/null
+++ b/app/helpers/file_explorer/application_helper.rb
@@ -0,0 +1,4 @@
+module FileExplorer
+ module ApplicationHelper
+ end
+end
diff --git a/app/helpers/file_explorer/index_helper.rb b/app/helpers/file_explorer/index_helper.rb
new file mode 100644
index 0000000..243d897
--- /dev/null
+++ b/app/helpers/file_explorer/index_helper.rb
@@ -0,0 +1,4 @@
+module FileExplorer
+ module IndexHelper
+ end
+end
diff --git a/app/jobs/file_explorer/application_job.rb b/app/jobs/file_explorer/application_job.rb
new file mode 100644
index 0000000..86a9d92
--- /dev/null
+++ b/app/jobs/file_explorer/application_job.rb
@@ -0,0 +1,4 @@
+module FileExplorer
+ class ApplicationJob < ActiveJob::Base
+ end
+end
diff --git a/app/mailers/file_explorer/application_mailer.rb b/app/mailers/file_explorer/application_mailer.rb
new file mode 100644
index 0000000..8deda7a
--- /dev/null
+++ b/app/mailers/file_explorer/application_mailer.rb
@@ -0,0 +1,6 @@
+module FileExplorer
+ class ApplicationMailer < ActionMailer::Base
+ default from: 'from@example.com'
+ layout 'mailer'
+ end
+end
diff --git a/app/models/file_explorer/application_record.rb b/app/models/file_explorer/application_record.rb
new file mode 100644
index 0000000..5ac20fb
--- /dev/null
+++ b/app/models/file_explorer/application_record.rb
@@ -0,0 +1,5 @@
+module FileExplorer
+ class ApplicationRecord < ActiveRecord::Base
+ self.abstract_class = true
+ end
+end
diff --git a/app/views/index/file.html.erb b/app/views/file_explorer/index/file.html.erb
similarity index 100%
rename from app/views/index/file.html.erb
rename to app/views/file_explorer/index/file.html.erb
diff --git a/app/views/index/index.html.erb b/app/views/file_explorer/index/index.html.erb
similarity index 87%
rename from app/views/index/index.html.erb
rename to app/views/file_explorer/index/index.html.erb
index 36baacd..e0222ba 100644
--- a/app/views/index/index.html.erb
+++ b/app/views/file_explorer/index/index.html.erb
@@ -1,4 +1,5 @@
-
<%= @absolute_path %>
+<%= @absolute_path %>
+<% if current_page?('/file_explorer') %> <%= Dir.pwd %> <% end %>
@@ -29,4 +30,4 @@
<% end %>
-
+
\ No newline at end of file
diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb
deleted file mode 100644
index d1987f7..0000000
--- a/app/views/layouts/application.html.erb
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
- FileExplorer
- <%= csrf_meta_tags %>
-
- <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
- <%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
-
-
-
- <%= yield %>
-
-
diff --git a/app/views/layouts/file_explorer/application.html.erb b/app/views/layouts/file_explorer/application.html.erb
new file mode 100644
index 0000000..29f8426
--- /dev/null
+++ b/app/views/layouts/file_explorer/application.html.erb
@@ -0,0 +1,16 @@
+
+
+
+ File explorer
+ <%= csrf_meta_tags %>
+ <%= csp_meta_tag %>
+
+ <%= stylesheet_link_tag "file_explorer/application", media: "all" %>
+ <%= javascript_include_tag "file_explorer/application" %>
+
+
+
+<%= yield %>
+
+
+
diff --git a/bin/bundle b/bin/bundle
deleted file mode 100644
index 66e9889..0000000
--- a/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/bin/rails b/bin/rails
index 5badb2f..6bca840 100644
--- a/bin/rails
+++ b/bin/rails
@@ -1,9 +1,14 @@
-#!/usr/bin/env ruby
-begin
- load File.expand_path('../spring', __FILE__)
-rescue LoadError => e
- raise unless e.message.include?('spring')
-end
-APP_PATH = File.expand_path('../config/application', __dir__)
-require_relative '../config/boot'
-require 'rails/commands'
+#!/usr/bin/env ruby.exe
+# This command will automatically be run when you run "rails" with Rails gems
+# installed from the root of your application.
+
+ENGINE_ROOT = File.expand_path('..', __dir__)
+ENGINE_PATH = File.expand_path('../lib/file_explorer/engine', __dir__)
+APP_PATH = File.expand_path('../test/dummy/config/application', __dir__)
+
+# Set up gems listed in the Gemfile.
+ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
+require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
+
+require 'rails/all'
+require 'rails/engine/commands'
diff --git a/bin/rake b/bin/rake
deleted file mode 100644
index d87d5f5..0000000
--- a/bin/rake
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/usr/bin/env ruby
-begin
- load File.expand_path('../spring', __FILE__)
-rescue LoadError => e
- raise unless e.message.include?('spring')
-end
-require_relative '../config/boot'
-require 'rake'
-Rake.application.run
diff --git a/bin/spring b/bin/spring
deleted file mode 100644
index fb2ec2e..0000000
--- a/bin/spring
+++ /dev/null
@@ -1,17 +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'
-
- lockfile = Bundler::LockfileParser.new(Bundler.default_lockfile.read)
- spring = lockfile.specs.detect { |spec| spec.name == "spring" }
- if spring
- Gem.use_paths Gem.dir, Bundler.bundle_path.to_s, *Gem.path
- gem 'spring', spring.version
- require 'spring/binstub'
- end
-end
diff --git a/config/application.rb b/config/application.rb
deleted file mode 100644
index e55a202..0000000
--- a/config/application.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-require_relative 'boot'
-
-require 'action_controller/railtie'
-require 'action_mailer/railtie'
-require 'active_model/railtie'
-require 'sprockets/railtie'
-require 'rails/test_unit/railtie'
-
-# Require the gems listed in Gemfile, including any gems
-# you've limited to :test, :development, or :production.
-Bundler.require(*Rails.groups)
-
-module FileExplorer
- 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.
- end
-end
diff --git a/config/boot.rb b/config/boot.rb
deleted file mode 100644
index da8896b..0000000
--- a/config/boot.rb
+++ /dev/null
@@ -1,4 +0,0 @@
-ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
-
-require 'bundler/setup' # Set up gems listed in the Gemfile.
-require 'bootsnap/setup'
diff --git a/config/cable.yml b/config/cable.yml
deleted file mode 100644
index 0bbde6f..0000000
--- a/config/cable.yml
+++ /dev/null
@@ -1,9 +0,0 @@
-development:
- adapter: async
-
-test:
- adapter: async
-
-production:
- adapter: redis
- url: redis://localhost:6379/1
diff --git a/config/initializers/application_controller_renderer.rb b/config/initializers/application_controller_renderer.rb
deleted file mode 100644
index 51639b6..0000000
--- a/config/initializers/application_controller_renderer.rb
+++ /dev/null
@@ -1,6 +0,0 @@
-# Be sure to restart your server when you modify this file.
-
-# ApplicationController.renderer.defaults.merge!(
-# http_host: 'example.org',
-# https: false
-# )
diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb
deleted file mode 100644
index 01ef3e6..0000000
--- a/config/initializers/assets.rb
+++ /dev/null
@@ -1,11 +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/config/initializers/new_framework_defaults.rb b/config/initializers/new_framework_defaults.rb
deleted file mode 100644
index 506640e..0000000
--- a/config/initializers/new_framework_defaults.rb
+++ /dev/null
@@ -1,24 +0,0 @@
-# Be sure to restart your server when you modify this file.
-#
-# This file contains migration options to ease your Rails 5.0 upgrade.
-#
-# Read the Guide for Upgrading Ruby on Rails for more info on each option.
-
-# Enable per-form CSRF tokens. Previous versions had false.
-Rails.application.config.action_controller.per_form_csrf_tokens = true
-
-# Enable origin-checking CSRF mitigation. Previous versions had false.
-Rails.application.config.action_controller.forgery_protection_origin_check = true
-
-# Make Ruby 2.4 preserve the timezone of the receiver when calling `to_time`.
-# Previous versions had false.
-ActiveSupport.to_time_preserves_timezone = true
-
-# Require `belongs_to` associations by default. Previous versions had false.
-# Rails.application.config.active_record.belongs_to_required_by_default = true
-
-# Do not halt callback chains when a callback returns false. Previous versions had true.
-ActiveSupport.halt_callback_chains_on_return_false = false
-
-# Configure SSL options to enable HSTS with subdomains. Previous versions had false.
-Rails.application.config.ssl_options = { hsts: { subdomains: true } }
diff --git a/config/initializers/session_store.rb b/config/initializers/session_store.rb
deleted file mode 100644
index 4782ead..0000000
--- a/config/initializers/session_store.rb
+++ /dev/null
@@ -1,3 +0,0 @@
-# Be sure to restart your server when you modify this file.
-
-Rails.application.config.session_store :cookie_store, key: '_file-explorer_session'
diff --git a/config/routes.rb b/config/routes.rb
index 6e55aea..ea01295 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -1,5 +1,6 @@
-Rails.application.routes.draw do
- get '/', to: 'index#index'
+FileExplorer::Engine.routes.draw do
+ # get '/', to: 'index#index'
get '/:path', to: 'index#path', constraints: { path: /.+/ }
delete '/:path', to: 'index#delete', constraints: { path: /.+/ }
+ root "index#index"
end
diff --git a/config/secrets.yml b/config/secrets.yml
deleted file mode 100644
index 536e06c..0000000
--- a/config/secrets.yml
+++ /dev/null
@@ -1,22 +0,0 @@
-# Be sure to restart your server when you modify this file.
-
-# Your secret key is used for verifying the integrity of signed cookies.
-# If you change this key, all old signed cookies will become invalid!
-
-# 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 `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.
-
-development:
- secret_key_base: d0f5dfccc76be97de74a7619cf1295d4d8a66a9887124cc0886416804c52f7f20eda32b47f7a38ceef75003cff5d08bf71676e844ef16192e8970e88428f1194
-
-test:
- secret_key_base: 574c0e562a5597f7b4cd3dd0c54237c27bbed7a161b40e326bce90330f1925ff484756cff17853e0a7eb0bee9f5d92de0bd2a9cc519352eb00137bfc95427ffc
-
-# 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
deleted file mode 100644
index c9119b4..0000000
--- a/config/spring.rb
+++ /dev/null
@@ -1,6 +0,0 @@
-%w(
- .ruby-version
- .rbenv-vars
- tmp/restart.txt
- tmp/caching-dev.txt
-).each { |path| Spring.watch(path) }
diff --git a/db/seeds.rb b/db/seeds.rb
deleted file mode 100644
index 1beea2a..0000000
--- a/db/seeds.rb
+++ /dev/null
@@ -1,7 +0,0 @@
-# This file should contain all the record creation needed to seed the database with its default values.
-# The data can then be loaded with the rails db:seed command (or created alongside the database with db:setup).
-#
-# Examples:
-#
-# movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }])
-# Character.create(name: 'Luke', movie: movies.first)
diff --git a/file_explorer.gemspec b/file_explorer.gemspec
new file mode 100644
index 0000000..e297e33
--- /dev/null
+++ b/file_explorer.gemspec
@@ -0,0 +1,22 @@
+$:.push File.expand_path("lib", __dir__)
+
+# Maintain your gem's version:
+require "file_explorer/version"
+
+# Describe your gem and declare its dependencies:
+Gem::Specification.new do |s|
+ s.name = "file_explorer"
+ s.version = FileExplorer::VERSION
+ s.authors = ["odion ohio"]
+ s.email = ["ohiodn8@gmail.com"]
+ s.homepage = "http://github.com/ohiodn8/file-explorer"
+ s.summary = "A rails file explorer gem"
+ s.description = "A rails file explorer gem"
+ s.license = "MIT"
+
+ s.files = Dir["{app,config,db,lib}/**/*", "MIT-LICENSE", "Rakefile", "README.md"]
+
+ s.add_dependency "rails", "~> 5.2.1"
+
+ s.add_development_dependency "sqlite3"
+end
diff --git a/lib/file_explorer.rb b/lib/file_explorer.rb
new file mode 100644
index 0000000..ac0087b
--- /dev/null
+++ b/lib/file_explorer.rb
@@ -0,0 +1,5 @@
+require "file_explorer/engine"
+
+module FileExplorer
+ # Your code goes here...
+end
diff --git a/lib/file_explorer/engine.rb b/lib/file_explorer/engine.rb
new file mode 100644
index 0000000..032504b
--- /dev/null
+++ b/lib/file_explorer/engine.rb
@@ -0,0 +1,5 @@
+module FileExplorer
+ class Engine < ::Rails::Engine
+ isolate_namespace FileExplorer
+ end
+end
diff --git a/lib/file_explorer/version.rb b/lib/file_explorer/version.rb
new file mode 100644
index 0000000..f698407
--- /dev/null
+++ b/lib/file_explorer/version.rb
@@ -0,0 +1,3 @@
+module FileExplorer
+ VERSION = '0.1.0'
+end
diff --git a/lib/tasks/file_explorer_tasks.rake b/lib/tasks/file_explorer_tasks.rake
new file mode 100644
index 0000000..e69cc9f
--- /dev/null
+++ b/lib/tasks/file_explorer_tasks.rake
@@ -0,0 +1,4 @@
+# desc "Explaining what the task does"
+# task :file_explorer do
+# # Task goes here
+# end
diff --git a/public/robots.txt b/public/robots.txt
deleted file mode 100644
index 3c9c7c0..0000000
--- a/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: /
diff --git a/test/controllers/file_explorer/index_controller_test.rb b/test/controllers/file_explorer/index_controller_test.rb
new file mode 100644
index 0000000..5559180
--- /dev/null
+++ b/test/controllers/file_explorer/index_controller_test.rb
@@ -0,0 +1,11 @@
+require 'test_helper'
+
+module FileExplorer
+ class IndexControllerTest < ActionDispatch::IntegrationTest
+ include Engine.routes.url_helpers
+
+ # test "the truth" do
+ # assert true
+ # end
+ end
+end
diff --git a/test/dummy/.ruby-version b/test/dummy/.ruby-version
new file mode 100644
index 0000000..fb47d6c
--- /dev/null
+++ b/test/dummy/.ruby-version
@@ -0,0 +1 @@
+ruby-2.3.3
\ No newline at end of file
diff --git a/test/dummy/Rakefile b/test/dummy/Rakefile
new file mode 100644
index 0000000..e85f913
--- /dev/null
+++ b/test/dummy/Rakefile
@@ -0,0 +1,6 @@
+# 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_relative 'config/application'
+
+Rails.application.load_tasks
diff --git a/app/assets/config/manifest.js b/test/dummy/app/assets/config/manifest.js
similarity index 74%
rename from app/assets/config/manifest.js
rename to test/dummy/app/assets/config/manifest.js
index b16e53d..1dba2fe 100644
--- a/app/assets/config/manifest.js
+++ b/test/dummy/app/assets/config/manifest.js
@@ -1,3 +1,4 @@
//= link_tree ../images
//= link_directory ../javascripts .js
//= link_directory ../stylesheets .css
+//= link file_explorer_manifest.js
diff --git a/app/controllers/concerns/.keep b/test/dummy/app/assets/images/.keep
similarity index 100%
rename from app/controllers/concerns/.keep
rename to test/dummy/app/assets/images/.keep
diff --git a/test/dummy/app/assets/javascripts/application.js b/test/dummy/app/assets/javascripts/application.js
new file mode 100644
index 0000000..67ce467
--- /dev/null
+++ b/test/dummy/app/assets/javascripts/application.js
@@ -0,0 +1,15 @@
+// This is a manifest file that'll be compiled into application.js, which will include all the files
+// listed below.
+//
+// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
+// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
+//
+// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
+// compiled file. JavaScript code in this file should be added after the last require_* statement.
+//
+// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
+// about supported directives.
+//
+//= require rails-ujs
+//= require activestorage
+//= require_tree .
diff --git a/test/dummy/app/assets/javascripts/cable.js b/test/dummy/app/assets/javascripts/cable.js
new file mode 100644
index 0000000..739aa5f
--- /dev/null
+++ b/test/dummy/app/assets/javascripts/cable.js
@@ -0,0 +1,13 @@
+// Action Cable provides the framework to deal with WebSockets in Rails.
+// You can generate new channels where WebSocket features live using the `rails generate channel` command.
+//
+//= require action_cable
+//= require_self
+//= require_tree ./channels
+
+(function() {
+ this.App || (this.App = {});
+
+ App.cable = ActionCable.createConsumer();
+
+}).call(this);
diff --git a/lib/assets/.keep b/test/dummy/app/assets/javascripts/channels/.keep
similarity index 100%
rename from lib/assets/.keep
rename to test/dummy/app/assets/javascripts/channels/.keep
diff --git a/test/dummy/app/assets/stylesheets/application.css b/test/dummy/app/assets/stylesheets/application.css
new file mode 100644
index 0000000..0ebd7fe
--- /dev/null
+++ b/test/dummy/app/assets/stylesheets/application.css
@@ -0,0 +1,15 @@
+/*
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
+ * listed below.
+ *
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
+ * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
+ *
+ * You're free to add application-wide styles to this file and they'll appear at the bottom of the
+ * compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
+ * files in this directory. Styles in this file should be added after the last require_* statement.
+ * It is generally better to create a new file per style scope.
+ *
+ *= require_tree .
+ *= require_self
+ */
diff --git a/test/dummy/app/channels/application_cable/channel.rb b/test/dummy/app/channels/application_cable/channel.rb
new file mode 100644
index 0000000..d672697
--- /dev/null
+++ b/test/dummy/app/channels/application_cable/channel.rb
@@ -0,0 +1,4 @@
+module ApplicationCable
+ class Channel < ActionCable::Channel::Base
+ end
+end
diff --git a/test/dummy/app/channels/application_cable/connection.rb b/test/dummy/app/channels/application_cable/connection.rb
new file mode 100644
index 0000000..0ff5442
--- /dev/null
+++ b/test/dummy/app/channels/application_cable/connection.rb
@@ -0,0 +1,4 @@
+module ApplicationCable
+ class Connection < ActionCable::Connection::Base
+ end
+end
diff --git a/app/controllers/application_controller.rb b/test/dummy/app/controllers/application_controller.rb
similarity index 58%
rename from app/controllers/application_controller.rb
rename to test/dummy/app/controllers/application_controller.rb
index 1c07694..09705d1 100644
--- a/app/controllers/application_controller.rb
+++ b/test/dummy/app/controllers/application_controller.rb
@@ -1,3 +1,2 @@
class ApplicationController < ActionController::Base
- protect_from_forgery with: :exception
end
diff --git a/lib/tasks/.keep b/test/dummy/app/controllers/concerns/.keep
similarity index 100%
rename from lib/tasks/.keep
rename to test/dummy/app/controllers/concerns/.keep
diff --git a/app/helpers/application_helper.rb b/test/dummy/app/helpers/application_helper.rb
similarity index 100%
rename from app/helpers/application_helper.rb
rename to test/dummy/app/helpers/application_helper.rb
diff --git a/test/dummy/app/jobs/application_job.rb b/test/dummy/app/jobs/application_job.rb
new file mode 100644
index 0000000..a009ace
--- /dev/null
+++ b/test/dummy/app/jobs/application_job.rb
@@ -0,0 +1,2 @@
+class ApplicationJob < ActiveJob::Base
+end
diff --git a/test/dummy/app/mailers/application_mailer.rb b/test/dummy/app/mailers/application_mailer.rb
new file mode 100644
index 0000000..286b223
--- /dev/null
+++ b/test/dummy/app/mailers/application_mailer.rb
@@ -0,0 +1,4 @@
+class ApplicationMailer < ActionMailer::Base
+ default from: 'from@example.com'
+ layout 'mailer'
+end
diff --git a/test/dummy/app/models/application_record.rb b/test/dummy/app/models/application_record.rb
new file mode 100644
index 0000000..10a4cba
--- /dev/null
+++ b/test/dummy/app/models/application_record.rb
@@ -0,0 +1,3 @@
+class ApplicationRecord < ActiveRecord::Base
+ self.abstract_class = true
+end
diff --git a/log/.keep b/test/dummy/app/models/concerns/.keep
similarity index 100%
rename from log/.keep
rename to test/dummy/app/models/concerns/.keep
diff --git a/test/dummy/app/views/layouts/application.html.erb b/test/dummy/app/views/layouts/application.html.erb
new file mode 100644
index 0000000..6093a4c
--- /dev/null
+++ b/test/dummy/app/views/layouts/application.html.erb
@@ -0,0 +1,15 @@
+
+
+
+ Dummy
+ <%= csrf_meta_tags %>
+ <%= csp_meta_tag %>
+
+ <%= stylesheet_link_tag 'application', media: 'all' %>
+ <%= javascript_include_tag 'application' %>
+
+
+
+ <%= yield %>
+
+
diff --git a/test/dummy/app/views/layouts/mailer.html.erb b/test/dummy/app/views/layouts/mailer.html.erb
new file mode 100644
index 0000000..cbd34d2
--- /dev/null
+++ b/test/dummy/app/views/layouts/mailer.html.erb
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+ <%= yield %>
+
+
diff --git a/test/dummy/app/views/layouts/mailer.text.erb b/test/dummy/app/views/layouts/mailer.text.erb
new file mode 100644
index 0000000..37f0bdd
--- /dev/null
+++ b/test/dummy/app/views/layouts/mailer.text.erb
@@ -0,0 +1 @@
+<%= yield %>
diff --git a/test/dummy/bin/bundle b/test/dummy/bin/bundle
new file mode 100644
index 0000000..8d5f7a5
--- /dev/null
+++ b/test/dummy/bin/bundle
@@ -0,0 +1,3 @@
+#!/usr/bin/env ruby.exe
+ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
+load Gem.bin_path('bundler', 'bundle')
diff --git a/test/dummy/bin/rails b/test/dummy/bin/rails
new file mode 100644
index 0000000..bec72ac
--- /dev/null
+++ b/test/dummy/bin/rails
@@ -0,0 +1,4 @@
+#!/usr/bin/env ruby.exe
+APP_PATH = File.expand_path('../config/application', __dir__)
+require_relative '../config/boot'
+require 'rails/commands'
diff --git a/test/dummy/bin/rake b/test/dummy/bin/rake
new file mode 100644
index 0000000..f6ed5a2
--- /dev/null
+++ b/test/dummy/bin/rake
@@ -0,0 +1,4 @@
+#!/usr/bin/env ruby.exe
+require_relative '../config/boot'
+require 'rake'
+Rake.application.run
diff --git a/bin/setup b/test/dummy/bin/setup
similarity index 85%
rename from bin/setup
rename to test/dummy/bin/setup
index e620b4d..237a371 100644
--- a/bin/setup
+++ b/test/dummy/bin/setup
@@ -1,10 +1,9 @@
-#!/usr/bin/env ruby
-require 'pathname'
+#!/usr/bin/env ruby.exe
require 'fileutils'
include FileUtils
# path to your application root.
-APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
+APP_ROOT = File.expand_path('..', __dir__)
def system!(*args)
system(*args) || abort("\n== Command #{args} failed ==")
@@ -18,6 +17,9 @@ chdir APP_ROOT do
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')
# cp 'config/database.yml.sample', 'config/database.yml'
diff --git a/bin/update b/test/dummy/bin/update
similarity index 82%
rename from bin/update
rename to test/dummy/bin/update
index a8e4462..1db4ab5 100644
--- a/bin/update
+++ b/test/dummy/bin/update
@@ -1,10 +1,9 @@
-#!/usr/bin/env ruby
-require 'pathname'
+#!/usr/bin/env ruby.exe
require 'fileutils'
include FileUtils
# path to your application root.
-APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
+APP_ROOT = File.expand_path('..', __dir__)
def system!(*args)
system(*args) || abort("\n== Command #{args} failed ==")
@@ -18,6 +17,9 @@ chdir APP_ROOT do
system! 'gem install bundler --conservative'
system('bundle check') || system!('bundle install')
+ # Install JavaScript dependencies if using Yarn
+ # system('bin/yarn')
+
puts "\n== Updating database =="
system! 'bin/rails db:migrate'
diff --git a/test/dummy/bin/yarn b/test/dummy/bin/yarn
new file mode 100644
index 0000000..3389822
--- /dev/null
+++ b/test/dummy/bin/yarn
@@ -0,0 +1,11 @@
+#!/usr/bin/env ruby.exe
+APP_ROOT = File.expand_path('..', __dir__)
+Dir.chdir(APP_ROOT) do
+ begin
+ exec "yarnpkg", *ARGV
+ 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.ru b/test/dummy/config.ru
similarity index 100%
rename from config.ru
rename to test/dummy/config.ru
diff --git a/test/dummy/config/application.rb b/test/dummy/config/application.rb
new file mode 100644
index 0000000..878499b
--- /dev/null
+++ b/test/dummy/config/application.rb
@@ -0,0 +1,19 @@
+require_relative 'boot'
+
+require 'rails/all'
+
+Bundler.require(*Rails.groups)
+require "file_explorer"
+
+module Dummy
+ class Application < Rails::Application
+ # Initialize configuration defaults for originally generated Rails version.
+ config.load_defaults 5.2
+
+ # Settings in config/environments/* take precedence over those specified here.
+ # Application configuration can go into files in config/initializers
+ # -- all .rb files in that directory are automatically loaded after loading
+ # the framework and any gems in your application.
+ end
+end
+
diff --git a/test/dummy/config/boot.rb b/test/dummy/config/boot.rb
new file mode 100644
index 0000000..c9aef85
--- /dev/null
+++ b/test/dummy/config/boot.rb
@@ -0,0 +1,5 @@
+# Set up gems listed in the Gemfile.
+ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../../Gemfile', __dir__)
+
+require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
+$LOAD_PATH.unshift File.expand_path('../../../lib', __dir__)
diff --git a/test/dummy/config/cable.yml b/test/dummy/config/cable.yml
new file mode 100644
index 0000000..1cd0f83
--- /dev/null
+++ b/test/dummy/config/cable.yml
@@ -0,0 +1,10 @@
+development:
+ adapter: async
+
+test:
+ adapter: async
+
+production:
+ adapter: redis
+ url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %>
+ channel_prefix: dummy_production
diff --git a/test/dummy/config/database.yml b/test/dummy/config/database.yml
new file mode 100644
index 0000000..0d02f24
--- /dev/null
+++ b/test/dummy/config/database.yml
@@ -0,0 +1,25 @@
+# SQLite version 3.x
+# gem install sqlite3
+#
+# Ensure the SQLite 3 gem is defined in your Gemfile
+# gem 'sqlite3'
+#
+default: &default
+ adapter: sqlite3
+ pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 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/config/environment.rb b/test/dummy/config/environment.rb
similarity index 100%
rename from config/environment.rb
rename to test/dummy/config/environment.rb
diff --git a/config/environments/development.rb b/test/dummy/config/environments/development.rb
similarity index 76%
rename from config/environments/development.rb
rename to test/dummy/config/environments/development.rb
index 5dafa1d..366e75a 100644
--- a/config/environments/development.rb
+++ b/test/dummy/config/environments/development.rb
@@ -13,12 +13,13 @@
config.consider_all_requests_local = true
# Enable/disable caching. By default caching is disabled.
- if Rails.root.join('tmp/caching-dev.txt').exist?
+ # Run rails dev:cache to toggle caching.
+ 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=172800'
+ 'Cache-Control' => "public, max-age=#{2.days.to_i}"
}
else
config.action_controller.perform_caching = false
@@ -26,6 +27,9 @@
config.cache_store = :null_store
end
+ # Store uploaded files on the local file system (see config/storage.yml for options)
+ config.active_storage.service = :local
+
# Don't care if the mailer can't send.
config.action_mailer.raise_delivery_errors = false
@@ -35,7 +39,10 @@
config.active_support.deprecation = :log
# Raise an error on page load if there are pending migrations.
- # config.active_record.migration_error = :page_load
+ config.active_record.migration_error = :page_load
+
+ # Highlight code that triggered database queries in logs.
+ config.active_record.verbose_query_logs = true
# Debug mode disables concatenation and preprocessing of assets.
# This option may cause significant delays in view rendering with a large
@@ -50,5 +57,5 @@
# 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
+ # config.file_watcher = ActiveSupport::EventedFileUpdateChecker
end
diff --git a/config/environments/production.rb b/test/dummy/config/environments/production.rb
similarity index 84%
rename from config/environments/production.rb
rename to test/dummy/config/environments/production.rb
index 1dee008..9ea5ad2 100644
--- a/config/environments/production.rb
+++ b/test/dummy/config/environments/production.rb
@@ -14,9 +14,13 @@
config.consider_all_requests_local = false
config.action_controller.perform_caching = true
+ # Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"]
+ # or in config/master.key. This key is used to decrypt credentials (and other encrypted files).
+ # config.require_master_key = true
+
# Disable serving static files from the `/public` folder by default since
# Apache or NGINX already handles this.
- config.public_file_server.enabled = true
+ config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
# Compress JavaScripts and CSS.
config.assets.js_compressor = :uglifier
@@ -34,6 +38,9 @@
# config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
+ # Store uploaded files on the local file system (see config/storage.yml for options)
+ config.active_storage.service = :local
+
# Mount Action Cable outside main process or domain
# config.action_cable.mount_path = nil
# config.action_cable.url = 'wss://example.com/cable'
@@ -54,7 +61,8 @@
# 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 = "file-explorer_#{Rails.env}"
+ # config.active_job.queue_name_prefix = "dummy_#{Rails.env}"
+
config.action_mailer.perform_caching = false
# Ignore bad email addresses and do not raise email delivery errors.
@@ -78,9 +86,9 @@
if ENV["RAILS_LOG_TO_STDOUT"].present?
logger = ActiveSupport::Logger.new(STDOUT)
logger.formatter = config.log_formatter
- config.logger = ActiveSupport::TaggedLogging.new(logger)
+ config.logger = ActiveSupport::TaggedLogging.new(logger)
end
# Do not dump schema after migrations.
- # config.active_record.dump_schema_after_migration = false
+ config.active_record.dump_schema_after_migration = false
end
diff --git a/config/environments/test.rb b/test/dummy/config/environments/test.rb
similarity index 90%
rename from config/environments/test.rb
rename to test/dummy/config/environments/test.rb
index 30587ef..0a38fd3 100644
--- a/config/environments/test.rb
+++ b/test/dummy/config/environments/test.rb
@@ -15,7 +15,7 @@
# 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=3600'
+ 'Cache-Control' => "public, max-age=#{1.hour.to_i}"
}
# Show full error reports and disable caching.
@@ -27,6 +27,10 @@
# Disable request forgery protection in test environment.
config.action_controller.allow_forgery_protection = false
+
+ # Store uploaded files on the local file system in a temporary directory
+ config.active_storage.service = :test
+
config.action_mailer.perform_caching = false
# Tell Action Mailer not to deliver emails to the real world.
diff --git a/test/dummy/config/initializers/application_controller_renderer.rb b/test/dummy/config/initializers/application_controller_renderer.rb
new file mode 100644
index 0000000..89d2efa
--- /dev/null
+++ b/test/dummy/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/test/dummy/config/initializers/assets.rb b/test/dummy/config/initializers/assets.rb
new file mode 100644
index 0000000..4b828e8
--- /dev/null
+++ b/test/dummy/config/initializers/assets.rb
@@ -0,0 +1,14 @@
+# 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
+# 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 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/test/dummy/config/initializers/backtrace_silencers.rb
similarity index 100%
rename from config/initializers/backtrace_silencers.rb
rename to test/dummy/config/initializers/backtrace_silencers.rb
diff --git a/test/dummy/config/initializers/content_security_policy.rb b/test/dummy/config/initializers/content_security_policy.rb
new file mode 100644
index 0000000..d3bcaa5
--- /dev/null
+++ b/test/dummy/config/initializers/content_security_policy.rb
@@ -0,0 +1,25 @@
+# Be sure to restart your server when you modify this file.
+
+# Define an application-wide content security policy
+# For further information see the following documentation
+# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy
+
+# Rails.application.config.content_security_policy do |policy|
+# policy.default_src :self, :https
+# policy.font_src :self, :https, :data
+# policy.img_src :self, :https, :data
+# policy.object_src :none
+# policy.script_src :self, :https
+# policy.style_src :self, :https
+
+# # Specify URI for violation reports
+# # policy.report_uri "/csp-violation-report-endpoint"
+# end
+
+# If you are using UJS then enable automatic nonce generation
+# Rails.application.config.content_security_policy_nonce_generator = -> request { SecureRandom.base64(16) }
+
+# Report CSP violations to a specified URI
+# For further information see the following documentation:
+# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only
+# Rails.application.config.content_security_policy_report_only = true
diff --git a/config/initializers/cookies_serializer.rb b/test/dummy/config/initializers/cookies_serializer.rb
similarity index 100%
rename from config/initializers/cookies_serializer.rb
rename to test/dummy/config/initializers/cookies_serializer.rb
diff --git a/config/initializers/filter_parameter_logging.rb b/test/dummy/config/initializers/filter_parameter_logging.rb
similarity index 100%
rename from config/initializers/filter_parameter_logging.rb
rename to test/dummy/config/initializers/filter_parameter_logging.rb
diff --git a/config/initializers/inflections.rb b/test/dummy/config/initializers/inflections.rb
similarity index 100%
rename from config/initializers/inflections.rb
rename to test/dummy/config/initializers/inflections.rb
diff --git a/config/initializers/mime_types.rb b/test/dummy/config/initializers/mime_types.rb
similarity index 100%
rename from config/initializers/mime_types.rb
rename to test/dummy/config/initializers/mime_types.rb
diff --git a/config/initializers/wrap_parameters.rb b/test/dummy/config/initializers/wrap_parameters.rb
similarity index 100%
rename from config/initializers/wrap_parameters.rb
rename to test/dummy/config/initializers/wrap_parameters.rb
diff --git a/config/locales/en.yml b/test/dummy/config/locales/en.yml
similarity index 74%
rename from config/locales/en.yml
rename to test/dummy/config/locales/en.yml
index 0653957..decc5a8 100644
--- a/config/locales/en.yml
+++ b/test/dummy/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/puma.rb b/test/dummy/config/puma.rb
similarity index 56%
rename from config/puma.rb
rename to test/dummy/config/puma.rb
index c7f311f..a5eccf8 100644
--- a/config/puma.rb
+++ b/test/dummy/config/puma.rb
@@ -1,13 +1,13 @@
# Puma can serve each request in a thread from an internal thread pool.
-# The `threads` method setting takes two numbers a minimum and maximum.
+# The `threads` method setting takes two numbers: a minimum and maximum.
# Any libraries that use thread pools should be configured to match
# the maximum value specified for Puma. Default is set to 5 threads for minimum
-# and maximum, this matches the default thread size of Active Record.
+# and maximum; this matches the default thread size of Active Record.
#
-threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }.to_i
+threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }
threads threads_count, threads_count
-# Specifies the `port` that Puma will listen on to receive requests, default is 3000.
+# Specifies the `port` that Puma will listen on to receive requests; default is 3000.
#
port ENV.fetch("PORT") { 3000 }
@@ -26,22 +26,9 @@
# Use the `preload_app!` method when specifying a `workers` number.
# This directive tells Puma to first boot the application and load code
# before forking the application. This takes advantage of Copy On Write
-# process behavior so workers use less memory. If you use this option
-# you need to make sure to reconnect any threads in the `on_worker_boot`
-# block.
+# process behavior so workers use less memory.
#
# preload_app!
-# The code in the `on_worker_boot` will be called if you are using
-# clustered mode by specifying a number of `workers`. After each worker
-# process is booted this block will be run, if you are using `preload_app!`
-# option you will want to use this block to reconnect to any threads
-# or connections that may have been created at application boot, Ruby
-# cannot share connections between processes.
-#
-# on_worker_boot do
-# ActiveRecord::Base.establish_connection if defined?(ActiveRecord)
-# end
-
# Allow puma to be restarted by `rails restart` command.
plugin :tmp_restart
diff --git a/test/dummy/config/routes.rb b/test/dummy/config/routes.rb
new file mode 100644
index 0000000..ea82692
--- /dev/null
+++ b/test/dummy/config/routes.rb
@@ -0,0 +1,3 @@
+Rails.application.routes.draw do
+ mount FileExplorer::Engine => "/file_explorer"
+end
diff --git a/test/dummy/config/storage.yml b/test/dummy/config/storage.yml
new file mode 100644
index 0000000..d32f76e
--- /dev/null
+++ b/test/dummy/config/storage.yml
@@ -0,0 +1,34 @@
+test:
+ service: Disk
+ root: <%= Rails.root.join("tmp/storage") %>
+
+local:
+ service: Disk
+ root: <%= Rails.root.join("storage") %>
+
+# Use rails credentials:edit to set the AWS secrets (as aws:access_key_id|secret_access_key)
+# amazon:
+# service: S3
+# access_key_id: <%= Rails.application.credentials.dig(:aws, :access_key_id) %>
+# secret_access_key: <%= Rails.application.credentials.dig(:aws, :secret_access_key) %>
+# region: us-east-1
+# bucket: your_own_bucket
+
+# Remember not to checkin your GCS keyfile to a repository
+# google:
+# service: GCS
+# project: your_project
+# credentials: <%= Rails.root.join("path/to/gcs.keyfile") %>
+# bucket: your_own_bucket
+
+# Use rails credentials:edit to set the Azure Storage secret (as azure_storage:storage_access_key)
+# microsoft:
+# service: AzureStorage
+# storage_account_name: your_account_name
+# storage_access_key: <%= Rails.application.credentials.dig(:azure_storage, :storage_access_key) %>
+# container: your_container_name
+
+# mirror:
+# service: Mirror
+# primary: local
+# mirrors: [ amazon, google, microsoft ]
diff --git a/test/controllers/.keep b/test/dummy/lib/assets/.keep
similarity index 100%
rename from test/controllers/.keep
rename to test/dummy/lib/assets/.keep
diff --git a/test/fixtures/.keep b/test/dummy/log/.keep
similarity index 100%
rename from test/fixtures/.keep
rename to test/dummy/log/.keep
diff --git a/test/dummy/package.json b/test/dummy/package.json
new file mode 100644
index 0000000..caa2d7b
--- /dev/null
+++ b/test/dummy/package.json
@@ -0,0 +1,5 @@
+{
+ "name": "dummy",
+ "private": true,
+ "dependencies": {}
+}
diff --git a/public/404.html b/test/dummy/public/404.html
similarity index 86%
rename from public/404.html
rename to test/dummy/public/404.html
index b612547..2be3af2 100644
--- a/public/404.html
+++ b/test/dummy/public/404.html
@@ -4,7 +4,7 @@
The page you were looking for doesn't exist (404)
-
+
diff --git a/public/422.html b/test/dummy/public/422.html
similarity index 86%
rename from public/422.html
rename to test/dummy/public/422.html
index a21f82b..c08eac0 100644
--- a/public/422.html
+++ b/test/dummy/public/422.html
@@ -4,7 +4,7 @@
The change you wanted was rejected (422)
-
+
diff --git a/public/500.html b/test/dummy/public/500.html
similarity index 85%
rename from public/500.html
rename to test/dummy/public/500.html
index 061abc5..78a030a 100644
--- a/public/500.html
+++ b/test/dummy/public/500.html
@@ -4,7 +4,7 @@
We're sorry, but something went wrong (500)
-
+
diff --git a/public/apple-touch-icon-precomposed.png b/test/dummy/public/apple-touch-icon-precomposed.png
similarity index 100%
rename from public/apple-touch-icon-precomposed.png
rename to test/dummy/public/apple-touch-icon-precomposed.png
diff --git a/public/apple-touch-icon.png b/test/dummy/public/apple-touch-icon.png
similarity index 100%
rename from public/apple-touch-icon.png
rename to test/dummy/public/apple-touch-icon.png
diff --git a/public/favicon.ico b/test/dummy/public/favicon.ico
similarity index 100%
rename from public/favicon.ico
rename to test/dummy/public/favicon.ico
diff --git a/test/file_explorer_test.rb b/test/file_explorer_test.rb
new file mode 100644
index 0000000..55a3a67
--- /dev/null
+++ b/test/file_explorer_test.rb
@@ -0,0 +1,7 @@
+require 'test_helper'
+
+class FileExplorer::Test < ActiveSupport::TestCase
+ test "truth" do
+ assert_kind_of Module, FileExplorer
+ end
+end
diff --git a/test/fixtures/files/.keep b/test/fixtures/files/.keep
deleted file mode 100644
index e69de29..0000000
diff --git a/test/helpers/.keep b/test/helpers/.keep
deleted file mode 100644
index e69de29..0000000
diff --git a/test/integration/.keep b/test/integration/.keep
deleted file mode 100644
index e69de29..0000000
diff --git a/test/integration/navigation_test.rb b/test/integration/navigation_test.rb
new file mode 100644
index 0000000..29e59d8
--- /dev/null
+++ b/test/integration/navigation_test.rb
@@ -0,0 +1,7 @@
+require 'test_helper'
+
+class NavigationTest < ActionDispatch::IntegrationTest
+ # test "the truth" do
+ # assert true
+ # end
+end
diff --git a/test/test_helper.rb b/test/test_helper.rb
index 92e39b2..211c727 100644
--- a/test/test_helper.rb
+++ b/test/test_helper.rb
@@ -1,10 +1,20 @@
-ENV['RAILS_ENV'] ||= 'test'
-require File.expand_path('../../config/environment', __FILE__)
-require 'rails/test_help'
+# Configure Rails Environment
+ENV["RAILS_ENV"] = "test"
-class ActiveSupport::TestCase
- # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
- fixtures :all
+require_relative "../test/dummy/config/environment"
+ActiveRecord::Migrator.migrations_paths = [File.expand_path("../test/dummy/db/migrate", __dir__)]
+ActiveRecord::Migrator.migrations_paths << File.expand_path('../db/migrate', __dir__)
+require "rails/test_help"
- # Add more helper methods to be used by all tests here...
+# Filter out Minitest backtrace while allowing backtrace from other libraries
+# to be shown.
+Minitest.backtrace_filter = Minitest::BacktraceFilter.new
+
+
+# Load fixtures from the engine
+if ActiveSupport::TestCase.respond_to?(:fixture_path=)
+ ActiveSupport::TestCase.fixture_path = File.expand_path("fixtures", __dir__)
+ ActionDispatch::IntegrationTest.fixture_path = ActiveSupport::TestCase.fixture_path
+ ActiveSupport::TestCase.file_fixture_path = ActiveSupport::TestCase.fixture_path + "/files"
+ ActiveSupport::TestCase.fixtures :all
end
diff --git a/tmp/.keep b/tmp/.keep
deleted file mode 100644
index e69de29..0000000
diff --git a/vendor/assets/javascripts/.keep b/vendor/assets/javascripts/.keep
deleted file mode 100644
index e69de29..0000000
diff --git a/vendor/assets/stylesheets/.keep b/vendor/assets/stylesheets/.keep
deleted file mode 100644
index e69de29..0000000