Class: OTPKickOff
- Inherits:
-
Thor
- Object
- Thor
- OTPKickOff
- Includes:
- Thor::Actions
- Defined in:
- lib/otp_kickoff.rb
Overview
Thor classes, the magic of tasks!
Class Method Summary collapse
Instance Method Summary collapse
- #configure ⇒ Object
- #new_application ⇒ Object
- #new_event_handler ⇒ Object
- #new_gen_server ⇒ Object
- #new_supervisor ⇒ Object
- #new_test ⇒ Object
Class Method Details
.destination_root ⇒ Object
25 26 27 |
# File 'lib/otp_kickoff.rb', line 25 def self.destination_root File.(File.dirname('.')) end |
.source_root ⇒ Object
Setup
21 22 23 |
# File 'lib/otp_kickoff.rb', line 21 def self.source_root File.(File.dirname(__FILE__) + '/..') end |
Instance Method Details
#configure ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/otp_kickoff.rb', line 43 def configure #set data about author = [:author] = [:email] create_file CONFIGURATION_FILE do %Q{ author_name: #{author_name} author_email: #{author_email} } end end |
#new_application ⇒ Object
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/otp_kickoff.rb', line 61 def new_application # set data to templates @application_name = [:name] @supervisor_name = @application_name @server_name = @application_name @test_name = @application_name , = get_config_info # generate templates template 'resources/template.app', "#{application_name}/src/#{application_name}.app" template 'resources/template_app.erl', "#{application_name}/src/#{application_name}_app.erl" template 'resources/template_sup.erl', "#{application_name}/src/#{application_name}_sup.erl" template 'resources/template_server.erl', "#{application_name}/src/#{application_name}_server.erl" template 'resources/template_appstart.erl', "#{application_name}/src/#{application_name}.erl" template 'resources/template_include.hrl', "#{application_name}/src/#{application_name}.hrl" template 'resources/template_test.erl', "#{application_name}/test/#{application_name}_test.erl" # create required directories empty_directory "#{application_name}/ebin" empty_directory "#{application_name}/deps" empty_directory "#{application_name}/priv" end |
#new_event_handler ⇒ Object
122 123 124 125 126 127 128 129 130 |
# File 'lib/otp_kickoff.rb', line 122 def new_event_handler # set data to templates @handler_name = [:name] , = get_config_info # generate templates template 'resources/template_handler.erl', "#{handler_name}_handler.erl" end |
#new_gen_server ⇒ Object
107 108 109 110 111 112 113 114 115 |
# File 'lib/otp_kickoff.rb', line 107 def new_gen_server # set data to templates @server_name = [:name] , = get_config_info # generate templates template 'resources/template_server.erl', "#{server_name}_server.erl" end |
#new_supervisor ⇒ Object
91 92 93 94 95 96 97 98 99 100 |
# File 'lib/otp_kickoff.rb', line 91 def new_supervisor # set data to templates @supervisor_name = [:name] @application_name = [:application_name] , = get_config_info # generate templates template 'resources/template_sup.erl', "#{supervisor_name}_sup.erl" end |
#new_test ⇒ Object
137 138 139 140 141 142 143 144 145 |
# File 'lib/otp_kickoff.rb', line 137 def new_test # set data to templates @test_name = [:name] , = get_config_info # generate templates template 'resources/template_test.erl', "#{test_name}_test.erl" end |