architecture-js 0.0.0 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +10 -2
- data/Gemfile.lock +14 -0
- data/README.md +1 -1
- data/Rakefile +3 -1
- data/VERSION +1 -1
- data/architecture-js.gemspec +62 -5
- data/bin/architect +214 -0
- data/lib/architecture-js.rb +32 -0
- data/lib/architecture-js/command.rb +80 -0
- data/lib/architecture-js/dependencies.rb +18 -0
- data/lib/architecture-js/generator.rb +44 -0
- data/lib/architecture-js/helpers.rb +30 -0
- data/lib/architecture-js/notification.rb +54 -0
- data/lib/architecture-js/project.rb +138 -0
- data/spec/architecture-js_spec.rb +51 -4
- data/spec/cli_spec.rb +38 -0
- data/spec/command_spec.rb +60 -0
- data/spec/fixtures/compiled_src.js +2 -0
- data/spec/fixtures/ejs_template.ejs +6 -0
- data/spec/fixtures/existing.architecture +6 -0
- data/spec/fixtures/lib1.js +1 -0
- data/spec/fixtures/lib2.js +1 -0
- data/spec/fixtures/myapp.architecture +6 -0
- data/spec/fixtures/src_file.js +2 -0
- data/spec/fixtures/test_template.erb +6 -0
- data/spec/fixtures/test_template.js +6 -0
- data/spec/fixtures/test_template_options.js +6 -0
- data/spec/generator_spec.rb +49 -0
- data/spec/helpers_spec.rb +16 -0
- data/spec/notification_spec.rb +27 -0
- data/spec/project_spec.rb +103 -0
- data/spec/spec_helper.rb +32 -7
- metadata +144 -15
data/Gemfile
CHANGED
@@ -5,9 +5,17 @@ source "http://rubygems.org"
|
|
5
5
|
|
6
6
|
# Add dependencies to develop your gem here.
|
7
7
|
# Include everything needed to run rake, tests, features, etc.
|
8
|
+
|
9
|
+
gem "fssm", ">= 0"
|
10
|
+
gem "jsmin", "~> 1.0.1"
|
11
|
+
gem "sprockets", "1.0.2"
|
12
|
+
|
8
13
|
group :development do
|
9
|
-
gem "rspec", "~> 2.3.0"
|
10
14
|
gem "bundler", "~> 1.0.0"
|
11
15
|
gem "jeweler", "~> 1.5.2"
|
16
|
+
gem "shoulda", ">= 0"
|
12
17
|
gem "rcov", ">= 0"
|
13
|
-
|
18
|
+
gem "rspec", "~> 2.3.0"
|
19
|
+
gem "ZenTest", "~> 4.4.2"
|
20
|
+
gem "rdoc", ">= 0"
|
21
|
+
end
|
data/Gemfile.lock
CHANGED
@@ -1,14 +1,20 @@
|
|
1
1
|
GEM
|
2
2
|
remote: http://rubygems.org/
|
3
3
|
specs:
|
4
|
+
ZenTest (4.4.2)
|
4
5
|
diff-lcs (1.1.3)
|
6
|
+
fssm (0.2.7)
|
5
7
|
git (1.2.5)
|
6
8
|
jeweler (1.5.2)
|
7
9
|
bundler (~> 1.0.0)
|
8
10
|
git (>= 1.2.5)
|
9
11
|
rake
|
12
|
+
jsmin (1.0.1)
|
13
|
+
json (1.6.3)
|
10
14
|
rake (0.9.2.2)
|
11
15
|
rcov (0.9.11)
|
16
|
+
rdoc (3.12)
|
17
|
+
json (~> 1.4)
|
12
18
|
rspec (2.3.0)
|
13
19
|
rspec-core (~> 2.3.0)
|
14
20
|
rspec-expectations (~> 2.3.0)
|
@@ -17,12 +23,20 @@ GEM
|
|
17
23
|
rspec-expectations (2.3.0)
|
18
24
|
diff-lcs (~> 1.1.2)
|
19
25
|
rspec-mocks (2.3.0)
|
26
|
+
shoulda (2.11.3)
|
27
|
+
sprockets (1.0.2)
|
20
28
|
|
21
29
|
PLATFORMS
|
22
30
|
ruby
|
23
31
|
|
24
32
|
DEPENDENCIES
|
33
|
+
ZenTest (~> 4.4.2)
|
25
34
|
bundler (~> 1.0.0)
|
35
|
+
fssm
|
26
36
|
jeweler (~> 1.5.2)
|
37
|
+
jsmin (~> 1.0.1)
|
27
38
|
rcov
|
39
|
+
rdoc
|
28
40
|
rspec (~> 2.3.0)
|
41
|
+
shoulda
|
42
|
+
sprockets (= 1.0.2)
|
data/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
##About
|
4
4
|
|
5
|
-
Architecture.js is a suite of tools to help you build and manage complex javascript applications and frameworks.
|
5
|
+
Architecture.js is a suite of tools to help you build and manage complex javascript applications and frameworks. With architecture.js you can create project scaffolding, manage third-party packages, compile, and compress your javascript application, all in real time as you write plain old vanilla javascript. In addition to large applications, architecture.js is perfect for developing your own javascript frameworks.
|
6
6
|
|
7
7
|
###contributing to architecture.js
|
8
8
|
|
data/Rakefile
CHANGED
@@ -21,7 +21,9 @@ Jeweler::Tasks.new do |gem|
|
|
21
21
|
gem.authors = ["Dayton Nolan"]
|
22
22
|
# Include your dependencies below. Runtime dependencies are required when using your gem,
|
23
23
|
# and development dependencies are only needed for development (ie running rake tasks, tests, etc)
|
24
|
-
|
24
|
+
gem.add_runtime_dependency 'jsmin'
|
25
|
+
gem.add_runtime_dependency 'fssm'
|
26
|
+
gem.add_runtime_dependency 'sprockets', '1.0.2'
|
25
27
|
# gem.add_development_dependency 'rspec', '> 1.2.3'
|
26
28
|
end
|
27
29
|
Jeweler::RubygemsDotOrgTasks.new
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.1.0
|
data/architecture-js.gemspec
CHANGED
@@ -5,13 +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.1.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 = "2011-12-
|
12
|
+
s.date = "2011-12-27"
|
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
16
|
s.extra_rdoc_files = [
|
16
17
|
"LICENSE.txt",
|
17
18
|
"README.md"
|
@@ -26,9 +27,32 @@ Gem::Specification.new do |s|
|
|
26
27
|
"Rakefile",
|
27
28
|
"VERSION",
|
28
29
|
"architecture-js.gemspec",
|
30
|
+
"bin/architect",
|
29
31
|
"lib/architecture-js.rb",
|
32
|
+
"lib/architecture-js/command.rb",
|
33
|
+
"lib/architecture-js/dependencies.rb",
|
34
|
+
"lib/architecture-js/generator.rb",
|
35
|
+
"lib/architecture-js/helpers.rb",
|
36
|
+
"lib/architecture-js/notification.rb",
|
37
|
+
"lib/architecture-js/project.rb",
|
30
38
|
"spec/.DS_Store",
|
31
39
|
"spec/architecture-js_spec.rb",
|
40
|
+
"spec/cli_spec.rb",
|
41
|
+
"spec/command_spec.rb",
|
42
|
+
"spec/fixtures/compiled_src.js",
|
43
|
+
"spec/fixtures/ejs_template.ejs",
|
44
|
+
"spec/fixtures/existing.architecture",
|
45
|
+
"spec/fixtures/lib1.js",
|
46
|
+
"spec/fixtures/lib2.js",
|
47
|
+
"spec/fixtures/myapp.architecture",
|
48
|
+
"spec/fixtures/src_file.js",
|
49
|
+
"spec/fixtures/test_template.erb",
|
50
|
+
"spec/fixtures/test_template.js",
|
51
|
+
"spec/fixtures/test_template_options.js",
|
52
|
+
"spec/generator_spec.rb",
|
53
|
+
"spec/helpers_spec.rb",
|
54
|
+
"spec/notification_spec.rb",
|
55
|
+
"spec/project_spec.rb",
|
32
56
|
"spec/spec_helper.rb"
|
33
57
|
]
|
34
58
|
s.homepage = "http://github.com/daytonn/architecture.js"
|
@@ -38,6 +62,12 @@ Gem::Specification.new do |s|
|
|
38
62
|
s.summary = "architecture.js is a command line application to dynamically build and manage complex javascript applications."
|
39
63
|
s.test_files = [
|
40
64
|
"spec/architecture-js_spec.rb",
|
65
|
+
"spec/cli_spec.rb",
|
66
|
+
"spec/command_spec.rb",
|
67
|
+
"spec/generator_spec.rb",
|
68
|
+
"spec/helpers_spec.rb",
|
69
|
+
"spec/notification_spec.rb",
|
70
|
+
"spec/project_spec.rb",
|
41
71
|
"spec/spec_helper.rb"
|
42
72
|
]
|
43
73
|
|
@@ -45,21 +75,48 @@ Gem::Specification.new do |s|
|
|
45
75
|
s.specification_version = 3
|
46
76
|
|
47
77
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
48
|
-
s.
|
78
|
+
s.add_runtime_dependency(%q<fssm>, [">= 0"])
|
79
|
+
s.add_runtime_dependency(%q<jsmin>, ["~> 1.0.1"])
|
80
|
+
s.add_runtime_dependency(%q<sprockets>, ["= 1.0.2"])
|
49
81
|
s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
|
50
82
|
s.add_development_dependency(%q<jeweler>, ["~> 1.5.2"])
|
83
|
+
s.add_development_dependency(%q<shoulda>, [">= 0"])
|
51
84
|
s.add_development_dependency(%q<rcov>, [">= 0"])
|
85
|
+
s.add_development_dependency(%q<rspec>, ["~> 2.3.0"])
|
86
|
+
s.add_development_dependency(%q<ZenTest>, ["~> 4.4.2"])
|
87
|
+
s.add_development_dependency(%q<rdoc>, [">= 0"])
|
88
|
+
s.add_runtime_dependency(%q<jsmin>, [">= 0"])
|
89
|
+
s.add_runtime_dependency(%q<fssm>, [">= 0"])
|
90
|
+
s.add_runtime_dependency(%q<sprockets>, ["= 1.0.2"])
|
52
91
|
else
|
53
|
-
s.add_dependency(%q<
|
92
|
+
s.add_dependency(%q<fssm>, [">= 0"])
|
93
|
+
s.add_dependency(%q<jsmin>, ["~> 1.0.1"])
|
94
|
+
s.add_dependency(%q<sprockets>, ["= 1.0.2"])
|
54
95
|
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
55
96
|
s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
|
97
|
+
s.add_dependency(%q<shoulda>, [">= 0"])
|
56
98
|
s.add_dependency(%q<rcov>, [">= 0"])
|
99
|
+
s.add_dependency(%q<rspec>, ["~> 2.3.0"])
|
100
|
+
s.add_dependency(%q<ZenTest>, ["~> 4.4.2"])
|
101
|
+
s.add_dependency(%q<rdoc>, [">= 0"])
|
102
|
+
s.add_dependency(%q<jsmin>, [">= 0"])
|
103
|
+
s.add_dependency(%q<fssm>, [">= 0"])
|
104
|
+
s.add_dependency(%q<sprockets>, ["= 1.0.2"])
|
57
105
|
end
|
58
106
|
else
|
59
|
-
s.add_dependency(%q<
|
107
|
+
s.add_dependency(%q<fssm>, [">= 0"])
|
108
|
+
s.add_dependency(%q<jsmin>, ["~> 1.0.1"])
|
109
|
+
s.add_dependency(%q<sprockets>, ["= 1.0.2"])
|
60
110
|
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
61
111
|
s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
|
112
|
+
s.add_dependency(%q<shoulda>, [">= 0"])
|
62
113
|
s.add_dependency(%q<rcov>, [">= 0"])
|
114
|
+
s.add_dependency(%q<rspec>, ["~> 2.3.0"])
|
115
|
+
s.add_dependency(%q<ZenTest>, ["~> 4.4.2"])
|
116
|
+
s.add_dependency(%q<rdoc>, [">= 0"])
|
117
|
+
s.add_dependency(%q<jsmin>, [">= 0"])
|
118
|
+
s.add_dependency(%q<fssm>, [">= 0"])
|
119
|
+
s.add_dependency(%q<sprockets>, ["= 1.0.2"])
|
63
120
|
end
|
64
121
|
end
|
65
122
|
|
data/bin/architect
ADDED
@@ -0,0 +1,214 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
$: << File.expand_path(File.join(File.dirname(__FILE__), "../lib"))
|
4
|
+
|
5
|
+
begin
|
6
|
+
require 'architecture-js'
|
7
|
+
require 'optparse'
|
8
|
+
rescue LoadError
|
9
|
+
require 'rubygems'
|
10
|
+
require 'architecture-js'
|
11
|
+
require 'optparse'
|
12
|
+
end
|
13
|
+
|
14
|
+
create = <<-CREATE
|
15
|
+
create Creates a new architecture-js application in the current working
|
16
|
+
directory or sub directory within.
|
17
|
+
|
18
|
+
Arguments:
|
19
|
+
application name - Name of the architecture-js application
|
20
|
+
subdirectory* - Directory where the application will be
|
21
|
+
installed (created if non existent)
|
22
|
+
|
23
|
+
examples:
|
24
|
+
arcjs create myapp
|
25
|
+
arcjs create myapp subdirectory
|
26
|
+
CREATE
|
27
|
+
|
28
|
+
generate = <<-GEN
|
29
|
+
generate Generates scoffolding for the given component file type.
|
30
|
+
|
31
|
+
Arguments:
|
32
|
+
type - Type of application scaffold to create (module, elements, model).
|
33
|
+
name* - Name of the module to generate the scaffold for
|
34
|
+
|
35
|
+
Options:
|
36
|
+
-a, --alias name* - Create an alias of the application object
|
37
|
+
(defaults to "app"), passing a name is optional
|
38
|
+
-e, --elements - Generate an elements file
|
39
|
+
-m, --model - Generate a model file
|
40
|
+
|
41
|
+
examples:
|
42
|
+
arcjs generate module mymodule -em (generates module, elements and model)
|
43
|
+
arcjs generate module mymodule -a (generates an application alias)
|
44
|
+
arcjs generate elements mymodule -m (generates an elements and a model file)
|
45
|
+
arcjs generate model mymodule (generates an model file)
|
46
|
+
GEN
|
47
|
+
|
48
|
+
compile = <<-COMP
|
49
|
+
compile Compiles the architecture-js project in the current working directory.
|
50
|
+
|
51
|
+
Options:
|
52
|
+
-c, --compress - Compress output with JsMin
|
53
|
+
|
54
|
+
example:
|
55
|
+
arcjs compile
|
56
|
+
COMP
|
57
|
+
|
58
|
+
watch = <<-WATCH
|
59
|
+
watch Watches the current working directory for file changes and
|
60
|
+
compiles when changes are detected.
|
61
|
+
|
62
|
+
example:
|
63
|
+
arcjs watch
|
64
|
+
WATCH
|
65
|
+
|
66
|
+
upd = <<-UPDATE
|
67
|
+
update Updates your application's core files to the latest version.
|
68
|
+
UPDATE
|
69
|
+
|
70
|
+
footer = <<-FOOTER
|
71
|
+
* optional argument
|
72
|
+
FOOTER
|
73
|
+
|
74
|
+
help = {
|
75
|
+
create: create,
|
76
|
+
generate: generate,
|
77
|
+
compile: compile,
|
78
|
+
watch: watch,
|
79
|
+
update: upd,
|
80
|
+
footer: footer
|
81
|
+
}
|
82
|
+
|
83
|
+
command = ARGV[0]
|
84
|
+
|
85
|
+
options = {
|
86
|
+
alias: nil,
|
87
|
+
elements: false,
|
88
|
+
model: false,
|
89
|
+
help: false,
|
90
|
+
compress: nil
|
91
|
+
}
|
92
|
+
|
93
|
+
optparse = OptionParser.new do |opts|
|
94
|
+
opts.on( '-h', '--help', 'Display this screen' ) do
|
95
|
+
options[:help] = true
|
96
|
+
end
|
97
|
+
|
98
|
+
opts.on( '-v', '--version', 'Display the version') do
|
99
|
+
time = Time.now
|
100
|
+
puts ArchitectureJS::Notification.notice 'arcjs ' + ArchitectureJS::VERSION
|
101
|
+
puts ArchitectureJS::Notification.notice "Copyright (c) #{time.year} Dayton Nolan"
|
102
|
+
puts ArchitectureJS::Notification.notice "Released under the MIT License"
|
103
|
+
exit
|
104
|
+
end
|
105
|
+
|
106
|
+
opts.on( '-a', '--alias [alias]', 'Generate application alias') do |als|
|
107
|
+
options[:alias] = als || "app"
|
108
|
+
end
|
109
|
+
|
110
|
+
opts.on( '-d', '--dest [dest]', 'Module destination directory') do |dest|
|
111
|
+
options[:dest] = dest
|
112
|
+
end
|
113
|
+
|
114
|
+
opts.on('-e', '--elements', 'Generate elements file') do
|
115
|
+
options[:elements] = true
|
116
|
+
end
|
117
|
+
|
118
|
+
opts.on('-m', '--model', 'Generate model file') do
|
119
|
+
options[:model] = true
|
120
|
+
end
|
121
|
+
|
122
|
+
opts.on('-c', '--compress', 'Compress with JsMin') do
|
123
|
+
options[:compress] = true
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
127
|
+
optparse.parse!
|
128
|
+
|
129
|
+
case command
|
130
|
+
# create
|
131
|
+
when "create"
|
132
|
+
if options[:help]
|
133
|
+
puts help[:create]
|
134
|
+
exit
|
135
|
+
end
|
136
|
+
app_name = ARGV[1]
|
137
|
+
sub_dir = ARGV[2] || nil
|
138
|
+
|
139
|
+
if app_name.nil?
|
140
|
+
puts "Error! Application name is required (arcjs create app_name)"
|
141
|
+
exit
|
142
|
+
end
|
143
|
+
|
144
|
+
config = { name: app_name }
|
145
|
+
config[:root] = sub_dir unless sub_dir.nil?
|
146
|
+
ArchitectureJS::Command.create(config)
|
147
|
+
# generate
|
148
|
+
when "generate"
|
149
|
+
if options[:help]
|
150
|
+
puts help[:generate]
|
151
|
+
exit
|
152
|
+
end
|
153
|
+
|
154
|
+
errors = Hash.new
|
155
|
+
type = ARGV[1]
|
156
|
+
name = ARGV[2]
|
157
|
+
als = options[:alias] || nil
|
158
|
+
dest = options[:dest] || nil
|
159
|
+
|
160
|
+
errors[:type] = "Error! Scaffold type is required (arcjs generate module mymodule)" if type.nil?
|
161
|
+
errors[:name] = "Error! Module name is required (arcjs generate module mymodule)" if name.nil?
|
162
|
+
|
163
|
+
unless errors.empty?
|
164
|
+
errors.each do |error|
|
165
|
+
puts error
|
166
|
+
end
|
167
|
+
exit
|
168
|
+
end
|
169
|
+
|
170
|
+
dependencies = {
|
171
|
+
model: options[:model],
|
172
|
+
elements: options[:elements]
|
173
|
+
}
|
174
|
+
|
175
|
+
ArchitectureJS::Command.generate({
|
176
|
+
project: ArchitectureJS::Project.new,
|
177
|
+
type: type,
|
178
|
+
name: name,
|
179
|
+
alias: als,
|
180
|
+
dest: dest,
|
181
|
+
dependencies: dependencies
|
182
|
+
})
|
183
|
+
# compile
|
184
|
+
when "compile"
|
185
|
+
if options[:help]
|
186
|
+
puts help[:compile]
|
187
|
+
exit
|
188
|
+
end
|
189
|
+
|
190
|
+
if options[:compress]
|
191
|
+
ArchitectureJS::Command.compile
|
192
|
+
else
|
193
|
+
ArchitectureJS::Command.compile({ force_compress: options[:compress] })
|
194
|
+
end
|
195
|
+
# watch
|
196
|
+
when "watch"
|
197
|
+
if options[:help]
|
198
|
+
puts help[:watch]
|
199
|
+
exit
|
200
|
+
end
|
201
|
+
ArchitectureJS::Command.watch
|
202
|
+
# update
|
203
|
+
when "update"
|
204
|
+
if options[:help]
|
205
|
+
puts help[:update]
|
206
|
+
exit
|
207
|
+
end
|
208
|
+
ArchitectureJS::Command.update
|
209
|
+
else
|
210
|
+
help.each do |section|
|
211
|
+
puts section.last + "\n"
|
212
|
+
end
|
213
|
+
exit
|
214
|
+
end
|
data/lib/architecture-js.rb
CHANGED
@@ -0,0 +1,32 @@
|
|
1
|
+
require "#{File.dirname(__FILE__)}/architecture-js/helpers"
|
2
|
+
|
3
|
+
module ArchitectureJS
|
4
|
+
BASE_DIR = File.expand_path(File.join(File.dirname(__FILE__), '..'))
|
5
|
+
LIB_DIR = File.expand_path(File.join(File.dirname(__FILE__)))
|
6
|
+
ROOT_DIR = Dir.getwd
|
7
|
+
VERSION = File.read("#{BASE_DIR}/VERSION")
|
8
|
+
FRAMEWORKS = Hash.new
|
9
|
+
|
10
|
+
def register_framework(name, constructor)
|
11
|
+
FRAMEWORKS[name] = constructor
|
12
|
+
end
|
13
|
+
|
14
|
+
def create_project_from_config(project_dir = nil)
|
15
|
+
project_dir ||= File.expand_path(Dir.getwd)
|
16
|
+
conf_file = (Dir.entries(project_dir).select { |f| f.match /\.architecture$/ })[0]
|
17
|
+
raise "<project_name>.architecture was not found in #{project_dir}" if conf_file.nil?
|
18
|
+
|
19
|
+
config = YAML.load_file("#{project_dir}/#{conf_file}")
|
20
|
+
config = ArchitectureJS::Helpers::symbolize_keys config
|
21
|
+
|
22
|
+
raise "The config file does not contain a project name" if config[:name].nil?
|
23
|
+
raise "#{config[:framework]} is not isntalled. Try gem install #{config[:framework]}-architecture" if ArchitectureJS::FRAMEWORKS[config[:framework]].nil?
|
24
|
+
|
25
|
+
project = ArchitectureJS::FRAMEWORKS[config[:framework]].new(config, project_dir)
|
26
|
+
end
|
27
|
+
|
28
|
+
module_function :register_framework,
|
29
|
+
:create_project_from_config
|
30
|
+
end
|
31
|
+
|
32
|
+
Dir.glob(File.dirname(__FILE__) + '/architecture-js/*') { |file| require file }
|