Giter VIP home page Giter VIP logo

front_end_builds's Introduction

Build Status Code Climate Gem Version

FrontEndBuilds

Warning: Beta software!

Front-End Builds lets you easily serve remotely-hosted static (JS) applications from your Rails apps.

Benefits:

Features:

  • Admin interface lets you easily view, rollback and activate different app versions

The motivation for this gem came from Luke Melia's RailsConf2014 talk.

Installation

Add this line to your application's Gemfile:

gem 'front_end_builds'

And then execute:

$ bundle

Front-End Builds brings some migrations along with it. To run, execute

rake front_end_builds:install:migrations

Usage

First, mount the admin interface in routes.rb:

Rails.application.routes.draw do

  mount FrontEndBuilds::Engine, at: '/frontends'

end

You should mount this under an authenticated route using your application's auth strategy, as anyone with access to the admin will be able to affect the production builds of your front end apps.a

If you don't want to set up an HTML auth strategy, you can do something like this:

# routes.rb
protected_app = Rack::Auth::Basic.new(FrontEndBuilds::Engine) do |username, password|
  username == 'admin' && password == (Rails.env.production? ? ENV['FEB_ADMIN_PASSWORD'] : '')
end
mount protected_app, at: '/frontends'

This will use basic HTTP auth to secure access to your admin ui. Just set the ENV variable, and use it to gain access.

Now, to create a new app, first add a front_end route pointing to your app in routes.rb:

Rails.application.routes.draw do

  front_end 'app-name', '/app-route'

end

Visit the admin (at whatever URL you mounted the engine above), create a new app named app-name, and you'll receive instructions on how to start pushing builds.

Note: If you're using this engine to serve an ember app at the Root, be sure to put all other Rails routes above the front_end route - as this take priority over all routes below it!

Rails.application.routes.draw do
  # All other Rails routes here

  front_end 'app-name', '/'
end

Development

Admin

The Admin interface is an Ember CLI app within feb. A distribution is kept within the gem, and must be updated whenever admin code is updated.

After changing the admin app, run

rake admin:build

to store a fresh distribution.

Running tests

# Rails tests
rspec

# Admin tests, from /admin dir
ember test

TODO

  • Create docs site
  • Auto live setting
  • make posts idempotent (i think they are), but dont insert a new row if it already exists.

front_end_builds's People

Contributors

hhff avatar jurre avatar lukemelia avatar ngottlieb avatar ryanto avatar samselikoff avatar

Stargazers

 avatar

Watchers

 avatar  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.