FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
jruby/tool/sync_ruby at master · jruby/jruby · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
jruby
/
jruby
Public
Uh oh!
There was an error while loading.
Please reload this page
.
Notifications
You must be signed in to change notification settings
Fork
947
Star
3.9k
Code
Issues
845
Pull requests
110
Discussions
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Discussions
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
jruby
/
tool
/
sync_ruby
Copy path
More file actions
More file actions
Latest commit
History
History
History
executable file
·
113 lines (94 loc) · 2.92 KB
Breadcrumbs
jruby
/
tool
/
sync_ruby
Copy path
File metadata and controls
executable file
·
113 lines (94 loc) · 2.92 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
#!/usr/bin/env jruby
# -*- coding: utf-8 -*-
# Can also be run by any compliant ruby.
# This script is for use with JRuby, to copy the (patched) stdlib and external test files from
# various locations in MRI's layout to JRuby's layout. It should be used
# against the jruby-specific fork of MRI's repository at github.com/jruby/ruby.
#
# This script selects the branch to use against with the version number, i.e: jruby-ruby_2_2_0.
#
# usage: sync_ruby <tests|stdlib|all> <version(2_2_0)> <jruby ruby fork clone> <jruby dir>
#
# Example:
#
# Suppose the JRuby ruby fork is in ../jruby-ruby, and jruby is in the current directory.
# We want to sync the 2.2.0 standard libraries.
#
# $ jruby tool/sync_ruby stdlib 2_2_0 ../jruby-ruby .
# Already on 'jruby-ruby_2_2_0'
# cp -r ../jruby-ruby/lib/English.rb ./lib/ruby/1.8
# cp -r ../jruby-ruby/lib/Env.rb ./lib/ruby/1.8
# ...
#
# Layout mapping lives in globals_<version>.rb.
require
'fileutils'
class
Sync
include
FileUtils
def
initialize
(
type
,
version
,
source
,
target
)
@type
=
type
@named_version
=
version
@version
=
format_version
(
version
)
@source
=
source
@target
=
target
checkout
end
def
sync_tests
Dir
.
glob
(
"
#{
@source
}
/test/*"
)
do
|
file
|
next
if
file
=~
/
\/
excludes$/
cp_r
file
,
"
#{
@target
}
/test/mri"
,
:verbose
=>
true
end
end
def
sync_stdlib
load
File
.
dirname
(
__FILE__
)
+
"/sync_ruby_files.rb"
for
file
in
STDLIB_FILES
cp_r
"
#{
@source
}
/lib/
#{
file
}
"
,
"
#{
@target
}
/lib/ruby/stdlib"
,
:verbose
=>
true
end
for
file
,
target
in
EXT_FILES
if
file
!~
/.rb$/
mkdir_p
"
#{
@source
}
/
#{
file
}
"
cp_r
"
#{
@source
}
/
#{
file
}
"
,
"
#{
@target
}
/lib/ruby/stdlib/
#{
target
}
/.."
,
:verbose
=>
true
else
cp_r
"
#{
@source
}
/
#{
file
}
"
,
"
#{
@target
}
/lib/ruby/stdlib/
#{
target
}
"
,
:verbose
=>
true
end
end
end
private
def
format_version
(
version
)
version
.
gsub
(
/_
\d
+$/
,
''
)
.
gsub
(
/_/
,
'.'
)
end
def
checkout
cd
(
@source
)
do
branch
=
"jruby-ruby
#{
@type
==
'rubygems'
?
'gems'
:
''
}
_
#{
@named_version
}
"
if
(
branches
=
`git branch | sed 's/[
\*
\s
]*//'`
)
.
split
(
"
\n
"
)
.
include?
branch
`git checkout
#{
branch
}
`
else
`git checkout -t origin/
#{
branch
}
`
end
end
end
end
if
$0 ==
__FILE__
if
ARGV
.
size
!=
4
abort
"usage: sync_ruby <tests|stdlib|all> <version(2_2_0)> <jruby ruby fork clone> <jruby dir>"
end
what
,
version
,
source
,
target
=
ARGV
if
!
%w{
tests
stdlib
all
}
.
include?
what
abort
"invalid source to sync:
#{
what
}
"
end
if
!
(
version
=~
/^
\d
_
\d
_
\d
$/
)
abort
"invalid version number:
#{
version
}
"
end
if
!
File
.
exist?
(
source
)
|| !
File
.
directory?
(
source
)
abort
"invalid source dir:
#{
source
}
"
end
if
!
File
.
exist?
(
target
)
|| !
File
.
directory?
(
target
)
abort
"invalid target dir:
#{
target
}
"
end
sync
=
Sync
.
new
(
what
,
version
,
source
,
target
)
if
what
==
'all'
sync
.
sync_tests
sync
.
sync_stdlib
else
sync
.
send
(
:"sync_
#{
what
}
"
)
end
end
Back
|
FazBrowse Home
|
New Git URL