Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mruby
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
mruby
Commits
9d0c49f0
Commit
9d0c49f0
authored
Sep 06, 2015
by
Seba Gamboa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Switch gem API to constants only
parent
230db2ca
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
31 additions
and
39 deletions
+31
-39
lib/mruby/source.rb
lib/mruby/source.rb
+30
-2
lib/mruby/source/path.rb
lib/mruby/source/path.rb
+0
-9
lib/mruby/source/version.rb
lib/mruby/source/version.rb
+0
-27
mruby-source.gemspec
mruby-source.gemspec
+1
-1
No files found.
lib/mruby/source.rb
View file @
9d0c49f0
require
"mruby/source/path"
require
"mruby/source/version"
require
"pathname"
module
MRuby
module
Source
# MRuby's source root directory
ROOT
=
Pathname
.
new
(
File
.
expand_path
(
'../../../'
,
__FILE__
))
# Reads a constant defined at version.h
MRUBY_READ_VERSION_CONSTANT
=
->
(
name
)
{
ROOT
.
join
(
'include'
,
'mruby'
,
'version.h'
).
read
.
match
(
/^#define
#{
name
}
+"?([\w\. ]+)"?$/
)[
1
]
}
MRUBY_RUBY_VERSION
=
MRUBY_READ_VERSION_CONSTANT
[
'MRUBY_RUBY_VERSION'
]
MRUBY_RUBY_ENGINE
=
MRUBY_READ_VERSION_CONSTANT
[
'MRUBY_RUBY_ENGINE'
]
MRUBY_RELEASE_MAJOR
=
Integer
(
MRUBY_READ_VERSION_CONSTANT
[
'MRUBY_RELEASE_MAJOR'
])
MRUBY_RELEASE_MINOR
=
Integer
(
MRUBY_READ_VERSION_CONSTANT
[
'MRUBY_RELEASE_MINOR'
])
MRUBY_RELEASE_TEENY
=
Integer
(
MRUBY_READ_VERSION_CONSTANT
[
'MRUBY_RELEASE_TEENY'
])
MRUBY_VERSION
=
[
MRUBY_RELEASE_MAJOR
,
MRUBY_RELEASE_MINOR
,
MRUBY_RELEASE_TEENY
].
join
(
'.'
)
MRUBY_RELEASE_NO
=
(
MRUBY_RELEASE_MAJOR
*
100
*
100
+
MRUBY_RELEASE_MINOR
*
100
+
MRUBY_RELEASE_TEENY
)
MRUBY_RELEASE_YEAR
=
Integer
(
MRUBY_READ_VERSION_CONSTANT
[
'MRUBY_RELEASE_YEAR'
])
MRUBY_RELEASE_MONTH
=
Integer
(
MRUBY_READ_VERSION_CONSTANT
[
'MRUBY_RELEASE_MONTH'
])
MRUBY_RELEASE_DAY
=
Integer
(
MRUBY_READ_VERSION_CONSTANT
[
'MRUBY_RELEASE_DAY'
])
MRUBY_RELEASE_DATE
=
[
MRUBY_RELEASE_YEAR
,
MRUBY_RELEASE_MONTH
,
MRUBY_RELEASE_DAY
].
join
(
'.'
)
MRUBY_BIRTH_YEAR
=
Integer
(
MRUBY_READ_VERSION_CONSTANT
[
'MRUBY_BIRTH_YEAR'
])
MRUBY_AUTHOR
=
MRUBY_READ_VERSION_CONSTANT
[
'MRUBY_AUTHOR'
]
end
end
lib/mruby/source/path.rb
deleted
100644 → 0
View file @
230db2ca
require
"pathname"
module
MRuby
module
Source
def
self
.
path
Pathname
.
new
(
File
.
expand_path
(
'../../../../'
,
__FILE__
))
end
end
end
lib/mruby/source/version.rb
deleted
100644 → 0
View file @
230db2ca
require
"mruby/source/path"
module
MRuby
module
Source
# Reads a constant defined at version.h
MRUBY_READ_VERSION_CONSTANT
=
->
(
name
)
{
Source
.
path
.
join
(
'include'
,
'mruby'
,
'version.h'
).
read
.
match
(
/^#define
#{
name
}
+"?([\w\. ]+)"?$/
)[
1
]
}
MRUBY_RUBY_VERSION
=
MRUBY_READ_VERSION_CONSTANT
[
'MRUBY_RUBY_VERSION'
]
MRUBY_RUBY_ENGINE
=
MRUBY_READ_VERSION_CONSTANT
[
'MRUBY_RUBY_ENGINE'
]
MRUBY_RELEASE_MAJOR
=
Integer
(
MRUBY_READ_VERSION_CONSTANT
[
'MRUBY_RELEASE_MAJOR'
])
MRUBY_RELEASE_MINOR
=
Integer
(
MRUBY_READ_VERSION_CONSTANT
[
'MRUBY_RELEASE_MINOR'
])
MRUBY_RELEASE_TEENY
=
Integer
(
MRUBY_READ_VERSION_CONSTANT
[
'MRUBY_RELEASE_TEENY'
])
MRUBY_VERSION
=
[
MRUBY_RELEASE_MAJOR
,
MRUBY_RELEASE_MINOR
,
MRUBY_RELEASE_TEENY
].
join
(
'.'
)
MRUBY_RELEASE_NO
=
(
MRUBY_RELEASE_MAJOR
*
100
*
100
+
MRUBY_RELEASE_MINOR
*
100
+
MRUBY_RELEASE_TEENY
)
MRUBY_RELEASE_YEAR
=
Integer
(
MRUBY_READ_VERSION_CONSTANT
[
'MRUBY_RELEASE_YEAR'
])
MRUBY_RELEASE_MONTH
=
Integer
(
MRUBY_READ_VERSION_CONSTANT
[
'MRUBY_RELEASE_MONTH'
])
MRUBY_RELEASE_DAY
=
Integer
(
MRUBY_READ_VERSION_CONSTANT
[
'MRUBY_RELEASE_DAY'
])
MRUBY_RELEASE_DATE
=
[
MRUBY_RELEASE_YEAR
,
MRUBY_RELEASE_MONTH
,
MRUBY_RELEASE_DAY
].
join
(
'.'
)
MRUBY_BIRTH_YEAR
=
Integer
(
MRUBY_READ_VERSION_CONSTANT
[
'MRUBY_BIRTH_YEAR'
])
MRUBY_AUTHOR
=
MRUBY_READ_VERSION_CONSTANT
[
'MRUBY_AUTHOR'
]
end
end
mruby-source.gemspec
View file @
9d0c49f0
# coding: utf-8
lib
=
File
.
expand_path
(
'../lib'
,
__FILE__
)
$LOAD_PATH
.
unshift
(
lib
)
unless
$LOAD_PATH
.
include?
(
lib
)
require
'mruby/source
/version
'
require
'mruby/source'
Gem
::
Specification
.
new
do
|
spec
|
spec
.
name
=
"mruby-source"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment