This commit is contained in:
John Bintz 2012-08-10 16:09:51 -04:00
parent d8e565524f
commit 88bf24a936
11 changed files with 70 additions and 36 deletions

View File

@ -1,29 +1,31 @@
# Sprockets::Assistant
# Sprockets Assistant
TODO: Write a gem description
## Installation
Add this line to your application's Gemfile:
gem 'sprockets-assistant'
And then execute:
$ bundle
Or install it yourself as:
$ gem install sprockets-assistant
An upgraded `Sprockets::Secretary`. A simple way to let me build little libraries and widgets and
things for various projects, while still taking advantage of all the Sprockets libraries and goodness
that I use elsewhere.
## Usage
TODO: Write usage instructions here
gem install sprockets-assistant
sprockets-assistant create my_project
cd my_project
bundle exec sprockets-assistant
## Contributing
This starts a server on localhost:8080. Hack away.
## `assistant_config.rb`
Prett simple DSL:
### `middleware`
Define a middleware stack.
### `app`
This is the guts of a `Sinatra::Base` app.
### `compile`
A list of files to compile with `sprockets-assistant compile`.
1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Added some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request

View File

@ -1 +0,0 @@
require "sprockets/assistant"

View File

@ -1,6 +0,0 @@
module Sprockets
module Assistant
end
end

View File

@ -6,8 +6,10 @@ require 'sprockets/assistant/compiler'
module Sprockets
module Assistant
class AppBuilder
ASSISTANT_CONFIG_FILE = Pathname('assistant_config.rb')
def initialize
instance_eval(File.read('assistant_config.rb'))
instance_eval(ASSISTANT_CONFIG_FILE.read)
end
def app(&block)

View File

@ -1,4 +1,3 @@
require 'sprockets/assistant/server'
require 'rack'
require 'thor'
@ -10,18 +9,28 @@ module Sprockets
desc "server", "server"
def server
require 'sprockets/assistant/server'
Rack::Handler.default.run(Sprockets::Assistant::Server.app)
end
desc "compile", "compile things"
def compile
require 'sprockets/assistant/app_builder'
Sprockets::Assistant::AppBuilder.new.compile
end
desc "create NAME", "initialize a new assistant project"
def create(name)
directory 'skel', name
end
Dir.chdir(name) do
Bundler.with_clean_env { system %{bundle} }
end
end
default_task :server
end
end
end

View File

@ -0,0 +1,12 @@
module Sprockets
module Assistant
class Compass
require 'compass'
::Compass.configuration do |c|
c.images_path = 'assets/images'
end
end
end
end

View File

@ -2,6 +2,8 @@ require 'sprockets'
require 'sprockets-vendor_gems/extend_all'
require 'pathname'
require 'sprockets/assistant/output'
require 'sprockets-sass'
require 'sprockets/assistant/compass'
module Sprockets
module Assistant
@ -16,6 +18,10 @@ module Sprockets
end
def compile
::Compass.configuration do |c|
c.output_style = :compressed
end
@env = Sprockets::Environment.new
@env.append_path('assets/javascripts')
@env.append_path('assets/stylesheets')

View File

@ -9,6 +9,8 @@ module Sprockets
def initialize
require 'sprockets/assistant/app_builder'
require 'sprockets-sass'
require 'sprockets/assistant/compass'
@app_builder = AppBuilder.new
end
@ -27,8 +29,6 @@ module Sprockets
instance_eval(&_app_builder.middleware)
map "/#{Sinatra::Sprockets.config.prefix}" do
$stderr.puts Sinatra::Sprockets.environment.inspect
run Sinatra::Sprockets.environment
end

View File

@ -1,5 +1,10 @@
source :rubygems
gem 'sprockets-assistant'
gem 'jquery-rails', :require => nil
gem 'thin'
gem 'compass'
# haml.js
# gem 'cshaml-sprockets'

View File

@ -1,3 +1,6 @@
# haml
# require 'cshaml-sprockets'
middleware do
# use Rack::LiveReload
end

View File

@ -4,8 +4,8 @@ require File.expand_path('../lib/sprockets/assistant/version', __FILE__)
Gem::Specification.new do |gem|
gem.authors = ["John Bintz"]
gem.email = ["john@coswellproductions.com"]
gem.description = %q{TODO: Write a gem description}
gem.summary = %q{TODO: Write a gem summary}
gem.description = %q{A modern replacement for Sprockets::Secretary.}
gem.summary = %q{A modern replacement for Sprockets::Secretary.}
gem.homepage = ""
gem.files = `git ls-files`.split($\)
@ -20,6 +20,8 @@ Gem::Specification.new do |gem|
gem.add_dependency 'sinatra-sprockets-ext'
gem.add_dependency 'coffee-script'
gem.add_dependency 'sass'
gem.add_dependency 'compass'
gem.add_dependency 'sprockets-vendor_gems'
gem.add_dependency 'sprockets-sass'
end