architecture-js 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +45 -5
- data/VERSION +1 -1
- data/architecture-js.gemspec +1 -1
- data/lib/architecture-js/generator.rb +1 -1
- metadata +20 -20
data/README.md
CHANGED
@@ -157,21 +157,61 @@ Having to do this manually every time you change a file and want to see it in yo
|
|
157
157
|
|
158
158
|
This will watch the project directory and compile the project every time a file changes. Even rather large applications compile instantly, so you can work without ever having to wait for it to build.
|
159
159
|
|
160
|
-
<a id="scaffolds"></a>
|
161
160
|
## Scaffolds
|
162
161
|
|
162
|
+
The ArchitectureJS scaffolding allows you to generate custom script templates dynamically. This system is a great way to share common boilerplate code in one easy to maintain place.
|
163
|
+
|
163
164
|
### generate
|
164
165
|
The `generate` command will create a new file based on a predefined template. Default template files are defined by the blueprint the project is using. The `default` blueprint only has one template named `blank`:
|
165
166
|
|
166
167
|
architect generate blank test
|
167
168
|
|
168
|
-
This will create a blank javascript file in the current directory. This doesn't really do much, the only reason it's there is
|
169
|
+
This will create a blank javascript file named `test.js` in the current directory. This doesn't really do much, the only reason it's there is to test the template generator. However, You can add your own templates by putting files inside a `/templates` directory inside your project root. For example, if you created a `/templates/class.js` file, you could generate a class template with the following command:
|
170
|
+
|
171
|
+
architect generate class widget
|
172
|
+
|
173
|
+
This would create a file named `widget.js` in the current directory based on the contents of `/templates/class.js`. At this point the file is just an empty file. Let's make a more practical template. We'll edit the `class.js` template to take advantage of the command line options:
|
174
|
+
|
175
|
+
```ruby
|
176
|
+
<%= options[:name] %> = (function() {
|
177
|
+
<% if options[:f] %>
|
178
|
+
function <%= options[:name] %>() {};
|
179
|
+
return new <%= options[:name] %>();
|
180
|
+
<% else %>
|
181
|
+
var <%= options[:name] %> = function() {};
|
182
|
+
return <%= options[:name] %>;
|
183
|
+
<% end %>
|
184
|
+
})();
|
185
|
+
```
|
186
|
+
|
187
|
+
The syntax may be a little strange if you've never worked with ERB but this template gives us a great way to generate template files via the command line with `architect`. There are two types of variable you can pass to a template via the generate command: named variables and flags. Named variables allow you to set variables with values. To pass a named variable you use the double dash syntax `architect generate class widget --name "Widget"`, passing the value as the next argument. Flags are simple boolean switches that turn on a flag. To pass a flag, use the single dash syntax `architect generate class widget -f`. All arguments passed will be available through the options variable in the template. Using the `class` template from above we can generate two basic class models using the command options:
|
188
|
+
|
189
|
+
architect generate class widget --name "Foo"
|
190
|
+
|
191
|
+
Which would create:
|
169
192
|
|
170
|
-
|
193
|
+
```js
|
194
|
+
Foo = (function() {
|
195
|
+
var Foo = function() {};
|
196
|
+
return Foo;
|
197
|
+
})();
|
198
|
+
```
|
199
|
+
|
200
|
+
We can generate a slightly different class template using the -f flag:
|
201
|
+
|
202
|
+
architect generate class widget --name "Foo" -f
|
203
|
+
|
204
|
+
Which generates:
|
205
|
+
|
206
|
+
```js
|
207
|
+
Foo = (function() {
|
208
|
+
function Foo() {};
|
209
|
+
return new Foo();
|
210
|
+
})();
|
211
|
+
```
|
171
212
|
|
172
|
-
This
|
213
|
+
This is a slightly contrived but not wholly unrealistic example of how you can use the architect template generator. Some blueprints contain default templates which work without the presence of a `/templates` folder.
|
173
214
|
|
174
|
-
<a id="package-management"></a>
|
175
215
|
## Package Management
|
176
216
|
_Not Yet Implemented_
|
177
217
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.1
|
data/architecture-js.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: architecture-js
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2012-02-21 00:00:00.000000000Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: fssm
|
16
|
-
requirement: &
|
16
|
+
requirement: &70211069072180 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 0.2.8.1
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70211069072180
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: jsmin
|
27
|
-
requirement: &
|
27
|
+
requirement: &70211069070900 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: 1.0.1
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70211069070900
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rspec
|
38
|
-
requirement: &
|
38
|
+
requirement: &70211069069380 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: 2.8.0
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70211069069380
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: bundler
|
49
|
-
requirement: &
|
49
|
+
requirement: &70211069067860 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ~>
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: 1.0.0
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70211069067860
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: jeweler
|
60
|
-
requirement: &
|
60
|
+
requirement: &70211069066260 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ~>
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: 1.8.3
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *70211069066260
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: ZenTest
|
71
|
-
requirement: &
|
71
|
+
requirement: &70211069056380 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ~>
|
@@ -76,10 +76,10 @@ dependencies:
|
|
76
76
|
version: 4.6.2
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *70211069056380
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: autotest-growl
|
82
|
-
requirement: &
|
82
|
+
requirement: &70211069054460 !ruby/object:Gem::Requirement
|
83
83
|
none: false
|
84
84
|
requirements:
|
85
85
|
- - ~>
|
@@ -87,10 +87,10 @@ dependencies:
|
|
87
87
|
version: 0.2.16
|
88
88
|
type: :development
|
89
89
|
prerelease: false
|
90
|
-
version_requirements: *
|
90
|
+
version_requirements: *70211069054460
|
91
91
|
- !ruby/object:Gem::Dependency
|
92
92
|
name: jsmin
|
93
|
-
requirement: &
|
93
|
+
requirement: &70211069052760 !ruby/object:Gem::Requirement
|
94
94
|
none: false
|
95
95
|
requirements:
|
96
96
|
- - ! '>='
|
@@ -98,10 +98,10 @@ dependencies:
|
|
98
98
|
version: '0'
|
99
99
|
type: :runtime
|
100
100
|
prerelease: false
|
101
|
-
version_requirements: *
|
101
|
+
version_requirements: *70211069052760
|
102
102
|
- !ruby/object:Gem::Dependency
|
103
103
|
name: fssm
|
104
|
-
requirement: &
|
104
|
+
requirement: &70211069047000 !ruby/object:Gem::Requirement
|
105
105
|
none: false
|
106
106
|
requirements:
|
107
107
|
- - ! '>='
|
@@ -109,7 +109,7 @@ dependencies:
|
|
109
109
|
version: '0'
|
110
110
|
type: :runtime
|
111
111
|
prerelease: false
|
112
|
-
version_requirements: *
|
112
|
+
version_requirements: *70211069047000
|
113
113
|
description: Architecture.js helps you generate scaffolding, manage third-party packages,
|
114
114
|
compile, and compress your application.
|
115
115
|
email: daytonn@gmail.com
|
@@ -223,7 +223,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
223
223
|
version: '0'
|
224
224
|
segments:
|
225
225
|
- 0
|
226
|
-
hash:
|
226
|
+
hash: -2723290340733350047
|
227
227
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
228
228
|
none: false
|
229
229
|
requirements:
|