architecture-js 0.5.6 → 0.5.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.5.6
1
+ 0.5.7
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "architecture-js"
8
- s.version = "0.5.6"
8
+ s.version = "0.5.7"
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"]
@@ -49,7 +49,7 @@ module Architect
49
49
  end
50
50
  blueprint = @options[:blueprint]
51
51
 
52
- raise 'you must specify a project name: architect create [project_name]' if args[0].nil?
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
- begin
72
- @project.generator.generate config
73
- rescue Exception => e
74
- puts ArchitectureJS::Notification.error e.message
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
- begin
81
- @project = ArchitectureJS::Blueprint.new_from_config(@root)
82
- compress = @options[:c] || @options[:compress]
83
- @project.update(compress)
84
- rescue Exception => e
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
- begin
112
- command = ''
113
- while not command =~ /^quit$/
114
- print ArchitectureJS::Notification.prompt
115
- command = gets.chomp
116
- args = command.split(/\s/)
117
- parse_command args
118
- case @command
119
- when /^quit$/
120
- @watcher.stop
121
- when /help/
122
- puts 'Interactive commands:'
123
- puts ' compile - compile the application'
124
- puts ' generate - generate a template'
125
- puts ' templates - list available templates to generate'
126
- puts ' src_files - list source files to be compiled into the build_dir'
127
- puts ' help - show this menu'
128
- puts ' quit - stop watching for changes'
129
- when /compile|generate|templates|src_files/
130
-
131
- if @command == :generate
132
- parse_arguments args
133
- parse_generate_options args
134
- else
135
- args = args.drop 1
136
- parse_interactive_options(args)
137
- parse_arguments args
138
- end
139
-
140
- self.send @command
141
- else
142
- puts ArchitectureJS::Notification.error "Unrecognized command `#{command}`. Try `help` or `quit`."
143
- end
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.6
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: -4246046546828477172
246
+ hash: -735876747371210409
247
247
  required_rubygems_version: !ruby/object:Gem::Requirement
248
248
  none: false
249
249
  requirements: