architecture-js 0.5.6 → 0.5.7
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/architecture-js.gemspec +1 -1
- data/lib/architecture-js/architect.rb +54 -50
- data/lib/architecture-js/blueprint.rb +1 -1
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.5.
|
1
|
+
0.5.7
|
data/architecture-js.gemspec
CHANGED
@@ -49,7 +49,7 @@ module Architect
|
|
49
49
|
end
|
50
50
|
blueprint = @options[:blueprint]
|
51
51
|
|
52
|
-
raise '
|
52
|
+
raise 'You must specify a project name: architect create [project_name]' if args[0].nil?
|
53
53
|
|
54
54
|
@root = File.expand_path sub_dir if sub_dir
|
55
55
|
config = { name: app_name, blueprint: blueprint }
|
@@ -58,6 +58,8 @@ module Architect
|
|
58
58
|
|
59
59
|
@project = ArchitectureJS::BLUEPRINTS[blueprint].new(config, @root)
|
60
60
|
@project.create
|
61
|
+
rescue Exception => e
|
62
|
+
puts ArchitectureJS::Notification.error e.message
|
61
63
|
end
|
62
64
|
|
63
65
|
def generate
|
@@ -68,22 +70,18 @@ module Architect
|
|
68
70
|
filename: @args[1],
|
69
71
|
options: @template_options
|
70
72
|
}
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
templates
|
76
|
-
end
|
73
|
+
@project.generator.generate config
|
74
|
+
rescue Exception => e
|
75
|
+
puts ArchitectureJS::Notification.error e.message
|
76
|
+
templates if @project
|
77
77
|
end
|
78
78
|
|
79
79
|
def compile
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
puts ArchitectureJS::Notification.error e.message
|
86
|
-
end
|
80
|
+
@project = ArchitectureJS::Blueprint.new_from_config(@root)
|
81
|
+
compress = @options[:c] || @options[:compress]
|
82
|
+
@project.update(compress)
|
83
|
+
rescue Exception => e
|
84
|
+
puts ArchitectureJS::Notification.error e.message
|
87
85
|
end
|
88
86
|
|
89
87
|
def watch
|
@@ -92,60 +90,66 @@ module Architect
|
|
92
90
|
@watcher = @project.watch
|
93
91
|
puts ArchitectureJS::Notification.log "architect is watching for changes. Type 'quit' to stop."
|
94
92
|
start_interactive_session
|
93
|
+
rescue Exception => e
|
94
|
+
puts ArchitectureJS::Notification.error e.message
|
95
95
|
end
|
96
96
|
|
97
97
|
def templates
|
98
98
|
@project = ArchitectureJS::Blueprint.new_from_config(@root)
|
99
99
|
puts "Templates:"
|
100
100
|
@project.generator.templates.each { |k,v| puts " - #{k}" }
|
101
|
+
rescue Exception => e
|
102
|
+
puts ArchitectureJS::Notification.error e.message
|
101
103
|
end
|
102
104
|
|
103
105
|
def src_files
|
104
106
|
@project = ArchitectureJS::Blueprint.new_from_config(@root)
|
105
107
|
puts "Source files:"
|
106
108
|
@project.src_files.each { |f| puts " - #{File.basename f}" }
|
109
|
+
rescue Exception => e
|
110
|
+
puts ArchitectureJS::Notification.error e.message
|
107
111
|
end
|
108
112
|
|
109
113
|
private
|
110
114
|
def start_interactive_session
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
115
|
+
command = ''
|
116
|
+
|
117
|
+
while not command =~ /^quit$/
|
118
|
+
print ArchitectureJS::Notification.prompt
|
119
|
+
command = gets.chomp
|
120
|
+
args = command.split(/\s/)
|
121
|
+
parse_command args
|
122
|
+
|
123
|
+
case @command
|
124
|
+
when /^quit$/
|
125
|
+
@watcher.stop
|
126
|
+
when /help/
|
127
|
+
puts 'Interactive commands:'
|
128
|
+
puts ' compile - compile the application'
|
129
|
+
puts ' generate - generate a template'
|
130
|
+
puts ' templates - list available templates to generate'
|
131
|
+
puts ' src_files - list source files to be compiled into the build_dir'
|
132
|
+
puts ' help - show this menu'
|
133
|
+
puts ' quit - stop watching for changes'
|
134
|
+
when /compile|generate|templates|src_files/
|
135
|
+
|
136
|
+
if @command == :generate
|
137
|
+
parse_arguments args
|
138
|
+
parse_generate_options args
|
139
|
+
else
|
140
|
+
args = args.drop 1
|
141
|
+
parse_interactive_options(args)
|
142
|
+
parse_arguments args
|
143
|
+
end
|
144
|
+
|
145
|
+
self.send @command
|
146
|
+
else
|
147
|
+
puts ArchitectureJS::Notification.error "Unrecognized command `#{command}`. Try `help` or `quit`."
|
144
148
|
end
|
145
|
-
rescue SystemExit, Interrupt
|
146
|
-
puts
|
147
|
-
@watcher.stop
|
148
149
|
end
|
150
|
+
rescue SystemExit, Interrupt
|
151
|
+
puts
|
152
|
+
@watcher.stop
|
149
153
|
end
|
150
154
|
|
151
155
|
def parse_interactive_options(args = [])
|
@@ -14,7 +14,7 @@ module ArchitectureJS
|
|
14
14
|
def self.new_from_config(path)
|
15
15
|
config_file = Dir.entries(path).select {|f| f =~ /\.blueprint$/ }.first
|
16
16
|
|
17
|
-
raise ".blueprint file was not found in #{path}" if config_file.nil?
|
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
|
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.5.
|
4
|
+
version: 0.5.7
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -243,7 +243,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
243
243
|
version: '0'
|
244
244
|
segments:
|
245
245
|
- 0
|
246
|
-
hash: -
|
246
|
+
hash: -735876747371210409
|
247
247
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
248
248
|
none: false
|
249
249
|
requirements:
|