architecture-js 0.1.17 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +9 -7
- data/VERSION +1 -1
- data/architecture-js.gemspec +8 -8
- data/lib/architecture-js/architect.rb +68 -9
- data/lib/architecture-js/blueprint.rb +3 -3
- data/lib/architecture-js/generator.rb +7 -3
- data/lib/architecture-js.rb +8 -3
- data/spec/architect_spec.rb +16 -38
- data/spec/architecture-js_spec.rb +3 -3
- data/spec/blueprint_spec.rb +5 -5
- data/spec/fixtures/templates/test_template_two.js +3 -3
- data/spec/generator_spec.rb +4 -0
- metadata +26 -27
- /data/{bin/HELP → HELP} +0 -0
- /data/spec/fixtures/{compressed.architecture → compressed.blueprint} +0 -0
- /data/spec/fixtures/{existing.architecture → existing.blueprint} +0 -0
- /data/spec/fixtures/{myapp.architecture → myapp.blueprint} +0 -0
- /data/spec/fixtures/{update.architecture → update.blueprint} +0 -0
data/README.md
CHANGED
@@ -17,7 +17,7 @@ Requires ruby version 1.9 or higher. The best way is using rubygems:
|
|
17
17
|
|
18
18
|
Or include it in your projects `Gemfile` with Bundler:
|
19
19
|
|
20
|
-
gem 'architecture-js', '~> 0.
|
20
|
+
gem 'architecture-js', '~> 0.2.0'
|
21
21
|
|
22
22
|
## Getting Started
|
23
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:
|
@@ -35,11 +35,11 @@ This will create the default project scaffold:
|
|
35
35
|
/lib
|
36
36
|
/src/
|
37
37
|
myapp.js
|
38
|
-
myapp.
|
38
|
+
myapp.blueprint
|
39
39
|
|
40
40
|
<a id="configuration"></a>
|
41
41
|
## Default Configurtaion
|
42
|
-
The `myapp.
|
42
|
+
The `myapp.blueprint` 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
43
|
|
44
44
|
blueprint: default
|
45
45
|
src_dir: src
|
@@ -146,7 +146,7 @@ You can compile your architecture project manually with the compile command:
|
|
146
146
|
|
147
147
|
architect compile
|
148
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 `.
|
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 `.blueprint` file in the current directory.
|
150
150
|
|
151
151
|
<a id="watch"></a>
|
152
152
|
### watch
|
@@ -160,14 +160,16 @@ This will watch the project directory and compile the project every time a file
|
|
160
160
|
<a id="scaffolds"></a>
|
161
161
|
## Scaffolds
|
162
162
|
|
163
|
-
### generate
|
164
|
-
The `generate` command will create a new file based on a predefined template. Default template files are defined by the
|
163
|
+
### generate
|
164
|
+
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
165
|
|
166
166
|
architect generate blank test
|
167
167
|
|
168
|
-
This will create a blank
|
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 the test the template generator. However, You can add your own template 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 line:
|
169
169
|
|
170
|
+
architect generate class Widget
|
170
171
|
|
172
|
+
This would create a file named `Widget.js` in the current directory based on the contents of `/templates/class.js`
|
171
173
|
|
172
174
|
<a id="package-management"></a>
|
173
175
|
## Package Management
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.2.0
|
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.
|
8
|
+
s.version = "0.2.0"
|
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-21"
|
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 = ["
|
15
|
+
s.executables = ["architect"]
|
16
16
|
s.extra_rdoc_files = [
|
17
17
|
"LICENSE.txt",
|
18
18
|
"README.md"
|
@@ -23,12 +23,12 @@ Gem::Specification.new do |s|
|
|
23
23
|
".travis.yml",
|
24
24
|
"Gemfile",
|
25
25
|
"Gemfile.lock",
|
26
|
+
"HELP",
|
26
27
|
"LICENSE.txt",
|
27
28
|
"README.md",
|
28
29
|
"Rakefile",
|
29
30
|
"VERSION",
|
30
31
|
"architecture-js.gemspec",
|
31
|
-
"bin/HELP",
|
32
32
|
"bin/architect",
|
33
33
|
"lib/architecture-js.rb",
|
34
34
|
"lib/architecture-js/architect.rb",
|
@@ -83,15 +83,15 @@ Gem::Specification.new do |s|
|
|
83
83
|
"spec/fixtures/.DS_Store",
|
84
84
|
"spec/fixtures/_hidden.js",
|
85
85
|
"spec/fixtures/compiled_src.js",
|
86
|
-
"spec/fixtures/compressed.
|
86
|
+
"spec/fixtures/compressed.blueprint",
|
87
87
|
"spec/fixtures/compressed.js",
|
88
88
|
"spec/fixtures/ejs.ejs",
|
89
|
-
"spec/fixtures/existing.
|
89
|
+
"spec/fixtures/existing.blueprint",
|
90
90
|
"spec/fixtures/lib1.js",
|
91
91
|
"spec/fixtures/lib1_compressed.js",
|
92
92
|
"spec/fixtures/lib2.js",
|
93
93
|
"spec/fixtures/lib2_compressed.js",
|
94
|
-
"spec/fixtures/myapp.
|
94
|
+
"spec/fixtures/myapp.blueprint",
|
95
95
|
"spec/fixtures/src_file.js",
|
96
96
|
"spec/fixtures/templates/test_template_one.js",
|
97
97
|
"spec/fixtures/templates/test_template_two.js",
|
@@ -99,7 +99,7 @@ Gem::Specification.new do |s|
|
|
99
99
|
"spec/fixtures/test_template_options.js",
|
100
100
|
"spec/fixtures/test_template_two.js",
|
101
101
|
"spec/fixtures/underscore_template.js",
|
102
|
-
"spec/fixtures/update.
|
102
|
+
"spec/fixtures/update.blueprint",
|
103
103
|
"spec/fixtures/update.js",
|
104
104
|
"spec/generator_spec.rb",
|
105
105
|
"spec/helpers_spec.rb",
|
@@ -25,7 +25,15 @@ module Architect
|
|
25
25
|
end
|
26
26
|
|
27
27
|
def run
|
28
|
-
|
28
|
+
parse_command
|
29
|
+
parse_arguments
|
30
|
+
|
31
|
+
if @command == :generate
|
32
|
+
parse_generate_options
|
33
|
+
else
|
34
|
+
parse_options
|
35
|
+
end
|
36
|
+
|
29
37
|
self.send(@command) if @command and not @options[:help]
|
30
38
|
help unless @command or @options[:help]
|
31
39
|
end
|
@@ -49,12 +57,30 @@ module Architect
|
|
49
57
|
end
|
50
58
|
|
51
59
|
def generate
|
52
|
-
|
60
|
+
project_path = File.expand_path(Dir.getwd)
|
61
|
+
|
62
|
+
# Go up to 10 levels up to look for the project config file
|
63
|
+
# This is not optimal but is probably the easiest way to allow
|
64
|
+
# generating templates in project sub-folders given we need to
|
65
|
+
# read the blueprint file to get the templates
|
66
|
+
10.times do
|
67
|
+
config_file = ArchitectureJS::get_config_file(project_path)
|
68
|
+
|
69
|
+
unless config_file
|
70
|
+
path_array = project_path.split(File::SEPARATOR)
|
71
|
+
path_array.pop # push the last dir off the stack
|
72
|
+
project_path = path_array.join(File::SEPARATOR)
|
73
|
+
else
|
74
|
+
break
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
project = ArchitectureJS::create_project_from_config(project_path)
|
79
|
+
template = @args.first
|
80
|
+
filename = @args[1]
|
81
|
+
options = @template_options
|
53
82
|
|
54
|
-
|
55
|
-
#raise "ninjs.conf was not located in #{conf_path}" unless File.exists? conf_path
|
56
|
-
#generator = ArchitectureJS::Generator.new(config)
|
57
|
-
#generator.generate
|
83
|
+
project.generator.generate(template, filename, options)
|
58
84
|
end
|
59
85
|
|
60
86
|
def compile
|
@@ -82,7 +108,7 @@ module Architect
|
|
82
108
|
watch_hash[dir] = "**/*.js"
|
83
109
|
end
|
84
110
|
|
85
|
-
watch_hash[path] = "**/*.
|
111
|
+
watch_hash[path] = "**/*.blueprint"
|
86
112
|
watch_hash["#{ArchitectureJS::base_directory}/repository"] = "**/*.js" # check changes to the repository as well
|
87
113
|
|
88
114
|
FSSM.monitor do
|
@@ -110,6 +136,7 @@ module Architect
|
|
110
136
|
end
|
111
137
|
end
|
112
138
|
#watch
|
139
|
+
|
113
140
|
private
|
114
141
|
def parse_options
|
115
142
|
@options = {}
|
@@ -136,14 +163,46 @@ module Architect
|
|
136
163
|
help
|
137
164
|
end
|
138
165
|
end.parse!
|
166
|
+
end
|
139
167
|
|
140
|
-
|
168
|
+
def parse_generate_options
|
169
|
+
@options = {
|
170
|
+
help: false
|
171
|
+
}
|
172
|
+
@template_options = {}
|
173
|
+
|
174
|
+
@args.each_with_index do |arg, i|
|
175
|
+
# double dash options contain variables
|
176
|
+
if arg.match(/^--/)
|
177
|
+
option_key = arg.gsub(/^--/, '')
|
178
|
+
option_value = @args[i + 1]
|
179
|
+
|
180
|
+
if (option_value && option_value.match(/^-/) || option_value.nil?)
|
181
|
+
# no option value
|
182
|
+
@template_options[option_key.to_sym] = false
|
183
|
+
else
|
184
|
+
# option has a value
|
185
|
+
@template_options[option_key.to_sym] = option_value
|
186
|
+
end
|
187
|
+
# single dash options are flags
|
188
|
+
elsif arg.match(/^-/)
|
189
|
+
@template_options[arg.gsub(/^-/, '').to_sym] = true
|
190
|
+
end
|
191
|
+
end
|
192
|
+
# each_with_index
|
193
|
+
end
|
194
|
+
|
195
|
+
def parse_arguments
|
141
196
|
@args = Array.try_convert(ARGV)
|
142
197
|
@args.shift # remove command
|
143
198
|
end
|
144
199
|
|
200
|
+
def parse_command
|
201
|
+
@command = ARGV[0].to_sym if ARGV[0]
|
202
|
+
end
|
203
|
+
|
145
204
|
def help
|
146
|
-
puts File.read("#{ArchitectureJS::base_directory}/
|
205
|
+
puts File.read("#{ArchitectureJS::base_directory}/HELP")
|
147
206
|
end
|
148
207
|
|
149
208
|
end
|
@@ -12,9 +12,9 @@ module ArchitectureJS
|
|
12
12
|
:raise_errors
|
13
13
|
|
14
14
|
def self.new_from_config(path)
|
15
|
-
config_file = Dir.entries(path).select {|f| f =~ /\.
|
15
|
+
config_file = Dir.entries(path).select {|f| f =~ /\.blueprint$/ }.first
|
16
16
|
|
17
|
-
raise ".
|
17
|
+
raise ".blueprint file was not found in #{path}" if config_file.nil?
|
18
18
|
|
19
19
|
config = YAML::load_file "#{path}/#{config_file}"
|
20
20
|
config = ArchitectureJS::Helpers::symbolize_keys config
|
@@ -28,7 +28,7 @@ module ArchitectureJS
|
|
28
28
|
def initialize(config, root = nil)
|
29
29
|
raise "#{self.class}.new({ name: 'myapp' }, options): config[:name] is undefined" unless config[:name]
|
30
30
|
@raise_errors = false
|
31
|
-
@config_file = "#{config[:name].downcase}.
|
31
|
+
@config_file = "#{config[:name].downcase}.blueprint"
|
32
32
|
root ||= Dir.getwd
|
33
33
|
@root = File.expand_path(root)
|
34
34
|
@template_directories = ["#{ArchitectureJS::base_directory}/templates", "#{@root}/templates"]
|
@@ -3,10 +3,12 @@ module ArchitectureJS
|
|
3
3
|
|
4
4
|
attr_accessor :template_paths,
|
5
5
|
:templates,
|
6
|
+
:blueprint,
|
6
7
|
:project
|
7
8
|
|
8
|
-
def initialize(
|
9
|
-
@project =
|
9
|
+
def initialize(blueprint)
|
10
|
+
@project = blueprint
|
11
|
+
@blueprint = @project.config
|
10
12
|
@template_paths = @project.template_directories
|
11
13
|
@templates = Hash.new
|
12
14
|
find_templates @template_paths
|
@@ -34,8 +36,9 @@ module ArchitectureJS
|
|
34
36
|
end
|
35
37
|
|
36
38
|
def generate(template, filename, options)
|
39
|
+
raise "There is no template named #{template} in the #{@blueprint[:name]} project" if @templates[template].nil?
|
37
40
|
filename = "#{filename}#{@templates[template][:ext]}"
|
38
|
-
generate_file(filename, render_template(template, options)
|
41
|
+
generate_file(filename, render_template(template, options))
|
39
42
|
end
|
40
43
|
|
41
44
|
def generate_file(filename, template, path = nil)
|
@@ -44,6 +47,7 @@ module ArchitectureJS
|
|
44
47
|
end
|
45
48
|
|
46
49
|
def render_template(template, options = nil)
|
50
|
+
blueprint = @blueprint
|
47
51
|
project = @project
|
48
52
|
@templates[template][:erb].result(binding)
|
49
53
|
end
|
data/lib/architecture-js.rb
CHANGED
@@ -22,8 +22,8 @@ module ArchitectureJS
|
|
22
22
|
|
23
23
|
def create_project_from_config(project_dir = nil)
|
24
24
|
project_dir ||= File.expand_path(Dir.getwd)
|
25
|
-
conf_file =
|
26
|
-
raise "<project_name>.
|
25
|
+
conf_file = get_config_file project_dir
|
26
|
+
raise "<project_name>.blueprint was not found in #{project_dir}" if conf_file.nil?
|
27
27
|
|
28
28
|
config = YAML.load_file("#{project_dir}/#{conf_file}")
|
29
29
|
config = ArchitectureJS::Helpers::symbolize_keys config
|
@@ -34,10 +34,15 @@ module ArchitectureJS
|
|
34
34
|
project = ArchitectureJS::BLUEPRINTS[config[:blueprint]].new(config, project_dir)
|
35
35
|
end
|
36
36
|
|
37
|
+
def get_config_file(path)
|
38
|
+
(Dir.entries(path).select { |f| f.match /\.blueprint$/ })[0]
|
39
|
+
end
|
40
|
+
|
37
41
|
module_function :base_directory,
|
38
42
|
:lib_directory,
|
39
43
|
:register_blueprint,
|
40
|
-
:create_project_from_config
|
44
|
+
:create_project_from_config,
|
45
|
+
:get_config_file
|
41
46
|
end
|
42
47
|
|
43
48
|
module ArchitectureJS
|
data/spec/architect_spec.rb
CHANGED
@@ -12,19 +12,19 @@ describe 'architect' do
|
|
12
12
|
FileUtils.cp "#{FIXTURES}/src_file.js", "#{TMP_DIR}/src/myapp.js"
|
13
13
|
end
|
14
14
|
|
15
|
-
|
15
|
+
after :each do
|
16
16
|
FileUtils.rm_rf "#{TMP_DIR}" if File.exists? "#{TMP_DIR}"
|
17
17
|
end
|
18
18
|
|
19
19
|
it 'should create a new application' do
|
20
|
-
"#{TMP_DIR}/myapp.
|
20
|
+
"#{TMP_DIR}/myapp.blueprint".should be_same_file_as "#{FIXTURES}/myapp.blueprint"
|
21
21
|
File.directory?("#{TMP_DIR}/lib").should be_true
|
22
22
|
File.directory?("#{TMP_DIR}/src").should be_true
|
23
23
|
end
|
24
24
|
|
25
25
|
it 'should create a new application in a subdirectory' do
|
26
|
-
|
27
|
-
"#{TMP_DIR}/sub/myapp.
|
26
|
+
`cd #{TMP_DIR}; #{@bin} create myapp sub`
|
27
|
+
"#{TMP_DIR}/sub/myapp.blueprint".should be_same_file_as "#{FIXTURES}/myapp.blueprint"
|
28
28
|
File.directory?("#{TMP_DIR}/sub/lib").should be_true
|
29
29
|
File.directory?("#{TMP_DIR}/sub/src").should be_true
|
30
30
|
File.exists?("#{TMP_DIR}/sub/src/myapp.js").should be_true
|
@@ -32,47 +32,25 @@ describe 'architect' do
|
|
32
32
|
end
|
33
33
|
|
34
34
|
it 'should compile the application' do
|
35
|
-
|
35
|
+
`cd #{TMP_DIR}; #{@bin} compile`
|
36
36
|
File.exists?("#{TMP_DIR}/lib/myapp.js").should be_true
|
37
37
|
"#{TMP_DIR}/lib/myapp.js".should be_same_file_as "#{FIXTURES}/compressed.js"
|
38
38
|
end
|
39
|
-
end
|
40
|
-
=begin
|
41
|
-
context 'alternate blueprint' do
|
42
|
-
|
43
|
-
before :each do
|
44
|
-
@bin = "#{ArchitectureJS::base_directory}/bin/architect"
|
45
|
-
FileUtils.mkdir TMP_DIR unless File.exists? TMP_DIR
|
46
|
-
end
|
47
|
-
|
48
|
-
after :each do
|
49
|
-
FileUtils.rm_rf TMP_DIR if File.exists? TMP_DIR
|
50
|
-
end
|
51
39
|
|
52
|
-
it 'should
|
53
|
-
|
54
|
-
|
55
|
-
File.directory?("#{TMP_DIR}/application").should be_true
|
56
|
-
File.directory?("#{TMP_DIR}/elements").should be_true
|
57
|
-
File.directory?("#{TMP_DIR}/lib").should be_true
|
58
|
-
File.directory?("#{TMP_DIR}/models").should be_true
|
59
|
-
File.directory?("#{TMP_DIR}/modules").should be_true
|
60
|
-
File.directory?("#{TMP_DIR}/plugins").should be_true
|
61
|
-
File.directory?("#{TMP_DIR}/spec").should be_true
|
40
|
+
it 'should generate a template' do
|
41
|
+
`cd #{TMP_DIR}/src; #{@bin} generate blank test`
|
42
|
+
File.exists?("#{TMP_DIR}/src/test.js").should be_true
|
62
43
|
end
|
63
44
|
|
64
|
-
it 'should
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
File.
|
70
|
-
|
71
|
-
File.directory?("#{TMP_DIR}/sub/modules").should be_true
|
72
|
-
File.directory?("#{TMP_DIR}/sub/plugins").should be_true
|
73
|
-
File.directory?("#{TMP_DIR}/sub/spec").should be_true
|
45
|
+
it 'should generate a template with options' do
|
46
|
+
FileUtils.mkdir("#{TMP_DIR}/templates")
|
47
|
+
FileUtils.cp("#{FIXTURES}/templates/test_template_two.js", "#{TMP_DIR}/templates/test_template.js")
|
48
|
+
`cd #{TMP_DIR}/src; #{@bin} generate test_template foo --optional_variable true --is_good -g --bool`
|
49
|
+
|
50
|
+
File.exists?("#{TMP_DIR}/src/foo.js").should be_true
|
51
|
+
"#{TMP_DIR}/src/foo.js".should be_same_file_as "#{FIXTURES}/test_template_options.js"
|
74
52
|
end
|
75
53
|
|
76
54
|
end
|
77
|
-
|
55
|
+
|
78
56
|
end
|
@@ -26,7 +26,7 @@ describe ArchitectureJS do
|
|
26
26
|
|
27
27
|
before :each do
|
28
28
|
FileUtils.mkdir("#{TMP_DIR}")
|
29
|
-
FileUtils.cp "#{FIXTURES}/existing.
|
29
|
+
FileUtils.cp "#{FIXTURES}/existing.blueprint", "#{TMP_DIR}/myapp.blueprint"
|
30
30
|
suppress_output { @project = ArchitectureJS::create_project_from_config(TMP_DIR) }
|
31
31
|
end
|
32
32
|
|
@@ -34,8 +34,8 @@ describe ArchitectureJS do
|
|
34
34
|
FileUtils.rm_rf "#{TMP_DIR}" if File.exists? "#{TMP_DIR}"
|
35
35
|
end
|
36
36
|
|
37
|
-
it "should raise an error if there is no .
|
38
|
-
FileUtils.rm_rf "#{TMP_DIR}/myapp.
|
37
|
+
it "should raise an error if there is no .blueprint file" do
|
38
|
+
FileUtils.rm_rf "#{TMP_DIR}/myapp.blueprint"
|
39
39
|
lambda { ArchitectureJS::create_project_from_config TMP_DIR }.should raise_error
|
40
40
|
end
|
41
41
|
|
data/spec/blueprint_spec.rb
CHANGED
@@ -48,7 +48,7 @@ describe ArchitectureJS::Blueprint do
|
|
48
48
|
|
49
49
|
context "with existing project" do
|
50
50
|
before(:each) do
|
51
|
-
FileUtils.cp("#{FIXTURES}/myapp.
|
51
|
+
FileUtils.cp("#{FIXTURES}/myapp.blueprint", "#{TMP_DIR}/myapp.blueprint")
|
52
52
|
end
|
53
53
|
|
54
54
|
it "should initialize with a config path" do
|
@@ -79,8 +79,8 @@ describe ArchitectureJS::Blueprint do
|
|
79
79
|
end
|
80
80
|
|
81
81
|
it 'should create a config file' do
|
82
|
-
File.exists?("#{TMP_DIR}/myapp.
|
83
|
-
"#{TMP_DIR}/myapp.
|
82
|
+
File.exists?("#{TMP_DIR}/myapp.blueprint").should be_true
|
83
|
+
"#{TMP_DIR}/myapp.blueprint".should be_same_file_as "#{FIXTURES}/myapp.blueprint"
|
84
84
|
end
|
85
85
|
|
86
86
|
it "should create an application source file" do
|
@@ -118,7 +118,7 @@ describe ArchitectureJS::Blueprint do
|
|
118
118
|
end
|
119
119
|
|
120
120
|
it 'should compress the application file' do
|
121
|
-
FileUtils.cp "#{FIXTURES}/compressed.
|
121
|
+
FileUtils.cp "#{FIXTURES}/compressed.blueprint", "#{TMP_DIR}/myapp.blueprint"
|
122
122
|
@project.config[:output].should == 'compressed'
|
123
123
|
end
|
124
124
|
|
@@ -134,7 +134,7 @@ describe ArchitectureJS::Blueprint do
|
|
134
134
|
suppress_output do
|
135
135
|
@project = ArchitectureJS::Blueprint.new({ name: 'myapp' },TMP_DIR)
|
136
136
|
@project.create
|
137
|
-
FileUtils.cp "#{FIXTURES}/update.
|
137
|
+
FileUtils.cp "#{FIXTURES}/update.blueprint", "#{TMP_DIR}/myapp.blueprint"
|
138
138
|
FileUtils.cp "#{FIXTURES}/lib1.js", "#{TMP_DIR}/src/lib1.js"
|
139
139
|
FileUtils.cp "#{FIXTURES}/lib2.js", "#{TMP_DIR}/src/lib2.js"
|
140
140
|
FileUtils.cp "#{FIXTURES}/src_file.js", "#{TMP_DIR}/src/myapp.js"
|
@@ -1,6 +1,6 @@
|
|
1
|
-
var <%=
|
2
|
-
function <%=
|
1
|
+
var <%= blueprint[:name] %> = (function() {
|
2
|
+
function <%= blueprint[:name] %>() {
|
3
3
|
<%= "var optional_variable = #{options[:optional_variable]};" if options %>
|
4
4
|
}
|
5
|
-
return <%=
|
5
|
+
return <%= blueprint[:name] %>;
|
6
6
|
})();
|
data/spec/generator_spec.rb
CHANGED
@@ -20,6 +20,10 @@ describe ArchitectureJS::Generator do
|
|
20
20
|
@gen.project.class.should == ArchitectureJS::Blueprint
|
21
21
|
end
|
22
22
|
|
23
|
+
it 'should have a blueprint' do
|
24
|
+
@gen.blueprint.class.should_not be_nil
|
25
|
+
end
|
26
|
+
|
23
27
|
it 'should have template_paths' do
|
24
28
|
@gen.template_paths.should == ["#{FIXTURES}/templates"]
|
25
29
|
end
|
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.
|
4
|
+
version: 0.2.0
|
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-21 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: fssm
|
16
|
-
requirement: &
|
16
|
+
requirement: &70350982276720 !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: *70350982276720
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: jsmin
|
27
|
-
requirement: &
|
27
|
+
requirement: &70350982276220 !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: *70350982276220
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rspec
|
38
|
-
requirement: &
|
38
|
+
requirement: &70350982275720 !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: *70350982275720
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: bundler
|
49
|
-
requirement: &
|
49
|
+
requirement: &70350982275220 !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: *70350982275220
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: jeweler
|
60
|
-
requirement: &
|
60
|
+
requirement: &70350982274720 !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: *70350982274720
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: ZenTest
|
71
|
-
requirement: &
|
71
|
+
requirement: &70350982274240 !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: *70350982274240
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: autotest-growl
|
82
|
-
requirement: &
|
82
|
+
requirement: &70350982273700 !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: *70350982273700
|
91
91
|
- !ruby/object:Gem::Dependency
|
92
92
|
name: jsmin
|
93
|
-
requirement: &
|
93
|
+
requirement: &70350982273180 !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: *70350982273180
|
102
102
|
- !ruby/object:Gem::Dependency
|
103
103
|
name: fssm
|
104
|
-
requirement: &
|
104
|
+
requirement: &70350982272640 !ruby/object:Gem::Requirement
|
105
105
|
none: false
|
106
106
|
requirements:
|
107
107
|
- - ! '>='
|
@@ -109,12 +109,11 @@ dependencies:
|
|
109
109
|
version: '0'
|
110
110
|
type: :runtime
|
111
111
|
prerelease: false
|
112
|
-
version_requirements: *
|
112
|
+
version_requirements: *70350982272640
|
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
|
118
117
|
- architect
|
119
118
|
extensions: []
|
120
119
|
extra_rdoc_files:
|
@@ -126,12 +125,12 @@ files:
|
|
126
125
|
- .travis.yml
|
127
126
|
- Gemfile
|
128
127
|
- 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
|
135
134
|
- bin/architect
|
136
135
|
- lib/architecture-js.rb
|
137
136
|
- lib/architecture-js/architect.rb
|
@@ -186,15 +185,15 @@ files:
|
|
186
185
|
- spec/fixtures/.DS_Store
|
187
186
|
- spec/fixtures/_hidden.js
|
188
187
|
- spec/fixtures/compiled_src.js
|
189
|
-
- spec/fixtures/compressed.
|
188
|
+
- spec/fixtures/compressed.blueprint
|
190
189
|
- spec/fixtures/compressed.js
|
191
190
|
- spec/fixtures/ejs.ejs
|
192
|
-
- spec/fixtures/existing.
|
191
|
+
- spec/fixtures/existing.blueprint
|
193
192
|
- spec/fixtures/lib1.js
|
194
193
|
- spec/fixtures/lib1_compressed.js
|
195
194
|
- spec/fixtures/lib2.js
|
196
195
|
- spec/fixtures/lib2_compressed.js
|
197
|
-
- spec/fixtures/myapp.
|
196
|
+
- spec/fixtures/myapp.blueprint
|
198
197
|
- spec/fixtures/src_file.js
|
199
198
|
- spec/fixtures/templates/test_template_one.js
|
200
199
|
- spec/fixtures/templates/test_template_two.js
|
@@ -202,7 +201,7 @@ files:
|
|
202
201
|
- spec/fixtures/test_template_options.js
|
203
202
|
- spec/fixtures/test_template_two.js
|
204
203
|
- spec/fixtures/underscore_template.js
|
205
|
-
- spec/fixtures/update.
|
204
|
+
- spec/fixtures/update.blueprint
|
206
205
|
- spec/fixtures/update.js
|
207
206
|
- spec/generator_spec.rb
|
208
207
|
- spec/helpers_spec.rb
|
@@ -224,7 +223,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
224
223
|
version: '0'
|
225
224
|
segments:
|
226
225
|
- 0
|
227
|
-
hash:
|
226
|
+
hash: 2033111183266170727
|
228
227
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
229
228
|
none: false
|
230
229
|
requirements:
|
/data/{bin/HELP → HELP}
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|