$ date +%s 1354127890
↑これだけ!意外と載っていないので。。。(Mac, Linux 共通)
また、UNIXTIMEを分かりやすく年月日で表示するコマンドは、
↓Mac (*BSD系はこれ?)
$ date -r "1354127890" 2012年 11月29日 木曜日 03時38分10秒 JST
↓Linux
$ date -d "@1354127890" 2012年 11月 29日 木曜日 03:38:10 JST
$ date +%s 1354127890
$ date -r "1354127890" 2012年 11月29日 木曜日 03時38分10秒 JST
$ date -d "@1354127890" 2012年 11月 29日 木曜日 03:38:10 JST
CentOSでコマンドラインでPerlを使ってJSONを見やすい形にしたいと思って、↓としてみたら、
$ echo '{"hoge":"fuga", "piyo" : {"fizz": "buzz"}}' | perl -MJSON -E "say to_json(decode_json(<>), { pretty => 1 });" Can't locate JSON.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .). BEGIN failed--compilation aborted.と怒られた。
$ sudo yum search perl json Loaded plugins: fastestmirror, presto Loading mirror speeds from cached hostfile * base: ftp.iij.ad.jp * extras: ftp.iij.ad.jp * updates: ftp.iij.ad.jp ================================== N/S Matched: perl, json ================================== perl-JSON.noarch : Parse and convert to JSON (JavaScript Object Notation) Full name and summary matches only, use "search all" for everything. $ sudo yum install perl-JSON 中略 Installed: perl-JSON.noarch 0:2.15-5.el6 Dependency Installed: perl-Compress-Raw-Zlib.x86_64 1:2.020-127.el6 perl-Compress-Zlib.x86_64 0:2.020-127.el6 perl-HTML-Parser.x86_64 0:3.64-2.el6 perl-HTML-Tagset.noarch 0:3.20-4.el6 perl-IO-Compress-Base.x86_64 0:2.020-127.el6 perl-IO-Compress-Zlib.x86_64 0:2.020-127.el6 perl-libwww-perl.noarch 0:5.833-2.el6 Complete!
$ echo '{"hoge":"fuga", "piyo" : {"fizz": "buzz"}}' | perl -MJSON -E "say to_json(decode_json(<>), { pretty => 1 });" { "piyo" : { "fizz" : "buzz" }, "hoge" : "fuga" }
[Users/piyo] > install p5-json ---> Computing dependencies for p5-json ---> Dependencies to be installed: p5.12-json ---> Fetching archive for p5.12-json ---> Attempting to fetch p5.12-json-2.530.0_2.darwin_10.noarch.tbz2 from http://packages.macports.org/p5.12-json ---> Attempting to fetch p5.12-json-2.530.0_2.darwin_10.noarch.tbz2.rmd160 from http://packages.macports.org/p5.12-json ---> Installing p5.12-json @2.530.0_2 ---> Activating p5.12-json @2.530.0_2 ---> Cleaning p5.12-json ---> Fetching archive for p5-json ---> Attempting to fetch p5-json-2.530.0_2.darwin_10.noarch.tbz2 from http://packages.macports.org/p5-json ---> Attempting to fetch p5-json-2.530.0_2.darwin_10.noarch.tbz2.rmd160 from http://packages.macports.org/p5-json ---> Installing p5-json @2.530.0_2 ---> Activating p5-json @2.530.0_2 ---> Cleaning p5-json ---> Updating database of binaries: 100.0% ---> Scanning binaries for linking errors: 100.0% ---> No broken files found.
その1はめちゃくちゃなので非公開にしています…。
連携についての作業を書いておく。毎回忘れて、historyとgrepとlessを多用することになるので。
想定する状況は、新しくレポジトリを作って、Redmineで反映させたいときです。
1. ローカルマシンで、新しくレポジトリを作ってcommit
2. Redmineとgitoliteが入っているリモートマシンにログイン
3. リモートマシンの、/var/lib/redmine/repositories/にて、
git clone --mirror /home/gitolite-user/repositories/hogehoge.gitとする。
vi post-receiveとして、
#!/bin/sh /usr/bin/git push --mirror /var/lib/redmine/repositories/hogehoge.gitと書いて、実行権限を付加。
chmod 700 post-receive
環境:
$ cat /etc/redhat-release CentOS release 6.3 (Final) $ rails -v Rails 3.2.8 $ ruby -v ruby 1.9.3p286 (2012-10-12 revision 37165) [x86_64-linux] $ cat /var/lib/redmine/lib/redmine/version.rb require 'rexml/document' module Redmine module VERSION #:nodoc: MAJOR = 2 MINOR = 1 TINY = 2 # => Redmine 2.1.2 stable
vi /var/lib/redmineapp/views/files/index.html.erb
<%= sort_header_tag('description', :caption => l(:field_description)) %> と<%= file.description %>
<div class="contextual"> <%= link_to(l(:label_attachment_new), new_project_file_path(@project), :class => 'icon icon-add') if User.current.allowed_to?(:manage_files, @project) %> </div> <h2><%=l(:label_attachment_plural)%></h2> <% delete_allowed = User.current.allowed_to?(:manage_files, @project) %> <table class="list files"> <thead><tr> <%= sort_header_tag('filename', :caption => l(:field_filename)) %> <%= sort_header_tag('description', :caption => l(:field_description)) %> <!-- ↑この行を追加! --> <%= sort_header_tag('created_on', :caption => l(:label_date), :default_order => 'desc') %> <%= sort_header_tag('size', :caption => l(:field_filesize), :default_order => 'desc') %> <%= sort_header_tag('downloads', :caption => l(:label_downloads_abbr), :default_order => 'desc') %> <th>MD5</th> <th></th> </tr></thead> <tbody> <% @containers.each do |container| %> <% next if container.attachments.empty? -%> <% if container.is_a?(Version) -%> <tr> <th colspan="6" align="left"> <%= link_to(h(container), {:controller => 'versions', :action => 'show', :id => container}, :class => "icon icon-package") %> </th> </tr> <% end -%> <% container.attachments.each do |file| %> <tr class="file <%= cycle("odd", "even") %>"> <td class="filename"><%= link_to_attachment file, :download => true, :title => file.description %></td> <td class="description"><%= file.description %></td> <!-- ↑この行を追加! --> <td class="created_on"><%= format_time(file.created_on) %></td> <td class="filesize"><%= number_to_human_size(file.filesize) %></td> <td class="downloads"><%= file.downloads %></td> <td class="digest"><%= file.digest %></td> <td align="center"> <%= link_to(image_tag('delete.png'), attachment_path(file), :data => {:confirm => l(:text_are_you_sure)}, :method => :delete) if delete_allowed %> </td> </tr> <% end reset_cycle %> <% end %> </tbody> </table> <% html_title(l(:label_attachment_plural)) -%>
service httpd restart