Giter Club home page Giter Club logo

thredded_create_app's Introduction

ThreddedCreateApp Build Status Test Coverage

Generates a Rails app with the Thredded forums engine installed.

See below for more information on the generated app.

Example screenshots of the generated app:

Home Sign Up
Messageboard Topic

Pre-requisites

  1. Git.
  2. A supported database: PostgreSQL (recommended), MySQL v5.7+, or SQLite.
  3. Ruby 2.3+.

Usage

Install the gem and create your app:

gem install thredded_create_app
thredded_create_app myapp

By default, PostgreSQL will be used as the database. Alternatively, you can pass --database sqlite3 for SQLite, or --datase mysql2 for MySQL.

Run thredded_create_app --help for more information about the available options.

RVM

If you're using RVM, you probably want to create a gemset before creating your app:

RUBY_VERSION=2.3.1 APP=myapp
rvm use --create "${RUBY_VERSION}@${APP}"
gem install thredded_create_app
thredded_create_app "$APP"

Then, generate the .ruby-version and .ruby-gemset files so that the gemset is used automatically whenever you cd into the project directory:

cd "$APP"
rvm use --ruby-version "${RUBY_VERSION}@${APP}"
printf '.ruby-version\n.ruby-gemset\n' >> .git/info/exclude

App generation

The app generator will do the steps below for you.

First, the rubygems package is updated and the latest versions of Rails and Bundler are installed.

Then, a Rails app is generated for use with the selected database.

Then, a git repository is initialized in the app directory. From here onwards, the app generator will commit the changes at each step.

RSpec is used as the testing framework, and some basic acceptance tests using capybara are added.

Devise is used as the authentication framework. Its default views are customized to add a user name field (display_name) to the registration form. The simple_form gem is used for the customized Devise views by default.

A basic responsive app layout with top bar navigation is added. A user profile page that displays some basic information about the user and their recent forum posts is also added.

The app comes with basic styles (~10KiB gzipped, including Thredded styles) that are written using Sass.

The app's JavaScript code is loaded asynchronously in production mode via the async attribute on the script tag. In development, the individual script files are not concatenated. With async they would load out-of-order, so defer is used instead.

NB: While loading scripts via async provides the best possible speed, a lot of JavaScript libraries do not support it. If you plan on adding JavaScript code, you might want to remove the async attribute from the javascript_include_tag in app/views/layouts/application.html.erb.

A Dockerfile and docker-compose.yml is generated for development. This is so that other engineers can spin up a development environment with a single command.

A production configuration file for the puma Ruby web server is created. A Procfile process description file is also created. This file can be used by the Heroku hosting platform or the foreman app runner.

Lastly, the $APP database user is created and given rights to the app's development and test databases. Then, the database is created, the migrations are run, and the database is seeded with an admin user and a messageboard.

Finally, the tests are run, and the development web server is started at http://localhost:3000.

Next steps

To learn about customizing the forums, see the Thredded Readme.

To learn about customizing the authentication system, e.g. to require email confirmation or to add an OAuth login, see the Devise Readme.

To change the homepage, edit the view file at app/views/home/show.html.erb.

To change the app's styles, see the files in app/assets/stylesheets. The app is generated with a randomly selected primary theme color that you may want to change. You can find it in app/assets/stylesheets/_variables.scss.

You can contact the Thredded team via the Thredded chat room. Once you've deployed your app, please let us know that you are using Thredded by tweeting @thredded!

Development

The instructions below are for developing and contributing to the Thredded app generator itself, not for using it.

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 generate an app with thredded_create_app at tmp/myapp, run:

bundle exec bin/create-tmp-myapp

This command will clean up the previously generated app before creating a new one.

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 tags, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/thredded/thredded_create_app. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

License

The gem is available as open source under the terms of the MIT License.

thredded_create_app's People

Contributors

glebm avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.