Module: Editus

Defined in:
lib/editus.rb,
lib/editus/cop.rb,
lib/editus/file.rb,
lib/editus/proxy.rb,
lib/editus/client.rb,
lib/editus/engine.rb,
lib/editus/script.rb,
lib/editus/actions.rb,
lib/editus/version.rb,
lib/editus/definition_proxy.rb,
app/helpers/editus/home_helper.rb,
app/models/editus/application_record.rb,
app/helpers/editus/application_helper.rb,
app/controllers/editus/home_controller.rb,
app/controllers/editus/application_controller.rb

Defined Under Namespace

Modules: ApplicationHelper, HomeHelper, Script Classes: Action, Actions, ApplicationController, ApplicationRecord, Client, Configuration, Cop, DefinitionProxy, Engine, FileLib, HomeController, InvalidModelError, Proxy, RecordProxy, UpdateFieldError

Constant Summary collapse

VERSION =
"1.1.0"
SUMMARY =
"This application is a simple web interface integrated with an existing Ruby on Rails application. It allows users to directly edit models, run predefined scripts, and easily undo changes."
DESCRIPTION =
<<~DOC
  This application is a user-friendly web interface designed to work with a Ruby on Rails application. With a simple and intuitive web interface, users can conveniently access the features of the application.

  One of the key features of this application is the ability to directly edit models. This enables users to make changes directly to the data without the need to learn and use complex tools. Through the web interface, users can access and modify the attributes of models with ease.

  Additionally, the application provides the capability to run predefined scripts. This allows users to perform automated tasks or handle complex data processing through prebuilt scripts. Running these scripts via the web interface saves users time and effort compared to alternative methods.
DOC

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.configurationObject



69
70
71
# File 'lib/editus.rb', line 69

def self.configuration
  @configuration ||= Editus::Configuration.new
end

.definition_file_pathsObject

Returns the value of attribute definition_file_paths.



66
67
68
# File 'lib/editus.rb', line 66

def definition_file_paths
  @definition_file_paths
end

Class Method Details

.configure {|configuration| ... } ⇒ Object

Yields:



73
74
75
# File 'lib/editus.rb', line 73

def self.configure
  yield(configuration)
end

.find_definitionsObject



79
80
81
82
83
84
85
86
87
88
89
# File 'lib/editus.rb', line 79

def self.find_definitions
  absolute_definition_file_paths = definition_file_paths.map{|path| File.expand_path(path)}

  absolute_definition_file_paths.uniq.each do |path|
    next unless File.directory? path

    Dir[File.join(path, "*.rb")].sort.each do |file|
      Editus::Script::Reader.read(file)
    end
  end
end

.load_file_configObject



91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# File 'lib/editus.rb', line 91

def self.load_file_config
  if File.exist?(Rails.root.join(Editus::Configuration::CONFIG_PATH))
    yaml = File.read(Rails.root.join(Editus::Configuration::CONFIG_PATH))
    config = YAML.safe_load(yaml)

    configure do |c|
      config.each do |key, value|
        next unless Editus::Configuration::CONFIG_KEYS.include?(key)

        c[key] = value
      end
    end
  else
    false
  end
rescue StandardError
  false
end