architecture-js 0.1.16 → 0.1.17
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +155 -11
- data/Rakefile +0 -1
- data/VERSION +1 -1
- data/architecture-js.gemspec +7 -7
- data/{HELP → bin/HELP} +0 -0
- data/lib/architecture-js.rb +7 -7
- data/lib/architecture-js/architect.rb +10 -9
- data/lib/architecture-js/{project.rb → blueprint.rb} +9 -8
- data/lib/architecture-js/generator.rb +1 -1
- data/spec/architect_spec.rb +3 -3
- data/spec/architecture-js_spec.rb +3 -3
- data/spec/{project_spec.rb → blueprint_spec.rb} +10 -10
- data/spec/fixtures/compressed.architecture +1 -1
- data/spec/fixtures/existing.architecture +1 -1
- data/spec/fixtures/myapp.architecture +1 -1
- data/spec/fixtures/{test_framework.rb → test_blueprint.rb} +4 -4
- data/spec/fixtures/update.architecture +1 -1
- data/spec/generator_spec.rb +2 -2
- data/spec/spec_helper.rb +1 -1
- metadata +26 -25
data/README.md
CHANGED
@@ -1,33 +1,177 @@
|
|
1
1
|
# architecture-js [![Build Status](https://secure.travis-ci.org/daytonn/architecture-js.png)](http://travis-ci.org/daytonn/architecture-js)
|
2
2
|
|
3
3
|
##About
|
4
|
+
ArchitectureJS is a suite of tools to help you build and manage complex javascript applications and frameworks. With ArchitectureJS you can create project scaffolding, manage third-party and custom packages, compile, and compress your javascript application, all in real time as you write plain old vanilla javascript. In addition to large applications, ArchitectureJS is perfect for developing your own javascript frameworks and libraries. ArchitectureJS contains the following tools to help you build modern javascript applications and frameworks:
|
4
5
|
|
5
|
-
|
6
|
-
|
6
|
+
* Project-specific configuration to manage defaults and dependencies
|
7
7
|
* JavaScript Compiler (Sprockets 1.0.2)
|
8
|
-
* JavaScript
|
8
|
+
* JavaScript Compression (JSMin)
|
9
9
|
* Scaffold generation using editable templates
|
10
10
|
* Custom local JavaScript package management
|
11
11
|
* Realtime file monitoring utility to compile your application while you code
|
12
|
-
* Project-specific configuration to manage defaults and dependencies
|
13
12
|
|
14
13
|
## Installation
|
15
|
-
|
14
|
+
Requires ruby version 1.9 or higher. The best way is using rubygems:
|
16
15
|
|
17
16
|
gem install architecture-js
|
18
17
|
|
19
|
-
|
18
|
+
Or include it in your projects `Gemfile` with Bundler:
|
20
19
|
|
21
|
-
|
22
|
-
cd architecture-js
|
23
|
-
bundle
|
20
|
+
gem 'architecture-js', '~> 0.1.16'
|
24
21
|
|
25
22
|
## Getting Started
|
26
|
-
ArchitectureJS comes with a small command line utility named
|
23
|
+
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:
|
27
24
|
|
28
25
|
architect -h
|
29
26
|
|
30
|
-
If architect is installed, this command will display the help menu. You will see there are only a few simple commands: create, compile, watch, and generate
|
27
|
+
If `architect` is installed correctly, this command will display the help menu. You will see there are only a few simple commands: create, compile, watch, and generate _(not implemented)_. These commands are all you need to manage complex javascript applications and frameworks.
|
28
|
+
|
29
|
+
To create an architect application use the create command (where "myapp" is the name of _your_ application)
|
30
|
+
|
31
|
+
architect create myapp
|
32
|
+
|
33
|
+
This will create the default project scaffold:
|
34
|
+
|
35
|
+
/lib
|
36
|
+
/src/
|
37
|
+
myapp.js
|
38
|
+
myapp.architecture
|
39
|
+
|
40
|
+
<a id="configuration"></a>
|
41
|
+
## Default Configurtaion
|
42
|
+
The `myapp.architecture` file contains the configuration for your architecture project. These few simple settings will give you a great amount of control over the compilation of your project. The default config file looks something like this
|
43
|
+
|
44
|
+
blueprint: default
|
45
|
+
src_dir: src
|
46
|
+
build_dir: lib
|
47
|
+
asset_root: ../
|
48
|
+
output: compressed
|
49
|
+
name: myapp
|
50
|
+
|
51
|
+
### blueprint
|
52
|
+
The `blueprint` is what determines the application scaffold and configuration settings. It defaults to `default` which is a bare bones project 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 any architecture. These blueprints can extend the basic architecture project including the scaffolding, templates, compilation tasks, and default templates. All blueprints will share the default configuration options (although some blueprints may treat them differently).
|
53
|
+
|
54
|
+
### src_dir
|
55
|
+
The `src_dir` is the directory or directories where the source files that will be compiled into the build directory (`build_dir`) are kept. By default the `src_dir` is usually a single directory represented as a string:
|
56
|
+
|
57
|
+
src_dir: src
|
58
|
+
|
59
|
+
but can be multiple directories. If you wished to compile the files in the three directories named "classes", "widgets", and "plugins", src_dir would be an array:
|
60
|
+
|
61
|
+
src_dir: [classes, widgets, plugins]
|
62
|
+
|
63
|
+
|
64
|
+
Any files in these three directories would be compiled into the build directory, including their requirements.
|
65
|
+
|
66
|
+
### build_dir
|
67
|
+
The `build_dir` is where all your source files will be compiled, including their requirements.
|
68
|
+
|
69
|
+
### asset_root
|
70
|
+
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.
|
71
|
+
|
72
|
+
<a id="output"></a>
|
73
|
+
### output
|
74
|
+
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.
|
75
|
+
|
76
|
+
### name
|
77
|
+
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.
|
78
|
+
|
79
|
+
<a id="sprockets"></a>
|
80
|
+
## Sprockets
|
81
|
+
ArchitectureJS uses the Sprockets javascript compiler under the hood to allow you to create a file system architecture that corresponds to your application architecture. This is the heart of the ArchitectureJS system. In addition to concatenating scripts together with special comments, Sprockets can also include stylesheet and image assets required by script files. It has a basic syntax using javascript comments, gracefully enhancing plain old vanilla javascript.
|
82
|
+
|
83
|
+
Sprockets takes any number of source files and preprocesses them line-by-line in order to build a single concatenation. Specially formatted lines act as directives to the Sprockets preprocessor, telling it to require the contents of another file or library first or to provide a set of asset files to the document root. Sprockets attempts to fulfill required dependencies by searching a set of directories called the load path.
|
84
|
+
|
85
|
+
### Comments
|
86
|
+
Use single-line (`//`) comments in JavaScript source files for comments that don’t need to appear in the resulting concatenated output. Use multiple-line (`/* ... */`) comments for comments that should appear in the resulting concatenated output, like copyright notices or descriptive headers.
|
87
|
+
Comments beginning with `//=` are treated by Sprockets as directives. Sprockets currently understands two directives, `require` and `provide`.
|
88
|
+
|
89
|
+
### //= require
|
90
|
+
Use the `require` directive to tell Sprockets that another JavaScript source file should be inserted into the concatenation before continuing to preprocess the current source file. If the specified source file has already been required, Sprockets ignores the directive.
|
91
|
+
|
92
|
+
The format of a `require` directive determines how Sprockets looks for the dependent source file. If you place the name of the source file in angle brackets:
|
93
|
+
|
94
|
+
```js
|
95
|
+
//= require <prototype>
|
96
|
+
```
|
97
|
+
Sprockets will search your load path, in order, for a file named `prototype.js`, and begin preprocessing the first match it finds. (An error will be raised if a matching file can’t be found.) If you place the name of the source file in quotes:
|
98
|
+
|
99
|
+
```js
|
100
|
+
//= require "date_helper"
|
101
|
+
```
|
102
|
+
|
103
|
+
Sprockets will not search the load path, but will instead look for a file named `date_helper.js` in the same directory as the current source file. In general, it is a good idea to use quotes to refer to related files, and angle brackets to refer to packages, libraries, or third-party code that may live in a different location.
|
104
|
+
|
105
|
+
You can refer to files in subdirectories with the `require` directive. For example:
|
106
|
+
|
107
|
+
```js
|
108
|
+
//= require <behavior/hover_observer>
|
109
|
+
```
|
110
|
+
|
111
|
+
Sprockets will search the load path for a file named `hover_observer.js` in a directory named `behavior`.
|
112
|
+
|
113
|
+
### //= provide
|
114
|
+
Sometimes it is necessary to include associated stylesheets, images, or even HTML files with a JavaScript plugin. Sprockets lets you specify that a JavaScript source file depends on a set of assets, and offers a routine for copying all dependent assets into the document root.
|
115
|
+
|
116
|
+
The `provide` directive tells Sprockets that the current source file depends on the set of assets in the named directory. For example, say you have a plugin with the following directory structure:
|
117
|
+
|
118
|
+
plugins/color_picker/assets/images/color_picker/arrow.png
|
119
|
+
plugins/color_picker/assets/images/color_picker/circle.png
|
120
|
+
plugins/color_picker/assets/images/color_picker/hue.png
|
121
|
+
plugins/color_picker/assets/images/color_picker/saturation_and_brightness.png
|
122
|
+
plugins/color_picker/assets/stylesheets/color_picker.css
|
123
|
+
plugins/color_picker/src/color.js
|
124
|
+
plugins/color_picker/src/color_picker.js
|
125
|
+
|
126
|
+
Assume `plugins/color_picker/src/` is in your Sprockets load path. `plugins/color_picker/src/color_picker.js` might look like this:
|
127
|
+
|
128
|
+
```js
|
129
|
+
//= require "color"
|
130
|
+
//= provide "../assets"
|
131
|
+
```
|
132
|
+
|
133
|
+
When `<color_picker>` is required in your application, its `provide` directive will tell Sprockets that all files in the `plugins/color_picker/assets/` directory should be copied into the web project’s root.
|
134
|
+
|
135
|
+
## ArchitectureJS/Sprockets Integration
|
136
|
+
ArchitectureJS automatically sets up Sprockets' `load_path` to include your project root directory and your internal repository. This gives every application you create with ArchitectureJS access to a central library of scripts that you maintain with the `//= require` directive. For example, if you have the jQuery library in your repository you could include it in you application with a simple:
|
137
|
+
|
138
|
+
```js
|
139
|
+
//= require <jquery-1.7.1>
|
140
|
+
```
|
141
|
+
|
142
|
+
## Compilation
|
143
|
+
|
144
|
+
### compile
|
145
|
+
You can compile your architecture project manually with the compile command:
|
146
|
+
|
147
|
+
architect compile
|
148
|
+
|
149
|
+
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 `.architecture` file in the current directory.
|
150
|
+
|
151
|
+
<a id="watch"></a>
|
152
|
+
### watch
|
153
|
+
|
154
|
+
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:
|
155
|
+
|
156
|
+
architect watch
|
157
|
+
|
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
|
+
|
160
|
+
<a id="scaffolds"></a>
|
161
|
+
## Scaffolds
|
162
|
+
|
163
|
+
### generate _(Not Yet Implemented)_
|
164
|
+
The `generate` command will create a new file based on a predefined template. Default template files are defined by the `blueprint` or in the `blueprint`'s user template directory. To generate a file named foo.js using the blank template of the default blueprint, type:
|
165
|
+
|
166
|
+
architect generate blank test
|
167
|
+
|
168
|
+
This will create a blank js file in the current directory. You can also create your own templates in a directory named templates in your project root.
|
169
|
+
|
170
|
+
|
171
|
+
|
172
|
+
<a id="package-management"></a>
|
173
|
+
## Package Management
|
174
|
+
_Not Yet Implemented_
|
31
175
|
|
32
176
|
##Contributing to architecture.js
|
33
177
|
|
data/Rakefile
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.17
|
data/architecture-js.gemspec
CHANGED
@@ -5,14 +5,14 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "architecture-js"
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.17"
|
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-02-
|
12
|
+
s.date = "2012-02-20"
|
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
|
-
s.executables = ["architect"]
|
15
|
+
s.executables = ["HELP", "architect"]
|
16
16
|
s.extra_rdoc_files = [
|
17
17
|
"LICENSE.txt",
|
18
18
|
"README.md"
|
@@ -23,20 +23,20 @@ Gem::Specification.new do |s|
|
|
23
23
|
".travis.yml",
|
24
24
|
"Gemfile",
|
25
25
|
"Gemfile.lock",
|
26
|
-
"HELP",
|
27
26
|
"LICENSE.txt",
|
28
27
|
"README.md",
|
29
28
|
"Rakefile",
|
30
29
|
"VERSION",
|
31
30
|
"architecture-js.gemspec",
|
31
|
+
"bin/HELP",
|
32
32
|
"bin/architect",
|
33
33
|
"lib/architecture-js.rb",
|
34
34
|
"lib/architecture-js/architect.rb",
|
35
|
+
"lib/architecture-js/blueprint.rb",
|
35
36
|
"lib/architecture-js/dependencies.rb",
|
36
37
|
"lib/architecture-js/generator.rb",
|
37
38
|
"lib/architecture-js/helpers.rb",
|
38
39
|
"lib/architecture-js/notification.rb",
|
39
|
-
"lib/architecture-js/project.rb",
|
40
40
|
"lib/sprockets/CHANGELOG",
|
41
41
|
"lib/sprockets/LICENSE",
|
42
42
|
"lib/sprockets/README.markdown",
|
@@ -79,6 +79,7 @@ Gem::Specification.new do |s|
|
|
79
79
|
"spec/.DS_Store",
|
80
80
|
"spec/architect_spec.rb",
|
81
81
|
"spec/architecture-js_spec.rb",
|
82
|
+
"spec/blueprint_spec.rb",
|
82
83
|
"spec/fixtures/.DS_Store",
|
83
84
|
"spec/fixtures/_hidden.js",
|
84
85
|
"spec/fixtures/compiled_src.js",
|
@@ -94,7 +95,7 @@ Gem::Specification.new do |s|
|
|
94
95
|
"spec/fixtures/src_file.js",
|
95
96
|
"spec/fixtures/templates/test_template_one.js",
|
96
97
|
"spec/fixtures/templates/test_template_two.js",
|
97
|
-
"spec/fixtures/
|
98
|
+
"spec/fixtures/test_blueprint.rb",
|
98
99
|
"spec/fixtures/test_template_options.js",
|
99
100
|
"spec/fixtures/test_template_two.js",
|
100
101
|
"spec/fixtures/underscore_template.js",
|
@@ -103,7 +104,6 @@ Gem::Specification.new do |s|
|
|
103
104
|
"spec/generator_spec.rb",
|
104
105
|
"spec/helpers_spec.rb",
|
105
106
|
"spec/notification_spec.rb",
|
106
|
-
"spec/project_spec.rb",
|
107
107
|
"spec/spec_helper.rb",
|
108
108
|
"templates/blank.js"
|
109
109
|
]
|
data/{HELP → bin/HELP}
RENAMED
File without changes
|
data/lib/architecture-js.rb
CHANGED
@@ -16,8 +16,8 @@ module ArchitectureJS
|
|
16
16
|
File.expand_path(File.join(File.dirname(Dir.getwd)))
|
17
17
|
end
|
18
18
|
|
19
|
-
def
|
20
|
-
ArchitectureJS::
|
19
|
+
def register_blueprint(name, constructor)
|
20
|
+
ArchitectureJS::BLUEPRINTS[name] = constructor
|
21
21
|
end
|
22
22
|
|
23
23
|
def create_project_from_config(project_dir = nil)
|
@@ -29,24 +29,24 @@ module ArchitectureJS
|
|
29
29
|
config = ArchitectureJS::Helpers::symbolize_keys config
|
30
30
|
|
31
31
|
raise "The config file does not contain a project name" if config[:name].nil?
|
32
|
-
raise "#{config[:
|
32
|
+
raise "#{config[:blueprint]} is not isntalled. Try gem install #{config[:blueprint]}-architecture" if ArchitectureJS::BLUEPRINTS[config[:blueprint]].nil?
|
33
33
|
|
34
|
-
project = ArchitectureJS::
|
34
|
+
project = ArchitectureJS::BLUEPRINTS[config[:blueprint]].new(config, project_dir)
|
35
35
|
end
|
36
36
|
|
37
37
|
module_function :base_directory,
|
38
38
|
:lib_directory,
|
39
|
-
:
|
39
|
+
:register_blueprint,
|
40
40
|
:create_project_from_config
|
41
41
|
end
|
42
42
|
|
43
43
|
module ArchitectureJS
|
44
44
|
VERSION = File.read("#{base_directory}/VERSION")
|
45
|
-
|
45
|
+
BLUEPRINTS = Hash.new
|
46
46
|
end
|
47
47
|
|
48
48
|
require "sprockets/lib/sprockets"
|
49
49
|
|
50
|
-
%w(dependencies generator notification
|
50
|
+
%w(dependencies generator notification blueprint architect).each do |lib|
|
51
51
|
require "architecture-js/#{lib}"
|
52
52
|
end
|
@@ -35,16 +35,16 @@ module Architect
|
|
35
35
|
if @args[1]
|
36
36
|
sub_dir = @args[1] unless @args[1].match /^-/
|
37
37
|
end
|
38
|
-
|
38
|
+
blueprint = @options[:blueprint]
|
39
39
|
|
40
40
|
raise 'you must specify a project name: architect create [project_name]' if args[0].nil?
|
41
41
|
|
42
42
|
@root = File.expand_path sub_dir if sub_dir
|
43
|
-
config = { name: app_name,
|
43
|
+
config = { name: app_name, blueprint: blueprint }
|
44
44
|
|
45
|
-
require "#{
|
45
|
+
require "#{blueprint}-architecture" unless blueprint == 'default'
|
46
46
|
|
47
|
-
project = ArchitectureJS::
|
47
|
+
project = ArchitectureJS::BLUEPRINTS[blueprint].new(config, @root)
|
48
48
|
project.create
|
49
49
|
end
|
50
50
|
|
@@ -63,13 +63,14 @@ module Architect
|
|
63
63
|
project.update
|
64
64
|
end
|
65
65
|
#compile
|
66
|
+
|
66
67
|
def watch
|
67
68
|
require "fssm"
|
68
69
|
path ||= Dir.getwd
|
69
70
|
path = File.expand_path(path)
|
70
71
|
|
71
72
|
puts ArchitectureJS::Notification.log "architect is watching for changes. Press Ctrl-C to stop."
|
72
|
-
project = ArchitectureJS::
|
73
|
+
project = ArchitectureJS::Blueprint::new_from_config(path)
|
73
74
|
project.update
|
74
75
|
watch_hash = Hash.new
|
75
76
|
watch_files = Dir["#{path}/**/"]
|
@@ -120,9 +121,9 @@ module Architect
|
|
120
121
|
@options[:version] = true
|
121
122
|
end
|
122
123
|
|
123
|
-
options[:
|
124
|
-
opts.on('-f', '--
|
125
|
-
@options[:
|
124
|
+
options[:blueprint] = 'default'
|
125
|
+
opts.on('-f', '--blueprint FRAMEWORK', 'with blueprint') do |blueprint|
|
126
|
+
@options[:blueprint] = blueprint
|
126
127
|
end
|
127
128
|
|
128
129
|
@options[:compress] = false
|
@@ -142,7 +143,7 @@ module Architect
|
|
142
143
|
end
|
143
144
|
|
144
145
|
def help
|
145
|
-
puts File.read("#{ArchitectureJS::base_directory}/HELP")
|
146
|
+
puts File.read("#{ArchitectureJS::base_directory}/bin/HELP")
|
146
147
|
end
|
147
148
|
|
148
149
|
end
|
@@ -1,9 +1,9 @@
|
|
1
1
|
module ArchitectureJS
|
2
2
|
|
3
|
-
class
|
3
|
+
class Blueprint
|
4
4
|
attr_accessor :root,
|
5
5
|
:src_files,
|
6
|
-
:
|
6
|
+
:blueprint,
|
7
7
|
:config_name,
|
8
8
|
:directories,
|
9
9
|
:template_directories,
|
@@ -19,9 +19,10 @@ module ArchitectureJS
|
|
19
19
|
config = YAML::load_file "#{path}/#{config_file}"
|
20
20
|
config = ArchitectureJS::Helpers::symbolize_keys config
|
21
21
|
|
22
|
-
raise "#{config[:
|
22
|
+
raise "#{config[:blueprint]} is unavailable or not installed" if ArchitectureJS::BLUEPRINTS[config[:blueprint]].nil?
|
23
23
|
|
24
|
-
|
24
|
+
require "#{config[:blueprint]}-architecture" unless config[:blueprint] == 'default'
|
25
|
+
project = ArchitectureJS::BLUEPRINTS[config[:blueprint]].new config, path
|
25
26
|
end
|
26
27
|
|
27
28
|
def initialize(config, root = nil)
|
@@ -34,7 +35,7 @@ module ArchitectureJS
|
|
34
35
|
@directories = ['lib', 'src']
|
35
36
|
@src_files = Array.new
|
36
37
|
@config = {
|
37
|
-
|
38
|
+
blueprint: 'default',
|
38
39
|
src_dir: 'src',
|
39
40
|
build_dir: 'lib',
|
40
41
|
asset_root: '../',
|
@@ -155,8 +156,8 @@ module ArchitectureJS
|
|
155
156
|
end
|
156
157
|
end
|
157
158
|
|
158
|
-
end # class
|
159
|
+
end # class Blueprint
|
159
160
|
end # module ArchitectureJS
|
160
161
|
|
161
|
-
# this line adds the default
|
162
|
-
ArchitectureJS::
|
162
|
+
# this line adds the default blueprint to ArchitectureJS
|
163
|
+
ArchitectureJS::register_blueprint('default', ArchitectureJS::Blueprint)
|
data/spec/architect_spec.rb
CHANGED
@@ -38,7 +38,7 @@ describe 'architect' do
|
|
38
38
|
end
|
39
39
|
end
|
40
40
|
=begin
|
41
|
-
context 'alternate
|
41
|
+
context 'alternate blueprint' do
|
42
42
|
|
43
43
|
before :each do
|
44
44
|
@bin = "#{ArchitectureJS::base_directory}/bin/architect"
|
@@ -49,7 +49,7 @@ describe 'architect' do
|
|
49
49
|
FileUtils.rm_rf TMP_DIR if File.exists? TMP_DIR
|
50
50
|
end
|
51
51
|
|
52
|
-
it 'should create a new application with an alternate
|
52
|
+
it 'should create a new application with an alternate blueprint' do
|
53
53
|
puts `cd #{TMP_DIR}; #{@bin} create myapp -f modjs`
|
54
54
|
|
55
55
|
File.directory?("#{TMP_DIR}/application").should be_true
|
@@ -61,7 +61,7 @@ describe 'architect' do
|
|
61
61
|
File.directory?("#{TMP_DIR}/spec").should be_true
|
62
62
|
end
|
63
63
|
|
64
|
-
it 'should create a new application in a subdirectory with an alternate
|
64
|
+
it 'should create a new application in a subdirectory with an alternate blueprint' do
|
65
65
|
puts `cd #{TMP_DIR}; #{@bin} create myapp sub -f modjs`
|
66
66
|
|
67
67
|
File.directory?("#{TMP_DIR}/sub/application").should be_true
|
@@ -18,8 +18,8 @@ describe ArchitectureJS do
|
|
18
18
|
ArchitectureJS::VERSION.should === version
|
19
19
|
end
|
20
20
|
|
21
|
-
it 'should have a
|
22
|
-
ArchitectureJS::
|
21
|
+
it 'should have a BLUEPRINTS constant' do
|
22
|
+
ArchitectureJS::BLUEPRINTS.should_not be_nil
|
23
23
|
end
|
24
24
|
|
25
25
|
context "Instantiation with a config file" do
|
@@ -41,7 +41,7 @@ describe ArchitectureJS do
|
|
41
41
|
|
42
42
|
it 'should set defaults from config file' do
|
43
43
|
@project.config.should == {
|
44
|
-
|
44
|
+
blueprint: 'default',
|
45
45
|
src_dir: 'source',
|
46
46
|
build_dir: 'dest',
|
47
47
|
asset_root: '../',
|
@@ -1,16 +1,16 @@
|
|
1
1
|
require "spec_helper.rb"
|
2
2
|
|
3
|
-
describe ArchitectureJS::
|
3
|
+
describe ArchitectureJS::Blueprint do
|
4
4
|
|
5
5
|
it "should exist" do
|
6
|
-
ArchitectureJS::
|
6
|
+
ArchitectureJS::Blueprint.should_not be_nil
|
7
7
|
end
|
8
8
|
|
9
9
|
context 'Instantiation' do
|
10
10
|
before :each do
|
11
11
|
FileUtils.mkdir TMP_DIR
|
12
12
|
suppress_output do
|
13
|
-
@project = ArchitectureJS::
|
13
|
+
@project = ArchitectureJS::Blueprint.new({ name: 'myapp' }, TMP_DIR)
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
@@ -18,8 +18,8 @@ describe ArchitectureJS::Project do
|
|
18
18
|
FileUtils.rm_rf "#{TMP_DIR}" if File.exists? "#{TMP_DIR}"
|
19
19
|
end
|
20
20
|
|
21
|
-
it "should add the '
|
22
|
-
ArchitectureJS::
|
21
|
+
it "should add the 'default' blueprint to ArchitectureJS" do
|
22
|
+
ArchitectureJS::BLUEPRINTS['default'].should == ArchitectureJS::Blueprint
|
23
23
|
end
|
24
24
|
|
25
25
|
it 'should have an empty src_files array' do
|
@@ -52,7 +52,7 @@ describe ArchitectureJS::Project do
|
|
52
52
|
end
|
53
53
|
|
54
54
|
it "should initialize with a config path" do
|
55
|
-
@existing = ArchitectureJS::
|
55
|
+
@existing = ArchitectureJS::Blueprint.new_from_config TMP_DIR
|
56
56
|
@existing.config.should_not be_empty
|
57
57
|
@existing.config[:name].should == 'myapp'
|
58
58
|
end
|
@@ -64,7 +64,7 @@ describe ArchitectureJS::Project do
|
|
64
64
|
before :each do
|
65
65
|
FileUtils.mkdir("#{TMP_DIR}")
|
66
66
|
suppress_output do
|
67
|
-
@project = ArchitectureJS::
|
67
|
+
@project = ArchitectureJS::Blueprint.new({ name: 'myapp' }, TMP_DIR)
|
68
68
|
@project.create
|
69
69
|
end
|
70
70
|
end
|
@@ -92,7 +92,7 @@ describe ArchitectureJS::Project do
|
|
92
92
|
before :each do
|
93
93
|
FileUtils.mkdir("#{TMP_DIR}")
|
94
94
|
suppress_output do
|
95
|
-
@project = ArchitectureJS::
|
95
|
+
@project = ArchitectureJS::Blueprint.new({ name: 'myapp' },TMP_DIR)
|
96
96
|
@project.create
|
97
97
|
FileUtils.cp "#{FIXTURES}/lib1.js", "#{TMP_DIR}/src/lib1.js"
|
98
98
|
FileUtils.cp "#{FIXTURES}/lib2.js", "#{TMP_DIR}/src/lib2.js"
|
@@ -132,7 +132,7 @@ describe ArchitectureJS::Project do
|
|
132
132
|
before :each do
|
133
133
|
FileUtils.mkdir("#{TMP_DIR}")
|
134
134
|
suppress_output do
|
135
|
-
@project = ArchitectureJS::
|
135
|
+
@project = ArchitectureJS::Blueprint.new({ name: 'myapp' },TMP_DIR)
|
136
136
|
@project.create
|
137
137
|
FileUtils.cp "#{FIXTURES}/update.architecture", "#{TMP_DIR}/myapp.architecture"
|
138
138
|
FileUtils.cp "#{FIXTURES}/lib1.js", "#{TMP_DIR}/src/lib1.js"
|
@@ -156,7 +156,7 @@ describe ArchitectureJS::Project do
|
|
156
156
|
before :each do
|
157
157
|
FileUtils.mkdir("#{TMP_DIR}")
|
158
158
|
suppress_output do
|
159
|
-
@project = ArchitectureJS::
|
159
|
+
@project = ArchitectureJS::Blueprint.new({ name: 'myapp' },TMP_DIR)
|
160
160
|
@project.raise_errors = true
|
161
161
|
@project.create
|
162
162
|
FileUtils.cp "#{FIXTURES}/underscore_template.js", "#{TMP_DIR}/src/underscore_template.js"
|
@@ -1,9 +1,9 @@
|
|
1
1
|
module TestFramework
|
2
|
-
class Project < ArchitectureJS::
|
2
|
+
class Project < ArchitectureJS::Blueprint
|
3
3
|
|
4
4
|
def initialize(config, root = nil)
|
5
5
|
@config = {
|
6
|
-
|
6
|
+
blueprint: 'test',
|
7
7
|
src_dir: 'modules',
|
8
8
|
build_dir: 'application',
|
9
9
|
dependencies: [],
|
@@ -17,5 +17,5 @@ module TestFramework
|
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
20
|
-
# this line adds the default
|
21
|
-
ArchitectureJS::
|
20
|
+
# this line adds the default blueprint to ArchitectureJS
|
21
|
+
ArchitectureJS::register_blueprint('test', TestFramework::Project)
|
data/spec/generator_spec.rb
CHANGED
@@ -7,7 +7,7 @@ describe ArchitectureJS::Generator do
|
|
7
7
|
FileUtils.mkdir "#{TMP_DIR}/templates"
|
8
8
|
FileUtils.cp "#{FIXTURES}/templates/test_template_one.js", "#{TMP_DIR}/test_template_one.js"
|
9
9
|
FileUtils.cp "#{FIXTURES}/templates/test_template_two.js", "#{TMP_DIR}/test_template_two.js"
|
10
|
-
project = ArchitectureJS::
|
10
|
+
project = ArchitectureJS::Blueprint.new({ name: 'myapp' }, TMP_DIR)
|
11
11
|
project.template_directories = ["#{FIXTURES}/templates"]
|
12
12
|
@gen = ArchitectureJS::Generator.new(project)
|
13
13
|
end
|
@@ -17,7 +17,7 @@ describe ArchitectureJS::Generator do
|
|
17
17
|
end
|
18
18
|
|
19
19
|
it 'should have a project' do
|
20
|
-
@gen.project.class.should == ArchitectureJS::
|
20
|
+
@gen.project.class.should == ArchitectureJS::Blueprint
|
21
21
|
end
|
22
22
|
|
23
23
|
it 'should have template_paths' do
|
data/spec/spec_helper.rb
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.1.
|
4
|
+
version: 0.1.17
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-02-
|
12
|
+
date: 2012-02-20 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: fssm
|
16
|
-
requirement: &
|
16
|
+
requirement: &70257038889820 !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: *70257038889820
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: jsmin
|
27
|
-
requirement: &
|
27
|
+
requirement: &70257038889320 !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: *70257038889320
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rspec
|
38
|
-
requirement: &
|
38
|
+
requirement: &70257038888800 !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: *70257038888800
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: bundler
|
49
|
-
requirement: &
|
49
|
+
requirement: &70257038888280 !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: *70257038888280
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: jeweler
|
60
|
-
requirement: &
|
60
|
+
requirement: &70257038887760 !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: *70257038887760
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: ZenTest
|
71
|
-
requirement: &
|
71
|
+
requirement: &70257038887200 !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: *70257038887200
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: autotest-growl
|
82
|
-
requirement: &
|
82
|
+
requirement: &70257038886720 !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: *70257038886720
|
91
91
|
- !ruby/object:Gem::Dependency
|
92
92
|
name: jsmin
|
93
|
-
requirement: &
|
93
|
+
requirement: &70257038886200 !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: *70257038886200
|
102
102
|
- !ruby/object:Gem::Dependency
|
103
103
|
name: fssm
|
104
|
-
requirement: &
|
104
|
+
requirement: &70257038885660 !ruby/object:Gem::Requirement
|
105
105
|
none: false
|
106
106
|
requirements:
|
107
107
|
- - ! '>='
|
@@ -109,11 +109,12 @@ dependencies:
|
|
109
109
|
version: '0'
|
110
110
|
type: :runtime
|
111
111
|
prerelease: false
|
112
|
-
version_requirements: *
|
112
|
+
version_requirements: *70257038885660
|
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
|
116
116
|
executables:
|
117
|
+
- HELP
|
117
118
|
- architect
|
118
119
|
extensions: []
|
119
120
|
extra_rdoc_files:
|
@@ -125,20 +126,20 @@ files:
|
|
125
126
|
- .travis.yml
|
126
127
|
- Gemfile
|
127
128
|
- Gemfile.lock
|
128
|
-
- HELP
|
129
129
|
- LICENSE.txt
|
130
130
|
- README.md
|
131
131
|
- Rakefile
|
132
132
|
- VERSION
|
133
133
|
- architecture-js.gemspec
|
134
|
+
- bin/HELP
|
134
135
|
- bin/architect
|
135
136
|
- lib/architecture-js.rb
|
136
137
|
- lib/architecture-js/architect.rb
|
138
|
+
- lib/architecture-js/blueprint.rb
|
137
139
|
- lib/architecture-js/dependencies.rb
|
138
140
|
- lib/architecture-js/generator.rb
|
139
141
|
- lib/architecture-js/helpers.rb
|
140
142
|
- lib/architecture-js/notification.rb
|
141
|
-
- lib/architecture-js/project.rb
|
142
143
|
- lib/sprockets/CHANGELOG
|
143
144
|
- lib/sprockets/LICENSE
|
144
145
|
- lib/sprockets/README.markdown
|
@@ -181,6 +182,7 @@ files:
|
|
181
182
|
- spec/.DS_Store
|
182
183
|
- spec/architect_spec.rb
|
183
184
|
- spec/architecture-js_spec.rb
|
185
|
+
- spec/blueprint_spec.rb
|
184
186
|
- spec/fixtures/.DS_Store
|
185
187
|
- spec/fixtures/_hidden.js
|
186
188
|
- spec/fixtures/compiled_src.js
|
@@ -196,7 +198,7 @@ files:
|
|
196
198
|
- spec/fixtures/src_file.js
|
197
199
|
- spec/fixtures/templates/test_template_one.js
|
198
200
|
- spec/fixtures/templates/test_template_two.js
|
199
|
-
- spec/fixtures/
|
201
|
+
- spec/fixtures/test_blueprint.rb
|
200
202
|
- spec/fixtures/test_template_options.js
|
201
203
|
- spec/fixtures/test_template_two.js
|
202
204
|
- spec/fixtures/underscore_template.js
|
@@ -205,7 +207,6 @@ files:
|
|
205
207
|
- spec/generator_spec.rb
|
206
208
|
- spec/helpers_spec.rb
|
207
209
|
- spec/notification_spec.rb
|
208
|
-
- spec/project_spec.rb
|
209
210
|
- spec/spec_helper.rb
|
210
211
|
- templates/blank.js
|
211
212
|
homepage: https://github.com/daytonn/architecture-js
|
@@ -223,7 +224,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
223
224
|
version: '0'
|
224
225
|
segments:
|
225
226
|
- 0
|
226
|
-
hash:
|
227
|
+
hash: 750126494778508333
|
227
228
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
228
229
|
none: false
|
229
230
|
requirements:
|