https://github.com/jruby/jruby/wiki/CallingJavaFromJRuby
http://wiki.eclipse.org/Jetty/Tutorial/Embedding_Jetty
http://download.eclipse.org/jetty/stable-7/apidocs/
| # put in config/intializers/ | |
| module ActionView | |
| class LookupContext | |
| module ViewPaths | |
| def find_all_templates(name, partial = false, locals = {}) | |
| prefixes.collect do |prefix| | |
| view_paths.collect do |resolver| | |
| temp_args = *args_for_lookup(name, [prefix], partial, locals, {}) | |
| temp_args[1] = temp_args[1][0] |
| # Setup | |
| # ===== | |
| # | |
| # Put this gist in Rails.root/config/initializers/cancan.rb | |
| # Add Squeel to Gemfile, see https://github.com/ernie/squeel | |
| # | |
| # gem "squeel", "~> 0.9.3" | |
| # | |
| # Load Squeel hash and symbol extensions in squeel config initializer | |
| # |
| # Usage | |
| # | |
| # OptimizedPDFKit.new(html_tempfile).to_pdf(pdf_tempfile_path) | |
| # | |
| class OptimizedPDFKit < PDFKit | |
| def initialize(url_file_or_html, options = {}) | |
| @source = Source.new(url_file_or_html) | |
| @stylesheets = [] |
| <thead> | |
| <tr> | |
| <% | |
| readonly = (@record.readonly? or not @record.authorized_for?(:crud_type => :update)) | |
| crud_type = @record.new_record? ? :create : (readonly ? :read : :update) | |
| config = active_scaffold_config_for(record.class) | |
| columns = @record.new_record? ? config.create.columns : config.update.columns | |
| columns.each :for => record.class, :crud_type => crud_type, :flatten => true do |column| | |
| hidden = column_renders_as(column) == :hidden | |
| next unless in_subform?(column, parent_record) |
| # Install Ruby 1.9.2 on CentOS | |
| # https://github.com/imeyer/ruby-1.9.2-rpm | |
| yum groupinstall "Development Tools" | |
| yum install curl-devel openssl-devel httpd-devel apr-devel apr-util-devel libzlib-ruby zlib-devel | |
| wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.2-p290.tar.gz | |
| tar -zxvf ruby-1.9.2-p290.tar.gz | |
| cd ruby-1.9.2-p290 | |
| ./configure && make && make install |
| apache-solr-cell-1.4.0.jar jempbox-0.2.0.jar | |
| asm-3.1.jar log4j-1.2.14.jar | |
| bcmail-jdk14-136.jar nekohtml-1.9.9.jar | |
| bcprov-jdk14-136.jar ooxml-schemas-1.0.jar | |
| commons-codec-1.3.jar pdfbox-0.7.3.jar | |
| commons-compress-1.0.jar poi-3.5-beta6.jar | |
| commons-io-1.4.jar poi-ooxml-3.5-beta6.jar | |
| commons-lang-2.1.jar poi-scratchpad-3.5-beta6.jar | |
| commons-logging-1.1.1.jar tika-core-0.4.jar | |
| dom4j-1.6.1.jar tika-parsers-0.4.jar |
| guardArgs = (def, args) -> | |
| i = 0 | |
| for arg, type of def | |
| throw new Error("bad type of #{arg}") unless typeof args[i] == type | |
| i++ | |
| typeEnsure = (def, f) -> -> | |
| guardArgs(def, arguments) | |
| f.apply @, arguments | |
| 1. Folosim ruby 1.9.2p190 de aici http://rubyinstaller.org/ | |
| Pentru NSIS fol comanda: | |
| # https://github.com/oneclick/rubyinstaller/wiki/FAQ#wiki-silent_install | |
| # very silent install to custom dir with file associations and PATH update | |
| c:\>rubyinstaller.exe /verysilent /dir="d:\rubyABC" /tasks="assocfiles,modpath" | |
| 2. Pentru rulare ca serviciu folosim mongrel & mongrel_service (gemuri). Ai grija sa le pui ca dependinte pe production. | |
| 3. Inainte de a impacheta serverul de aplicatie (gislog) instalam toate dependintele si le vendorizam: |
| # stop the execution and open a debug console | |
| import pdb; pdb.set_trace() | |
| # inspect the object (what names it defines, as in methods) | |
| dir(object) | |
| # inspect the object more (the dictionary of attributes, as in properties) | |
| dir(object.__dict__) # or something like that |