Ruby in office time
reboot
後藤 謙太郎, Goto Kentaro
@gotoken
syngram.co.jp
Acknowledgements
• All you RubyKaigi participants
• All RubyKaigi staffs
• All RubyKaigi sponsors
• All Ruby committers
• Matz
• And all my colleagues at work in Syngram
Apologies
• Too late preparation for this presentation
• English interpreter has not been given enough time
• The responsibility lies with the presenter, that is me
Excuse
• Non edge technologies only
• Please move to the next room if you’d like to get high-tech talk
• Maybe old topics
Agenda
Today’s topics
• Introducing this series
• Case studies
• Summary
Introducing this series
Scope of this session
• Engineers having several roles in small company or team
• Cases of useful Ruby and products
• Commoditized techs, not edge
Past talks
• 2006 manage job with Kagemai BTS, share with Hiki, RWiki
• 2007 One liner helps us
• 2008 customize BTS view, scraping and feeding intra site
Past slides available
• https://www.slideshare.net/gotoken
Introducing our team
• Products
• Good look and much usable web GUIs and sites
• Effective company communication. Printing matters and SI
• Professional GUI prototyping for data scientists
Our team
• Members
• Designers: use Adobe CC and prototyping tools InVision etc.
• Front-end engineers: Markup, Stylesheet and JavaScript
• Back-end engineers: Programming, networking and all tech matters
• No proper sales person
Principle: Merit of a team
• Diversity
• I can’t create beautiful looks
• But our team provide them
• Redundancy
• I can’t do all administration
• But our team achieve them
Pleasures
• Working with designers is fun.
• They have flexible thinking ways
• Creating process is interesting
• I can be a coauthor of beautiful products
• Kaizen (Improvements)
• A little bit of programming sometimes makes work much efficient
• Small tools are often helpful
Small team difficulties
• IT solutions often needs admin’s help
• We are small team
• Engineers cannot be dedicated to proper intranet matters
Case studies
Case 1: Redmine applied to everything
Redmine
• Helped me very much. Thank you developers!
• In this 10 years Redmine has been much sophisticated
• Non-engineer uses are also comfortable
Basic concepts of issue tracker
Project
VersionVersionVersionVersion
Issue
Issue
IssueIssue
Issue
Roadmap
Issue, Roadmap, Project
• Issue
• Will be closed eventually
• Roadmap
• A sub-goal of project in many cases
• Collection of ticket is also useful. e.g., defining a business period
• Project
• Defines development of a project
• Never ending project fits to business operation.
Projects, ending and never ending
• Projects with goal
• Usual projects have the end, will be closed anyway
• Projects without goal
• Collections of issues which have similar scope and lifecycle
• Good alternative of Excel sheet and folder forest
Succeeding endless project example
• Name: Borrowed
• Purpose: Track lifecycle of borrowed items and its IOU
• Attach photos of all items and all steps of package opening
• We can package correctly again
• Periodical not-lost checking is easy
• Cross project reference is easy too
Succeeding endless project example
• Name: Inquiries
• Purpose: Track biz flow as an issue from offering to billing
• Each version stands for ship-out month
• Versions are closed annually
• Orders can be listed by month
Deploying Redmine
lxc
Ansible
Playbook
Private fork
customized
On-premise
Repository
On-premise
origin
repo
provisioning
Thanks to Hiraku Kuroda, Syngram system administrator The service
Useful plugin pick up
• Attach image from clipboard
http://www.redmine.org/plugins/clipboard_image_paste
• Author: Richard Pecl
• Enables attach image by paste and crop image
• Screen shot of bugs helps understanding immediately the problem
• Paste images also from power point figures or excel rectangle region
Case 2: Every member has own projects
Problem
All servers are on local site, not cloud
projects
repos
Update ticket by cron
Web designers
Many members
cannot create repo
Problem: Repositories and Redmine
• Creating SVN repository needs admin operation
`svnadmin create reponame`
• Creating Git shared repositories needs complex operations
from command line
• We want every team member to be able to prepare Redmine
project.
Before GitLab
• We have used large one subversion repository
• Each our product was a sub-directory in the repo
• Team members can add sub-directory via TortoiseSVN
• But that has many problems
• Commit often affects topology widely. Merging is almost impossible
• Too large repo: backup copy or exporting repository is hell
• Importing to Redmine took very long time and time-outed
Deploying GitLab
lxc
On-premise
install
package
Ansible
Playbook
provisioning
Thanks to Hiraku again The service
Problem (repeated)
projects
repos
Update ticket by cron
Web designers
Many members
cannot create repo
All servers are on local site, not cloud
Every member can
setup a project.
Role in each projects is variable
Redmine and GitLab CE gives us
projects
repos
Update ticket by git push
Web designers
Every member can
setup a repository
All servers are on local site, not cloud
Redmine and GitLab CE gives us
• Every team member can create new repository
• Commit or push updates ticket via github hook plugin:
https://github.com/koppen/redmine_github_hook
• Git cultures: issue branch, easy merge
• Web hooks also available: e.g. Slack
• These all features can be configured on web interface
• No .git/hooks scripts needed
• Redmine requires git bare repository on local filesystem
• We want separate GitLab lxc and Redmine lxc
• Solution: bind mount - exposing host directory to containers
Referring GitLab from Redmine
On-premise
lxcreposlxc
bind mount bind mount
Thanks to Hiraku again
readable
Case 3: Customers like xlsx
Axlsx: Office Open XML Spreadsheet Generation
Situation
• Renewal a static web site. hundreds pages.
• Analyze them to obtain link structure, template variations…
• Then you got a table like this
No. Path Title Tmpl Depth Lv2 Lv2 Lv4 Lv5
1 index.html The Ruby Corporaton top.dwt 1
2 about/index.html Corporation overview common.dwt 2 About us
3 about/mission.html Our missions common.dwt 3 About us
4 about/ir.html Investor Relations common.dwt 3 Abuut us
5 about/history.html Corporation history common.dwt 3 About us
6 about/access.html Access common.dwt 2
7 about/privacy.html Privacy Policy common.dwt 2
8 product/index.html Product product.dwt 2 Product
When you send this table to your client
• If you want add column value filter, column value sorter
• You may choose MS Excel
• Save as a CSV or TSV, read with Excel, Edit and then save as xlsx
• You may also make it more pretty, e.g., coloring, font text styling,
appending summary sheet
• But if the source data will be updated many times
• For example, data was incomplete at first
• Another case, you have to add a column for progress of the process
• Updating manually is boredom and hard to avoid mistakes
Axls is xlsx document generator
• Chart generation
• Styling
• Auto and Manually data type
• Image attachment
• Hyperlinks
• Auto filtering
• Printing related features: header, footer, page break
Case 4: I want provide a script to designer
Well-known one line http server
ruby -run -e httpd
• Serves current directory on http://localhost:8080
• It is too simple to provide something more than file browser
• However there are some command line options
• Try
ruby -run -e httpd -- --help
httpd options
% ruby -run -e httpd -- --help
Run WEBrick HTTP server.
ruby -run -e httpd -- [OPTION] DocumentRoot
--bind-address=ADDR address to bind
--port=NUM listening port number
--max-clients=MAX max number of simultaneous clients
--temp-dir=DIR temporary directory
--do-not-reverse-lookup disable reverse lookup
--request-timeout=SECOND request timeout in seconds
--http-version=VERSION HTTP version
-v verbose
To provide something more complex
• Typically, file processing script on a server
• For example, web site checking with eyes
repository
Working
copy
Screenshot
viewer.html
update
git pull node shot.js
Want to provide a CGI kicking here
<img src>
Sinatra is fit to such simple task
Considerations
Summary
• Applying Redmine to everything
• Admin-free project setup with Redmine + GitLab
• Axlsx helps communication with client
• Sinatra is good simple DSL
By the way, what is fun of Ruby?
Recently, I feel
• Closing thinking and writing
• e.g., right substitution
• Simple closure syntax
• But why we don’t use JavaScript promise-like interface?
Thank you!

Ruby in office time reboot

  • 1.
    Ruby in officetime reboot 後藤 謙太郎, Goto Kentaro @gotoken syngram.co.jp
  • 2.
    Acknowledgements • All youRubyKaigi participants • All RubyKaigi staffs • All RubyKaigi sponsors • All Ruby committers • Matz • And all my colleagues at work in Syngram
  • 3.
    Apologies • Too latepreparation for this presentation • English interpreter has not been given enough time • The responsibility lies with the presenter, that is me
  • 4.
    Excuse • Non edgetechnologies only • Please move to the next room if you’d like to get high-tech talk • Maybe old topics
  • 5.
  • 6.
    Today’s topics • Introducingthis series • Case studies • Summary
  • 7.
  • 8.
    Scope of thissession • Engineers having several roles in small company or team • Cases of useful Ruby and products • Commoditized techs, not edge
  • 9.
    Past talks • 2006manage job with Kagemai BTS, share with Hiki, RWiki • 2007 One liner helps us • 2008 customize BTS view, scraping and feeding intra site
  • 10.
    Past slides available •https://www.slideshare.net/gotoken
  • 11.
    Introducing our team •Products • Good look and much usable web GUIs and sites • Effective company communication. Printing matters and SI • Professional GUI prototyping for data scientists
  • 12.
    Our team • Members •Designers: use Adobe CC and prototyping tools InVision etc. • Front-end engineers: Markup, Stylesheet and JavaScript • Back-end engineers: Programming, networking and all tech matters • No proper sales person
  • 13.
    Principle: Merit ofa team • Diversity • I can’t create beautiful looks • But our team provide them • Redundancy • I can’t do all administration • But our team achieve them
  • 14.
    Pleasures • Working withdesigners is fun. • They have flexible thinking ways • Creating process is interesting • I can be a coauthor of beautiful products • Kaizen (Improvements) • A little bit of programming sometimes makes work much efficient • Small tools are often helpful
  • 15.
    Small team difficulties •IT solutions often needs admin’s help • We are small team • Engineers cannot be dedicated to proper intranet matters
  • 16.
  • 17.
    Case 1: Redmineapplied to everything
  • 18.
    Redmine • Helped mevery much. Thank you developers! • In this 10 years Redmine has been much sophisticated • Non-engineer uses are also comfortable
  • 19.
    Basic concepts ofissue tracker Project VersionVersionVersionVersion Issue Issue IssueIssue Issue Roadmap
  • 20.
    Issue, Roadmap, Project •Issue • Will be closed eventually • Roadmap • A sub-goal of project in many cases • Collection of ticket is also useful. e.g., defining a business period • Project • Defines development of a project • Never ending project fits to business operation.
  • 21.
    Projects, ending andnever ending • Projects with goal • Usual projects have the end, will be closed anyway • Projects without goal • Collections of issues which have similar scope and lifecycle • Good alternative of Excel sheet and folder forest
  • 22.
    Succeeding endless projectexample • Name: Borrowed • Purpose: Track lifecycle of borrowed items and its IOU • Attach photos of all items and all steps of package opening • We can package correctly again • Periodical not-lost checking is easy • Cross project reference is easy too
  • 23.
    Succeeding endless projectexample • Name: Inquiries • Purpose: Track biz flow as an issue from offering to billing • Each version stands for ship-out month • Versions are closed annually • Orders can be listed by month
  • 24.
  • 25.
    Useful plugin pickup • Attach image from clipboard http://www.redmine.org/plugins/clipboard_image_paste • Author: Richard Pecl • Enables attach image by paste and crop image • Screen shot of bugs helps understanding immediately the problem • Paste images also from power point figures or excel rectangle region
  • 26.
    Case 2: Everymember has own projects
  • 27.
    Problem All servers areon local site, not cloud projects repos Update ticket by cron Web designers Many members cannot create repo
  • 28.
    Problem: Repositories andRedmine • Creating SVN repository needs admin operation `svnadmin create reponame` • Creating Git shared repositories needs complex operations from command line • We want every team member to be able to prepare Redmine project.
  • 29.
    Before GitLab • Wehave used large one subversion repository • Each our product was a sub-directory in the repo • Team members can add sub-directory via TortoiseSVN • But that has many problems • Commit often affects topology widely. Merging is almost impossible • Too large repo: backup copy or exporting repository is hell • Importing to Redmine took very long time and time-outed
  • 30.
  • 31.
    Problem (repeated) projects repos Update ticketby cron Web designers Many members cannot create repo All servers are on local site, not cloud
  • 32.
    Every member can setupa project. Role in each projects is variable Redmine and GitLab CE gives us projects repos Update ticket by git push Web designers Every member can setup a repository All servers are on local site, not cloud
  • 33.
    Redmine and GitLabCE gives us • Every team member can create new repository • Commit or push updates ticket via github hook plugin: https://github.com/koppen/redmine_github_hook • Git cultures: issue branch, easy merge • Web hooks also available: e.g. Slack • These all features can be configured on web interface • No .git/hooks scripts needed
  • 34.
    • Redmine requiresgit bare repository on local filesystem • We want separate GitLab lxc and Redmine lxc • Solution: bind mount - exposing host directory to containers Referring GitLab from Redmine On-premise lxcreposlxc bind mount bind mount Thanks to Hiraku again readable
  • 35.
    Case 3: Customerslike xlsx Axlsx: Office Open XML Spreadsheet Generation
  • 36.
    Situation • Renewal astatic web site. hundreds pages. • Analyze them to obtain link structure, template variations… • Then you got a table like this No. Path Title Tmpl Depth Lv2 Lv2 Lv4 Lv5 1 index.html The Ruby Corporaton top.dwt 1 2 about/index.html Corporation overview common.dwt 2 About us 3 about/mission.html Our missions common.dwt 3 About us 4 about/ir.html Investor Relations common.dwt 3 Abuut us 5 about/history.html Corporation history common.dwt 3 About us 6 about/access.html Access common.dwt 2 7 about/privacy.html Privacy Policy common.dwt 2 8 product/index.html Product product.dwt 2 Product
  • 37.
    When you sendthis table to your client • If you want add column value filter, column value sorter • You may choose MS Excel • Save as a CSV or TSV, read with Excel, Edit and then save as xlsx • You may also make it more pretty, e.g., coloring, font text styling, appending summary sheet • But if the source data will be updated many times • For example, data was incomplete at first • Another case, you have to add a column for progress of the process • Updating manually is boredom and hard to avoid mistakes
  • 38.
    Axls is xlsxdocument generator • Chart generation • Styling • Auto and Manually data type • Image attachment • Hyperlinks • Auto filtering • Printing related features: header, footer, page break
  • 39.
    Case 4: Iwant provide a script to designer
  • 40.
    Well-known one linehttp server ruby -run -e httpd • Serves current directory on http://localhost:8080 • It is too simple to provide something more than file browser • However there are some command line options • Try ruby -run -e httpd -- --help
  • 41.
    httpd options % ruby-run -e httpd -- --help Run WEBrick HTTP server. ruby -run -e httpd -- [OPTION] DocumentRoot --bind-address=ADDR address to bind --port=NUM listening port number --max-clients=MAX max number of simultaneous clients --temp-dir=DIR temporary directory --do-not-reverse-lookup disable reverse lookup --request-timeout=SECOND request timeout in seconds --http-version=VERSION HTTP version -v verbose
  • 42.
    To provide somethingmore complex • Typically, file processing script on a server • For example, web site checking with eyes repository Working copy Screenshot viewer.html update git pull node shot.js Want to provide a CGI kicking here <img src>
  • 43.
    Sinatra is fitto such simple task
  • 44.
  • 45.
    Summary • Applying Redmineto everything • Admin-free project setup with Redmine + GitLab • Axlsx helps communication with client • Sinatra is good simple DSL
  • 46.
    By the way,what is fun of Ruby? Recently, I feel • Closing thinking and writing • e.g., right substitution • Simple closure syntax • But why we don’t use JavaScript promise-like interface?
  • 47.