neptune_coffee 0.0.2 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -4
- data/bin/neptune_coffee +3 -4
- data/examples/after/geometry/namespace.js +1 -1
- data/examples/after/geometry/solids/namespace.js +1 -1
- data/examples/after/geometry/solids.js +2 -2
- data/examples/after/geometry.js +4 -4
- data/examples/after/namespace.js +1 -1
- data/lib/neptune_coffee/javascript_generator.rb +1 -1
- data/lib/neptune_coffee/version.rb +1 -1
- data/spec/javascript_generator_spec.rb +5 -5
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cddf86c8945bc610d8cf38f4f7ba8bafa62a84d6
|
4
|
+
data.tar.gz: f4690c75025d2dbaf2d470bcb57f405d94fedbff
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b9184a51f6980940d3b326f7e45fc45637e40c7eac994030d66695f344a0ecd89ec780aafe7213af5f682b8ed23150af2a3485a651a53f6d96d78336bf5b1a99
|
7
|
+
data.tar.gz: 4272f120cb31e48f4f3b70315c213faa483029314e4e29c60114f5e4ff5672db039b8606a8ed892c8ccbba875a02433ec7726cd3ab70f3ea3546112e6ff9e85c
|
data/README.md
CHANGED
@@ -21,11 +21,11 @@ NeptuneCoffee generates the .js files to define your AMD modules.
|
|
21
21
|
NeptuneCoffee has an opinion about how you should organize your javascript for AMD modules. It is:
|
22
22
|
|
23
23
|
* Directories are AMD modules
|
24
|
-
* Directory
|
25
|
-
* Directory names snake_case
|
26
|
-
* generated AMD module names
|
24
|
+
* Directory's name defines the AMD module's name
|
25
|
+
* Directory names should be snake_case
|
26
|
+
* generated AMD module names will be CamelCase
|
27
27
|
* require "foo/bar" includes all files in the module defined by the directory "foo/bar"
|
28
|
-
* Defines a
|
28
|
+
* Defines a hierachical namespace based on module names and directory structure nesting
|
29
29
|
|
30
30
|
## Benefit
|
31
31
|
|
data/bin/neptune_coffee
CHANGED
@@ -10,13 +10,12 @@ NeptuneCoffee
|
|
10
10
|
An opinionated javascript AMD module generator.
|
11
11
|
|
12
12
|
For every $subdir, generates:
|
13
|
-
$subdir/neptune.js // adds all sub-namespaces to $subdir's namespace object
|
14
13
|
$subdir/namespace.js // defines $subdir's namespace object
|
15
14
|
$subdir.js // loads all .js files in $subdir recursively
|
16
15
|
|
17
|
-
*
|
18
|
-
*
|
19
|
-
* Source files
|
16
|
+
* both generated files return $subdir's namespace object.
|
17
|
+
* Clients should require $subdir.js.
|
18
|
+
* Source files should require ./namespace.js
|
20
19
|
|
21
20
|
Options:
|
22
21
|
ENDBANNER
|
data/examples/after/geometry.js
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
// Generated by NeptuneCoffee 0.0
|
1
|
+
// Generated by NeptuneCoffee 0.1.0
|
2
2
|
define([
|
3
|
-
'./geometry/namespace'
|
4
|
-
'./geometry/box'
|
5
|
-
'./geometry/circle'
|
3
|
+
'./geometry/namespace',
|
4
|
+
'./geometry/box',
|
5
|
+
'./geometry/circle',
|
6
6
|
'./geometry/solids'
|
7
7
|
], function(Geometry) {
|
8
8
|
return Geometry;
|
data/examples/after/namespace.js
CHANGED
@@ -7,7 +7,7 @@ module NeptuneCoffee
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def define_js files, relative_to_path
|
10
|
-
files_js = files.length == 0 ? "" : files.map{|f| "\n './#{f.relative_path_from(relative_to_path)}'"}.join + "\n"
|
10
|
+
files_js = files.length == 0 ? "" : files.map{|f| "\n './#{f.relative_path_from(relative_to_path)}'"}.join(",") + "\n"
|
11
11
|
"define([#{files_js}], function"
|
12
12
|
end
|
13
13
|
|
@@ -22,10 +22,10 @@ describe JavascriptGenerator do
|
|
22
22
|
|
23
23
|
module_js.should == <<ENDJS
|
24
24
|
define([
|
25
|
-
'./bar/namespace'
|
26
|
-
'./bar/file1'
|
27
|
-
'./bar/file2'
|
28
|
-
'./bar/subdir1'
|
25
|
+
'./bar/namespace',
|
26
|
+
'./bar/file1',
|
27
|
+
'./bar/file2',
|
28
|
+
'./bar/subdir1',
|
29
29
|
'./bar/subdir2'
|
30
30
|
], function(Bar) {
|
31
31
|
return Bar;
|
@@ -39,7 +39,7 @@ ENDJS
|
|
39
39
|
]
|
40
40
|
namespace_js.should == <<ENDJS
|
41
41
|
define([
|
42
|
-
'./sub_dir1/namespace'
|
42
|
+
'./sub_dir1/namespace',
|
43
43
|
'./sub_dir2/namespace'
|
44
44
|
], function(SubDir1, SubDir2) {
|
45
45
|
Bar = (function() {
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: neptune_coffee
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shane Brinkman-Davis
|
@@ -165,7 +165,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
165
165
|
version: '0'
|
166
166
|
requirements: []
|
167
167
|
rubyforge_project:
|
168
|
-
rubygems_version: 2.0.
|
168
|
+
rubygems_version: 2.0.7
|
169
169
|
signing_key:
|
170
170
|
specification_version: 4
|
171
171
|
summary: NeptuneCoffee is an opinionated module generator. Modules and namespaces
|