Class: Architect::Application
- Inherits:
-
Object
- Object
- Architect::Application
- Defined in:
- lib/architecture-js/architect.rb
Instance Attribute Summary collapse
-
#args ⇒ Object
readonly
Returns the value of attribute args.
-
#command ⇒ Object
readonly
Returns the value of attribute command.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #compile ⇒ Object
- #create ⇒ Object
-
#initialize(path = nil) ⇒ Application
constructor
A new instance of Application.
- #run ⇒ Object
- #src_files ⇒ Object
- #watch ⇒ Object
Constructor Details
#initialize(path = nil) ⇒ Application
19 20 21 22 23 24 25 |
# File 'lib/architecture-js/architect.rb', line 19 def initialize(path = nil) if path @root = File.(path) else @root = File.(Dir.getwd) end end |
Instance Attribute Details
#args ⇒ Object (readonly)
Returns the value of attribute args.
15 16 17 |
# File 'lib/architecture-js/architect.rb', line 15 def args @args end |
#command ⇒ Object (readonly)
Returns the value of attribute command.
15 16 17 |
# File 'lib/architecture-js/architect.rb', line 15 def command @command end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
15 16 17 |
# File 'lib/architecture-js/architect.rb', line 15 def end |
Instance Method Details
#compile ⇒ Object
60 61 62 63 64 65 66 |
# File 'lib/architecture-js/architect.rb', line 60 def compile @project = ArchitectureJS::Blueprint.init_with_config(@root) compress = [:c] || [:compress] @project.update(compress) rescue Exception => e puts ArchitectureJS::Notification.error e. end |
#create ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/architecture-js/architect.rb', line 40 def create app_name = @args.first if @args[1] sub_dir = @args[1] unless @args[1].match(/^-/) end blueprint = [:blueprint] raise 'You must specify a project name: architect create [project_name]' if args[0].nil? @root = File. sub_dir if sub_dir config = { name: app_name, blueprint: blueprint } require "#{blueprint}-architecture" unless blueprint == 'default' @project = ArchitectureJS::BLUEPRINTS[blueprint].new(config, @root) @project.create rescue Exception => e puts ArchitectureJS::Notification.error e. end |
#run ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/architecture-js/architect.rb', line 27 def run parse_command parse_arguments if @command self.send @command unless @command =~ /^-/ else help end end |
#src_files ⇒ Object
77 78 79 80 81 82 83 |
# File 'lib/architecture-js/architect.rb', line 77 def src_files @project = ArchitectureJS::Blueprint.init_with_config(@root) puts "Source files:" @project.src_files.each { |f| puts " - #{File.basename f}" } rescue Exception => e puts ArchitectureJS::Notification.error e. end |
#watch ⇒ Object
68 69 70 71 72 73 74 75 |
# File 'lib/architecture-js/architect.rb', line 68 def watch @project = ArchitectureJS::Blueprint.init_with_config(@root) @project.update @watcher = @project.watch("architect is watching for changes. Type 'quit' or 'exit' to stop.") start_interactive_session rescue Exception => e puts ArchitectureJS::Notification.error e. end |