<commit_before># coding: utf-8
require "bx_hooks"

Redmine::Plugin.register :redmine_bx do
  name 'redmine_bx'
  author 'pinzolo'
  description 'redmine_bx is a plugin for Redmine. This will reduce excel files in your projects.'
  version '0.0.1'
  url 'https://github.com/pinzolo/redmine_bx'
  author_url 'https://github.com/pinzolo'

  project_module :bx do
    permission :bx_view_resources, :bx_resources => [:index, :show],
                                   :bx_resource_categories => [:show]
    permission :bx_manage_resources, :bx_resources => [:new, :edit, :create, :update, :destroy],
                                     :bx_resource_categories => [:new, :edit, :create, :update, :destroy],
                                     :bx_resource_branches => [:new, :edit, :create, :update, :destroy],
                                     :require => :member
  end

  menu :project_menu, :bx, { :controller => :bx_resources, :action => :index }, :param => :project_id

  Dir.glob(File.expand_path(File.join(File.dirname(__FILE__), "app", "{forms,services,validators}"))) do |dir|
    ActiveSupport::Dependencies.autoload_paths += [dir]
  end
end<commit_msg>add bx_resource wiki macro.<commit_after># coding: utf-8
require "bx_hooks"

Redmine::Plugin.register :redmine_bx do
  name 'redmine_bx'
  author 'pinzolo'
  description 'redmine_bx is a plugin for Redmine. This will reduce excel files in your projects.'
  version '0.0.1'
  url 'https://github.com/pinzolo/redmine_bx'
  author_url 'https://github.com/pinzolo'

  project_module :bx do
    permission :bx_view_resources, :bx_resources => [:index, :show],
                                   :bx_resource_categories => [:show]
    permission :bx_manage_resources, :bx_resources => [:new, :edit, :create, :update, :destroy],
                                     :bx_resource_categories => [:new, :edit, :create, :update, :destroy],
                                     :bx_resource_branches => [:new, :edit, :create, :update, :destroy],
                                     :require => :member
  end

  menu :project_menu, :bx, { :controller => :bx_resources, :action => :index }, :param => :project_id

  Dir.glob(File.expand_path(File.join(File.dirname(__FILE__), "app", "{forms,services,validators}"))) do |dir|
    ActiveSupport::Dependencies.autoload_paths += [dir]
  end
end

Redmine::WikiFormatting::Macros.register do
  macro :bx_resource do |obj, args|
    resource_id = args.first
    resource = BxResourceNode.where(:id => resource_id).first
    if resource
      link_label = resource.code
      link_label << " : #{resource.summary}" if resource.summary.present?
      link_to(link_label, project_bx_resource_path(resource.project, resource))
    else
      ""
    end
  end
end
{'fraction_non_alphanumeric': 0.1312250090876045, 'fraction_numerical': 0.0029080334423845873, 'mean_word_length': 2.954022988505747, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 22, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2151379', 'n_tokens_mistral': 894, 'n_tokens_neox': 840, 'n_words': 197}