ruby가 2006~2008 년도 피크로 죽어가는 걸로 보임.

이걸 해야 하는가?







* bitnami redmine plugin 개발 환경 만들어 보기

(모든 바이너리는 32bit 기준)


-bitnami redmine 설치

-Redmine 3.2.0-2 설치

: https://bitnami.com/stack/redmine/installer

D:\svn\redmine\redmine-3.2.0-2 설치

admin/admin1234

localhost:3000/redmine


Environment:

 Redmine version                3.2.0.stable

 Ruby version                   2.0.0-p647 (2015-08-18) [i386-mingw32]

 Rails version                  4.2.5

 Environment                    production

 Database adapter               Mysql2

SCM:

 Subversion                     1.8.11

 Git                            2.5.1

 Filesystem                     

Redmine plugins:

 redmine_ckeditor               1.1.3

 redmine_lightbox2              0.2.4

 subtask_list_columns           0.0.3

- path 등록

D:\svn\redmine\redmine-3.2.0-2\ruby\bin


> cd D:\redmine\redmine-3.2.0-2\apps\redmine\htdocs>

(rails 버전 : bundle exec ruby bin/rails -v)

#https 에러 처리

Gemfile에 https를 http로 변경

source 'https://rubygems.org'

source 'http://rubygems.org'

> set RAILS_ENV=production

> gem update --system

> gem install ruby-debug-ide

- 그리고

D:\svn\redmine\redmine-3.2.0-2\apps\redmine\htdocs\config\environments\development.rb 를

production.rb 로 변경

데이터 베이스 : bitnami_redmine

계정 : bitnami/26464b6e65


- 실행

그냥 실행시 :

> bundle exec ruby bin/thin start -p 3000 -e production --prefix /redmine

(bundle exec ruby bin/rails s -p 3000)

디버깅용으로 실행 시 :

> rdebug-ide --port 1234 --dispatcher-port 3000 --host 0.0.0.0 -- bin/thin start -e production --prefix /redmine


- aptana

- 설치

FAiled to correctly acquire installer_nodejs_windows.msi file: CRC error.

발생하므로 http://go.aptana.com/installer_nodejs_windows 다운받아 설치


http://www.aptana.com/products/radrails.html 다운 받아 설치

- import project

"import > Existing Folder as New Project"

Select folder : D:\svn\redmine\redmine-3.2.0-2\apps\redmine\htdocs

Project name : redmine

Project Type : Rails - Primary

- 디버깅 방법

실행>

> gem install rake -v 10.5.0

> rdebug-ide --port 1234 --dispatcher-port 3000 --host 0.0.0.0 -- bin/thin start -e production --prefix /redmine

aptana>

"Debug Configurations > Remote Ruby Debug Session" 추가 생성

Common 탭에 Debug 체크


* bat 파일(편의성) - D:\svn\redmine\redmine-3.2.0-2\use_redmine.bat

@echo off

CALL "D:\svn\redmine\REDMIN~1.0-2\scripts\setenv.bat"

D:

rem cd "D:\svn\redmine\redmine-3.2.0-2"

cd "D:\svn\redmine\redmine-3.2.0-2\apps\redmine\htdocs"

START "Bitnami Redmine Stack Environment" cmd




* bat 파일(편의성) - D:\svn\redmine\redmine-3.2.0-2\apps\redmine\htdocs\debug.bat

@echo off


echo http://localhost:3000/redmine

rdebug-ide --port 1234 --dispatcher-port 3000 --host 0.0.0.0 -- bin/thin start -e production --prefix /redmine




* bat 파일(편의성) - D:\svn\redmine\redmine-3.2.0-2\apps\redmine\htdocs\run.bat
@echo off

echo http://localhost:3000/redmine
bundle exec ruby bin/thin start -p 3000 -e production --prefix /redmine



* plugin 설치/삭제

-설치

콘솔 : D:\svn\redmine\redmine-3.2.0-2\use_redmine.bat

> cd D:\svn\redmine\redmine-3.2.0-2\apps\redmine\htdocs

> bundle exec rake redmine:plugins:migrate RAILS_ENV=production

재시작

-삭제

bundle exec rake redmine:plugins:migrate NAME=플러그인이름 VERSION=0 RAILS_ENV=production


- plugin 참고

https://github.com/alexmonteiro/Redmine-Monitoring-Controlling

https://github.com/Coren/redmine_advanced_roadmap_v2


* plugin 만들기

콘솔 : D:\redmine\redmine-3.2.0-2\use_redmine.bat

> cd D:\redmine\redmine-3.2.0-2\apps\redmine\htdocs

> set RAILS_ENV=production


#플러그인 생성

> bundle exec ruby bin/rails generate redmine_plugin 플러그인이름

#모델 생성(필요 없어서 안함)

...생략...



* rails 설치

- git 설치

- ruby, devkit 다운로드

http://rubyinstaller.org

- rubyinstaller-2.2.4.exe

모두 체크하여 설치


(devkit이 깔려있는 듯..)

- DevKit-mingw64-32-4.7.2-20130224-1151-sfx.exe

압축 해제 후

> ruby dk.rb init

config.yml 에서 ruby path 확인

> ruby dk.rb install


- rails 설치

> gem install rails -v 4.2.5


- aptana 설치

https://nodejs.org/download/release/v0.10.13/node-v0.10.13-x86.msi 설치

http://www.aptana.com/products/radrails.html


- 그외

libmysql.dll 를 ruby/bin 복사

> cd D:\redmine\redmine-3.2.0-2\apps\redmine\htdocs>

#https 에러 처리

1. gem

> gem source -r https://rubygems.org

> gem source -a http://rubygems.org

2. bundle

Gemfile에 https를 http로 변경

source 'https://rubygems.org'

source 'http://rubygems.org'

> set RAILS_ENV=production

> gem update --system

> gem install ruby-debug-ide rake json tzinfo-data

(그 외 필요한거 설치)

- 실행

> rdebug-ide --port 1234 --dispatcher-port 3000 --host 0.0.0.0 bin/rails s

aptana "Debug Configurations > Remote Ruby Debug Session" 추가 생성

Common 탭에 Debug 체크




* 로깅은..

  - 파일 로깅

    logger.debug "debugging!!!!!!!"

  - 콘솔 출력

    put "hi put"