Class: Localtower::PagesController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Localtower::PagesController
- Defined in:
- app/controllers/localtower/pages_controller.rb
Instance Method Summary collapse
- #dashboard ⇒ Object
- #log ⇒ Object
- #log_var ⇒ Object
- #logs ⇒ Object
- #migrations ⇒ Object
- #models ⇒ Object
- #post_migrations ⇒ Object
- #post_models ⇒ Object
- #post_relations ⇒ Object
- #relations ⇒ Object
- #status ⇒ Object
Methods inherited from ApplicationController
Instance Method Details
#dashboard ⇒ Object
6 7 |
# File 'app/controllers/localtower/pages_controller.rb', line 6 def dashboard end |
#log ⇒ Object
13 14 15 16 17 |
# File 'app/controllers/localtower/pages_controller.rb', line 13 def log file = Dir["#{Localtower::Plugins::Capture::LOG_PATH.call}/localtower*#{params[:md5]}*"][0] render json: JSON.parse(open(file).read) end |
#log_var ⇒ Object
19 20 21 22 23 24 25 26 27 28 |
# File 'app/controllers/localtower/pages_controller.rb', line 19 def log_var answer = {} file = Dir["#{Localtower::Plugins::Capture::LOG_PATH.call}/localtower*#{params[:md5]}*"][0] data = JSON.parse(open(file).read) answer = data["variables"].select {|i| i["event_name"] == params[:var] }[0]["returned"] render json: answer end |
#logs ⇒ Object
9 10 11 |
# File 'app/controllers/localtower/pages_controller.rb', line 9 def logs @logs = Localtower::Plugins::Capture.new.logs end |
#migrations ⇒ Object
34 35 |
# File 'app/controllers/localtower/pages_controller.rb', line 34 def migrations end |
#models ⇒ Object
67 68 |
# File 'app/controllers/localtower/pages_controller.rb', line 67 def models end |
#post_migrations ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'app/controllers/localtower/pages_controller.rb', line 37 def post_migrations # Because we have a list or a field, take the item from the list in priority params[:migrations][:migrations] = params[:migrations][:migrations].map do |action_line| action_line["new_column_type"] = action_line["column_type"] if action_line["column"].present? action_line["column"] = action_line["column"] end if action_line["column_list"].present? action_line["column"] = action_line["column_list"] end action_line.delete("column_list") action_line end use_generator(::Localtower::Generators::Migration, params[:migrations]) redirect_to migrations_path end |
#post_models ⇒ Object
70 71 72 73 |
# File 'app/controllers/localtower/pages_controller.rb', line 70 def post_models use_generator(::Localtower::Generators::Model, params[:models]) redirect_to relations_path end |
#post_relations ⇒ Object
62 63 64 65 |
# File 'app/controllers/localtower/pages_controller.rb', line 62 def post_relations use_generator(::Localtower::Generators::Relation, params[:relations]) redirect_to relations_path end |
#relations ⇒ Object
59 60 |
# File 'app/controllers/localtower/pages_controller.rb', line 59 def relations end |
#status ⇒ Object
30 31 32 |
# File 'app/controllers/localtower/pages_controller.rb', line 30 def status @data = ::Localtower::Status.new.run end |