qedproject

Quick and flexible web project generator for standalone sites or use with QEDServer. gem install qedproject

18
2
Ruby

=QEDProject
==Modern web project generator

QEDProject creates a simple web project skeleton with support for Sass and CoffeeScript
as well as asset packaging, LiveReload support, and JavaScript testing. It’s a tool I wrote to make things easier for me, and
if you like it, I’d love to hear how you’re using it. It makes use of Guard and many other Ruby tools and lets you create projects with:

  • Sass
  • CoffeeScript
  • Backbone.JS
  • jQuery
  • jQuery Mobile
  • Ember.JS
  • Skeleton (http://getskeleton.com)
  • Knockout.JS
  • Angular.JS and Angular.resource

It also goes great with http://qedserver.napcs.com/

== Installation

QEDProject is distributed as a Ruby gem. That means you’ll need the Ruby programming language installed on your machine along with the RubyGems package manager.

Then, simply

gem install bundler
gem install qedproject

to get the latest version and all its dependencies.

If you’re on Windows, you’ll need to install RubyInstaller and the Devkit. See http://rubyinstaller.org/add-ons/devkit/ for more.

If you’re on OSX, you need to have XCode installed with the Command Line tools

If you’re on Ubuntu and you want to use CoffeeScript, you’ll need to install NodeJS.

== Usage

Generate a simple web project

qedproject myproject
cd myproject

Then open the public/index.html file in your browser and get to work. Of course, this is only the tip of the iceberg.

=== CoffeeScript and Sass support

To generate a simple web project with CoffeeScript and Sass support, using Guard to monitor files for changes.

qedproject myproject -c -s

Once the project is created, go into the project folder and run the Guard command.

cd myproject
bundle exec guard 

As you work on the Sass and CoffeeScript files, the corresponding CSS and JS files will be placed in public/javascripts and public/stylesheets respectively.

=== Asset Packaging with Jammit

Generate a project that minifies CSS and JS files using Jammit.
Creates the asset configuration file and a Guardfile.

qedproject myproject -a

Create a project with CoffeeScript, Sass, and asset packaging support,
using Guard.

qedproject myproject -c -s -a

=== Including JavaScript libraries.

QEDProject has several popular libraries included.

  • jquery
  • jquerymobile
  • backbone
  • ember

as well as the simple Responsive Design framework Skeleton

Create a new project using jQuery

qedproject myproject -l jquery

Create a new project using jQuery and Backbone

qedproject myproject -l jquery,backbone

Create a new project using jQuery and Backbone,
but also with Sass, CoffeeScript, and asset packaging.

qedproject myproject -l jquery,backbone -c -s -a

Create a new project using the Skeleton design framework,
jQuery, Backbone, also with Sass, CoffeeScript, and asset packaging.

qedproject myproject -l jquery,backbone,skeleton -c -s -a

=== Creating projects with Jasmine BDD tests

If you’d like to create projects where you can do Jasmine testing, use the -t flag.

qedproject myproject -l jquery,backbone -c -s -a -t

This will create a suite.html file in the spec folder, and will create
a sample spec. If you asked for CoffeeScript, the sample spec will be
written in CoffeeSript and the Guardfile will be modified to convert specs to
js files.

And if you used jQuery, the jasmine-jquery library will be added to your test suite.

=== Using the Server and LiveReload

You can use the -r flag to add LiveReload support to the project.

qedproject myproject -r -c -s -a -t -l jquery

You can make your browser refresh when you change your files. To do that, first open another window and type

cd myproject
qedproject --server

which starts up a web server on port 1337 that serves up your project’s public folder. Then install one of the LiveReload plugins for your browser and connect your browser by visiting http://localhost:1337 and activating LiveReload.

To get the browser plugins, visit http://help.livereload.com/kb/general-use/browser-extensions

== Overwriting files

By default, the CLI tool will not overwrite files with the same name. If you want to replace files, pass the -o flag.

= Building Plugins
Plugins should be gems that start with the prefix qedproject-.

Assuming we’re making a plugin called “qedproject-prototype”
for the Prototype library.

Make a structure like this:

qedproject-prototype
  lib/
    plugins/
      prototype.rb
    qedproject-prototype.rb
    version.rb
 vendor/
   prototype/
     prototype.js

Then your code will look like this for the prototype.rb file:

module QEDProject
  module Plugins

    class Prototype < QEDProject::Libraries::Base

      library :prototype, __FILE__
  
      set_js_files ["prototype.js"]
      #set_css_files  ["array", "of", "css", "files"]
      #set_image_files ["array", "of", "image", "files"]

      def generate!
         super
         # customizations of your own
         # if you have no customizations, just don't implement generate! at all.
      end
     end 
   
  end
end

When your plugin is installed as a gem, QEDProject will detect it and attempt to load it.
It will actually load the gem itself, so you don’t necessarily have to create a plugin
with this - you could override any behavior you’d like.

= Contributing

Fork, send patches. Keep them small so I can pull them in.

= Changes
2013-10-27 - 0.6.3

  • Updated Guard and dependencies to most recent versions
    2013-10-24 - 0.6.2.1
  • Forced gem versions in the generated Gemfile

2013-07-19 - 0.6.2

  • Fixed Backbone, Underscore bugs introduced in 0.6.0
  • Fixed a minor issue with dependencies

2013-06-04 - 0.6.1

  • Updated and fixed bad tests
  • Added Angular.js 1.1.5 and Angular resource
  • Updated jquery to 1.10.1
  • Updated jasmine-jquery to 1.5.2

2013-04-10 - 0.6.0

  • added Angular.js support
  • Updated Backbone.js to 1.0.0

2013-03-19 - 0.5.0

  • Ruby 1.9 only. No more support for 1.8.7
  • Updated jQuery to 1.9.1
  • Updated Ember to 1.0.0-rc1
  • Updated Knockout to 2.2
  • Updated Jasmine to 1.3.1
  • Updated Backbone.js to 0.9.10
  • Updated mustache to 0.7.2
  • Updated Guard depenndency to 1.6 so tmux is supported
  • QEDProject creation automatically runs ‘bundle install’
  • Compression for Jammit uses uglifier now.

2013-03-09 - 0.4.2

  • Fixed dependency issue with guard-livereload.
  • Seriously, last version that supports 1.8.7.

2013-02-17 - 0.4.1

  • Minor update of gem dependencies
  • Force Guard to use 1.4.0 for Ruby 1.8.7 compatibility
  • Last version that supports Ruby 1.8.7

2012-10-25 - 0.4.0

  • Change temp directory name from tmp to _qedtmp
  • jquery mpbile update to 1.2.0
  • Updated Skeleton to 1.2.0
  • Updated jquery to 1.8.2
  • Fixes the livereload inclusion bug that shows up with Guard.
  • Fixed a duplicate test name and added test case for Jasmine
  • Updated Jasmine to 1.2.0
  • Renamed Suite.html back to SpecRunner.html to be more standard

2012-4-30 - 0.3.2

  • Fixed incorrect reference in suite.html for jasmine-jquery

2012-4-24 - 0.3.1

  • Jasmine-jquery added.
  • Fixed the Jasmine template.
  • Made LiveReload an option instead of the default.

2012-4-19 - 0.3.0

  • New projects get a Gemfile now to make it a little easier if you use Bundler
  • The Jammit guard now forces rebuilding the assets - it was getting stuck on CoffeeScript files and this fixes it.
  • JQuery Mobile 1.1
  • Knockout 2.0.0
  • Added a --server option which just starts up a simple web server pointing to the public/ folder of the current dir.
  • Fixed a bug where Skeleton’s default page wasn’t loading the assets right without Jammit

2012-1-10 - 0.2.1

  • Added Ember.js
  • Updated jQuery Mobile to 1.0
  • Removed jQuery Templates
  • Updated Jasmine suite.html template to include the JS you’ve used

2011-11-10 - 0.2.0

  • jQuery 1.7
  • jQuery Mobile 1.0rc2
  • Added Mustache.js plugin to core
  • Ensured Skeleton depends on jQuery, removed Google Ajax API from skeleton template

2011-10-09 - 0.1.1

  • Changed deployment script template to remove original directory by default

2011-10-08 - 0.1.0

  • jQuery Mobile 1.0RC1
  • Added -o, --overwrite option, so existing files won’t be blown away.

2011-09-21 - 0.0.9

  • jQuery 1.6.4
  • Added HTMLShiv to index template
  • Added Google Analytics code to index templates for default and Skeleton
  • Added default css and js files
  • Added default coffee and sass files

2011-09-07 - 0.0.8

  • Fixed output path for css generated by Jammit
  • made index creation optional with --skip-index option
  • made name of “public” folder configurable with -p or --public_dir option

2011-09-07 - 0.0.7

  • Added JQuery Mobile support
  • Refactored output
  • Fixed issue with assets file extensions
  • Cleaned up tests

2011-09-03 - 0.0.6

  • Libraries can now have dependencies
  • Plugins can be developed as gems

2011-09-02 - 0.0.5

  • Fixed broken guardfile generation
  • Fixed indentation in generated files

2011-09-02 - 0.0.4

  • Index and Rakefile added
  • Fixed issue with bad libraries

2011-09-01 - 0.0.2

  • Birthday

= Licence:

MIT license