changes
This commit is contained in:
parent
d8e565524f
commit
88bf24a936
48
README.md
48
README.md
@ -1,29 +1,31 @@
|
|||||||
# Sprockets::Assistant
|
# Sprockets Assistant
|
||||||
|
|
||||||
TODO: Write a gem description
|
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
|
||||||
## Installation
|
that I use elsewhere.
|
||||||
|
|
||||||
Add this line to your application's Gemfile:
|
|
||||||
|
|
||||||
gem 'sprockets-assistant'
|
|
||||||
|
|
||||||
And then execute:
|
|
||||||
|
|
||||||
$ bundle
|
|
||||||
|
|
||||||
Or install it yourself as:
|
|
||||||
|
|
||||||
$ gem install sprockets-assistant
|
|
||||||
|
|
||||||
## Usage
|
## 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
|
|
||||||
|
@ -1 +0,0 @@
|
|||||||
require "sprockets/assistant"
|
|
@ -1,6 +0,0 @@
|
|||||||
module Sprockets
|
|
||||||
module Assistant
|
|
||||||
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
@ -6,8 +6,10 @@ require 'sprockets/assistant/compiler'
|
|||||||
module Sprockets
|
module Sprockets
|
||||||
module Assistant
|
module Assistant
|
||||||
class AppBuilder
|
class AppBuilder
|
||||||
|
ASSISTANT_CONFIG_FILE = Pathname('assistant_config.rb')
|
||||||
|
|
||||||
def initialize
|
def initialize
|
||||||
instance_eval(File.read('assistant_config.rb'))
|
instance_eval(ASSISTANT_CONFIG_FILE.read)
|
||||||
end
|
end
|
||||||
|
|
||||||
def app(&block)
|
def app(&block)
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
require 'sprockets/assistant/server'
|
|
||||||
require 'rack'
|
require 'rack'
|
||||||
require 'thor'
|
require 'thor'
|
||||||
|
|
||||||
@ -10,18 +9,28 @@ module Sprockets
|
|||||||
|
|
||||||
desc "server", "server"
|
desc "server", "server"
|
||||||
def server
|
def server
|
||||||
|
require 'sprockets/assistant/server'
|
||||||
|
|
||||||
Rack::Handler.default.run(Sprockets::Assistant::Server.app)
|
Rack::Handler.default.run(Sprockets::Assistant::Server.app)
|
||||||
end
|
end
|
||||||
|
|
||||||
desc "compile", "compile things"
|
desc "compile", "compile things"
|
||||||
def compile
|
def compile
|
||||||
|
require 'sprockets/assistant/app_builder'
|
||||||
|
|
||||||
Sprockets::Assistant::AppBuilder.new.compile
|
Sprockets::Assistant::AppBuilder.new.compile
|
||||||
end
|
end
|
||||||
|
|
||||||
desc "create NAME", "initialize a new assistant project"
|
desc "create NAME", "initialize a new assistant project"
|
||||||
def create(name)
|
def create(name)
|
||||||
directory 'skel', name
|
directory 'skel', name
|
||||||
end
|
|
||||||
|
Dir.chdir(name) do
|
||||||
|
Bundler.with_clean_env { system %{bundle} }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
default_task :server
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
12
lib/sprockets/assistant/compass.rb
Normal file
12
lib/sprockets/assistant/compass.rb
Normal 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
|
||||||
|
|
@ -2,6 +2,8 @@ require 'sprockets'
|
|||||||
require 'sprockets-vendor_gems/extend_all'
|
require 'sprockets-vendor_gems/extend_all'
|
||||||
require 'pathname'
|
require 'pathname'
|
||||||
require 'sprockets/assistant/output'
|
require 'sprockets/assistant/output'
|
||||||
|
require 'sprockets-sass'
|
||||||
|
require 'sprockets/assistant/compass'
|
||||||
|
|
||||||
module Sprockets
|
module Sprockets
|
||||||
module Assistant
|
module Assistant
|
||||||
@ -16,6 +18,10 @@ module Sprockets
|
|||||||
end
|
end
|
||||||
|
|
||||||
def compile
|
def compile
|
||||||
|
::Compass.configuration do |c|
|
||||||
|
c.output_style = :compressed
|
||||||
|
end
|
||||||
|
|
||||||
@env = Sprockets::Environment.new
|
@env = Sprockets::Environment.new
|
||||||
@env.append_path('assets/javascripts')
|
@env.append_path('assets/javascripts')
|
||||||
@env.append_path('assets/stylesheets')
|
@env.append_path('assets/stylesheets')
|
||||||
|
@ -9,6 +9,8 @@ module Sprockets
|
|||||||
|
|
||||||
def initialize
|
def initialize
|
||||||
require 'sprockets/assistant/app_builder'
|
require 'sprockets/assistant/app_builder'
|
||||||
|
require 'sprockets-sass'
|
||||||
|
require 'sprockets/assistant/compass'
|
||||||
|
|
||||||
@app_builder = AppBuilder.new
|
@app_builder = AppBuilder.new
|
||||||
end
|
end
|
||||||
@ -27,8 +29,6 @@ module Sprockets
|
|||||||
instance_eval(&_app_builder.middleware)
|
instance_eval(&_app_builder.middleware)
|
||||||
|
|
||||||
map "/#{Sinatra::Sprockets.config.prefix}" do
|
map "/#{Sinatra::Sprockets.config.prefix}" do
|
||||||
$stderr.puts Sinatra::Sprockets.environment.inspect
|
|
||||||
|
|
||||||
run Sinatra::Sprockets.environment
|
run Sinatra::Sprockets.environment
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -1,5 +1,10 @@
|
|||||||
|
source :rubygems
|
||||||
|
|
||||||
gem 'sprockets-assistant'
|
gem 'sprockets-assistant'
|
||||||
|
gem 'jquery-rails', :require => nil
|
||||||
|
|
||||||
gem 'thin'
|
gem 'thin'
|
||||||
gem 'compass'
|
gem 'compass'
|
||||||
|
|
||||||
|
# haml.js
|
||||||
|
# gem 'cshaml-sprockets'
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
|
# haml
|
||||||
|
# require 'cshaml-sprockets'
|
||||||
|
|
||||||
middleware do
|
middleware do
|
||||||
# use Rack::LiveReload
|
# use Rack::LiveReload
|
||||||
end
|
end
|
||||||
|
@ -4,8 +4,8 @@ require File.expand_path('../lib/sprockets/assistant/version', __FILE__)
|
|||||||
Gem::Specification.new do |gem|
|
Gem::Specification.new do |gem|
|
||||||
gem.authors = ["John Bintz"]
|
gem.authors = ["John Bintz"]
|
||||||
gem.email = ["john@coswellproductions.com"]
|
gem.email = ["john@coswellproductions.com"]
|
||||||
gem.description = %q{TODO: Write a gem description}
|
gem.description = %q{A modern replacement for Sprockets::Secretary.}
|
||||||
gem.summary = %q{TODO: Write a gem summary}
|
gem.summary = %q{A modern replacement for Sprockets::Secretary.}
|
||||||
gem.homepage = ""
|
gem.homepage = ""
|
||||||
|
|
||||||
gem.files = `git ls-files`.split($\)
|
gem.files = `git ls-files`.split($\)
|
||||||
@ -20,6 +20,8 @@ Gem::Specification.new do |gem|
|
|||||||
gem.add_dependency 'sinatra-sprockets-ext'
|
gem.add_dependency 'sinatra-sprockets-ext'
|
||||||
gem.add_dependency 'coffee-script'
|
gem.add_dependency 'coffee-script'
|
||||||
gem.add_dependency 'sass'
|
gem.add_dependency 'sass'
|
||||||
|
gem.add_dependency 'compass'
|
||||||
gem.add_dependency 'sprockets-vendor_gems'
|
gem.add_dependency 'sprockets-vendor_gems'
|
||||||
|
gem.add_dependency 'sprockets-sass'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user