Rpages is intended to be an all in one out of the box solution for displaying content on the web to a broad number of devices (from mobile to VR). It is a rule based engine that uses certain behaviour paterns to controll the display of content. It utilizes tools like Twitter Bootstrap v4, animate CSS, Font Awesome & many more. Using a fully dynamic backend it gives you the ability to display any content - in any way you like - without touching the source code.
The main intention is to reduce clutter as much as possible and use & combine the best tools and techniques available into a single solution.
Rpages is using Paperclip for image upload & processing (see Paperclip), so you have to meet certain requirements for that. It now requires Ruby version >= 2.1 and Rails version >= 4.2 (only if you're going to use Paperclip with Ruby on Rails.)
ImageMagick must be installed and Rpages must have access to it. To ensure
that it does, on your command line, run which convert
(one of the ImageMagick
utilities). This will give you the path where that utility is installed. For
example, it might return /usr/local/bin/convert
.
If you're on Mac OS X, you'll want to run the following with [Homebrew] (http://www.brew.sh):
brew install imagemagick
If you are dealing with pdf uploads or running the test suite, you'll also need to install GhostScript. On Mac OS X, you can also install that using Homebrew:
brew install gs
If you are on Ubuntu (or any Debian base Linux distribution), you'll want to run the following with apt-get:
sudo apt-get install imagemagick -y
The Unix file
command is required for content-type checking.
This utility isn't available in Windows, but comes bundled with Ruby Devkit,
so Windows users must make sure that the devkit is installed and added to the system PATH
.
Manual Installation
If you're using Windows 7+ as a development environment, you may need to install the file.exe
application manually. The file spoofing
system in Rpages relies on this; if you don't have it working, you'll receive Validation failed: Upload file has an extension that does not match its contents.
errors.
To manually install, you should perform the following:
Download & install
file
from this URL
To test, you can use the image below:
Next, you need to integrate with your environment - preferably through the PATH
variable, or by changing your config/environments/development.rb
file
PATH
1. Click "Start"
2. On "Computer", right-click and select "Properties"
3. In Properties, select "Advanced System Settings"
4. Click the "Environment Variables" button
5. Locate the "PATH" var - at the end, add the path to your newly installed `file.exe` (typically `C:\Program Files (x86)\GnuWin32\bin`)
6. Restart any CMD shells you have open & see if it works
OR
Environment
1. Open `config/environments/development.rb`
2. Add the following line: `Paperclip.options[:command_path] = 'C:\Program Files (x86)\GnuWin32\bin'`
3. Restart your Rails server
Either of these methods will give your Rails setup access to the file.exe
functionality, thus providing the ability to check the contents of a file (fixing the spoofing problem)
FFMPEG must be installed and Rpages must have access to it. To ensure
that it does, on your command line, run ffmpeg
(one of the FFMPEGs
utilities). This will give you the path where that utility is installed.
Please not to you need to install FFMPEG with some aditional libraries, in order to process mp4, ogv & webm formats.
For details on how to setup FFMPEG, please have a look at the official documentation.
Rpages is distributed as a gem, which is how it should be used in your app.
Include the gem in your Gemfile:
gem "rpages", github: 'maximr/rpages'
For now you need to use to git repo directory, because this gem is not registered with ruby gems yet...
If you're trying to use features that don't seem to be in the latest released gem, but are mentioned in this README, then you probably need to specify the master branch if you want to use them. This README is probably ahead of the latest released version if you're reading it on GitHub.
The setup is kinda complicated at the moment. Sorry for the trouble. But keep in mind that this is a complex gem & has a lot of dependencies & features. I really should add more automated generators in the future (didn't have time to do it yet. If you feel up to the task, please feel free to send me a pull request).
Add these gems to your gem file. The current versions are not up to date, so you need to require the git repos... at least for now.
gem 'activeadmin', github: 'activeadmin/activeadmin'
gem 'inherited_resources', github: 'activeadmin/inherited_resources'
gem 'ckeditor', github: 'galetahub/ckeditor'
gem "active_admin_multi_upload", github: 'maximr/active_admin_multi_upload'
gem 'activeadmin-select2', github: 'mfairburn/activeadmin-select2'
Run the bundler
bundle install
I supposed you have allready created a Database for your App. If not, make sure to run first
rails db:create
-> Run this line to create the migration file required to setup your database
rails g rpages:add_migrations
-> Run this line to migrate your database with the new migration file
rails db:migrate
-> Run this line to create the default configuration file in config/... (Please make sure to rename it, in order for it to work properly)
rails rpages:create_default_config
-> Run this line to create the default admin account you need to access the backend
rails rpages:create_admin_user
-> Run this line to create all of the default setts that are required by the application (see setts for details)
rails rpages:create_default_setts
-> Run this - it will create most of the default assets & files required by the application
rails rpages:create_asset_files
-> Add these lines to your /config/routes.rb
mount Ckeditor::Engine => '/ckeditor'
devise_for :users, ActiveAdmin::Devise.config
ActiveAdmin.routes(self)
-> Add these lines to your application js file:
//= require rpages_admin
$map_key = 'Your_Google_Maps_Api_Key';
$brand_primary = 'Your_Brand_Color';
-> Add the following lines to your application.scss file:
$brand-secondary: #000; //change this to a value of your own
@import "variables"; //if you have a variables file - to redifine the rpages variables
@import "rpages/rpages";
-> Add these lines to your application controller
include RpagesHelper
helper_method :get_device_data
helper_method :is_mobile?
You should add this config settings to your config/application.rb to make sure your app works properly in production mode...
config.autoload_paths += Dir[Rails.root.join('app', 'models', '{**}')]
config.assets.precompile += Ckeditor.assets
config.autoload_paths << Rails.root.join('lib')
If you want to be able to include dynamic models & database entries within Rpages, you should add following code in your model.rb file:
class YourModel < ApplicationRecord
include RpagesSelectable
end
Note: If you want to overwrite any of the Sass variables defined within Rpages, please use a custom variables definition.
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request
Rpages is Copyright © 2016-2017 Maxim Roubintchik, inc. It is free software, and may be redistributed under the terms specified in the MIT-LICENSE file.
Rpages is maintained and funded by Maxim Roubintchik.