From dce11f7c5bd4eca1f32e3ddee7117504821938dc Mon Sep 17 00:00:00 2001 From: Matt Date: Mon, 28 Aug 2023 17:39:59 +0200 Subject: [PATCH] initial commit --- .gitignore | 3 + CHANGELOG.md | 5 + LICENSE.txt | 21 +++ README.md | 166 ++++++++++++++++++ SECURITY.md | 11 ++ packages/agent/.gitignore | 13 ++ packages/agent/.rspec | 3 + packages/agent/.rubocop.yml | 55 ++++++ packages/agent/CHANGELOG.md | 5 + packages/agent/Gemfile | 7 + packages/agent/LICENSE.txt | 21 +++ packages/agent/README.md | 35 ++++ packages/agent/Rakefile | 10 ++ packages/agent/agent.gemspec | 37 ++++ packages/agent/bin/console | 9 + packages/agent/bin/setup | 8 + packages/agent/lib/agent.rb | 6 + packages/agent/lib/agent/version.rb | 3 + packages/agent/sig/agent.rbs | 4 + packages/agent/spec/agent_spec.rb | 5 + packages/agent/spec/spec_helper.rb | 13 ++ packages/datasource_active_record/.gitkeep | 0 packages/rails_forestadmin/.gitignore | 11 ++ packages/rails_forestadmin/.rubocop.yml | 82 +++++++++ packages/rails_forestadmin/Gemfile | 8 + packages/rails_forestadmin/MIT-LICENSE | 20 +++ packages/rails_forestadmin/README.md | 28 +++ packages/rails_forestadmin/Rakefile | 5 + .../app/controllers/concerns/.keep | 0 .../forestadmin/application_controller.rb | 4 + .../helpers/forestadmin/application_helper.rb | 4 + .../app/models/concerns/.keep | 0 .../models/forestadmin/application_record.rb | 0 packages/rails_forestadmin/bin/rails | 25 +++ packages/rails_forestadmin/config/routes.rb | 3 + .../rails_forestadmin/forestadmin.gemspec | 30 ++++ packages/rails_forestadmin/lib/forestadmin.rb | 6 + .../lib/forestadmin/engine.rb | 5 + .../lib/forestadmin/version.rb | 3 + .../lib/tasks/forestadmin_tasks.rake | 4 + version.rb | 3 + 41 files changed, 681 insertions(+) create mode 100644 .gitignore create mode 100644 CHANGELOG.md create mode 100644 LICENSE.txt create mode 100644 README.md create mode 100644 SECURITY.md create mode 100644 packages/agent/.gitignore create mode 100644 packages/agent/.rspec create mode 100644 packages/agent/.rubocop.yml create mode 100644 packages/agent/CHANGELOG.md create mode 100644 packages/agent/Gemfile create mode 100644 packages/agent/LICENSE.txt create mode 100644 packages/agent/README.md create mode 100644 packages/agent/Rakefile create mode 100644 packages/agent/agent.gemspec create mode 100755 packages/agent/bin/console create mode 100755 packages/agent/bin/setup create mode 100644 packages/agent/lib/agent.rb create mode 100644 packages/agent/lib/agent/version.rb create mode 100644 packages/agent/sig/agent.rbs create mode 100644 packages/agent/spec/agent_spec.rb create mode 100644 packages/agent/spec/spec_helper.rb create mode 100644 packages/datasource_active_record/.gitkeep create mode 100644 packages/rails_forestadmin/.gitignore create mode 100644 packages/rails_forestadmin/.rubocop.yml create mode 100644 packages/rails_forestadmin/Gemfile create mode 100644 packages/rails_forestadmin/MIT-LICENSE create mode 100644 packages/rails_forestadmin/README.md create mode 100644 packages/rails_forestadmin/Rakefile create mode 100644 packages/rails_forestadmin/app/controllers/concerns/.keep create mode 100644 packages/rails_forestadmin/app/controllers/forestadmin/application_controller.rb create mode 100644 packages/rails_forestadmin/app/helpers/forestadmin/application_helper.rb create mode 100644 packages/rails_forestadmin/app/models/concerns/.keep create mode 100644 packages/rails_forestadmin/app/models/forestadmin/application_record.rb create mode 100755 packages/rails_forestadmin/bin/rails create mode 100644 packages/rails_forestadmin/config/routes.rb create mode 100644 packages/rails_forestadmin/forestadmin.gemspec create mode 100644 packages/rails_forestadmin/lib/forestadmin.rb create mode 100644 packages/rails_forestadmin/lib/forestadmin/engine.rb create mode 100644 packages/rails_forestadmin/lib/forestadmin/version.rb create mode 100644 packages/rails_forestadmin/lib/tasks/forestadmin_tasks.rake create mode 100644 version.rb diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000..5aabd7e8b --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +/.idea +/.vscode +.DS_Store diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 000000000..5e9aea0df --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,5 @@ +## [Unreleased] + +## [0.1.0] - 2023-08-28 + +- Initial release diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 000000000..516e99ab8 --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2023 Matt + +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 new file mode 100644 index 000000000..5e82dac79 --- /dev/null +++ b/README.md @@ -0,0 +1,166 @@ +# Forest Admin agent PHP + + +Forest Admin provides an off-the-shelf administration panel based on a highly-extensible API plugged into your application. + +This project has been designed with scalability in mind to fit requirements from small projects to mature companies. + +## Who Uses Forest Admin + +- [Apartmentlist](https://www.apartmentlist.com) +- [Carbon Health](https://carbonhealth.com) +- [Ebanx](https://www.ebanx.com) +- [First circle](https://www.firstcircle.ph) +- [Forest Admin](https://www.forestadmin.com) of course :-) +- [Heetch](https://www.heetch.com) +- [Lunchr](https://www.lunchr.co) +- [Pillow](https://www.pillow.com) +- [Qonto](https://www.qonto.eu) +- [Shadow](https://shadow.tech) +- And hundreds more… + +## Getting started + +[https://docs.forestadmin.com/documentation/how-tos/setup/install](https://docs.forestadmin.com/documentation/how-tos/setup/install) + +## Documentation + +[https://docs.forestadmin.com/documentation/](https://docs.forestadmin.com/documentation/) + +## How it works + +

+ Howitworks +

+ +Forest Admin consists of two components: + +- The Admin Frontend is the user interface where you'll manage your data and configuration. +- The Admin Backend API hosted on your servers where you can find and extend your data models and all the business logic (routes, actions, …) related to your admin panel. + +The Forest Admin package (aka Forest Liana) introspects all your data model +and dynamically generates the Admin API hosted on your servers. The Forest Admin +interface is a web application that handles communication between the admin +user and your application data through the Admin API. + +## Features + +### CRUD + +All of your CRUD operations are natively supported. The API automatically +supports your data models' validation and allows you to easily extend or +override any API routes' with your very own custom logic. + +CRUD + +### Search & Filters + +Forest Admin has a built-in search allowing you to run basic queries to +retrieve your application's data. Set advanced filters based on fields and +relationships to handle complex search use cases. + +Search and Filters + +### Sorting & Pagination + +Sorting and pagination features are natively handled by the Admin API. We're +continuously optimizing how queries are run in order to display results faster +and reduce the load of your servers. + +Sorting and Pagination + +### Custom action + +A custom action is a button which allows you to trigger an API call to execute +a custom logic. With virtually no limitations, you can extend the way you +manipulate data and trigger actions (e.g. refund a customer, apply a coupon, +ban a user, etc.) + +Custom action + +### Export + +Sometimes you need to export your data to a good old fashioned CSV. Yes, we +know this can come in handy sometimes :-) + +Export + +### Segments + +Get in app access to a subset of your application data by doing a basic search +or typing an SQL query or implementing an API route. + +Segments + +### Dashboards + +Forest Admin is able to tap into your actual data to chart out your metrics +using a simple UI panel, a SQL query or a custom API call. + +Dashboard + +### WYSIWYG + +The WYSIWYG interface saves you a tremendous amount of frontend development +time using drag'n'drop as well as advanced widgets to build customizable views. + +WYSIWYG + +### Custom HTML/JS/CSS + +Code your own views using JS, HTML, and CSS to display your application data in +a more appropriate way (e.g. Kanban, Map, Calendar, Gallery, etc.). + +Custom views + +### Team-based permissions + +Without any lines of code, manage directly from the UI who has access or can +act on which data using a team-based permission system. + +Team based permissions + +### Third-party integrations + +Leverage data from third-party services by reconciling it with your +application’s data and providing it directly to your Admin Panel. All your +actions can be performed at the same place, bringing additional intelligence to +your Admin Panel and ensuring consistency. + +Third-party integrations + +### Notes & Comments + +Assign your teammates to specific tasks, leave a note or simply comment a +record, thereby simplifying collaboration all across your organization. + +Notes and Comments + +### Activity logs + +Monitor each action executed and follow the trail of modification on any data +with an extensive activity log system. + +Activity logs + +## How to contribute + +This repository is officially maintained by Forest Admin. +We're always happy to get contributions for other fellow lumberjacks. +All contributions will be reviewed by Forest Admin's team before being merged into main. + +Here is the contribution workflow: + +1. **Fork** the repo on GitHub +2. **Clone** the project to your own machine +3. **Commit** changes to your own branch +4. **Push** your work back up to your fork +5. Submit a **Pull request** so that we can review your changes + +Please ensure that the **tests** are passing before submitting any pull request. + +## Community + +👇 Join our Developers community for support and more + +[![Discourse developers community](https://img.shields.io/discourse/posts?label=discourse&server=https%3A%2F%2Fcommunity.forestadmin.com)](https://community.forestadmin.com) diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 000000000..f0c689385 --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,11 @@ +# Security Policy + +## Reporting a Vulnerability + +To report a security vulnerability, please use the [Forest Admin security email](mailto:security@forestadmin.com). + +Our technical team will consider your request carefully. + +If the vulnerability report is accepted, Forest Admin will: +- work on a fix of the current version with the highest priority, +- let you know as soon as a new patched version is published. diff --git a/packages/agent/.gitignore b/packages/agent/.gitignore new file mode 100644 index 000000000..5c249f1e4 --- /dev/null +++ b/packages/agent/.gitignore @@ -0,0 +1,13 @@ +/.bundle/ +/.yardoc +/_yardoc/ +/coverage/ +/doc/ +/pkg/ +/spec/reports/ +/tmp/ + +# rspec failure tracking +.rspec_status + +Gemfile.lock diff --git a/packages/agent/.rspec b/packages/agent/.rspec new file mode 100644 index 000000000..34c5164d9 --- /dev/null +++ b/packages/agent/.rspec @@ -0,0 +1,3 @@ +--format documentation +--color +--require spec_helper diff --git a/packages/agent/.rubocop.yml b/packages/agent/.rubocop.yml new file mode 100644 index 000000000..cc8fe8921 --- /dev/null +++ b/packages/agent/.rubocop.yml @@ -0,0 +1,55 @@ +require: + - rubocop-performance + - rubocop-rspec + +AllCops: + TargetRubyVersion: 3.0 + NewCops: enable + +# Offense count: 8 +# This cop supports unsafe autocorrection (--autocorrect-all). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: always, always_true, never +Style/FrozenStringLiteralComment: + Exclude: + - 'Gemfile' + - 'Rakefile' + - 'agent.gemspec' + - 'bin/console' + - 'lib/agent.rb' + - 'lib/agent/version.rb' + - 'spec/agent_spec.rb' + - 'spec/spec_helper.rb' + +# Offense count: 1 +# This cop supports unsafe autocorrection (--autocorrect-all). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: literals, strict +Style/MutableConstant: + Exclude: + - 'lib/agent/version.rb' + +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline. +# SupportedStyles: single_quotes, double_quotes +Style/StringLiterals: + Enabled: true + EnforcedStyle: double_quotes + Exclude: + - 'Gemfile' + +Style/StringLiteralsInInterpolation: + Enabled: true + EnforcedStyle: double_quotes + +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: WordRegex. +# SupportedStyles: percent, brackets +Style/WordArray: + EnforcedStyle: percent + MinSize: 3 + +Layout/LineLength: + Max: 120 diff --git a/packages/agent/CHANGELOG.md b/packages/agent/CHANGELOG.md new file mode 100644 index 000000000..5e9aea0df --- /dev/null +++ b/packages/agent/CHANGELOG.md @@ -0,0 +1,5 @@ +## [Unreleased] + +## [0.1.0] - 2023-08-28 + +- Initial release diff --git a/packages/agent/Gemfile b/packages/agent/Gemfile new file mode 100644 index 000000000..653c80529 --- /dev/null +++ b/packages/agent/Gemfile @@ -0,0 +1,7 @@ +source "https://rubygems.org" + +gemspec + +group :development, :test do + // +end diff --git a/packages/agent/LICENSE.txt b/packages/agent/LICENSE.txt new file mode 100644 index 000000000..516e99ab8 --- /dev/null +++ b/packages/agent/LICENSE.txt @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2023 Matt + +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/packages/agent/README.md b/packages/agent/README.md new file mode 100644 index 000000000..496ca4f14 --- /dev/null +++ b/packages/agent/README.md @@ -0,0 +1,35 @@ +# Agent + +TODO: Delete this and the text below, and describe your gem + +Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/agent_ruby`. To experiment with that code, run `bin/console` for an interactive prompt. + +## Installation + +TODO: Replace `UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG` with your gem name right after releasing it to RubyGems.org. Please do not do it earlier due to security reasons. Alternatively, replace this section with instructions to install your gem from git if you don't plan to release to RubyGems.org. + +Install the gem and add to the application's Gemfile by executing: + + $ bundle add UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG + +If bundler is not being used to manage dependencies, install the gem by executing: + + $ gem install UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG + +## Usage + +TODO: Write usage instructions here + +## Development + +After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment. + +To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org). + +## Contributing + +Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/agent_ruby. + +## License + +The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT). diff --git a/packages/agent/Rakefile b/packages/agent/Rakefile new file mode 100644 index 000000000..21c0df6fa --- /dev/null +++ b/packages/agent/Rakefile @@ -0,0 +1,10 @@ +require "bundler/gem_tasks" +require "rspec/core/rake_task" + +RSpec::Core::RakeTask.new(:spec) + +require "rubocop/rake_task" + +RuboCop::RakeTask.new + +task default: %i[spec rubocop] diff --git a/packages/agent/agent.gemspec b/packages/agent/agent.gemspec new file mode 100644 index 000000000..8509fcafe --- /dev/null +++ b/packages/agent/agent.gemspec @@ -0,0 +1,37 @@ +require_relative "lib/agent/version" + +Gem::Specification.new do |spec| + spec.name = "agent" + spec.version = Agent::VERSION + spec.authors = ["Matthieu", "Nicolas"] + spec.email = ["matthv@gmail.com", "nicolasalexandre9@gmail.com"] + spec.homepage = "https://www.forestadmin.com" + spec.summary = "Ruby agent for Forest Admin." + spec.description = "Forest is a modern admin interface that works on all major web frameworks. This gem makes Forest +admin work on any Ruby application." + spec.license = "MIT" + spec.required_ruby_version = ">= 3.0.0" + + spec.metadata["homepage_uri"] = spec.homepage + spec.metadata["source_code_uri"] = "https://github.com/ForestAdmin/agent-ruby" + spec.metadata["changelog_uri"] = "https://github.com/ForestAdmin/agent-ruby/CHANGELOG.md" + spec.metadata["rubygems_mfa_required"] = "true" + + # Specify which files should be added to the gem when it is released. + # The `git ls-files -z` loads the files in the RubyGem that have been added into git. + spec.files = Dir.chdir(__dir__) do + `git ls-files -z`.split("\x0").reject do |f| + (File.expand_path(f) == __FILE__) || + f.start_with?(*%w[bin/ test/ spec/ features/ .git Gemfile]) + end + end + spec.bindir = "exe" + spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) } + spec.require_paths = ["lib"] + + spec.add_dependency "rake", "~> 13.0" + spec.add_dependency "rspec", "~> 3.0" + spec.add_dependency "rubocop", "~> 1.33" + spec.add_dependency "rubocop-performance", "~> 1.19" + spec.add_dependency "rubocop-rspec", "~> 2.23" +end diff --git a/packages/agent/bin/console b/packages/agent/bin/console new file mode 100755 index 000000000..4acbcc1d9 --- /dev/null +++ b/packages/agent/bin/console @@ -0,0 +1,9 @@ +#!/usr/bin/env ruby +require "bundler/setup" +require "agent" + +# You can add fixtures and/or initialization code here to make experimenting +# with your gem easier. You can also use a different console, if you like. + +require "irb" +IRB.start(__FILE__) diff --git a/packages/agent/bin/setup b/packages/agent/bin/setup new file mode 100755 index 000000000..dce67d860 --- /dev/null +++ b/packages/agent/bin/setup @@ -0,0 +1,8 @@ +#!/usr/bin/env bash +set -euo pipefail +IFS=$'\n\t' +set -vx + +bundle install + +# Do any other automated setup that you need to do here diff --git a/packages/agent/lib/agent.rb b/packages/agent/lib/agent.rb new file mode 100644 index 000000000..628910f08 --- /dev/null +++ b/packages/agent/lib/agent.rb @@ -0,0 +1,6 @@ +require_relative "agent/version" + +module Agent + class Error < StandardError; end + # Your code goes here... +end diff --git a/packages/agent/lib/agent/version.rb b/packages/agent/lib/agent/version.rb new file mode 100644 index 000000000..ef87fddde --- /dev/null +++ b/packages/agent/lib/agent/version.rb @@ -0,0 +1,3 @@ +module Agent + VERSION = "0.1.0" +end diff --git a/packages/agent/sig/agent.rbs b/packages/agent/sig/agent.rbs new file mode 100644 index 000000000..4a98e6985 --- /dev/null +++ b/packages/agent/sig/agent.rbs @@ -0,0 +1,4 @@ +module Agent + VERSION: String + # See the writing guide of rbs: https://github.com/ruby/rbs#guides +end diff --git a/packages/agent/spec/agent_spec.rb b/packages/agent/spec/agent_spec.rb new file mode 100644 index 000000000..f28d6515c --- /dev/null +++ b/packages/agent/spec/agent_spec.rb @@ -0,0 +1,5 @@ +RSpec.describe Agent do + it "has a version number" do + expect(Agent::VERSION).not_to be_nil + end +end diff --git a/packages/agent/spec/spec_helper.rb b/packages/agent/spec/spec_helper.rb new file mode 100644 index 000000000..8214409e8 --- /dev/null +++ b/packages/agent/spec/spec_helper.rb @@ -0,0 +1,13 @@ +require "agent" + +RSpec.configure do |config| + # Enable flags like --only-failures and --next-failure + config.example_status_persistence_file_path = ".rspec_status" + + # Disable RSpec exposing methods globally on `Module` and `main` + config.disable_monkey_patching! + + config.expect_with :rspec do |c| + c.syntax = :expect + end +end diff --git a/packages/datasource_active_record/.gitkeep b/packages/datasource_active_record/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/packages/rails_forestadmin/.gitignore b/packages/rails_forestadmin/.gitignore new file mode 100644 index 000000000..2d0bc0e61 --- /dev/null +++ b/packages/rails_forestadmin/.gitignore @@ -0,0 +1,11 @@ +/.bundle/ +/doc/ +/log/*.log +/pkg/ +/tmp/ + +/.idea +/.vscode +.DS_Store + +Gemfile.lock diff --git a/packages/rails_forestadmin/.rubocop.yml b/packages/rails_forestadmin/.rubocop.yml new file mode 100644 index 000000000..dfb350dfa --- /dev/null +++ b/packages/rails_forestadmin/.rubocop.yml @@ -0,0 +1,82 @@ +require: + - rubocop-performance + - rubocop-rspec + +AllCops: + TargetRubyVersion: 3.0 + NewCops: enable + +Gemspec/OrderedDependencies: + Exclude: + - 'forestadmin.gemspec' + +# Offense count: 1 +# Configuration parameters: AllowComments. +Lint/EmptyFile: + Exclude: + - 'app/models/forestadmin/application_record.rb' + +# Offense count: 3 +# Configuration parameters: AllowedConstants. +Style/Documentation: + Exclude: + - 'spec/**/*' + - 'test/**/*' + - 'app/helpers/forestadmin/application_helper.rb' + - 'lib/forestadmin.rb' + - 'lib/forestadmin/engine.rb' + +# Offense count: 11 +# This cop supports unsafe autocorrection (--autocorrect-all). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: always, always_true, never +Style/FrozenStringLiteralComment: + Exclude: + - 'Gemfile' + - 'Rakefile' + - 'app/controllers/forestadmin/application_controller.rb' + - 'app/helpers/forestadmin/application_helper.rb' + - 'bin/rails' + - 'config/routes.rb' + - 'forestadmin.gemspec' + - 'lib/forestadmin.rb' + - 'lib/forestadmin/engine.rb' + - 'lib/forestadmin/version.rb' + - 'lib/tasks/forestadmin_tasks.rake' + +# Offense count: 1 +# This cop supports unsafe autocorrection (--autocorrect-all). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: literals, strict +Style/MutableConstant: + Exclude: + - 'lib/forestadmin/version.rb' + +# Offense count: 50 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline. +# SupportedStyles: single_quotes, double_quotes +Style/StringLiterals: + Enabled: true + EnforcedStyle: double_quotes + Exclude: + - 'Gemfile' + - 'Rakefile' + - 'bin/rails' + - 'forestadmin.gemspec' + - 'lib/forestadmin.rb' + - 'lib/forestadmin/version.rb' + +Style/StringLiteralsInInterpolation: + Enabled: true + EnforcedStyle: double_quotes + +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: MinSize, WordRegex. +# SupportedStyles: percent, brackets +Style/WordArray: + EnforcedStyle: brackets + +Layout/LineLength: + Max: 120 diff --git a/packages/rails_forestadmin/Gemfile b/packages/rails_forestadmin/Gemfile new file mode 100644 index 000000000..088b832b9 --- /dev/null +++ b/packages/rails_forestadmin/Gemfile @@ -0,0 +1,8 @@ +source "https://rubygems.org" +git_source(:github) { |repo| "https://github.com/#{repo}.git" } + +gemspec + +group :development, :test do + // +end diff --git a/packages/rails_forestadmin/MIT-LICENSE b/packages/rails_forestadmin/MIT-LICENSE new file mode 100644 index 000000000..10c8d8fed --- /dev/null +++ b/packages/rails_forestadmin/MIT-LICENSE @@ -0,0 +1,20 @@ +Copyright 2023 Matt + +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/packages/rails_forestadmin/README.md b/packages/rails_forestadmin/README.md new file mode 100644 index 000000000..b3ab2247c --- /dev/null +++ b/packages/rails_forestadmin/README.md @@ -0,0 +1,28 @@ +# Forestadmin +Short description and motivation. + +## Usage +How to use my plugin. + +## Installation +Add this line to your application's Gemfile: + +```ruby +gem "forestadmin" +``` + +And then execute: +```bash +$ bundle +``` + +Or install it yourself as: +```bash +$ gem install forestadmin +``` + +## Contributing +Contribution directions go here. + +## License +The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT). diff --git a/packages/rails_forestadmin/Rakefile b/packages/rails_forestadmin/Rakefile new file mode 100644 index 000000000..857762308 --- /dev/null +++ b/packages/rails_forestadmin/Rakefile @@ -0,0 +1,5 @@ +require "bundler/setup" + +load "rails/tasks/statistics.rake" + +require "bundler/gem_tasks" diff --git a/packages/rails_forestadmin/app/controllers/concerns/.keep b/packages/rails_forestadmin/app/controllers/concerns/.keep new file mode 100644 index 000000000..e69de29bb diff --git a/packages/rails_forestadmin/app/controllers/forestadmin/application_controller.rb b/packages/rails_forestadmin/app/controllers/forestadmin/application_controller.rb new file mode 100644 index 000000000..2969957e8 --- /dev/null +++ b/packages/rails_forestadmin/app/controllers/forestadmin/application_controller.rb @@ -0,0 +1,4 @@ +module Forestadmin + class ApplicationController < ActionController::Base + end +end diff --git a/packages/rails_forestadmin/app/helpers/forestadmin/application_helper.rb b/packages/rails_forestadmin/app/helpers/forestadmin/application_helper.rb new file mode 100644 index 000000000..3b451e0eb --- /dev/null +++ b/packages/rails_forestadmin/app/helpers/forestadmin/application_helper.rb @@ -0,0 +1,4 @@ +module Forestadmin + module ApplicationHelper + end +end diff --git a/packages/rails_forestadmin/app/models/concerns/.keep b/packages/rails_forestadmin/app/models/concerns/.keep new file mode 100644 index 000000000..e69de29bb diff --git a/packages/rails_forestadmin/app/models/forestadmin/application_record.rb b/packages/rails_forestadmin/app/models/forestadmin/application_record.rb new file mode 100644 index 000000000..e69de29bb diff --git a/packages/rails_forestadmin/bin/rails b/packages/rails_forestadmin/bin/rails new file mode 100755 index 000000000..bd6bc1732 --- /dev/null +++ b/packages/rails_forestadmin/bin/rails @@ -0,0 +1,25 @@ +#!/usr/bin/env ruby +# 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/forestadmin/engine", __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" +# Pick the frameworks you want: +require "active_model/railtie" +require "active_job/railtie" +require "active_record/railtie" +require "active_storage/engine" +require "action_controller/railtie" +# require "action_mailer/railtie" +# require "action_mailbox/engine" +# require "action_text/engine" +require "action_view/railtie" +# require "action_cable/engine" +# require "rails/test_unit/railtie" +require "rails/engine/commands" diff --git a/packages/rails_forestadmin/config/routes.rb b/packages/rails_forestadmin/config/routes.rb new file mode 100644 index 000000000..f6bc2b1a3 --- /dev/null +++ b/packages/rails_forestadmin/config/routes.rb @@ -0,0 +1,3 @@ +Forestadmin::Engine.routes.draw do + // +end diff --git a/packages/rails_forestadmin/forestadmin.gemspec b/packages/rails_forestadmin/forestadmin.gemspec new file mode 100644 index 000000000..ab3244e6b --- /dev/null +++ b/packages/rails_forestadmin/forestadmin.gemspec @@ -0,0 +1,30 @@ +require_relative "lib/forestadmin/version" + +Gem::Specification.new do |spec| + spec.name = "forestadmin" + spec.version = Forestadmin::VERSION + spec.authors = ["Matthieu", "Nicolas"] + spec.email = ["matthv@gmail.com", "nicolasalexandre9@gmail.com"] + spec.homepage = "https://www.forestadmin.com" + spec.summary = "Official Rails Agent for Forest Admin." + spec.description = "Forest is a modern admin interface that works on all major web frameworks. This gem makes Forest +admin work on any Rails application (Rails >= 6.1)." + spec.license = "MIT" + spec.required_ruby_version = ">= 3.0.0" + + spec.metadata["homepage_uri"] = spec.homepage + spec.metadata["source_code_uri"] = "https://github.com/ForestAdmin/rails-forestadmin" + spec.metadata["changelog_uri"] = "https://github.com/ForestAdmin/rails-forestadmin/CHANGELOG.md" + spec.metadata['rubygems_mfa_required'] = 'true' + + spec.files = Dir.chdir(File.expand_path(__dir__)) do + Dir["{app,config,lib}/**/*", "MIT-LICENSE", "Rakefile", "README.md"] + end + + spec.add_dependency "rails", ">= 6.1" + spec.add_dependency "puma" + spec.add_dependency "sqlite3" + spec.add_dependency "rubocop", "~> 1.33" + spec.add_dependency "rubocop-performance", "~> 1.19" + spec.add_dependency "rubocop-rspec", "~> 2.23" +end diff --git a/packages/rails_forestadmin/lib/forestadmin.rb b/packages/rails_forestadmin/lib/forestadmin.rb new file mode 100644 index 000000000..cdd648a01 --- /dev/null +++ b/packages/rails_forestadmin/lib/forestadmin.rb @@ -0,0 +1,6 @@ +require "forestadmin/version" +require "forestadmin/engine" + +module Forestadmin + # Your code goes here... +end diff --git a/packages/rails_forestadmin/lib/forestadmin/engine.rb b/packages/rails_forestadmin/lib/forestadmin/engine.rb new file mode 100644 index 000000000..d2fd99eff --- /dev/null +++ b/packages/rails_forestadmin/lib/forestadmin/engine.rb @@ -0,0 +1,5 @@ +module Forestadmin + class Engine < ::Rails::Engine + isolate_namespace Forestadmin + end +end diff --git a/packages/rails_forestadmin/lib/forestadmin/version.rb b/packages/rails_forestadmin/lib/forestadmin/version.rb new file mode 100644 index 000000000..c3b020e0b --- /dev/null +++ b/packages/rails_forestadmin/lib/forestadmin/version.rb @@ -0,0 +1,3 @@ +module Forestadmin + VERSION = "0.1.0" +end diff --git a/packages/rails_forestadmin/lib/tasks/forestadmin_tasks.rake b/packages/rails_forestadmin/lib/tasks/forestadmin_tasks.rake new file mode 100644 index 000000000..367f151d6 --- /dev/null +++ b/packages/rails_forestadmin/lib/tasks/forestadmin_tasks.rake @@ -0,0 +1,4 @@ +# desc "Explaining what the task does" +# task :forestadmin do +# # Task goes here +# end diff --git a/version.rb b/version.rb new file mode 100644 index 000000000..c802b3718 --- /dev/null +++ b/version.rb @@ -0,0 +1,3 @@ +module AgentRuby + VERSION = "0.1.0" +end