ninjs 0.0.0 → 0.9.0
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.
- data/LICENSE +29 -0
- data/README.textile +41 -0
- data/bin/ninjs +52 -0
- metadata +10 -3
- data/README +0 -0
data/LICENSE
CHANGED
@@ -0,0 +1,29 @@
|
|
1
|
+
Copyright (c) 2010-2011 Dayton D. Nolan
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
No attribution is required by products that make use of this software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
16
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
17
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
18
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
19
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
20
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
21
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
22
|
+
|
23
|
+
Except as contained in this notice, the name(s) of the above copyright
|
24
|
+
holders shall not be used in advertising or otherwise to promote the sale,
|
25
|
+
use or other dealings in this Software without prior written authorization.
|
26
|
+
|
27
|
+
Contributors to this project agree to grant all rights to the copyright
|
28
|
+
holder of the primary product. Attribution is maintained in the source
|
29
|
+
control history of the product.
|
data/README.textile
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
h1. Readme
|
2
|
+
|
3
|
+
h2. About
|
4
|
+
|
5
|
+
Ninjs (No Inheritance Necessary) is a command line application written in ruby that leverages the "Sprockets":http://getsprockets.org JavaScript compiler to create modular javascript applications without having to compile your scripts manually. Ninjs also contains a very barebones JavaScript framework to enforce best practices like name-spacing and modular separation.
|
6
|
+
|
7
|
+
h2. Installation
|
8
|
+
|
9
|
+
You can install Ninjs using RubyGems. This is the easiest way of installing and recommended for most users.
|
10
|
+
<pre name="code" class="brush: sh;">$ gem install ninjs</pre>
|
11
|
+
|
12
|
+
If you want to use the development code you should clone the Git repository and add the binary to your path:
|
13
|
+
<pre name="code" class="brush: sh">$ git clone git://github.com/textnotspeech/ninjs.git
|
14
|
+
$ export PATH=/path/to/ninjs/bin:$PATH
|
15
|
+
</pre>
|
16
|
+
|
17
|
+
h1. Create a Ninjs application
|
18
|
+
|
19
|
+
<pre name="code" class="brush: sh;">$ ninjs create MyApplication</pre>
|
20
|
+
|
21
|
+
This will create a Ninjs application in the current working directory. Now we can create Ninjs modules by adding them in the modules directory.
|
22
|
+
|
23
|
+
h1. Create a Ninjs module
|
24
|
+
|
25
|
+
Create a module file in the /modules directory. By convention, we'll name the file with a suffix of .module. An example of a module named login would look like this:
|
26
|
+
|
27
|
+
/modules/login.module.js
|
28
|
+
|
29
|
+
The basic functionality of a module is to encapsulate code into logical container. Think of a module as a class in the sense that it allows to name-space properties and methods. A Ninjs module is an extremely lightweight object that contains a very simple api which helps you write clear, concise code. The following is the bare minimum you need to have a working module a.k.a Ninjs' "Hello World":
|
30
|
+
|
31
|
+
<pre name="code" class="brush: js;">
|
32
|
+
MyApplication.add_module('login');
|
33
|
+
|
34
|
+
MyApplication.login.actions = function() {
|
35
|
+
alert('Hello World');
|
36
|
+
};
|
37
|
+
|
38
|
+
MyApplication.login.run();
|
39
|
+
</pre>
|
40
|
+
|
41
|
+
In the real world however, you're probably waiting for the DOM to load before you want your
|
data/bin/ninjs
CHANGED
@@ -0,0 +1,52 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
$: << File.expand_path(File.join(File.dirname(__FILE__), "../lib"))
|
4
|
+
|
5
|
+
begin
|
6
|
+
require 'rubikon'
|
7
|
+
require 'ninjs'
|
8
|
+
rescue LoadError
|
9
|
+
require 'rubygems'
|
10
|
+
require 'rubikon'
|
11
|
+
require 'ninjs'
|
12
|
+
end
|
13
|
+
|
14
|
+
class NinjsConsole < Rubikon::Application::Base
|
15
|
+
def initialize
|
16
|
+
@directory = '/'
|
17
|
+
end
|
18
|
+
|
19
|
+
option :version
|
20
|
+
option :v => :version
|
21
|
+
default do
|
22
|
+
if version.given?
|
23
|
+
time = Time.now
|
24
|
+
copyright_year = time.year == 2010 ? '2010' : '2010-' << time.year
|
25
|
+
puts 'ninjs ' << Ninjs.version
|
26
|
+
puts "Copyright (c) #{copyright_year} Dayton Nolan"
|
27
|
+
puts "Released under the MIT License"
|
28
|
+
else
|
29
|
+
Ninjs::Command.help
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
command :compile do
|
34
|
+
Ninjs::Command.compile
|
35
|
+
end
|
36
|
+
|
37
|
+
command :watch do
|
38
|
+
Ninjs::Command.watch
|
39
|
+
end
|
40
|
+
|
41
|
+
command :import do
|
42
|
+
Ninjs::Command.import
|
43
|
+
end
|
44
|
+
|
45
|
+
option :directory, [:dir] do
|
46
|
+
@directory = dir
|
47
|
+
end
|
48
|
+
option :p => :directory
|
49
|
+
command :create, [:app_name] do
|
50
|
+
Ninjs::Command.create(app_name, @directory)
|
51
|
+
end
|
52
|
+
end
|
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ninjs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 59
|
4
5
|
prerelease: false
|
5
6
|
segments:
|
6
7
|
- 0
|
8
|
+
- 9
|
7
9
|
- 0
|
8
|
-
|
9
|
-
version: 0.0.0
|
10
|
+
version: 0.9.0
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- Dayton Nolan
|
@@ -25,6 +26,7 @@ dependencies:
|
|
25
26
|
requirements:
|
26
27
|
- - ">="
|
27
28
|
- !ruby/object:Gem::Version
|
29
|
+
hash: 3
|
28
30
|
segments:
|
29
31
|
- 0
|
30
32
|
version: "0"
|
@@ -38,6 +40,7 @@ dependencies:
|
|
38
40
|
requirements:
|
39
41
|
- - ">="
|
40
42
|
- !ruby/object:Gem::Version
|
43
|
+
hash: 3
|
41
44
|
segments:
|
42
45
|
- 0
|
43
46
|
version: "0"
|
@@ -51,6 +54,7 @@ dependencies:
|
|
51
54
|
requirements:
|
52
55
|
- - ">="
|
53
56
|
- !ruby/object:Gem::Version
|
57
|
+
hash: 3
|
54
58
|
segments:
|
55
59
|
- 0
|
56
60
|
version: "0"
|
@@ -64,6 +68,7 @@ dependencies:
|
|
64
68
|
requirements:
|
65
69
|
- - ">="
|
66
70
|
- !ruby/object:Gem::Version
|
71
|
+
hash: 3
|
67
72
|
segments:
|
68
73
|
- 0
|
69
74
|
version: "0"
|
@@ -80,7 +85,7 @@ extra_rdoc_files: []
|
|
80
85
|
files:
|
81
86
|
- bin/ninjs
|
82
87
|
- LICENSE
|
83
|
-
- README
|
88
|
+
- README.textile
|
84
89
|
has_rdoc: true
|
85
90
|
homepage: http://textnotspeech.github.com/ninjs/
|
86
91
|
licenses: []
|
@@ -95,6 +100,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
95
100
|
requirements:
|
96
101
|
- - ">="
|
97
102
|
- !ruby/object:Gem::Version
|
103
|
+
hash: 3
|
98
104
|
segments:
|
99
105
|
- 0
|
100
106
|
version: "0"
|
@@ -103,6 +109,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
103
109
|
requirements:
|
104
110
|
- - ">="
|
105
111
|
- !ruby/object:Gem::Version
|
112
|
+
hash: 3
|
106
113
|
segments:
|
107
114
|
- 0
|
108
115
|
version: "0"
|
data/README
DELETED
File without changes
|