# == Schema Information # # Table name: action_nodes # # id :integer not null, primary key # name :string(255) # full_name :string(255) # description :string(255) # icon :string(255) # action_node_types_id :integer # is_local :boolean default("0") # local_url :string(255) # yaml :text(65535) # sort_no :integer default("0") # use_count :integer default("0") # user_id :integer # created_at :datetime not null # updated_at :datetime not null # label :string(255) # node_type :string(255) # is_mutil_link :boolean # link_type :string(255) # # Indexes # # by_name (name) # index_action_nodes_on_action_types_id (action_node_types_id) # index_action_nodes_on_user_id (user_id) # class Action::Node < ApplicationRecord self.table_name = 'action_nodes' default_scope { order(sort_no: :asc) } has_many :action_node_inputs, :class_name => 'Action::NodeInput', foreign_key: "action_nodes_id" has_many :action_node_selects, :class_name => 'Action::NodeSelect', foreign_key: "action_nodes_id" belongs_to :action_node_type, :class_name => 'Action::NodeType', foreign_key: "action_node_types_id" belongs_to :user, optional: true attr_accessor :cust_name, :run_values, :input_values, :parent_node_id, :sub_nodes, :link_type_array, :node_id validates :name, presence: { message: "不能为空" } validates :full_name, length: { maximum: 200, too_long: "不能超过200个字符" } validates :label, length: { maximum: 200, too_long: "不能超过200个字符" } validates :description, length: { maximum: 65535, too_long: "不能超过65535个字符"} def content_yaml "foo".to_yaml <<~YAML - name: Set up JDK ${{ matrix.java }} uses: actions/setup-java@v3 with: distribution: 'temurin' java-version: ${{ matrix.java }} YAML end def node self end def build_yaml yaml = ERB.new(File.read(File.join(Rails.root, "app/views/api/v1/projects/pipelines", "build_node.yaml.erb"))).result(binding) # 删除空行内容 yaml = yaml.gsub(/^\s*\n/, "") # Rails.logger.info "=========================" # Rails.logger.info yaml yaml end end