From e73dcc60ae100f47e110b5e090bb3dd68a620309 Mon Sep 17 00:00:00 2001 From: Keyvan Fatehi Date: Wed, 7 Aug 2013 01:10:20 -0700 Subject: [PATCH 1/2] merge this when my pull request to asset_snack is accepted --- Rakefile | 6 ++++-- lib/bait/assets.rb | 14 -------------- 2 files changed, 4 insertions(+), 16 deletions(-) diff --git a/Rakefile b/Rakefile index 79dc626..40c8aac 100644 --- a/Rakefile +++ b/Rakefile @@ -13,8 +13,10 @@ end namespace :assets do task :precompile do - require 'bait' - Bait.assets.compile! + require 'bait/api' + print "Compiling assets ... " + Sinatra::AssetSnack.precompile! + puts "Done!" end end diff --git a/lib/bait/assets.rb b/lib/bait/assets.rb index ab55de8..663e84e 100644 --- a/lib/bait/assets.rb +++ b/lib/bait/assets.rb @@ -15,20 +15,6 @@ def remove! def dynamic? Bait.env != "production" end - - def compile! - Module.new do - require 'bait/api' - require 'sinatra/asset_snack' - extend Sinatra::AssetSnack::InstanceMethods - Sinatra::AssetSnack.assets.each do |assets| - path = File.join(Bait.public, assets[:route]) - File.open(path, 'w') do |file| - file.write compile(assets[:paths])[:body] - end - end - end - end end.new end end From 73f054dd66802e67626e9f78a634b40d2518345f Mon Sep 17 00:00:00 2001 From: Keyvan Fatehi Date: Wed, 7 Aug 2013 22:26:40 -0700 Subject: [PATCH 2/2] Use new changes --- Gemfile | 2 ++ Gemfile.lock | 16 ++++++++++------ Rakefile | 13 ++++--------- 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/Gemfile b/Gemfile index ea4ae50..e4488d4 100644 --- a/Gemfile +++ b/Gemfile @@ -2,3 +2,5 @@ source 'https://rubygems.org' # Specify your gem's dependencies in rmts.gemspec gemspec + +gem 'sinatra-asset-snack', path: '/Users/keyvan/sinatra-asset-snack' diff --git a/Gemfile.lock b/Gemfile.lock index 0328065..1ee18cc 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -11,6 +11,15 @@ PATH thin toystore +PATH + remote: /Users/keyvan/sinatra-asset-snack + specs: + sinatra-asset-snack (0.1.5) + coffee-script + mime-types + sass + sinatra + GEM remote: https://rubygems.org/ specs: @@ -92,11 +101,6 @@ GEM rack (~> 1.4) rack-protection (~> 1.4) tilt (~> 1.3, >= 1.3.4) - sinatra-asset-snack (0.1.5) - coffee-script - mime-types - sass - sinatra sinatra-contrib (1.4.0) backports (>= 2.0) eventmachine @@ -132,4 +136,4 @@ DEPENDENCIES rake rspec simplecov - sinatra-asset-snack + sinatra-asset-snack! diff --git a/Rakefile b/Rakefile index 40c8aac..3a13713 100644 --- a/Rakefile +++ b/Rakefile @@ -11,20 +11,15 @@ task :pry do require 'pry'; binding.pry end -namespace :assets do - task :precompile do - require 'bait/api' - print "Compiling assets ... " - Sinatra::AssetSnack.precompile! - puts "Done!" - end -end - def git_master? `git branch | grep '* master'` $?.exitstatus == 0 end +APP_FILE = "lib/bait/api.rb" +require 'sinatra/asset_snack/rake' +namespace(:assets) { task :precompile => 'assetsnack:build' } + namespace :git do task :dirty do if `git status --porcelain`.match(/M /)