Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] reports ディレクトリを変更する Ruby スクリプトを書く #1158

Open
wants to merge 50 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
ed01996
First step
yucao24hours Sep 7, 2015
cddc7b8
techcamp team
yucao24hours Sep 7, 2015
caf1d3e
freshman
yucao24hours Sep 7, 2015
034e0e0
show path
yucao24hours Sep 7, 2015
081c594
messed with dots
yucao24hours Sep 7, 2015
a28d1fc
作ってみました。パスは随時変えて頂ければと。windowsのパスなので気持ち悪いことになってます。。
yoheimiyamoto Sep 8, 2015
c5a6fcd
Revert "作ってみました。パスは随時変えて頂ければと。windowsのパスなので気持ち悪いことになってます。。"
yucao24hours Sep 19, 2015
b248d1e
change to relative path
pupupopo88 Sep 19, 2015
cd616ea
add debug code
pupupopo88 Sep 19, 2015
629b954
Delete old codes
yucao24hours Sep 19, 2015
1255db3
Make attendees directory
yucao24hours Sep 19, 2015
0e060d6
Add comment
yucao24hours Sep 19, 2015
732fc1b
Debug
yucao24hours Sep 19, 2015
3e08756
change directory to reports and get arrays
irinoyasu Sep 19, 2015
b6018ac
Delete files
yucao24hours Sep 19, 2015
168314d
delete unused lines
Sep 19, 2015
2864733
make yyyy/mm/dd directories
Sep 19, 2015
d8fc39a
add debug code
nakayama-san Sep 19, 2015
4d1ab09
chenge directory
myong-l Sep 19, 2015
e7d26b1
add copy part
Sep 19, 2015
60e8737
refactoring
Sep 19, 2015
9d23134
WIP:writing comments
irinoyasu Sep 28, 2015
3813502
Add some comments
akinomaeni Sep 28, 2015
26c0ae1
コメント追加
kiyohito1101 Sep 28, 2015
f8a0223
コメントアウト
irinoyasu Oct 5, 2015
7d471b1
copy ga ayashii
Oct 5, 2015
6cdbaf1
error ga kieta ppoi
sawaday Oct 5, 2015
5722ba0
ugoita ppoi
yucao24hours Oct 5, 2015
8daa5d4
Tidy code
fkmy Oct 17, 2015
a3c6e1f
add test settings
Oct 17, 2015
6bb3bfd
create test script
Oct 17, 2015
20ffbe9
add setup part
Oct 17, 2015
36e0f8c
require original file
Oct 17, 2015
99b5120
make class
Oct 17, 2015
7841a5a
Change class name
fkmy Oct 17, 2015
263b29f
add function
harukaueda Oct 17, 2015
58a66a2
add test_run_rebuilder
Oct 19, 2015
8df031f
add two tests method
irinoyasu Oct 19, 2015
bb31abd
Being separate test_dir method from run_builder method(TODO)
highwide Oct 19, 2015
e411c79
Create directory for rebuilder
yucao24hours Nov 13, 2015
bf43a4e
Remove unneeded comments
yucao24hours Nov 13, 2015
ac7ed4f
Remove unused test methods
yucao24hours Nov 13, 2015
834c8f2
Create dest_dir(but not implemented yet)
yucao24hours Nov 13, 2015
0221404
Define destination
yucao24hours Nov 13, 2015
3354c53
Add dest_dir method implementation
5t111111 Nov 13, 2015
72b8a1b
Remove trailing slash from dest_dir string
5t111111 Nov 13, 2015
4c24909
Change variable name src_dir in test to src
5t111111 Nov 13, 2015
3d97b4a
Create meetups method to get where your meetups directory exists in y…
yucao24hours Nov 14, 2015
515d094
Use meetups method in dest_dir
yucao24hours Nov 14, 2015
5ed5442
[WIP]Create copy_dir method
yucao24hours Nov 14, 2015
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions reports/20131202_01.md

This file was deleted.

10 changes: 0 additions & 10 deletions reports/20131209_02.md

This file was deleted.

11 changes: 0 additions & 11 deletions reports/20140114_04.md

This file was deleted.

15 changes: 0 additions & 15 deletions reports/20140120_05.md

This file was deleted.

3 changes: 3 additions & 0 deletions scripts/rebuilder/Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
source "https://rubygems.org"

gem "minitest"
13 changes: 13 additions & 0 deletions scripts/rebuilder/Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
GEM
remote: https://rubygems.org/
specs:
minitest (5.8.1)

PLATFORMS
ruby

DEPENDENCIES
minitest

BUNDLED WITH
1.10.6
47 changes: 47 additions & 0 deletions scripts/rebuilder/rebuilder.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
require 'fileutils'
# TODO attendees ディレクトリがすでに存在する場合は以下の処理を飛ばしたい

class Rebuilder
def dest_dir(str)
year = str[0..3]
month = str[4..5]
day = str[6..7]
"#{meetups}/attendees/#{year}/#{month}/#{day}"
end

def run_rebuilder
# reportsディレクトリに移動
Dir.chdir('reports')

# reportsディレクトリ内のディレクトリを全て取得
dirs = Dir.glob('*')

# 各ディレクトリを対象にする(dir)
dirs.each do |dir|
dest = dest_dir(dir)
FileUtils.mkdir_p(dest)

# 既存のフォルダに移動する
Dir.chdir(dir)

# フォルダにあるすべてのファイルのファイル名を配列で取得する
files = Dir.glob("*")

dest2 = '../' + dest
puts dest2
FileUtils.cp(files, dest2)

# reportsのフォルダに移動する
Dir.chdir('..')
end
end

private

def meetups
Dir.chdir(File.dirname(__FILE__))
Dir.chdir("../../")

Dir.pwd
end
end
21 changes: 21 additions & 0 deletions scripts/rebuilder/test/test_rebuilder.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
require "minitest/autorun"
require_relative "../rebuilder.rb"

class TestRebuilder < Minitest::Test
def setup
@rebuilder = Rebuilder.new
end

def test_dest_dir
src_dir = "20140722_no28"
# XXX 各自の環境に依存している
dest = "/Users/yucao24hours/work/yochiyochi/meetups/attendees/2014/07/22"
assert_equal @rebuilder.dest_dir(src_dir), dest
end

def test_copy_dir
expected = !File.directory?("/Users/yucao24hours/work/yochiyochi/meetups/attendees/2014/07/22")

assert expected
end
end