cjoiner 1.5.0

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,18 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ !example/output
data/Gemfile ADDED
@@ -0,0 +1,9 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in cjoiner.gemspec
4
+ gemspec
5
+
6
+ gem 'sass'
7
+ #we need the old gem version as it provides a simplified usage for our purposes
8
+ gem 'sprockets', "1.0.2"
9
+ gem 'yui-compressor'
data/README.md ADDED
@@ -0,0 +1,164 @@
1
+ cjoiner is free software: you can redistribute it and/or modify
2
+ it under the terms of the GNU General Public License as published by
3
+ the Free Software Foundation, either version 3 of the License, or
4
+ (at your option) any later version.
5
+
6
+ cjoiner is distributed in the hope that it will be useful,
7
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
8
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
9
+ GNU General Public License for more details.
10
+
11
+ You should have received a copy of the GNU General Public License
12
+ along with cjoiner. If not, see <http://www.gnu.org/licenses/>.
13
+
14
+ cjoiner
15
+ ========================================
16
+ Join css, js or other text files and create a versioned file. It also supports compression.
17
+
18
+ For now `cjoiner` is designed to work with javascript using [sprockets v.1.0.2](https://github.com/sstephenson/sprockets/tree/1.0.2) and css using [sass](http://sass-lang.com/), also you can join files using a `yaml` to define sources.
19
+
20
+ Author
21
+ ----------------------------------------
22
+ Alejandro El Informático
23
+
24
+ Installation
25
+ ----------------------------
26
+
27
+ $ [sudo] gem install cjoiner
28
+
29
+ Usage
30
+ ----------------------------------------
31
+ ### As CLI tool
32
+ `cjoiner` will use `pwd` as a primary path and will look for `config.yaml` file if no `config_file` is passed as argument.
33
+
34
+ $ cjoiner [config_file]
35
+
36
+ ### As a library
37
+
38
+ require 'cjoiner'
39
+
40
+ Using an object:
41
+
42
+ cjoiner = Cjoiner::Joiner.new data
43
+ cjoiner.proccess!
44
+
45
+ Using the `yaml` file:
46
+
47
+ cjoiner = Cjoiner::Joiner.new
48
+ cjoiner.load_config! 'config.yaml'
49
+ cjoiner.proccess!
50
+
51
+ ### Configuration file
52
+ This is the skeleton for the configuration file or the data object:
53
+
54
+ `config.yaml`
55
+
56
+ * `config`: configuration wrapper
57
+ * `compress`: _{boolean}_ set compression for all files
58
+ * `yui`: _{string}_ the _yui-compressor_ java file to use if wanted
59
+ * `munge`: _{boolean}_ short the variable names for js files
60
+ * `charset`: _{string}_ set the charset
61
+ * `debug`: _{boolean}_ save a file without compression, just all the concatenation
62
+ * `debug_suffix`: _{string}_ suffix for the `debug` file, usually `name.debug.extension`
63
+ * `common_dependencies`: _{array}_ general dependencies array
64
+ * `common_path`: _{string}_ common path for all items
65
+ * `common_output`: _{string}_ common output path for all files
66
+ * `files`: define files
67
+ * `file`: _{string}_ path and name for file (assuming `common_path` as root) to process, ex: `javascripts/all.js`
68
+ * `name`: _{string}_ output name
69
+ * `extension`: _{string}_ output extension
70
+ * `type`: _{string}_ file type, `sass`, `js` or `yaml`, this is optional as `cjoiner` can guess by the extension
71
+ * `major`: _{int}_ major release
72
+ * `minor`: _{int}_ minor release
73
+ * `bugfix`: _{int}_ bugfix number
74
+ * `compilation`: _{int}_ compilation number
75
+ * `compress`: _{boolean}_ set compresion for this file, overrides general compression flag
76
+ * `debug`: _{boolean}_ set debug for this file, overrides general debug flag
77
+ * `dependencies`: _{array}_ custom dependencies array for this file
78
+ * `output`: _{string}_ file output assuming `common_output` as root
79
+
80
+ ##### Join text files
81
+ Set file type to `yaml` and define sources in another `yaml` file:
82
+
83
+ files:
84
+ - file-1.extension
85
+ - file-2.extension
86
+ - file-3.extension
87
+
88
+ #### Example
89
+
90
+ $ cjoiner project.yaml
91
+
92
+ ### project.yaml
93
+ config :
94
+ common_path : /work/project/
95
+ common_output : /work/project/output/
96
+ debug : true
97
+ common_dependencies : [
98
+ javascripts/src/,
99
+ javascripts/src/core/,
100
+ javascripts/src/lib/,
101
+ sass/
102
+ ]
103
+ files:
104
+ javascripts/all.js :
105
+ name : all
106
+ extension : js
107
+ major : 1
108
+ minor : 0
109
+ bugfix : 0
110
+ compilation : 0
111
+ output : /javascripts/
112
+ sass/css.sass :
113
+ type : sass
114
+ name : css
115
+ extension : css
116
+ major : 0
117
+ minor : 0
118
+ bugfix : 0
119
+ compilation : 1
120
+ output : /stylesheets/
121
+ other.yaml :
122
+ name : files
123
+ extension : output
124
+ major : 1
125
+ minor : 1
126
+ bugfix : 1
127
+ compilation : 1
128
+
129
+ ### all.js (sprockets file)
130
+ //= require "lib.js"
131
+ //= require "debug.js"
132
+ //= require "vendor/plugin.js"
133
+
134
+ ### css.sass (sass file)
135
+ @import defines
136
+ @import mixins
137
+ @import general
138
+
139
+ ### other.yaml (other files)
140
+ files:
141
+ - file-1.extension
142
+ - file-2.extension
143
+ - file-3.extension
144
+
145
+ Will generate two compressed files and two debug files for javascript and sass files, and other file for the other files:
146
+
147
+ 1. `/work/project/output/javascripts/all.1.0.0.0.js`
148
+ 2. `/work/project/output/javascripts/all.debug.js`
149
+ 3. `/work/project/output/stylesheets/css.1.0.0.0.js`
150
+ 4. `/work/project/output/stylesheets/css.debug.js`
151
+ 5. `/work/project/output/files.1.1.1.1.output`
152
+
153
+ Requirements
154
+ ----------------------------------------
155
+ * ruby 1.8.7, 1.9.3
156
+ * rubygems > 1.3.7
157
+ * gems
158
+ * sprockets 1.0.2
159
+ * yui-compressor > 0.9.6
160
+ * sass > 3.1.4
161
+
162
+ TODO
163
+ -----------
164
+ * Create tests
data/bin/cjoiner ADDED
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # -*- encoding: utf-8 -*-
4
+ require 'cjoiner'
5
+
6
+ # configuration file
7
+ config_file = ARGV[0] || "config.yaml"
8
+ begin
9
+ puts "no file given, using the default configuration file: '#{config_file}'" unless ARGV[0]
10
+ puts "loading configuration from '#{config_file}'..."
11
+ cjoiner = Cjoiner::Joiner.new
12
+ cjoiner.load_config! config_file
13
+ cjoiner.proccess!
14
+ puts "all done!"
15
+ rescue Cjoiner::Errors::FileNotFound => e
16
+ puts "File '#{e.message}' not found!"
17
+ end
data/cjoiner.gemspec ADDED
@@ -0,0 +1,19 @@
1
+ # -*- encoding: utf-8 -*-
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'cjoiner/version'
5
+
6
+ Gem::Specification.new do |gem|
7
+ gem.name = "cjoiner"
8
+ gem.version = Cjoiner::VERSION
9
+ gem.authors = ["Alejandro El Informático"]
10
+ gem.email = ["aeinformatico@gmail.com"]
11
+ gem.description = %q{Join css and js assets and create a versioned file.}
12
+ gem.summary = %q{Simple tool for joining css and js assets and create a versioned file using a yaml file as configuration. Output format is 'filename.0.0.0.0.extension'}
13
+ gem.homepage = "https://github.com/ainformatico/cjoiner"
14
+
15
+ gem.files = `git ls-files`.split($/)
16
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
17
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
18
+ gem.require_paths = ["lib"]
19
+ end
data/config.yaml ADDED
@@ -0,0 +1,17 @@
1
+ config :
2
+ compress: false
3
+ common_path : /work/
4
+ common_output : /work/
5
+ common_dependencies : [
6
+ javascripts/debug/src/,
7
+ javascripts/debug/src/core/
8
+ ]
9
+ files :
10
+ javascripts/all.js :
11
+ name : all
12
+ extension : js
13
+ major : 1
14
+ minor : 0
15
+ bugfix : 0
16
+ compilation : 0
17
+ output : javascripts/
@@ -0,0 +1,28 @@
1
+ config :
2
+ common_path : project/
3
+ common_output : output/
4
+ debug : true
5
+ compress : true
6
+ common_dependencies : [
7
+ javascripts/src/,
8
+ javascripts/src/lib/,
9
+ javascripts/src/core/,
10
+ sass/
11
+ ]
12
+ files:
13
+ javascripts/all.js :
14
+ name : all
15
+ extension : js
16
+ major : 1
17
+ minor : 0
18
+ bugfix : 0
19
+ compilation : 0
20
+ sass/css.sass :
21
+ type : sass
22
+ name : css
23
+ extension : css
24
+ major : 1
25
+ minor : 0
26
+ bugfix : 0
27
+ compilation : 0
28
+ debug : false
@@ -0,0 +1 @@
1
+ output files will be generated here
@@ -0,0 +1 @@
1
+ //= require <lib>
@@ -0,0 +1 @@
1
+ //= require "plugins/foo.js
@@ -0,0 +1,4 @@
1
+ (function()
2
+ {
3
+ console.log("foo");
4
+ })();
@@ -0,0 +1,2 @@
1
+ AUTHOR : John Doe <john@doe.com>
2
+ CORE_VERSION : 1.0
@@ -0,0 +1,2 @@
1
+ //= require <lib/core>
2
+ //= require <lib/utils>
@@ -0,0 +1,11 @@
1
+
2
+ /**
3
+ * LIB core
4
+ *
5
+ * @author <%= AUTHOR %>
6
+ *
7
+ * @version <%= CORE_VERSION %>
8
+ *
9
+ **/
10
+
11
+ var LIB = LIB || {};
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Utils package
3
+ *
4
+ * @author <%= AUTHOR %>
5
+ *
6
+ * @version <%= CORE_VERSION %>
7
+ *
8
+ * */
9
+
10
+ (function()
11
+ {
12
+ LIB.utils =
13
+ {
14
+ return_one : function()
15
+ {
16
+ var a = 1,
17
+ b = a * a;
18
+ return(b);
19
+ }
20
+ }
21
+ })();
@@ -0,0 +1,3 @@
1
+ //general
2
+ $font_size: 62.5%
3
+ $font_family: Verdana, Arial, Sans-Serif
@@ -0,0 +1,10 @@
1
+ @import defines
2
+
3
+ html, body
4
+ margin: 0
5
+ padding: 0
6
+
7
+ body
8
+ font:
9
+ family: $font_family
10
+ size: $font_size
@@ -0,0 +1,4 @@
1
+ @import mixins
2
+
3
+ #header
4
+ @include text_shadow(1px, 1px, 2px, #000)
@@ -0,0 +1,2 @@
1
+ @mixin text_shadow ($x, $y, $blur, $color)
2
+ text-shadow: $x $y $blur $color
@@ -0,0 +1,3 @@
1
+ @import general
2
+ @import layout
3
+ @import plugins/foo
@@ -0,0 +1,2 @@
1
+ #foo
2
+ color: #fff
data/lib/cjoiner.rb ADDED
@@ -0,0 +1,113 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require "cjoiner/version"
3
+ require "cjoiner/errors"
4
+ require "cjoiner/helpers"
5
+ require "cjoiner/engine"
6
+
7
+ # gems
8
+ require 'rubygems'
9
+
10
+ module Cjoiner #:nodoc
11
+ # main class
12
+ class Joiner
13
+ include Cjoiner::Helpers::Files
14
+ # load the configuration file
15
+ def load_config!(config_file)
16
+ @config.merge! load_yaml(config_file)["config"]
17
+ end
18
+
19
+ #process all the configuration
20
+ def proccess!
21
+ #each filename with its options
22
+ @config["files"].each do |filename, file_opts|
23
+ # set file path and name
24
+ file_full_path = @config["common_path"] + filename
25
+ full_filename = file(file_full_path)
26
+ #raise if the file does not exits
27
+ file_exists full_filename
28
+ output_name = %[#{file_opts["name"]}.#{file_opts["major"]}.#{file_opts["minor"]}.#{file_opts["bugfix"]}.#{file_opts["compilation"]}.#{file_opts["extension"]}]
29
+ debug_name = %[#{file_opts["name"]}.#{@config["debug_suffix"]}.#{file_opts["extension"]}]
30
+ output_file = expand_path(full_filename.dirname + output_name)
31
+ debug_file = expand_path(full_filename.dirname + debug_name)
32
+ debug = (@config["debug"] and file_opts["debug"].nil? or file_opts["debug"])
33
+ custom_output = (@config["common_output"] and file_opts["output"].nil? or file_opts["output"])
34
+ # save all the concatenation
35
+ concatenation = ""
36
+ # save compressed content
37
+ compressed = ""
38
+ # merge common paths and specific file paths
39
+ paths = @config["common_dependencies"] | (file_opts["dependencies"] || [] << File.expand_path(output_file.dirname.to_s))
40
+ # prepend paths with common_path
41
+ if @config["common_path"]
42
+ paths.each_with_index do |n, i|
43
+ paths[i] = @config["common_path"] + n
44
+ end
45
+ end
46
+ # source file[s]
47
+ sources = [] << File.expand_path(file_full_path)
48
+ # do magic
49
+ if file_opts["type"] == "sass"
50
+ concatenation = Cjoiner::Engines::Css.new(
51
+ {
52
+ :content => read_file(file_full_path),
53
+ :paths => paths,
54
+ :style => file_opts["style"]
55
+ }).render
56
+ elsif file_opts["type"] == "js" or file_opts["extension"] == "js"
57
+ concatenation = Cjoiner::Engines::JsJoiner.new(
58
+ {
59
+ :paths => paths,
60
+ :sources => sources
61
+ }).render
62
+ elsif file_opts["type"] == "yaml"
63
+ files = load_yaml(full_filename)["files"].map! do |file|
64
+ @config["common_path"] + file
65
+ end
66
+ concatenation = Cjoiner::Engines::Joiner.new(
67
+ {
68
+ :files => files
69
+ }).render
70
+ end
71
+ # compress
72
+ if @config["compress"] and file_opts["compress"].nil? or file_opts["compress"]
73
+ compressed = Cjoiner::Engines::Compressor.new(
74
+ {
75
+ :type => file_opts["extension"].to_sym,
76
+ :yui => @config['yui'],
77
+ :charset => @config['charset'],
78
+ :content => concatenation
79
+ }).render
80
+ end
81
+ # save debug file
82
+ if debug
83
+ write_file debug_file, concatenation
84
+ end
85
+ # save final file
86
+ write_file output_file, compressed != "" ? compressed : concatenation
87
+ # set custom output
88
+ if custom_output
89
+ output = @config["common_output"] ? @config["common_output"] : ""
90
+ output += file_opts["output"] if file_opts["output"]
91
+ move_file output_file, expand_path(output + output_name)
92
+ if debug
93
+ move_file debug_file, expand_path(output + debug_name)
94
+ end
95
+ end
96
+ end
97
+ end
98
+
99
+ #init the configuration
100
+ def initialize(config = {})
101
+ @config =
102
+ {
103
+ "yui" => false,
104
+ "munge" => true,
105
+ "charset" => 'utf-8',
106
+ "debug" => false,
107
+ "debug_suffix" => 'debug',
108
+ "compress" => false,
109
+ "common_path" => ''
110
+ }.merge(config)
111
+ end
112
+ end
113
+ end
@@ -0,0 +1,12 @@
1
+ require "cjoiner/helpers"
2
+ require "cjoiner/engines/base"
3
+ require "cjoiner/engines/css"
4
+ require "cjoiner/engines/compressor"
5
+ require "cjoiner/engines/jsjoiner"
6
+ require "cjoiner/engines/joiner"
7
+
8
+ module Cjoiner
9
+ # all the engines
10
+ module Engines
11
+ end
12
+ end
@@ -0,0 +1,17 @@
1
+ require 'cjoiner/engine'
2
+
3
+ module Cjoiner
4
+ module Engines
5
+ # abstract class for engines
6
+ class Engine
7
+ include Cjoiner::Helpers::Files
8
+
9
+ attr_reader :engine
10
+
11
+ # used as abstract class
12
+ def render
13
+ @engine
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,29 @@
1
+ require 'yui/compressor'
2
+
3
+ module Cjoiner
4
+ module Engines
5
+ # compress content
6
+ class Compressor < Cjoiner::Engines::Engine
7
+ def initialize(opts)
8
+ # use the standalone java jar file
9
+ if opts[:yui]
10
+ temp = temp_file "cjoiner.#{opts[:type]}", opts[:content]
11
+ munge = !opts[:munge] ? "--nomunge" : ""
12
+ @engine = `java -jar #{opts[:yui]} #{munge} --charset #{opts[:charset]} --type #{opts[:type]} #{temp.path}` if file_exists opts[:yui]
13
+ else
14
+ case opts[:type]
15
+ when :css
16
+ compressor = ::YUI::CssCompressor.new(:charset => opts[:charset])
17
+ when :js
18
+ compressor = ::YUI::JavaScriptCompressor.new(:munge => opts[:munge], :charset => opts[:charset])
19
+ end
20
+ if compressor
21
+ @engine = compressor.compress(opts[:content])
22
+ else
23
+ @engine = opts[:content]
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,16 @@
1
+ require 'sass'
2
+
3
+ module Cjoiner
4
+ module Engines
5
+ # engine for css files
6
+ class Css < Cjoiner::Engines::Engine
7
+ def initialize(opts)
8
+ @engine = ::Sass::Engine.new(opts[:content],
9
+ {
10
+ :load_paths => opts[:paths],
11
+ :style => opts[:style] || :expanded
12
+ }).render
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,14 @@
1
+ module Cjoiner
2
+ module Engines
3
+ # join files
4
+ class Joiner < Cjoiner::Engines::Engine
5
+ def initialize(opts)
6
+ output = ""
7
+ opts[:files].each do |file|
8
+ output << read_file(file) << "\n"
9
+ end
10
+ @engine = output
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,15 @@
1
+ require 'sprockets'
2
+
3
+ module Cjoiner
4
+ module Engines
5
+ # engine for js files
6
+ class JsJoiner < Cjoiner::Engines::Engine
7
+ def initialize(opts)
8
+ @engine = ::Sprockets::Secretary.new(
9
+ :load_path => opts[:paths],
10
+ :source_files => opts[:sources]
11
+ ).concatenation.to_s
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,9 @@
1
+ # -*- encoding: utf-8 -*-
2
+ module Cjoiner
3
+ # holds all the errors for Cjoiner
4
+ module Errors
5
+ # a file was not found
6
+ class FileNotFound < StandardError
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,58 @@
1
+ require 'yaml'
2
+ require 'fileutils'
3
+ require 'tempfile'
4
+ require 'pathname'
5
+ require 'cjoiner/errors'
6
+
7
+ module Cjoiner
8
+ module Helpers
9
+ module Files
10
+ # check if a file exists
11
+ def file_exists(file, halt = true)
12
+ check = ::File.exists? file
13
+ raise(Cjoiner::Errors::FileNotFound, file) if !check and halt
14
+ check
15
+ end
16
+
17
+ # load a yaml file
18
+ def load_yaml(file)
19
+ if file_exists(file)
20
+ ::YAML::load_file(file)
21
+ end
22
+ end
23
+
24
+ # move a file
25
+ def move_file(from, to)
26
+ return false if from == to
27
+ FileUtils.mv from, to
28
+ end
29
+
30
+ # read file
31
+ def read_file(file)
32
+ File.read(file) if file_exists file
33
+ end
34
+
35
+ # write data to file
36
+ def write_file(file, data)
37
+ file.open("w") { |io| io.puts data }
38
+ end
39
+
40
+ # create a temporal file
41
+ def temp_file(file, data)
42
+ temp = Tempfile.new(file) << data
43
+ temp.close
44
+ temp
45
+ end
46
+
47
+ # return Pathname.new.expand_path
48
+ def expand_path(file)
49
+ Pathname.new(file).expand_path
50
+ end
51
+
52
+ # use Pathname
53
+ def file(file)
54
+ Pathname.new file
55
+ end
56
+ end
57
+ end
58
+ end
@@ -0,0 +1,4 @@
1
+ # -*- encoding: utf-8 -*-
2
+ module Cjoiner
3
+ VERSION = "1.5.0" #:nodoc
4
+ end
data/license ADDED
@@ -0,0 +1,450 @@
1
+ GNU Free Documentation License
2
+ Version 1.3, 3 November 2008
3
+
4
+
5
+ Copyright (C) 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc.
6
+ <http://fsf.org/>
7
+ Everyone is permitted to copy and distribute verbatim copies
8
+ of this license document, but changing it is not allowed.
9
+
10
+ 0. PREAMBLE
11
+
12
+ The purpose of this License is to make a manual, textbook, or other
13
+ functional and useful document "free" in the sense of freedom: to
14
+ assure everyone the effective freedom to copy and redistribute it,
15
+ with or without modifying it, either commercially or noncommercially.
16
+ Secondarily, this License preserves for the author and publisher a way
17
+ to get credit for their work, while not being considered responsible
18
+ for modifications made by others.
19
+
20
+ This License is a kind of "copyleft", which means that derivative
21
+ works of the document must themselves be free in the same sense. It
22
+ complements the GNU General Public License, which is a copyleft
23
+ license designed for free software.
24
+
25
+ We have designed this License in order to use it for manuals for free
26
+ software, because free software needs free documentation: a free
27
+ program should come with manuals providing the same freedoms that the
28
+ software does. But this License is not limited to software manuals;
29
+ it can be used for any textual work, regardless of subject matter or
30
+ whether it is published as a printed book. We recommend this License
31
+ principally for works whose purpose is instruction or reference.
32
+
33
+
34
+ 1. APPLICABILITY AND DEFINITIONS
35
+
36
+ This License applies to any manual or other work, in any medium, that
37
+ contains a notice placed by the copyright holder saying it can be
38
+ distributed under the terms of this License. Such a notice grants a
39
+ world-wide, royalty-free license, unlimited in duration, to use that
40
+ work under the conditions stated herein. The "Document", below,
41
+ refers to any such manual or work. Any member of the public is a
42
+ licensee, and is addressed as "you". You accept the license if you
43
+ copy, modify or distribute the work in a way requiring permission
44
+ under copyright law.
45
+
46
+ A "Modified Version" of the Document means any work containing the
47
+ Document or a portion of it, either copied verbatim, or with
48
+ modifications and/or translated into another language.
49
+
50
+ A "Secondary Section" is a named appendix or a front-matter section of
51
+ the Document that deals exclusively with the relationship of the
52
+ publishers or authors of the Document to the Document's overall
53
+ subject (or to related matters) and contains nothing that could fall
54
+ directly within that overall subject. (Thus, if the Document is in
55
+ part a textbook of mathematics, a Secondary Section may not explain
56
+ any mathematics.) The relationship could be a matter of historical
57
+ connection with the subject or with related matters, or of legal,
58
+ commercial, philosophical, ethical or political position regarding
59
+ them.
60
+
61
+ The "Invariant Sections" are certain Secondary Sections whose titles
62
+ are designated, as being those of Invariant Sections, in the notice
63
+ that says that the Document is released under this License. If a
64
+ section does not fit the above definition of Secondary then it is not
65
+ allowed to be designated as Invariant. The Document may contain zero
66
+ Invariant Sections. If the Document does not identify any Invariant
67
+ Sections then there are none.
68
+
69
+ The "Cover Texts" are certain short passages of text that are listed,
70
+ as Front-Cover Texts or Back-Cover Texts, in the notice that says that
71
+ the Document is released under this License. A Front-Cover Text may
72
+ be at most 5 words, and a Back-Cover Text may be at most 25 words.
73
+
74
+ A "Transparent" copy of the Document means a machine-readable copy,
75
+ represented in a format whose specification is available to the
76
+ general public, that is suitable for revising the document
77
+ straightforwardly with generic text editors or (for images composed of
78
+ pixels) generic paint programs or (for drawings) some widely available
79
+ drawing editor, and that is suitable for input to text formatters or
80
+ for automatic translation to a variety of formats suitable for input
81
+ to text formatters. A copy made in an otherwise Transparent file
82
+ format whose markup, or absence of markup, has been arranged to thwart
83
+ or discourage subsequent modification by readers is not Transparent.
84
+ An image format is not Transparent if used for any substantial amount
85
+ of text. A copy that is not "Transparent" is called "Opaque".
86
+
87
+ Examples of suitable formats for Transparent copies include plain
88
+ ASCII without markup, Texinfo input format, LaTeX input format, SGML
89
+ or XML using a publicly available DTD, and standard-conforming simple
90
+ HTML, PostScript or PDF designed for human modification. Examples of
91
+ transparent image formats include PNG, XCF and JPG. Opaque formats
92
+ include proprietary formats that can be read and edited only by
93
+ proprietary word processors, SGML or XML for which the DTD and/or
94
+ processing tools are not generally available, and the
95
+ machine-generated HTML, PostScript or PDF produced by some word
96
+ processors for output purposes only.
97
+
98
+ The "Title Page" means, for a printed book, the title page itself,
99
+ plus such following pages as are needed to hold, legibly, the material
100
+ this License requires to appear in the title page. For works in
101
+ formats which do not have any title page as such, "Title Page" means
102
+ the text near the most prominent appearance of the work's title,
103
+ preceding the beginning of the body of the text.
104
+
105
+ The "publisher" means any person or entity that distributes copies of
106
+ the Document to the public.
107
+
108
+ A section "Entitled XYZ" means a named subunit of the Document whose
109
+ title either is precisely XYZ or contains XYZ in parentheses following
110
+ text that translates XYZ in another language. (Here XYZ stands for a
111
+ specific section name mentioned below, such as "Acknowledgements",
112
+ "Dedications", "Endorsements", or "History".) To "Preserve the Title"
113
+ of such a section when you modify the Document means that it remains a
114
+ section "Entitled XYZ" according to this definition.
115
+
116
+ The Document may include Warranty Disclaimers next to the notice which
117
+ states that this License applies to the Document. These Warranty
118
+ Disclaimers are considered to be included by reference in this
119
+ License, but only as regards disclaiming warranties: any other
120
+ implication that these Warranty Disclaimers may have is void and has
121
+ no effect on the meaning of this License.
122
+
123
+ 2. VERBATIM COPYING
124
+
125
+ You may copy and distribute the Document in any medium, either
126
+ commercially or noncommercially, provided that this License, the
127
+ copyright notices, and the license notice saying this License applies
128
+ to the Document are reproduced in all copies, and that you add no
129
+ other conditions whatsoever to those of this License. You may not use
130
+ technical measures to obstruct or control the reading or further
131
+ copying of the copies you make or distribute. However, you may accept
132
+ compensation in exchange for copies. If you distribute a large enough
133
+ number of copies you must also follow the conditions in section 3.
134
+
135
+ You may also lend copies, under the same conditions stated above, and
136
+ you may publicly display copies.
137
+
138
+
139
+ 3. COPYING IN QUANTITY
140
+
141
+ If you publish printed copies (or copies in media that commonly have
142
+ printed covers) of the Document, numbering more than 100, and the
143
+ Document's license notice requires Cover Texts, you must enclose the
144
+ copies in covers that carry, clearly and legibly, all these Cover
145
+ Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on
146
+ the back cover. Both covers must also clearly and legibly identify
147
+ you as the publisher of these copies. The front cover must present
148
+ the full title with all words of the title equally prominent and
149
+ visible. You may add other material on the covers in addition.
150
+ Copying with changes limited to the covers, as long as they preserve
151
+ the title of the Document and satisfy these conditions, can be treated
152
+ as verbatim copying in other respects.
153
+
154
+ If the required texts for either cover are too voluminous to fit
155
+ legibly, you should put the first ones listed (as many as fit
156
+ reasonably) on the actual cover, and continue the rest onto adjacent
157
+ pages.
158
+
159
+ If you publish or distribute Opaque copies of the Document numbering
160
+ more than 100, you must either include a machine-readable Transparent
161
+ copy along with each Opaque copy, or state in or with each Opaque copy
162
+ a computer-network location from which the general network-using
163
+ public has access to download using public-standard network protocols
164
+ a complete Transparent copy of the Document, free of added material.
165
+ If you use the latter option, you must take reasonably prudent steps,
166
+ when you begin distribution of Opaque copies in quantity, to ensure
167
+ that this Transparent copy will remain thus accessible at the stated
168
+ location until at least one year after the last time you distribute an
169
+ Opaque copy (directly or through your agents or retailers) of that
170
+ edition to the public.
171
+
172
+ It is requested, but not required, that you contact the authors of the
173
+ Document well before redistributing any large number of copies, to
174
+ give them a chance to provide you with an updated version of the
175
+ Document.
176
+
177
+
178
+ 4. MODIFICATIONS
179
+
180
+ You may copy and distribute a Modified Version of the Document under
181
+ the conditions of sections 2 and 3 above, provided that you release
182
+ the Modified Version under precisely this License, with the Modified
183
+ Version filling the role of the Document, thus licensing distribution
184
+ and modification of the Modified Version to whoever possesses a copy
185
+ of it. In addition, you must do these things in the Modified Version:
186
+
187
+ A. Use in the Title Page (and on the covers, if any) a title distinct
188
+ from that of the Document, and from those of previous versions
189
+ (which should, if there were any, be listed in the History section
190
+ of the Document). You may use the same title as a previous version
191
+ if the original publisher of that version gives permission.
192
+ B. List on the Title Page, as authors, one or more persons or entities
193
+ responsible for authorship of the modifications in the Modified
194
+ Version, together with at least five of the principal authors of the
195
+ Document (all of its principal authors, if it has fewer than five),
196
+ unless they release you from this requirement.
197
+ C. State on the Title page the name of the publisher of the
198
+ Modified Version, as the publisher.
199
+ D. Preserve all the copyright notices of the Document.
200
+ E. Add an appropriate copyright notice for your modifications
201
+ adjacent to the other copyright notices.
202
+ F. Include, immediately after the copyright notices, a license notice
203
+ giving the public permission to use the Modified Version under the
204
+ terms of this License, in the form shown in the Addendum below.
205
+ G. Preserve in that license notice the full lists of Invariant Sections
206
+ and required Cover Texts given in the Document's license notice.
207
+ H. Include an unaltered copy of this License.
208
+ I. Preserve the section Entitled "History", Preserve its Title, and add
209
+ to it an item stating at least the title, year, new authors, and
210
+ publisher of the Modified Version as given on the Title Page. If
211
+ there is no section Entitled "History" in the Document, create one
212
+ stating the title, year, authors, and publisher of the Document as
213
+ given on its Title Page, then add an item describing the Modified
214
+ Version as stated in the previous sentence.
215
+ J. Preserve the network location, if any, given in the Document for
216
+ public access to a Transparent copy of the Document, and likewise
217
+ the network locations given in the Document for previous versions
218
+ it was based on. These may be placed in the "History" section.
219
+ You may omit a network location for a work that was published at
220
+ least four years before the Document itself, or if the original
221
+ publisher of the version it refers to gives permission.
222
+ K. For any section Entitled "Acknowledgements" or "Dedications",
223
+ Preserve the Title of the section, and preserve in the section all
224
+ the substance and tone of each of the contributor acknowledgements
225
+ and/or dedications given therein.
226
+ L. Preserve all the Invariant Sections of the Document,
227
+ unaltered in their text and in their titles. Section numbers
228
+ or the equivalent are not considered part of the section titles.
229
+ M. Delete any section Entitled "Endorsements". Such a section
230
+ may not be included in the Modified Version.
231
+ N. Do not retitle any existing section to be Entitled "Endorsements"
232
+ or to conflict in title with any Invariant Section.
233
+ O. Preserve any Warranty Disclaimers.
234
+
235
+ If the Modified Version includes new front-matter sections or
236
+ appendices that qualify as Secondary Sections and contain no material
237
+ copied from the Document, you may at your option designate some or all
238
+ of these sections as invariant. To do this, add their titles to the
239
+ list of Invariant Sections in the Modified Version's license notice.
240
+ These titles must be distinct from any other section titles.
241
+
242
+ You may add a section Entitled "Endorsements", provided it contains
243
+ nothing but endorsements of your Modified Version by various
244
+ parties--for example, statements of peer review or that the text has
245
+ been approved by an organization as the authoritative definition of a
246
+ standard.
247
+
248
+ You may add a passage of up to five words as a Front-Cover Text, and a
249
+ passage of up to 25 words as a Back-Cover Text, to the end of the list
250
+ of Cover Texts in the Modified Version. Only one passage of
251
+ Front-Cover Text and one of Back-Cover Text may be added by (or
252
+ through arrangements made by) any one entity. If the Document already
253
+ includes a cover text for the same cover, previously added by you or
254
+ by arrangement made by the same entity you are acting on behalf of,
255
+ you may not add another; but you may replace the old one, on explicit
256
+ permission from the previous publisher that added the old one.
257
+
258
+ The author(s) and publisher(s) of the Document do not by this License
259
+ give permission to use their names for publicity for or to assert or
260
+ imply endorsement of any Modified Version.
261
+
262
+
263
+ 5. COMBINING DOCUMENTS
264
+
265
+ You may combine the Document with other documents released under this
266
+ License, under the terms defined in section 4 above for modified
267
+ versions, provided that you include in the combination all of the
268
+ Invariant Sections of all of the original documents, unmodified, and
269
+ list them all as Invariant Sections of your combined work in its
270
+ license notice, and that you preserve all their Warranty Disclaimers.
271
+
272
+ The combined work need only contain one copy of this License, and
273
+ multiple identical Invariant Sections may be replaced with a single
274
+ copy. If there are multiple Invariant Sections with the same name but
275
+ different contents, make the title of each such section unique by
276
+ adding at the end of it, in parentheses, the name of the original
277
+ author or publisher of that section if known, or else a unique number.
278
+ Make the same adjustment to the section titles in the list of
279
+ Invariant Sections in the license notice of the combined work.
280
+
281
+ In the combination, you must combine any sections Entitled "History"
282
+ in the various original documents, forming one section Entitled
283
+ "History"; likewise combine any sections Entitled "Acknowledgements",
284
+ and any sections Entitled "Dedications". You must delete all sections
285
+ Entitled "Endorsements".
286
+
287
+
288
+ 6. COLLECTIONS OF DOCUMENTS
289
+
290
+ You may make a collection consisting of the Document and other
291
+ documents released under this License, and replace the individual
292
+ copies of this License in the various documents with a single copy
293
+ that is included in the collection, provided that you follow the rules
294
+ of this License for verbatim copying of each of the documents in all
295
+ other respects.
296
+
297
+ You may extract a single document from such a collection, and
298
+ distribute it individually under this License, provided you insert a
299
+ copy of this License into the extracted document, and follow this
300
+ License in all other respects regarding verbatim copying of that
301
+ document.
302
+
303
+
304
+ 7. AGGREGATION WITH INDEPENDENT WORKS
305
+
306
+ A compilation of the Document or its derivatives with other separate
307
+ and independent documents or works, in or on a volume of a storage or
308
+ distribution medium, is called an "aggregate" if the copyright
309
+ resulting from the compilation is not used to limit the legal rights
310
+ of the compilation's users beyond what the individual works permit.
311
+ When the Document is included in an aggregate, this License does not
312
+ apply to the other works in the aggregate which are not themselves
313
+ derivative works of the Document.
314
+
315
+ If the Cover Text requirement of section 3 is applicable to these
316
+ copies of the Document, then if the Document is less than one half of
317
+ the entire aggregate, the Document's Cover Texts may be placed on
318
+ covers that bracket the Document within the aggregate, or the
319
+ electronic equivalent of covers if the Document is in electronic form.
320
+ Otherwise they must appear on printed covers that bracket the whole
321
+ aggregate.
322
+
323
+
324
+ 8. TRANSLATION
325
+
326
+ Translation is considered a kind of modification, so you may
327
+ distribute translations of the Document under the terms of section 4.
328
+ Replacing Invariant Sections with translations requires special
329
+ permission from their copyright holders, but you may include
330
+ translations of some or all Invariant Sections in addition to the
331
+ original versions of these Invariant Sections. You may include a
332
+ translation of this License, and all the license notices in the
333
+ Document, and any Warranty Disclaimers, provided that you also include
334
+ the original English version of this License and the original versions
335
+ of those notices and disclaimers. In case of a disagreement between
336
+ the translation and the original version of this License or a notice
337
+ or disclaimer, the original version will prevail.
338
+
339
+ If a section in the Document is Entitled "Acknowledgements",
340
+ "Dedications", or "History", the requirement (section 4) to Preserve
341
+ its Title (section 1) will typically require changing the actual
342
+ title.
343
+
344
+
345
+ 9. TERMINATION
346
+
347
+ You may not copy, modify, sublicense, or distribute the Document
348
+ except as expressly provided under this License. Any attempt
349
+ otherwise to copy, modify, sublicense, or distribute it is void, and
350
+ will automatically terminate your rights under this License.
351
+
352
+ However, if you cease all violation of this License, then your license
353
+ from a particular copyright holder is reinstated (a) provisionally,
354
+ unless and until the copyright holder explicitly and finally
355
+ terminates your license, and (b) permanently, if the copyright holder
356
+ fails to notify you of the violation by some reasonable means prior to
357
+ 60 days after the cessation.
358
+
359
+ Moreover, your license from a particular copyright holder is
360
+ reinstated permanently if the copyright holder notifies you of the
361
+ violation by some reasonable means, this is the first time you have
362
+ received notice of violation of this License (for any work) from that
363
+ copyright holder, and you cure the violation prior to 30 days after
364
+ your receipt of the notice.
365
+
366
+ Termination of your rights under this section does not terminate the
367
+ licenses of parties who have received copies or rights from you under
368
+ this License. If your rights have been terminated and not permanently
369
+ reinstated, receipt of a copy of some or all of the same material does
370
+ not give you any rights to use it.
371
+
372
+
373
+ 10. FUTURE REVISIONS OF THIS LICENSE
374
+
375
+ The Free Software Foundation may publish new, revised versions of the
376
+ GNU Free Documentation License from time to time. Such new versions
377
+ will be similar in spirit to the present version, but may differ in
378
+ detail to address new problems or concerns. See
379
+ http://www.gnu.org/copyleft/.
380
+
381
+ Each version of the License is given a distinguishing version number.
382
+ If the Document specifies that a particular numbered version of this
383
+ License "or any later version" applies to it, you have the option of
384
+ following the terms and conditions either of that specified version or
385
+ of any later version that has been published (not as a draft) by the
386
+ Free Software Foundation. If the Document does not specify a version
387
+ number of this License, you may choose any version ever published (not
388
+ as a draft) by the Free Software Foundation. If the Document
389
+ specifies that a proxy can decide which future versions of this
390
+ License can be used, that proxy's public statement of acceptance of a
391
+ version permanently authorizes you to choose that version for the
392
+ Document.
393
+
394
+ 11. RELICENSING
395
+
396
+ "Massive Multiauthor Collaboration Site" (or "MMC Site") means any
397
+ World Wide Web server that publishes copyrightable works and also
398
+ provides prominent facilities for anybody to edit those works. A
399
+ public wiki that anybody can edit is an example of such a server. A
400
+ "Massive Multiauthor Collaboration" (or "MMC") contained in the site
401
+ means any set of copyrightable works thus published on the MMC site.
402
+
403
+ "CC-BY-SA" means the Creative Commons Attribution-Share Alike 3.0
404
+ license published by Creative Commons Corporation, a not-for-profit
405
+ corporation with a principal place of business in San Francisco,
406
+ California, as well as future copyleft versions of that license
407
+ published by that same organization.
408
+
409
+ "Incorporate" means to publish or republish a Document, in whole or in
410
+ part, as part of another Document.
411
+
412
+ An MMC is "eligible for relicensing" if it is licensed under this
413
+ License, and if all works that were first published under this License
414
+ somewhere other than this MMC, and subsequently incorporated in whole or
415
+ in part into the MMC, (1) had no cover texts or invariant sections, and
416
+ (2) were thus incorporated prior to November 1, 2008.
417
+
418
+ The operator of an MMC Site may republish an MMC contained in the site
419
+ under CC-BY-SA on the same site at any time before August 1, 2009,
420
+ provided the MMC is eligible for relicensing.
421
+
422
+
423
+ ADDENDUM: How to use this License for your documents
424
+
425
+ To use this License in a document you have written, include a copy of
426
+ the License in the document and put the following copyright and
427
+ license notices just after the title page:
428
+
429
+ Copyright (c) YEAR YOUR NAME.
430
+ Permission is granted to copy, distribute and/or modify this document
431
+ under the terms of the GNU Free Documentation License, Version 1.3
432
+ or any later version published by the Free Software Foundation;
433
+ with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
434
+ A copy of the license is included in the section entitled "GNU
435
+ Free Documentation License".
436
+
437
+ If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts,
438
+ replace the "with...Texts." line with this:
439
+
440
+ with the Invariant Sections being LIST THEIR TITLES, with the
441
+ Front-Cover Texts being LIST, and with the Back-Cover Texts being LIST.
442
+
443
+ If you have Invariant Sections without Cover Texts, or some other
444
+ combination of the three, merge those two alternatives to suit the
445
+ situation.
446
+
447
+ If your document contains nontrivial examples of program code, we
448
+ recommend releasing these examples in parallel under your choice of
449
+ free software license, such as the GNU General Public License,
450
+ to permit their use in free software.
metadata ADDED
@@ -0,0 +1,99 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: cjoiner
3
+ version: !ruby/object:Gem::Version
4
+ hash: 3
5
+ prerelease:
6
+ segments:
7
+ - 1
8
+ - 5
9
+ - 0
10
+ version: 1.5.0
11
+ platform: ruby
12
+ authors:
13
+ - "Alejandro El Inform\xC3\xA1tico"
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2013-01-14 00:00:00 +01:00
19
+ default_executable:
20
+ dependencies: []
21
+
22
+ description: Join css and js assets and create a versioned file.
23
+ email:
24
+ - aeinformatico@gmail.com
25
+ executables:
26
+ - cjoiner
27
+ extensions: []
28
+
29
+ extra_rdoc_files: []
30
+
31
+ files:
32
+ - .gitignore
33
+ - Gemfile
34
+ - README.md
35
+ - bin/cjoiner
36
+ - cjoiner.gemspec
37
+ - config.yaml
38
+ - example/config.yaml
39
+ - example/output/README
40
+ - example/project/javascripts/all.js
41
+ - example/project/javascripts/plugins.js
42
+ - example/project/javascripts/plugins/foo.js
43
+ - example/project/javascripts/src/constants.yml
44
+ - example/project/javascripts/src/core/lib.js
45
+ - example/project/javascripts/src/lib/core.js
46
+ - example/project/javascripts/src/lib/utils.js
47
+ - example/project/sass/_defines.sass
48
+ - example/project/sass/_general.sass
49
+ - example/project/sass/_layout.sass
50
+ - example/project/sass/_mixins.sass
51
+ - example/project/sass/css.sass
52
+ - example/project/sass/plugins/foo.sass
53
+ - lib/cjoiner.rb
54
+ - lib/cjoiner/engine.rb
55
+ - lib/cjoiner/engines/base.rb
56
+ - lib/cjoiner/engines/compressor.rb
57
+ - lib/cjoiner/engines/css.rb
58
+ - lib/cjoiner/engines/joiner.rb
59
+ - lib/cjoiner/engines/jsjoiner.rb
60
+ - lib/cjoiner/errors.rb
61
+ - lib/cjoiner/helpers.rb
62
+ - lib/cjoiner/version.rb
63
+ - license
64
+ has_rdoc: true
65
+ homepage: https://github.com/ainformatico/cjoiner
66
+ licenses: []
67
+
68
+ post_install_message:
69
+ rdoc_options: []
70
+
71
+ require_paths:
72
+ - lib
73
+ required_ruby_version: !ruby/object:Gem::Requirement
74
+ none: false
75
+ requirements:
76
+ - - ">="
77
+ - !ruby/object:Gem::Version
78
+ hash: 3
79
+ segments:
80
+ - 0
81
+ version: "0"
82
+ required_rubygems_version: !ruby/object:Gem::Requirement
83
+ none: false
84
+ requirements:
85
+ - - ">="
86
+ - !ruby/object:Gem::Version
87
+ hash: 3
88
+ segments:
89
+ - 0
90
+ version: "0"
91
+ requirements: []
92
+
93
+ rubyforge_project:
94
+ rubygems_version: 1.6.2
95
+ signing_key:
96
+ specification_version: 3
97
+ summary: Simple tool for joining css and js assets and create a versioned file using a yaml file as configuration. Output format is 'filename.0.0.0.0.extension'
98
+ test_files: []
99
+