join 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
  require "rubygems"
3
+
3
4
  libdir = File.join(File.dirname(File.dirname(__FILE__)), "lib")
4
5
  $LOAD_PATH.unshift(libdir) unless $LOAD_PATH.include?(libdir)
5
6
 
File without changes
@@ -1,14 +1,20 @@
1
+ # Copyright (c) 20011 Owain Lewis. owain@owainlewis.com
2
+ # All files in this distribution are subject to the terms of the Ruby license.
3
+
1
4
  $:.unshift File.dirname(__FILE__)
2
- require "join/version"
5
+
3
6
  require "fileutils"
7
+ require "join/version"
8
+ require 'join/process'
9
+ require 'join/concatenate'
4
10
 
5
11
  module Join
12
+
6
13
  class << self
7
14
  def message(m)
8
15
  STDOUT.puts m
9
16
  end
10
17
  end
18
+
11
19
  end
12
20
 
13
- require 'join/process'
14
- require 'join/concatenate'
@@ -9,7 +9,7 @@ module Join
9
9
 
10
10
  #Return an array of required modules and files
11
11
  def required(file)
12
- expr = /^\/\/=\s?(.*)$/
12
+ expr = /^\/\/= require\s?(.*)$/
13
13
  file.scan(expr) do |m|
14
14
  @required_modules << m
15
15
  end
@@ -1,6 +1,5 @@
1
1
  module Join
2
- MAJOR_VERSION = 0
3
- MINOR = 0
4
- TINY = 2
5
- VERSION = [MAJOR_VERSION, MINOR, TINY].join(".")
2
+ VERSION = "0.0.3"
6
3
  end
4
+
5
+
data/readme.md CHANGED
@@ -1,7 +1,68 @@
1
1
  #Join
2
2
 
3
- Join is a Ruby gem for concatenating together multiple JavaScript files and libraries ready for deployment.
3
+ Join is a Ruby gem for concatenating together multiple JavaScript files and libraries ready for deployment. The primary goals are
4
+
5
+ + To provide a pseudo common.js module system for the browser. //= require myfile.js
6
+ + To reduce the number of script tag calls on websites
7
+ + To make combining multiple js files easier.
8
+
4
9
  Each JavaScript module is created with a time stamp and a path to the original source file.
5
10
 
11
+ ##Installation
12
+
6
13
  gem install join
7
- join-files /javascripts compressed.js
14
+
15
+ ##Usage
16
+
17
+ The basic idea is to have one main.js file that calls in other dependencies via a simple join statement:
18
+
19
+ //= require path_to/somefile.js
20
+
21
+ You can require other files using the Join require statement (//= require filename.js) like this
22
+
23
+ //= require cufon.js
24
+ //= require lightbox.js
25
+ //= require plugins/jquery.js
26
+
27
+ (function(){
28
+ //Application code here
29
+ })();
30
+
31
+ Then run the join-files command in the terminal to join together all your files
32
+
33
+ join-compile source_file.js output_file.js
34
+
35
+ Sample output should be something like this:
36
+
37
+ /*
38
+ Compiled with Join at 2011-08-28 23:11:02 +0100
39
+ from /Users/owainlewis/Projects/Ruby/jointest/app/other.js
40
+ */
41
+
42
+ Object.keys = function( obj ) {
43
+ var array = new Array();
44
+ for ( var prop in obj ) {
45
+ if ( obj.hasOwnProperty( prop ) ) {
46
+ array.push( prop );
47
+ }
48
+ }
49
+ return array;
50
+ };
51
+
52
+ /*
53
+ Compiled with Join at 2011-08-28 23:11:02 +0100
54
+ from /Users/owainlewis/Projects/Ruby/jointest/app/main.js
55
+ */
56
+
57
+ //Main File
58
+ //= other.js
59
+
60
+ Object.defineProperties = function( obj, props ) {
61
+ for ( var prop in props ) {
62
+ Object.defineProperty( obj, prop, props[prop] );
63
+ }
64
+ };
65
+
66
+ ## Known issues
67
+
68
+ There are a few path issues that I still need to address. Also, relative paths are currently required in the require statements ( //= require /app/main.js etc )
@@ -0,0 +1,22 @@
1
+ /*
2
+ Compiled with Join at 2011-09-11 18:16:25 +0100
3
+ from /Users/owainlewis/Projects/ruby/Gems/Join/test/include.js
4
+ */
5
+
6
+ (function (){
7
+
8
+ /* Include.js */
9
+
10
+ }).call(this);
11
+
12
+ /*
13
+ Compiled with Join at 2011-09-11 18:16:25 +0100
14
+ from /Users/owainlewis/Projects/ruby/Gems/Join/test/index.js
15
+ */
16
+
17
+ //= require include.js
18
+
19
+
20
+
21
+
22
+
@@ -0,0 +1,5 @@
1
+ (function (){
2
+
3
+ /* Include.js */
4
+
5
+ }).call(this);
@@ -0,0 +1,4 @@
1
+ //= require include.js
2
+
3
+
4
+
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: join
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,27 +9,31 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-08-28 00:00:00.000000000Z
12
+ date: 2011-09-11 00:00:00.000000000Z
13
13
  dependencies: []
14
14
  description: A Ruby library for joining files together. Principally aimed at joining
15
15
  JavaScript modules
16
16
  email:
17
17
  - owain@owainlewis.com
18
18
  executables:
19
- - join-files
19
+ - join-compile
20
20
  extensions: []
21
21
  extra_rdoc_files: []
22
22
  files:
23
23
  - .gitignore
24
24
  - Gemfile
25
25
  - Rakefile
26
- - bin/join-files
26
+ - bin/join-compile
27
+ - index.js
27
28
  - join.gemspec
28
29
  - lib/join.rb
29
30
  - lib/join/concatenate.rb
30
31
  - lib/join/process.rb
31
32
  - lib/join/version.rb
32
33
  - readme.md
34
+ - test/compiled.js
35
+ - test/include.js
36
+ - test/index.js
33
37
  homepage: ''
34
38
  licenses: []
35
39
  post_install_message:
@@ -55,4 +59,7 @@ signing_key:
55
59
  specification_version: 3
56
60
  summary: A Ruby library for joining files together. Principally aimed at joining JavaScript
57
61
  modules
58
- test_files: []
62
+ test_files:
63
+ - test/compiled.js
64
+ - test/include.js
65
+ - test/index.js