architecture-js 0.6.0 → 0.6.1

Sign up to get free protection for your applications and to get access to all the features.
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 1.9.3-p448
data/.travis.yml CHANGED
@@ -1 +1,2 @@
1
- rvm: 1.9.2
1
+ language: ruby
2
+ rvm: 1.9.3
data/Gemfile CHANGED
@@ -1,17 +1,19 @@
1
- source :rubygems
1
+ source "https://rubygems.org"
2
2
 
3
3
  gem "listen"
4
4
  gem "ejs"
5
- gem "jsmin", "~> 1.0.1"
5
+ gem "jsmin"
6
6
 
7
7
  group :test do
8
- gem "simplecov", "~> 0.5.4", :require => false
9
- gem 'rb-fsevent', :require => false if RUBY_PLATFORM =~ /darwin/i
8
+ gem "simplecov"
9
+ gem 'rb-fsevent'
10
10
  gem 'guard-rspec'
11
11
  end
12
12
 
13
13
  group :development do
14
- gem "rspec", "~> 2.8.0"
14
+ gem "rspec"
15
+ gem "nyan-cat-formatter"
16
+ gem "unicorn-formatter"
15
17
  gem "bundler"
16
- gem "jeweler", "~> 1.8.3"
18
+ gem "jeweler"
17
19
  end
data/Gemfile.lock CHANGED
@@ -1,48 +1,101 @@
1
1
  GEM
2
- remote: http://rubygems.org/
2
+ remote: https://rubygems.org/
3
3
  specs:
4
- diff-lcs (1.1.3)
4
+ addressable (2.3.5)
5
+ builder (3.2.2)
6
+ celluloid (0.15.2)
7
+ timers (~> 1.1.0)
8
+ coderay (1.1.0)
9
+ diff-lcs (1.2.5)
10
+ docile (1.1.0)
5
11
  ejs (1.1.1)
6
- ffi (1.0.11)
7
- git (1.2.5)
8
- guard (1.2.1)
9
- listen (>= 0.4.2)
10
- thor (>= 0.14.6)
11
- guard-rspec (1.1.0)
12
- guard (>= 1.1)
13
- jeweler (1.8.4)
12
+ faraday (0.8.8)
13
+ multipart-post (~> 1.2.0)
14
+ ffi (1.9.3)
15
+ formatador (0.2.4)
16
+ git (1.2.6)
17
+ github_api (0.10.1)
18
+ addressable
19
+ faraday (~> 0.8.1)
20
+ hashie (>= 1.2)
21
+ multi_json (~> 1.4)
22
+ nokogiri (~> 1.5.2)
23
+ oauth2
24
+ guard (2.2.3)
25
+ formatador (>= 0.2.4)
26
+ listen (~> 2.1)
27
+ lumberjack (~> 1.0)
28
+ pry (>= 0.9.12)
29
+ thor (>= 0.18.1)
30
+ guard-rspec (4.0.4)
31
+ guard (>= 2.1.1)
32
+ rspec (~> 2.14)
33
+ hashie (2.0.5)
34
+ highline (1.6.20)
35
+ httpauth (0.2.0)
36
+ jeweler (1.8.8)
37
+ builder
14
38
  bundler (~> 1.0)
15
39
  git (>= 1.2.5)
40
+ github_api (= 0.10.1)
41
+ highline (>= 1.6.15)
42
+ nokogiri (= 1.5.10)
16
43
  rake
17
44
  rdoc
18
45
  jsmin (1.0.1)
19
- json (1.7.3)
20
- listen (0.4.7)
21
- rb-fchange (~> 0.0.5)
22
- rb-fsevent (~> 0.9.1)
23
- rb-inotify (~> 0.8.8)
24
- multi_json (1.0.4)
25
- rake (0.9.2.2)
26
- rb-fchange (0.0.5)
27
- ffi
28
- rb-fsevent (0.9.1)
29
- rb-inotify (0.8.8)
46
+ json (1.8.1)
47
+ jwt (0.1.8)
48
+ multi_json (>= 1.5)
49
+ listen (2.2.0)
50
+ celluloid (>= 0.15.2)
51
+ rb-fsevent (>= 0.9.3)
52
+ rb-inotify (>= 0.9)
53
+ lockfile (2.1.0)
54
+ lumberjack (1.0.4)
55
+ method_source (0.8.2)
56
+ multi_json (1.8.2)
57
+ multi_xml (0.5.5)
58
+ multipart-post (1.2.0)
59
+ nokogiri (1.5.10)
60
+ nyan-cat-formatter (0.5.2)
61
+ rspec (>= 2.13)
62
+ oauth2 (0.9.2)
63
+ faraday (~> 0.8)
64
+ httpauth (~> 0.2)
65
+ jwt (~> 0.1.4)
66
+ multi_json (~> 1.0)
67
+ multi_xml (~> 0.5)
68
+ rack (~> 1.2)
69
+ pry (0.9.12.3)
70
+ coderay (~> 1.0)
71
+ method_source (~> 0.8)
72
+ slop (~> 3.4)
73
+ rack (1.5.2)
74
+ rake (10.1.0)
75
+ rb-fsevent (0.9.3)
76
+ rb-inotify (0.9.2)
30
77
  ffi (>= 0.5.0)
31
- rdoc (3.12)
78
+ rdoc (4.0.1)
32
79
  json (~> 1.4)
33
- rspec (2.8.0)
34
- rspec-core (~> 2.8.0)
35
- rspec-expectations (~> 2.8.0)
36
- rspec-mocks (~> 2.8.0)
37
- rspec-core (2.8.0)
38
- rspec-expectations (2.8.0)
39
- diff-lcs (~> 1.1.2)
40
- rspec-mocks (2.8.0)
41
- simplecov (0.5.4)
42
- multi_json (~> 1.0.3)
43
- simplecov-html (~> 0.5.3)
44
- simplecov-html (0.5.3)
45
- thor (0.15.4)
80
+ rspec (2.14.1)
81
+ rspec-core (~> 2.14.0)
82
+ rspec-expectations (~> 2.14.0)
83
+ rspec-mocks (~> 2.14.0)
84
+ rspec-core (2.14.7)
85
+ rspec-expectations (2.14.4)
86
+ diff-lcs (>= 1.1.3, < 2.0)
87
+ rspec-mocks (2.14.4)
88
+ simplecov (0.8.1)
89
+ docile (~> 1.1.0)
90
+ lockfile (>= 2.1.0)
91
+ multi_json
92
+ simplecov-html (~> 0.8.0)
93
+ simplecov-html (0.8.0)
94
+ slop (3.4.7)
95
+ thor (0.18.1)
96
+ timers (1.1.0)
97
+ unicorn-formatter (0.1.3)
98
+ rspec
46
99
 
47
100
  PLATFORMS
48
101
  ruby
@@ -51,9 +104,11 @@ DEPENDENCIES
51
104
  bundler
52
105
  ejs
53
106
  guard-rspec
54
- jeweler (~> 1.8.3)
55
- jsmin (~> 1.0.1)
107
+ jeweler
108
+ jsmin
56
109
  listen
110
+ nyan-cat-formatter
57
111
  rb-fsevent
58
- rspec (~> 2.8.0)
59
- simplecov (~> 0.5.4)
112
+ rspec
113
+ simplecov
114
+ unicorn-formatter
data/LICENSE.txt CHANGED
@@ -1,20 +1,202 @@
1
- Copyright (c) 2011 Dayton 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
-
14
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
data/README.md CHANGED
@@ -12,24 +12,20 @@ ArchitectureJS is javascript build tool that helps you create and manage large-s
12
12
  * Realtime file monitoring utility to compile your application while you code
13
13
 
14
14
  ## Installation
15
- Requires ruby version 1.9 or higher. The best way is using rubygems:
15
+ Requires ruby version 1.9 or higher. Using rubygems:
16
16
 
17
17
  gem install architecture-js
18
18
 
19
- Or include it in your projects `Gemfile` with Bundler:
20
-
21
- gem 'architecture-js', '~> 0.2.0'
22
-
23
19
  ## Getting Started
24
20
  ArchitectureJS comes with a small command line utility named `architect` to manage your architecture projects. To be sure architecture-js is installed correctly, type this command:
25
21
 
26
22
  architect -h
27
23
 
28
- If `architect` is installed, you should see the help menu. There are only a few simple commands: create, compile, watch, and generate. These commands are all you need to manage your architecture projects.
24
+ If `architect` is installed, you should see the help menu. There are only a few simple commands: create, compile, and watch. These commands are all you need to manage your architecture projects.
29
25
 
30
26
  To create an architect application use the create command (where "myapp" is the name of _your_ application)
31
27
 
32
- architect create myapp
28
+ architect create MyApp
33
29
 
34
30
  This will create the default project scaffold:
35
31
 
@@ -42,22 +38,24 @@ This will create the default project scaffold:
42
38
  ## Default Configurtaion
43
39
  The `myapp.blueprint` file is the configuration file for your project. The default config file looks something like this
44
40
 
45
- blueprint: default
46
- src_dir: src
47
- build_dir: lib
48
- asset_root: ../
49
- output: compressed
50
- name: myapp
41
+ blueprint: default
42
+ src_dir: src
43
+ build_dir: lib
44
+ asset_root: ../
45
+ output: compressed
46
+ template_dir: templates
47
+ template_namespace: templates
48
+ name: MyApp
51
49
 
52
50
  ### blueprint
53
- The project's `blueprint` is the scaffolding framework your application is based on. The default blueprint is `default` which is a bare bones layout for simple javascript libraries. It has one directory for source files (src), and a build directory named "lib" for distributable code. Other blueprints can be plugged in to support other architectures. These blueprints extend the basic project template and can have their own templates, compilation tasks, and project scaffolding. Third party blueprints may have many of their own properties and layouts, but all ArchitectureJS projects will share this same core properties contained in this default blueprint.
51
+ The project's `blueprint` is the framework your application is based on. The default blueprint is `default` which is a bare bones layout useful for simple javascript libraries (ie. underscore.js, backbone.js). Other blueprints can be used to support any application architecture you prefer. Blueprints are simple `Ruby` classes which extend the basic blueprint. Custom blueprints can have unique properties and scaffolding, but all ArchitectureJS projects will share this same core properties contained in this default blueprint (even if they are not used).
54
52
 
55
53
  ### src_dir
56
- The `src_dir` is the directory or directories where the source files to be compiled into the `build_dir` are kept. By default the `src_dir` is usually a single directory represented as a string:
54
+ The `src_dir` is the target path or paths where `architect` will search for files to be compiled. By default the `src_dir` is usually a single directory represented as a string:
57
55
 
58
56
  src_dir: src
59
57
 
60
- However the src_dir can be multiple directories. To compile the files in the three directories named "classes", "widgets", and "plugins", src_dir would be an array:
58
+ However the src_dir can be multiple paths. To search for source files in three directories named "classes", "widgets", and "plugins", `src_dir` would be an array:
61
59
 
62
60
  src_dir: [classes, widgets, plugins]
63
61
 
@@ -65,7 +63,7 @@ However the src_dir can be multiple directories. To compile the files in the thr
65
63
  Any files in these three directories would be compiled into the build directory, including their requirements.
66
64
 
67
65
  ### build_dir
68
- The `build_dir` is where all your source files will be compiled.
66
+ The `build_dir` is where all source files will be compiled.
69
67
 
70
68
  ### asset_root
71
69
  The `asset_root` is where stylesheet and image assets will be installed by the `//= provide` directive. By default the `asset_root` is the project root. Stylesheets and images will be placed in css and images directories respectively.
@@ -75,7 +73,64 @@ The `asset_root` is where stylesheet and image assets will be installed by the `
75
73
  The `output` determines whether the compiled javascript will be `compressed` or `expanded`, which are the two possible values. The JSMin engine is used for compression.
76
74
 
77
75
  ### name
78
- The `name` is the name of your architecture project. The name value can be used by the blueprint in a variety of ways. By default the name is used to create the main application file in the /src directory.
76
+ The `name` is the name of your architecture project. The name value can be used by the blueprint in a variety of ways. By default the name is used to create the main application file in the /src directory (in lowercase).
77
+
78
+ <a id="compilation"></a>
79
+ ## Compilation
80
+
81
+ ### compile
82
+ You can compile your architecture project manually with the compile command:
83
+
84
+ architect compile
85
+
86
+ This will get the requirements of every file in your `src_dir`(s) and compile them into your `build_dir` using the settings found in the `.blueprint` file in the current directory.
87
+
88
+ <a id="watch"></a>
89
+ ### watch
90
+
91
+ Having to do this manually every time you change a file and want to see it in your browser is a pain in the ass. Using the `watch` command is probably the only way you'll want to develop an ArchitectureJS project:
92
+
93
+ architect watch
94
+
95
+ 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.
96
+
97
+ <a id="templates"></a>
98
+ ## Templates
99
+
100
+ The ArchitectureJS templating system is designed to let you organize your javascript templates on the file system however you like. ArchitectureJS uses the ruby-ejs gem to automatically compile your template files into your application.
101
+
102
+ By default, ArchitectureJS searches for templates in the blueprint's template_dir. Any file with a .jst extension will be compiled into your application as a [JST](http://code.google.com/p/trimpath/wiki/JavaScriptTemplates) template function under your blueprint's `template_namespace`. For example with the following project structure:
103
+
104
+ * lib
105
+ * myapp.blueprint
106
+ * src
107
+ * myapp.js
108
+ * templates
109
+ * my_template.jst
110
+ * another_template.jst
111
+
112
+ Given the following configuration, when the application is compiled, the templates will be compiled into the build_dir (/lib) in a file named templates.js:
113
+
114
+ blueprint: default
115
+ src_dir: src
116
+ build_dir: lib
117
+ asset_root: ../
118
+ output: compressed
119
+ template_dir: templates
120
+ template_namespace: templates
121
+ name: MyApp
122
+
123
+ ArchitectureJS will create a template file like this:
124
+
125
+ ```js
126
+ MyApp.templates = {
127
+ "my_template": /* compiled jst template function */,
128
+ "another_template": /* compiled jst template function */
129
+ };
130
+ ```
131
+
132
+ You can then include the `[build_dir]/templates.js` file directly in your html or use `//= require` in your application file. This allows you to treat templates as individual files, while seamlessly providing template methods to render your templates within your application.
133
+
79
134
 
80
135
  <a id="sprockets"></a>
81
136
  ## Sprockets
@@ -140,80 +195,6 @@ ArchitectureJS automatically sets up Sprockets' `load_path` to include your proj
140
195
  //= require <jquery-1.7.1>
141
196
  ```
142
197
 
143
- ## Compilation
144
-
145
- ### compile
146
- You can compile your architecture project manually with the compile command:
147
-
148
- architect compile
149
-
150
- This will get the requirements of every file in your `src_dir`(s) and compile them into your `build_dir` using the settings found in the `.blueprint` file in the current directory.
151
-
152
- <a id="watch"></a>
153
- ### watch
154
-
155
- Having to do this manually every time you change a file and want to see it in your browser is a pain in the ass. Using the `watch` command is probably the only way you'll want to develop an ArchitectureJS project:
156
-
157
- architect watch
158
-
159
- 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.
160
-
161
- ## Scaffolds
162
-
163
- 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.
164
-
165
- ### generate
166
- 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`:
167
-
168
- architect generate blank test
169
-
170
- 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:
171
-
172
- architect generate class widget
173
-
174
- 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:
175
-
176
- ```ruby
177
- <%= options[:name] %> = (function() {
178
- <% if options[:f] %>
179
- function <%= options[:name] %>() {};
180
- return new <%= options[:name] %>();
181
- <% else %>
182
- var <%= options[:name] %> = function() {};
183
- return <%= options[:name] %>;
184
- <% end %>
185
- })();
186
- ```
187
-
188
- 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:
189
-
190
- architect generate class widget --name "Foo"
191
-
192
- Which would create:
193
-
194
- ```js
195
- Foo = (function() {
196
- var Foo = function() {};
197
- return Foo;
198
- })();
199
- ```
200
-
201
- We can generate a slightly different class template using the -f flag:
202
-
203
- architect generate class widget --name "Foo" -f
204
-
205
- Which generates:
206
-
207
- ```js
208
- Foo = (function() {
209
- function Foo() {};
210
- return new Foo();
211
- })();
212
- ```
213
-
214
- This is obviously a contrived but not wholly unrealistic example of how you can use the architect template generator. Some blueprints contain default templates of their own which are available without the presence of a `/templates` folder. These templates should be documented by the blueprint's authors.
215
-
216
-
217
198
  ##Contributing to architecture.js
218
199
 
219
200
  * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
@@ -227,5 +208,4 @@ This is obviously a contrived but not wholly unrealistic example of how you can
227
208
  ##Copyright
228
209
 
229
210
  Copyright (c) 2011 Dayton Nolan. See LICENSE.txt for
230
- further details.
231
-
211
+ further details.
data/Rakefile CHANGED
@@ -10,7 +10,6 @@ end
10
10
  require 'rake'
11
11
  require 'jeweler'
12
12
  Jeweler::Tasks.new do |gem|
13
- # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
14
13
  gem.name = "architecture-js"
15
14
  gem.homepage = "https://github.com/daytonn/architecture-js"
16
15
  gem.license = "MIT"
@@ -18,11 +17,8 @@ Jeweler::Tasks.new do |gem|
18
17
  gem.description = %Q{Architecture.js helps you generate scaffolding, manage third-party packages, compile, and compress your application.}
19
18
  gem.email = "daytonn@gmail.com"
20
19
  gem.authors = ["Dayton Nolan"]
21
- # Include your dependencies below. Runtime dependencies are required when using your gem,
22
- # and development dependencies are only needed for development (ie running rake tasks, tests, etc)
23
20
  gem.add_runtime_dependency 'jsmin'
24
21
  gem.add_runtime_dependency 'listen'
25
- # gem.add_development_dependency 'rspec', '> 1.2.3'
26
22
  end
27
23
  Jeweler::RubygemsDotOrgTasks.new
28
24
 
@@ -47,4 +43,4 @@ Rake::RDocTask.new do |rdoc|
47
43
  rdoc.title = "architecture-js #{version}"
48
44
  rdoc.rdoc_files.include('README*')
49
45
  rdoc.rdoc_files.include('lib/**/*.rb')
50
- end
46
+ end
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.6.0
1
+ 0.6.1
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "architecture-js"
8
- s.version = "0.6.0"
8
+ s.version = "0.6.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Dayton Nolan"]
12
- s.date = "2012-07-01"
12
+ s.date = "2013-11-16"
13
13
  s.description = "Architecture.js helps you generate scaffolding, manage third-party packages, compile, and compress your application."
14
14
  s.email = "daytonn@gmail.com"
15
15
  s.executables = ["architect"]
@@ -20,7 +20,7 @@ Gem::Specification.new do |s|
20
20
  s.files = [
21
21
  ".DS_Store",
22
22
  ".document",
23
- ".rvmrc",
23
+ ".ruby-version",
24
24
  ".travis.yml",
25
25
  "AUTHORS",
26
26
  "Gemfile",
@@ -114,12 +114,13 @@ Gem::Specification.new do |s|
114
114
  "spec/notification_spec.rb",
115
115
  "spec/spec_helper.rb",
116
116
  "spec/templates_spec.rb",
117
- "templates/templates_file.erb"
117
+ "templates/templates_file.erb",
118
+ "travis.yml"
118
119
  ]
119
120
  s.homepage = "https://github.com/daytonn/architecture-js"
120
121
  s.licenses = ["MIT"]
121
122
  s.require_paths = ["lib"]
122
- s.rubygems_version = "1.8.24"
123
+ s.rubygems_version = "1.8.23"
123
124
  s.summary = "architecture.js is a command line application to dynamically build and manage complex javascript applications."
124
125
 
125
126
  if s.respond_to? :specification_version then
@@ -128,29 +129,35 @@ Gem::Specification.new do |s|
128
129
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
129
130
  s.add_runtime_dependency(%q<listen>, [">= 0"])
130
131
  s.add_runtime_dependency(%q<ejs>, [">= 0"])
131
- s.add_runtime_dependency(%q<jsmin>, ["~> 1.0.1"])
132
- s.add_development_dependency(%q<rspec>, ["~> 2.8.0"])
132
+ s.add_runtime_dependency(%q<jsmin>, [">= 0"])
133
+ s.add_development_dependency(%q<rspec>, [">= 0"])
134
+ s.add_development_dependency(%q<nyan-cat-formatter>, [">= 0"])
135
+ s.add_development_dependency(%q<unicorn-formatter>, [">= 0"])
133
136
  s.add_development_dependency(%q<bundler>, [">= 0"])
134
- s.add_development_dependency(%q<jeweler>, ["~> 1.8.3"])
137
+ s.add_development_dependency(%q<jeweler>, [">= 0"])
135
138
  s.add_runtime_dependency(%q<jsmin>, [">= 0"])
136
139
  s.add_runtime_dependency(%q<listen>, [">= 0"])
137
140
  else
138
141
  s.add_dependency(%q<listen>, [">= 0"])
139
142
  s.add_dependency(%q<ejs>, [">= 0"])
140
- s.add_dependency(%q<jsmin>, ["~> 1.0.1"])
141
- s.add_dependency(%q<rspec>, ["~> 2.8.0"])
143
+ s.add_dependency(%q<jsmin>, [">= 0"])
144
+ s.add_dependency(%q<rspec>, [">= 0"])
145
+ s.add_dependency(%q<nyan-cat-formatter>, [">= 0"])
146
+ s.add_dependency(%q<unicorn-formatter>, [">= 0"])
142
147
  s.add_dependency(%q<bundler>, [">= 0"])
143
- s.add_dependency(%q<jeweler>, ["~> 1.8.3"])
148
+ s.add_dependency(%q<jeweler>, [">= 0"])
144
149
  s.add_dependency(%q<jsmin>, [">= 0"])
145
150
  s.add_dependency(%q<listen>, [">= 0"])
146
151
  end
147
152
  else
148
153
  s.add_dependency(%q<listen>, [">= 0"])
149
154
  s.add_dependency(%q<ejs>, [">= 0"])
150
- s.add_dependency(%q<jsmin>, ["~> 1.0.1"])
151
- s.add_dependency(%q<rspec>, ["~> 2.8.0"])
155
+ s.add_dependency(%q<jsmin>, [">= 0"])
156
+ s.add_dependency(%q<rspec>, [">= 0"])
157
+ s.add_dependency(%q<nyan-cat-formatter>, [">= 0"])
158
+ s.add_dependency(%q<unicorn-formatter>, [">= 0"])
152
159
  s.add_dependency(%q<bundler>, [">= 0"])
153
- s.add_dependency(%q<jeweler>, ["~> 1.8.3"])
160
+ s.add_dependency(%q<jeweler>, [">= 0"])
154
161
  s.add_dependency(%q<jsmin>, [">= 0"])
155
162
  s.add_dependency(%q<listen>, [">= 0"])
156
163
  end
@@ -7,9 +7,8 @@ module ArchitectureJS
7
7
  @project = project
8
8
  @listener = Listen.to(@project.root)
9
9
  @listener.ignore(/#{@project.config[:build_dir]}/)
10
- .filter(/\.jst?$|\.blueprint$/)
11
10
  .change do |modified, added, removed|
12
- update_files(modified, "modified") if modified.length > 0
11
+ update_files(modified, "modified") if modified.length > 0
13
12
  update_files(added, "added") if added.length > 0
14
13
  update_files(removed, "deleted") if removed.length > 0
15
14
  end
@@ -43,4 +42,4 @@ module ArchitectureJS
43
42
  end
44
43
 
45
44
  end
46
- end
45
+ end
data/travis.yml ADDED
@@ -0,0 +1,3 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.9.3
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.6.0
4
+ version: 0.6.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-07-01 00:00:00.000000000 Z
12
+ date: 2013-11-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: listen
@@ -48,33 +48,65 @@ dependencies:
48
48
  requirement: !ruby/object:Gem::Requirement
49
49
  none: false
50
50
  requirements:
51
- - - ~>
51
+ - - ! '>='
52
52
  - !ruby/object:Gem::Version
53
- version: 1.0.1
53
+ version: '0'
54
54
  type: :runtime
55
55
  prerelease: false
56
56
  version_requirements: !ruby/object:Gem::Requirement
57
57
  none: false
58
58
  requirements:
59
- - - ~>
59
+ - - ! '>='
60
60
  - !ruby/object:Gem::Version
61
- version: 1.0.1
61
+ version: '0'
62
62
  - !ruby/object:Gem::Dependency
63
63
  name: rspec
64
64
  requirement: !ruby/object:Gem::Requirement
65
65
  none: false
66
66
  requirements:
67
- - - ~>
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ type: :development
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ - !ruby/object:Gem::Dependency
79
+ name: nyan-cat-formatter
80
+ requirement: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ! '>='
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
86
+ type: :development
87
+ prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
+ - !ruby/object:Gem::Dependency
95
+ name: unicorn-formatter
96
+ requirement: !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ! '>='
68
100
  - !ruby/object:Gem::Version
69
- version: 2.8.0
101
+ version: '0'
70
102
  type: :development
71
103
  prerelease: false
72
104
  version_requirements: !ruby/object:Gem::Requirement
73
105
  none: false
74
106
  requirements:
75
- - - ~>
107
+ - - ! '>='
76
108
  - !ruby/object:Gem::Version
77
- version: 2.8.0
109
+ version: '0'
78
110
  - !ruby/object:Gem::Dependency
79
111
  name: bundler
80
112
  requirement: !ruby/object:Gem::Requirement
@@ -96,17 +128,17 @@ dependencies:
96
128
  requirement: !ruby/object:Gem::Requirement
97
129
  none: false
98
130
  requirements:
99
- - - ~>
131
+ - - ! '>='
100
132
  - !ruby/object:Gem::Version
101
- version: 1.8.3
133
+ version: '0'
102
134
  type: :development
103
135
  prerelease: false
104
136
  version_requirements: !ruby/object:Gem::Requirement
105
137
  none: false
106
138
  requirements:
107
- - - ~>
139
+ - - ! '>='
108
140
  - !ruby/object:Gem::Version
109
- version: 1.8.3
141
+ version: '0'
110
142
  - !ruby/object:Gem::Dependency
111
143
  name: jsmin
112
144
  requirement: !ruby/object:Gem::Requirement
@@ -151,7 +183,7 @@ extra_rdoc_files:
151
183
  files:
152
184
  - .DS_Store
153
185
  - .document
154
- - .rvmrc
186
+ - .ruby-version
155
187
  - .travis.yml
156
188
  - AUTHORS
157
189
  - Gemfile
@@ -246,6 +278,7 @@ files:
246
278
  - spec/spec_helper.rb
247
279
  - spec/templates_spec.rb
248
280
  - templates/templates_file.erb
281
+ - travis.yml
249
282
  homepage: https://github.com/daytonn/architecture-js
250
283
  licenses:
251
284
  - MIT
@@ -261,7 +294,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
261
294
  version: '0'
262
295
  segments:
263
296
  - 0
264
- hash: 278530094311869968
297
+ hash: 4111059795836270419
265
298
  required_rubygems_version: !ruby/object:Gem::Requirement
266
299
  none: false
267
300
  requirements:
@@ -270,7 +303,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
270
303
  version: '0'
271
304
  requirements: []
272
305
  rubyforge_project:
273
- rubygems_version: 1.8.24
306
+ rubygems_version: 1.8.23
274
307
  signing_key:
275
308
  specification_version: 3
276
309
  summary: architecture.js is a command line application to dynamically build and manage
data/.rvmrc DELETED
@@ -1 +0,0 @@
1
- rvm use 1.9.2-p290@arcjs --create