File tree Expand file tree Collapse file tree 3 files changed +16
-10
lines changed
ext/java/org/jruby/ext/stringio Expand file tree Collapse file tree 3 files changed +16
-10
lines changed Original file line number Diff line number Diff line change @@ -83,6 +83,9 @@ public static RubyClass createStringIOClass(final Ruby runtime) {
8383 RubyClass stringIOClass = runtime .defineClass (
8484 "StringIO" , runtime .getObject (), StringIO ::new );
8585
86+ RubyString version = RubyString .newString (runtime , "3.0.8" );
87+ stringIOClass .defineConstant ("VERSION" , version );
88+
8689 stringIOClass .defineAnnotatedMethods (StringIO .class );
8790 stringIOClass .includeModule (runtime .getEnumerable ());
8891
Original file line number Diff line number Diff line change 11class << ( helper = Bundler ::GemHelper . instance )
2- SOURCE_PATH = "ext/stringio/stringio.c"
2+ C_SOURCE_PATH = "ext/stringio/stringio.c"
3+ JAVA_SOURCE_PATH = "ext/java/org/jruby/ext/stringio/StringIO.java"
34 def update_source_version
4- path = SOURCE_PATH
5- File . open ( path , "r+b" ) do |f |
6- d = f . read
7- if d . sub! ( /^#define\s +STRINGIO_VERSION\s +\K ".*"/ ) { version . to_s . dump }
8- f . rewind
9- f . truncate ( 0 )
10- f . print ( d )
11- end
12- end
5+ c_source = File . read ( C_SOURCE_PATH )
6+ c_source . sub! ( /^#define\s +STRINGIO_VERSION\s +\K ".*"/ ) { version . to_s . dump }
7+ File . write ( C_SOURCE_PATH , c_source )
8+
9+ java_source = File . read ( JAVA_SOURCE_PATH )
10+ java_source . sub! ( /version = RubyString\. newString\( runtime, \K ".*"/ ) { version . to_s . dump }
11+ File . write ( JAVA_SOURCE_PATH , java_source )
1312 end
1413
1514 def commit_bump
Original file line number Diff line number Diff line change @@ -14,6 +14,10 @@ def open_file(content)
1414
1515 include TestEOF ::Seek
1616
17+ def test_version
18+ assert_kind_of ( String , StringIO ::VERSION )
19+ end
20+
1721 def test_initialize
1822 assert_kind_of StringIO , StringIO . new
1923 assert_kind_of StringIO , StringIO . new ( 'str' )
You can’t perform that action at this time.
0 commit comments