zoukankan      html  css  js  c++  java
  • Redmine插件开发帮助

    这里先零星记录二次开发用得上的知识点:

    1、windows下开发环境,参考此文。最好使用rubyinstaller安装,注意选择版本。或者直接安装railsinstaller。

    2、获取issue自定义字段内容,参考此文

    Every customizable redmine object has custom_field_values field, that value is array ofCustomFieldValueCustomFieldValue contains current value, custom field description and customized object.

    Needed values i reads and alters by sort out. May be it's not best variant, but i acquainted with ruby language not so long ago.

    Method for reading custom fields values:

    def object_custom_field_value(object, field_name)
      object.custom_field_values.each do |field|
        if field.custom_field.name == field_name
          return field.value
        end
      end
    end

    And for changing:

    def object_custom_field_set_value(object, field_name, value)
      object.custom_field_values.each do |field|
        if field.custom_field.name == field_name
          field.value = value
        end
      end
    end

     3、bundle源修改

    方法一:

    bundle config --delete 'mirror.https://rubygems.org/'  # 删除全局变量

    bundle config 'mirror.https://rubygems.org' 'https://ruby.taobao.org' 

    2016.12.29设置后运行bundle install也失效,需将taobao的源更新至aliyun

    bundle config 'mirror.https://rubygems.org' 'http://mirrors.aliyun.com/rubygems/'

    bundle config 'mirror.http://mirrors.aliyun.com/rubygems/'http://gems.ruby-china.org/'  # 2017.1.7 发现gems.ruby-china.org好用。

    方法二:

    在Gemfile里加入:source 'http://mirrors.aliyun.com/rubygems/'

    4、gem install rails --version 4.2.6 --no-ri --no-rdoc 失败的解决方法

    原因还是因为默认的源地址不对,gem sources可查看gem使用的服务器地址。修改:

          gem sources -a http://mirrors.aliyun.com/rubygems/ --remove https://rubygems.org/ 

    20170107 update: 因为ruby版本的原因,会出现“bad response Not Found 404 (http://ruby.taobao.org/specs.4.8.gz)”错误,修改:

          gem sources -a http://gems.ruby-china.org/ -V

    C:Sites>gem install rails --version 4.2.6 --no-ri --no-rdoc
    Fetching: activesupport-4.2.6.gem (100%)
    Successfully installed activesupport-4.2.6
    Fetching: actionview-4.2.6.gem (100%)
    Successfully installed actionview-4.2.6
    Fetching: actionpack-4.2.6.gem (100%)
    Successfully installed actionpack-4.2.6
    Fetching: activejob-4.2.6.gem (100%)
    Successfully installed activejob-4.2.6
    Fetching: actionmailer-4.2.6.gem (100%)
    Successfully installed actionmailer-4.2.6
    Fetching: activemodel-4.2.6.gem (100%)
    Successfully installed activemodel-4.2.6
    Fetching: activerecord-4.2.6.gem (100%)
    Successfully installed activerecord-4.2.6
    Fetching: railties-4.2.6.gem (100%)
    Successfully installed railties-4.2.6
    Fetching: rails-4.2.6.gem (100%)
    Successfully installed rails-4.2.6
    9 gems installed

    5、bundle与gem

    6、创建插件框架

    ruby htdocs/script/rails generate redmine_plugin Polls  # database connect error, maybe need to config first

    6、帮助文档

    自己生成chm帮助文档(参考1参考2),前提是已安装HTML HELP WORKSHOP

    To create the documentation for Ruby, go to the Ruby source directory (src uby-x.x.x-pxxx) in the console and enter: rdoc -f [format] -o [destination-folder].

    To create the documentation for Rails, go to the ruby gems directory (i.e. lib ubygems1.8gems) and enter: rdoc -f [format] -x test/* -x template/* -o [destination-folder] action* active* rails-* .

    The extra argument -x template/* is needed here to prevent errors from occurring during compilation, as discussed here. This problem occurs for both html and chm compilation.

    我的实例:

    D:AppCoderRailsInstallerRuby2.1.0lib ubygems2.1.0gems>rdoc -f chm -x test/* -x template/* -x rails-4.2.5.1/* -o d: ails4.2.6.chm action* active* rails-*

    也可直接下载ruby文档。

    7、Rubymine设置github,参考此文,主要几步:

    To use GitHub integration, perform these general steps

  • 相关阅读:
    转linux ln命令详解 简单
    商业智能哲学思索
    IE8 RTM 和 IE8 RC1 版本比较。
    汇编语言发展树.
    IE8卸载后遗症,不得不继续当小白鼠。。。
    商务智能系统实现数据管理的关键技术
    商务智能 是什么? 不是什么?
    Standard and Custom Toolset Configurations
    统一论:3G手机、云计算、SaaS、业务开发平台、SOA、BPEL [转]
    JAVA Atm测试实验心得
  • 原文地址:https://www.cnblogs.com/lustforlife/p/5637761.html
Copyright © 2011-2022 走看看