Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Gemspec and console tool were added

  • Loading branch information...
commit 7f924f613e4feb332e1e06d45acd281863b63ea9 1 parent 5258ea7
@MadRabbit authored
View
1  .gitignore
@@ -8,3 +8,4 @@ spec/temp/*
nbproject
build/in/*
build/out/*
+*.gem
View
4 CHANGELOG
@@ -1,3 +1,7 @@
+* 1.0.6 (December 14, 2009) - Nikolay V. Nemshilov aka St.
+ * rubygem is now available
+ * console util was added
+
* 1.0.2 (April 25, 2009) - Nikolay V. Nemshilov aka St.
* Tokens negotiation process update
* The self-build script enhancement
View
18 README
@@ -11,8 +11,22 @@ for your code, see the description below.
The library can be used as a plugin for rails. See description below.
-Usage
-=====
+RubyGem and Console tool
+========================
+
+FrontCompiler is now available as a rubygem at the gemcutter service
+
+gem sources -a http://gemcutter.org
+gem install front-compiler
+
+With the rubygem you'll have a console tool called 'frontcc'
+
+$ frontcc file0.js file1.js file2.js file3.js
+
+
+
+Basic Usage
+===========
It's pretty simple
View
53 bin/frontcc
@@ -0,0 +1,53 @@
+#!/usr/bin/env ruby
+$LOAD_PATH.unshift(File.expand_path(File.join(File.dirname(__FILE__),'..','lib')))
+
+require 'front_compiler'
+
+if ARGV.empty? || ARGV.include?('-h') || ARGV.include?('--help')
+ puts %Q{FrontCompiler the Ruby based JavaScript/CSS/HTML compiler
+(C) 2008-2009 Nikolay Nemshilov
+
+
+frontcc [options] file file file ...
+
+options:
+ -h Show this help
+ -p Create an albeit packed script
+
+
+The command supports any standard console */* selectors
+and will automatically recognize file-types by extensions
+}
+else
+ cc = FrontCompiler.new
+
+ javascript = false
+
+ # creating an overall source
+ source = ARGV.collect{ |path| Dir[path] }.flatten.collect do |path|
+ if File.exists? path
+ src = File.open(path, 'r').read
+
+ case path.split('.').last.downcase
+ when "html"
+ throw "We don't inline HTML into JavaScript" if javascript
+ cc.compact_html(src)
+ when "css"
+ cc.send(javascript ? :inline_css : :compact_css, src)
+ when "js"
+ javascript = true
+ src =~ /;\s*\Z/ ? src : (src + ';') # <- checking the end semicolon
+
+ else
+ throw "Unsupported kind of file '#{path}'"
+ end
+ end
+ end.compact.join("")
+
+ if javascript
+ source = cc.compact_js(source)
+ source = source.create_self_build if ARGV.include?('-p')
+ end
+
+ puts source
+end
View
23 front-compiler.gemspec
@@ -0,0 +1,23 @@
+Gem::Specification.new do |s|
+ s.name = 'front-compiler'
+ s.version = '1.0.6'
+ s.date = '2009-12-14'
+
+ s.summary = "FrontCompiler is a Ruby based JavaScript/CSS/HTML compressor"
+ s.description = "FrontCompiler is a Ruby based JavaScript/CSS/HTML compressor. It provides the basic JavaScript/CSS/HTML minifying feature. Plus it can create albeit packed JavaScript files, can inline CSS inside JavaScript, works with DRYed CSS files and also can work as a RubyOnRails plugin."
+
+ s.authors = ['Nikolay Nemshilov']
+ s.email = 'nemshilov@gmail.com'
+ s.homepage = 'http://github.com/MadRabbit/frontcompiler'
+
+ s.files = Dir['lib/**/*'] + Dir['spec/**/*']
+ s.files+= %w(
+ README
+ LICENSE
+ CHANGELOG
+ Rakefile
+ init.rb
+ )
+
+ s.executables = ['frontcc']
+end
View
5 lib/front-compiler.rb
@@ -0,0 +1,5 @@
+#
+# Hook for rails when the plugin is used as a gem
+#
+require 'front_compiler'
+require File.dirname(__FILE__) + '/../init.rb'
View
2  lib/front_compiler.rb
@@ -6,7 +6,7 @@
$LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__))).uniq!
class FrontCompiler
- VERSION = "0.1"
+ VERSION = "1.0.6"
def initialize
@html_compactor = HTMLCompactor.new
Please sign in to comment.
Something went wrong with that request. Please try again.