<commit_before># -*- coding: undecided -*-
require 'uri'
require 'asakusa_satellite/hook'

OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE

class AsakusaSatellite::Filter::RedmineTicketLink < AsakusaSatellite::Filter::Base
  def link_only(id, ref)
  end

  def ticket(id, ref)
    url =  URI.join(config.roots,"./issues/#{id}")
    if config.api_key then
      api =  URI.join(config.roots,"./issues/#{id}.json?key=#{config.api_key}")
      begin
        open(api.to_s) do|io|
          hash = JSON.parse(io.read)
          subject = hash["issue"]["subject"]
          return %[<a target="_blank" href="#{url}">#{ref} #{subject}</a>]
        end
      rescue => e
        %[<a target="_blank" href="#{url}">#{ref}</a>]
      end
    else
      %[<a target="_blank" href="#{url}">#{ref}</a>]
    end
  end

  def process(text)
    text.gsub(/#(\d+)/) do|id|
      ticket $1, id
    end
  end
end

class AsakusaSatellite::Hook::RedmineTicketLink < AsakusaSatellite::Hook::Listener
  include ActionController::UrlWriter


  def message_buttons(context)
    subject = CGI.escape(context[:message].body)

    description = CGI.escape(<<"END")
#{context[:message].user.name}: #{context[:message].body}

#{context[:permlink]}
END

    url =  URI.join(config.roots,"./projects/#{config.project}/issues/new?issue[description]=#{description}&issue[subject]=#{subject}")
    %(<a target="_blank" href="#{url}"><img src="#{root_path}images/redmine.png" /></a>)
  end
end

<commit_msg>redmineアイコンへのURLをきめうちした refs #421<commit_after># -*- coding: undecided -*-
require 'uri'
require 'asakusa_satellite/hook'

OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE

class AsakusaSatellite::Filter::RedmineTicketLink < AsakusaSatellite::Filter::Base
  def link_only(id, ref)
  end

  def ticket(id, ref)
    url =  URI.join(config.roots,"./issues/#{id}")
    if config.api_key then
      api =  URI.join(config.roots,"./issues/#{id}.json?key=#{config.api_key}")
      begin
        open(api.to_s) do|io|
          hash = JSON.parse(io.read)
          subject = hash["issue"]["subject"]
          return %[<a target="_blank" href="#{url}">#{ref} #{subject}</a>]
        end
      rescue => e
        %[<a target="_blank" href="#{url}">#{ref}</a>]
      end
    else
      %[<a target="_blank" href="#{url}">#{ref}</a>]
    end
  end

  def process(text)
    text.gsub(/#(\d+)/) do|id|
      ticket $1, id
    end
  end
end

class AsakusaSatellite::Hook::RedmineTicketLink < AsakusaSatellite::Hook::Listener
  include ActionController::UrlWriter


  def message_buttons(context)
    subject = CGI.escape(context[:message].body)

    description = CGI.escape(<<"END")
#{context[:message].user.name}: #{context[:message].body}

#{context[:permlink]}
END

    url =  URI.join(config.roots,"./projects/#{config.project}/issues/new?issue[description]=#{description}&issue[subject]=#{subject}")
    %(<a target="_blank" href="#{url}"><img src="https://codefirst.org/as/images/redmine.png" /></a>)
  end
end


{'fraction_non_alphanumeric': 0.19270659083305453, 'fraction_numerical': 0.0016728002676480427, 'mean_word_length': 3.8225806451612905, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 23, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3750231', 'n_tokens_mistral': 1076, 'n_tokens_neox': 1055, 'n_words': 172}