faster_support 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.clang-format +89 -0
- data/.color_coded +61 -0
- data/.gitignore +15 -0
- data/.rspec +2 -0
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/.travis.yml +5 -0
- data/.ycm_extra_conf.py +159 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +12 -0
- data/Guardfile +43 -0
- data/LICENSE.txt +21 -0
- data/README.md +41 -0
- data/Rakefile +24 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/compile_commands.json +22 -0
- data/ext/faster_support/array_blank.c +35 -0
- data/ext/faster_support/extconf.rb +3 -0
- data/ext/faster_support/faster_support.c +8 -0
- data/ext/faster_support/faster_support.h +23 -0
- data/ext/faster_support/object_blank.c +65 -0
- data/ext/faster_support/string_blank.c +97 -0
- data/faster_support.gemspec +30 -0
- data/lib/faster_support/version.rb +3 -0
- data/lib/faster_support.rb +7 -0
- data/lib/tasks/tooling.rake +35 -0
- data/lib/tasks/tooling.rb +48 -0
- metadata +129 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 132b585e74020c9ccc26b7fca4e06ae1273f14da
|
4
|
+
data.tar.gz: 9d6f8979ca5fce7918bc1bbdf7b0c04e36ee1d1c
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 66d2dc9892a1986fa621ab0d85558b7c8bebcfa7fbfc5fea9dc9e56a695a91109db40798cf58ca93c4903dc2f37fc3063fdbb253150cf245c510021f2bafbfcc
|
7
|
+
data.tar.gz: 89eed820c0251c8db69241112a1ca2ebc2c07d866ac4a1a561c97eafa39f1f4a2ceabbffabd680fbe9d3852a2ee535b03544a54ecbd04e6aba95cadf43d85ca3
|
data/.clang-format
ADDED
@@ -0,0 +1,89 @@
|
|
1
|
+
---
|
2
|
+
Language: Cpp
|
3
|
+
# BasedOnStyle: LLVM
|
4
|
+
AccessModifierOffset: -2
|
5
|
+
AlignAfterOpenBracket: Align
|
6
|
+
AlignConsecutiveAssignments: false
|
7
|
+
AlignConsecutiveDeclarations: false
|
8
|
+
AlignEscapedNewlinesLeft: false
|
9
|
+
AlignOperands: true
|
10
|
+
AlignTrailingComments: true
|
11
|
+
AllowAllParametersOfDeclarationOnNextLine: true
|
12
|
+
AllowShortBlocksOnASingleLine: false
|
13
|
+
AllowShortCaseLabelsOnASingleLine: false
|
14
|
+
AllowShortFunctionsOnASingleLine: Empty
|
15
|
+
AllowShortIfStatementsOnASingleLine: true
|
16
|
+
AllowShortLoopsOnASingleLine: false
|
17
|
+
AlwaysBreakAfterDefinitionReturnType: None
|
18
|
+
AlwaysBreakBeforeMultilineStrings: false
|
19
|
+
AlwaysBreakTemplateDeclarations: false
|
20
|
+
BinPackArguments: false
|
21
|
+
BinPackParameters: false
|
22
|
+
BraceWrapping:
|
23
|
+
AfterClass: true
|
24
|
+
AfterControlStatement: false
|
25
|
+
AfterEnum: false
|
26
|
+
AfterFunction: true
|
27
|
+
AfterNamespace: false
|
28
|
+
AfterObjCDeclaration: true
|
29
|
+
AfterStruct: false
|
30
|
+
AfterUnion: false
|
31
|
+
BeforeCatch: false
|
32
|
+
BeforeElse: true
|
33
|
+
IndentBraces: false
|
34
|
+
BreakBeforeBinaryOperators: None
|
35
|
+
BreakBeforeBraces: Custom
|
36
|
+
BreakBeforeTernaryOperators: true
|
37
|
+
BreakConstructorInitializersBeforeComma: false
|
38
|
+
ColumnLimit: 80
|
39
|
+
CommentPragmas: '^ IWYU pragma:'
|
40
|
+
ConstructorInitializerAllOnOneLineOrOnePerLine: false
|
41
|
+
ConstructorInitializerIndentWidth: 2
|
42
|
+
ContinuationIndentWidth: 4
|
43
|
+
Cpp11BracedListStyle: true
|
44
|
+
DerivePointerAlignment: false
|
45
|
+
DisableFormat: false
|
46
|
+
ExperimentalAutoDetectBinPacking: false
|
47
|
+
ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ]
|
48
|
+
IncludeCategories:
|
49
|
+
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
|
50
|
+
Priority: 2
|
51
|
+
- Regex: '^(<|"(gtest|isl|json)/)'
|
52
|
+
Priority: 3
|
53
|
+
- Regex: '.*'
|
54
|
+
Priority: 1
|
55
|
+
IndentCaseLabels: false
|
56
|
+
IndentWidth: 2
|
57
|
+
IndentWrappedFunctionNames: false
|
58
|
+
KeepEmptyLinesAtTheStartOfBlocks: false
|
59
|
+
MacroBlockBegin: 'SpecBegin'
|
60
|
+
MacroBlockEnd: 'SpecEnd'
|
61
|
+
MaxEmptyLinesToKeep: 1
|
62
|
+
NamespaceIndentation: None
|
63
|
+
ObjCBlockIndentWidth: 2
|
64
|
+
ObjCSpaceAfterProperty: false
|
65
|
+
ObjCSpaceBeforeProtocolList: true
|
66
|
+
PenaltyBreakBeforeFirstCallParameter: 1
|
67
|
+
PenaltyBreakComment: 30
|
68
|
+
PenaltyBreakFirstLessLess: 120
|
69
|
+
PenaltyBreakString: 1000
|
70
|
+
PenaltyExcessCharacter: 1000000
|
71
|
+
PenaltyReturnTypeOnItsOwnLine: 200
|
72
|
+
PointerAlignment: Right
|
73
|
+
ReflowComments: true
|
74
|
+
SortIncludes: true
|
75
|
+
SpaceAfterCStyleCast: false
|
76
|
+
SpaceBeforeAssignmentOperators: true
|
77
|
+
SpaceBeforeParens: ControlStatements
|
78
|
+
SpaceInEmptyParentheses: false
|
79
|
+
SpacesBeforeTrailingComments: 1
|
80
|
+
SpacesInAngles: false
|
81
|
+
SpacesInContainerLiterals: true
|
82
|
+
SpacesInCStyleCastParentheses: false
|
83
|
+
SpacesInParentheses: false
|
84
|
+
SpacesInSquareBrackets: false
|
85
|
+
Standard: Cpp11
|
86
|
+
TabWidth: 8
|
87
|
+
UseTab: Never
|
88
|
+
...
|
89
|
+
|
data/.color_coded
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
-x
|
2
|
+
c
|
3
|
+
-std=c99
|
4
|
+
-I.
|
5
|
+
-I/Users/morgan/.rvm/rubies/ruby-2.4.0/include/ruby-2.4.0/x86_64-darwin16
|
6
|
+
-I/Users/morgan/.rvm/rubies/ruby-2.4.0/include/ruby-2.4.0/ruby/backward
|
7
|
+
-I/Users/morgan/.rvm/rubies/ruby-2.4.0/include/ruby-2.4.0
|
8
|
+
-I../../../../ext/faster_support
|
9
|
+
-I/usr/local/opt/libyaml/include
|
10
|
+
-I/usr/local/opt/readline/include
|
11
|
+
-I/usr/local/opt/libksba/include
|
12
|
+
-I/usr/local/opt/openssl/include
|
13
|
+
-I/usr/local/opt/libyaml/include
|
14
|
+
-I/usr/local/opt/readline/include
|
15
|
+
-I/usr/local/opt/libksba/include
|
16
|
+
-I/usr/local/opt/openssl/include
|
17
|
+
-D_XOPEN_SOURCE
|
18
|
+
-D_DARWIN_C_SOURCE
|
19
|
+
-D_DARWIN_UNLIMITED_SELECT
|
20
|
+
-D_REENTRANT
|
21
|
+
-fno-common
|
22
|
+
-O3
|
23
|
+
-fno-fast-math
|
24
|
+
-ggdb3
|
25
|
+
-Wall
|
26
|
+
-Wextra
|
27
|
+
-Wno-unused-parameter
|
28
|
+
-Wno-parentheses
|
29
|
+
-Wno-long-long
|
30
|
+
-Wno-missing-field-initializers
|
31
|
+
-Wno-tautological-compare
|
32
|
+
-Wno-parentheses-equality
|
33
|
+
-Wno-constant-logical-operand
|
34
|
+
-Wno-self-assign
|
35
|
+
-Wunused-variable
|
36
|
+
-Wimplicit-int
|
37
|
+
-Wpointer-arith
|
38
|
+
-Wwrite-strings
|
39
|
+
-Wdeclaration-after-statement
|
40
|
+
-Wshorten-64-to-32
|
41
|
+
-Wimplicit-function-declaration
|
42
|
+
-Wdivision-by-zero
|
43
|
+
-Wdeprecated-declarations
|
44
|
+
-Wextra-tokens
|
45
|
+
-fno-common
|
46
|
+
-pipe
|
47
|
+
-isystem
|
48
|
+
/usr/local/include
|
49
|
+
-isystem
|
50
|
+
/usr/include
|
51
|
+
-isystem
|
52
|
+
/Library/Developer/CommandLineTools/usr/include
|
53
|
+
-isystem
|
54
|
+
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include
|
55
|
+
-isystem
|
56
|
+
/System/Library/Frameworks
|
57
|
+
-isystem
|
58
|
+
/Library/Frameworks
|
59
|
+
-isystem
|
60
|
+
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/7.3.0/include
|
61
|
+
-fspell-checking
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.ruby-gemset
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
faster_support
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
ruby-2.4.0
|
data/.travis.yml
ADDED
data/.ycm_extra_conf.py
ADDED
@@ -0,0 +1,159 @@
|
|
1
|
+
# Generated by YCM Generator at 2016-03-16 15:39:24.822512
|
2
|
+
|
3
|
+
# This file is NOT licensed under the GPLv3, which is the license for the rest
|
4
|
+
# of YouCompleteMe.
|
5
|
+
#
|
6
|
+
# Here's the license text for this file:
|
7
|
+
#
|
8
|
+
# This is free and unencumbered software released into the public domain.
|
9
|
+
#
|
10
|
+
# Anyone is free to copy, modify, publish, use, compile, sell, or
|
11
|
+
# distribute this software, either in source code form or as a compiled
|
12
|
+
# binary, for any purpose, commercial or non-commercial, and by any
|
13
|
+
# means.
|
14
|
+
#
|
15
|
+
# In jurisdictions that recognize copyright laws, the author or authors
|
16
|
+
# of this software dedicate any and all copyright interest in the
|
17
|
+
# software to the public domain. We make this dedication for the benefit
|
18
|
+
# of the public at large and to the detriment of our heirs and
|
19
|
+
# successors. We intend this dedication to be an overt act of
|
20
|
+
# relinquishment in perpetuity of all present and future rights to this
|
21
|
+
# software under copyright law.
|
22
|
+
#
|
23
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
24
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
25
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
26
|
+
# IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
27
|
+
# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
28
|
+
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
29
|
+
# OTHER DEALINGS IN THE SOFTWARE.
|
30
|
+
#
|
31
|
+
# For more information, please refer to <http://unlicense.org/>
|
32
|
+
|
33
|
+
import os
|
34
|
+
import sys
|
35
|
+
import ycm_core
|
36
|
+
|
37
|
+
flags = [
|
38
|
+
'-x',
|
39
|
+
'c',
|
40
|
+
'-DNDEBUG',
|
41
|
+
'-I/Users/morgan/projects/coach/faster_support/ext/faster_support/.',
|
42
|
+
'-I/Users/morgan/projects/coach/faster_support/tmp/x86_64-darwin16/stage/lib/faster_support/.',
|
43
|
+
'-I/Users/morgan/projects/coach/faster_support/tmp/x86_64-darwin16/faster_support/2.4.0/.',
|
44
|
+
'-I/Users/morgan/.rvm/rubies/ruby-2.4.0/include/ruby-2.4.0/.',
|
45
|
+
'-I/Users/morgan/.rvm/rubies/ruby-2.4.0/include/ruby-2.4.0/x86_64-darwin16/.',
|
46
|
+
'-Wall',
|
47
|
+
'-Wextra',
|
48
|
+
'-std=c99',
|
49
|
+
]
|
50
|
+
|
51
|
+
|
52
|
+
# Set this to the absolute path to the folder (NOT the file!) containing the
|
53
|
+
# compile_commands.json file to use that instead of 'flags'. See here for
|
54
|
+
# more details: http://clang.llvm.org/docs/JSONCompilationDatabase.html
|
55
|
+
#
|
56
|
+
# You can get CMake to generate this file for you by adding:
|
57
|
+
# set( CMAKE_EXPORT_COMPILE_COMMANDS 1 )
|
58
|
+
# to your CMakeLists.txt file.
|
59
|
+
#
|
60
|
+
# Most projects will NOT need to set this to anything; you can just change the
|
61
|
+
# 'flags' list of compilation flags. Notice that YCM itself uses that approach.
|
62
|
+
def PossibleCompilationDatabase():
|
63
|
+
this_dir = os.path.dirname(os.path.abspath(__file__))
|
64
|
+
possible_db = os.path.join(this_dir, 'compile_commands.json')
|
65
|
+
build_dir = os.path.join(this_dir, 'build')
|
66
|
+
if os.path.exists(possible_db) and os.access(possible_db, os.R_OK):
|
67
|
+
return this_dir
|
68
|
+
elif os.path.exists(build_dir):
|
69
|
+
possible_db = os.path.join(build_dir, 'compile_commands.json')
|
70
|
+
if os.path.exists(possible_db) and os.access(possible_db, os.R_OK):
|
71
|
+
return build_dir
|
72
|
+
return ''
|
73
|
+
|
74
|
+
compilation_database_folder = PossibleCompilationDatabase()
|
75
|
+
|
76
|
+
if os.path.exists( compilation_database_folder ):
|
77
|
+
database = ycm_core.CompilationDatabase( compilation_database_folder )
|
78
|
+
else:
|
79
|
+
database = None
|
80
|
+
|
81
|
+
SOURCE_EXTENSIONS = [ '.cpp', '.cxx', '.cc', '.c', '.m', '.mm' ]
|
82
|
+
|
83
|
+
def DirectoryOfThisScript():
|
84
|
+
return os.path.dirname( os.path.abspath( __file__ ) )
|
85
|
+
|
86
|
+
|
87
|
+
def MakeRelativePathsInFlagsAbsolute( flags, working_directory ):
|
88
|
+
if not working_directory:
|
89
|
+
return list( flags )
|
90
|
+
new_flags = []
|
91
|
+
make_next_absolute = False
|
92
|
+
path_flags = [ '-isystem', '-I', '-iquote', '--sysroot=' ]
|
93
|
+
for flag in flags:
|
94
|
+
new_flag = flag
|
95
|
+
|
96
|
+
if make_next_absolute:
|
97
|
+
make_next_absolute = False
|
98
|
+
if not flag.startswith( '/' ):
|
99
|
+
new_flag = os.path.join( working_directory, flag )
|
100
|
+
|
101
|
+
for path_flag in path_flags:
|
102
|
+
if flag == path_flag:
|
103
|
+
make_next_absolute = True
|
104
|
+
break
|
105
|
+
|
106
|
+
if flag.startswith( path_flag ):
|
107
|
+
path = flag[ len( path_flag ): ]
|
108
|
+
new_flag = path_flag + os.path.join( working_directory, path )
|
109
|
+
break
|
110
|
+
|
111
|
+
if new_flag:
|
112
|
+
new_flags.append( new_flag )
|
113
|
+
return new_flags
|
114
|
+
|
115
|
+
|
116
|
+
def IsHeaderFile( filename ):
|
117
|
+
extension = os.path.splitext( filename )[ 1 ]
|
118
|
+
return extension in [ '.h', '.hxx', '.hpp', '.hh' ]
|
119
|
+
|
120
|
+
|
121
|
+
def GetCompilationInfoForFile( filename ):
|
122
|
+
# The compilation_commands.json file generated by CMake does not have entries
|
123
|
+
# for header files. So we do our best by asking the db for flags for a
|
124
|
+
# corresponding source file, if any. If one exists, the flags for that file
|
125
|
+
# should be good enough.
|
126
|
+
if IsHeaderFile( filename ):
|
127
|
+
basename = os.path.splitext( filename )[ 0 ]
|
128
|
+
for extension in SOURCE_EXTENSIONS:
|
129
|
+
replacement_file = basename + extension
|
130
|
+
if os.path.exists( replacement_file ):
|
131
|
+
compilation_info = database.GetCompilationInfoForFile(
|
132
|
+
replacement_file )
|
133
|
+
if compilation_info.compiler_flags_:
|
134
|
+
return compilation_info
|
135
|
+
return None
|
136
|
+
return database.GetCompilationInfoForFile( filename )
|
137
|
+
|
138
|
+
|
139
|
+
def FlagsForFile( filename, **kwargs ):
|
140
|
+
if database:
|
141
|
+
# Bear in mind that compilation_info.compiler_flags_ does NOT return a
|
142
|
+
# python list, but a "list-like" StringVec object
|
143
|
+
compilation_info = GetCompilationInfoForFile( filename )
|
144
|
+
if not compilation_info:
|
145
|
+
return None
|
146
|
+
|
147
|
+
final_flags = MakeRelativePathsInFlagsAbsolute(
|
148
|
+
compilation_info.compiler_flags_,
|
149
|
+
compilation_info.compiler_working_dir_ )
|
150
|
+
|
151
|
+
else:
|
152
|
+
relative_to = DirectoryOfThisScript()
|
153
|
+
final_flags = MakeRelativePathsInFlagsAbsolute( flags, relative_to )
|
154
|
+
|
155
|
+
return {
|
156
|
+
'flags': final_flags,
|
157
|
+
'do_cache': True
|
158
|
+
}
|
159
|
+
|
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at j.morgan.lieberthal@gmail.com. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [http://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: http://contributor-covenant.org
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
# Specify your gem's dependencies in faster_support.gemspec
|
4
|
+
gemspec
|
5
|
+
|
6
|
+
group :development, :test do
|
7
|
+
gem 'rubocop', require: false
|
8
|
+
gem 'rubocop-rspec', require: false
|
9
|
+
|
10
|
+
gem 'guard-rake', require: false
|
11
|
+
gem 'guard-rspec', require: false
|
12
|
+
end
|
data/Guardfile
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# A sample Guardfile
|
4
|
+
# More info at https://github.com/guard/guard#readme
|
5
|
+
|
6
|
+
## Uncomment and set this to only include directories you want to watch
|
7
|
+
# directories %w(app lib config test spec features) \
|
8
|
+
# .select{|d| Dir.exists?(d) ? d : UI.warning("Directory #{d} does not exist")}
|
9
|
+
|
10
|
+
## Note: if you are using the `directories` clause above and you are not
|
11
|
+
## watching the project directory ('.'), then you will want to move
|
12
|
+
## the Guardfile to a watched dir and symlink it back, e.g.
|
13
|
+
#
|
14
|
+
# $ mkdir config
|
15
|
+
# $ mv Guardfile config/
|
16
|
+
# $ ln -s config/Guardfile .
|
17
|
+
#
|
18
|
+
# and, you'll have to watch "config/Guardfile" instead of "Guardfile"
|
19
|
+
|
20
|
+
group :build_and_test, halt_on_fail: true do
|
21
|
+
guard 'rake', task: 'prespec' do
|
22
|
+
watch(%r{^ext/(.+)\.(c|h|rb)$})
|
23
|
+
end
|
24
|
+
|
25
|
+
guard :rspec, cmd: 'bundle exec rspec' do
|
26
|
+
require 'guard/rspec/dsl'
|
27
|
+
dsl = Guard::RSpec::Dsl.new(self)
|
28
|
+
|
29
|
+
# Feel free to open issues for suggestions and improvements
|
30
|
+
|
31
|
+
# RSpec files
|
32
|
+
rspec = dsl.rspec
|
33
|
+
watch(rspec.spec_helper) { rspec.spec_dir }
|
34
|
+
watch(rspec.spec_support) { rspec.spec_dir }
|
35
|
+
watch(rspec.spec_files)
|
36
|
+
|
37
|
+
watch(%r{^ext/(.+)\.(c|h|rb)$}) { rspec.spec_dir }
|
38
|
+
|
39
|
+
# Ruby files
|
40
|
+
ruby = dsl.ruby
|
41
|
+
dsl.watch_spec_files_for(ruby.lib_files)
|
42
|
+
end
|
43
|
+
end
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2017 J. Morgan Lieberthal
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
# FasterSupport
|
2
|
+
|
3
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/faster_support`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
+
|
5
|
+
TODO: Delete this and the text above, and describe your gem
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'faster_support'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install faster_support
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
TODO: Write usage instructions here
|
26
|
+
|
27
|
+
## Development
|
28
|
+
|
29
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
|
+
|
31
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
32
|
+
|
33
|
+
## Contributing
|
34
|
+
|
35
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/faster_support. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
36
|
+
|
37
|
+
|
38
|
+
## License
|
39
|
+
|
40
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
41
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
ENV['MAKE'] = 'bear make'
|
4
|
+
|
5
|
+
require 'bundler/gem_tasks'
|
6
|
+
require 'rspec/core/rake_task'
|
7
|
+
|
8
|
+
RSpec::Core::RakeTask.new(:spec)
|
9
|
+
|
10
|
+
require 'rake/extensiontask'
|
11
|
+
|
12
|
+
task build: [:compile, :tooling]
|
13
|
+
|
14
|
+
task prespec: [:clobber, :compile, :tooling]
|
15
|
+
|
16
|
+
Dir['./lib/tasks/**/*.rake'].each { |f| load f } # load task directory
|
17
|
+
|
18
|
+
Rake::ExtensionTask.new('faster_support') do |ext|
|
19
|
+
ext.lib_dir = 'lib/faster_support'
|
20
|
+
ext.source_pattern = '*.{c,cpp,m,mm}'
|
21
|
+
Tooling.exttask = ext
|
22
|
+
end
|
23
|
+
|
24
|
+
task default: [:clobber, :compile, :tooling, :spec]
|
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'bundler/setup'
|
4
|
+
require 'faster_support'
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require 'irb'
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
[
|
2
|
+
{
|
3
|
+
"command": "cc -c -I. -I/Users/morgan/.rvm/rubies/ruby-2.4.0/include/ruby-2.4.0/x86_64-darwin16 -I/Users/morgan/.rvm/rubies/ruby-2.4.0/include/ruby-2.4.0/ruby/backward -I/Users/morgan/.rvm/rubies/ruby-2.4.0/include/ruby-2.4.0 -I../../../../ext/faster_support -I/usr/local/opt/libyaml/include -I/usr/local/opt/readline/include -I/usr/local/opt/libksba/include -I/usr/local/opt/openssl/include -I/usr/local/opt/libyaml/include -I/usr/local/opt/readline/include -I/usr/local/opt/libksba/include -I/usr/local/opt/openssl/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -fno-common -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wno-tautological-compare -Wno-parentheses-equality -Wno-constant-logical-operand -Wno-self-assign -Wunused-variable -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wshorten-64-to-32 -Wimplicit-function-declaration -Wdivision-by-zero -Wdeprecated-declarations -Wextra-tokens -fno-common -pipe -o array_blank.o ../../../../ext/faster_support/array_blank.c",
|
4
|
+
"directory": "/Users/morgan/projects/coach/faster_support/tmp/x86_64-darwin16/faster_support/2.4.0",
|
5
|
+
"file": "/Users/morgan/projects/coach/faster_support/ext/faster_support/array_blank.c"
|
6
|
+
},
|
7
|
+
{
|
8
|
+
"command": "cc -c -I. -I/Users/morgan/.rvm/rubies/ruby-2.4.0/include/ruby-2.4.0/x86_64-darwin16 -I/Users/morgan/.rvm/rubies/ruby-2.4.0/include/ruby-2.4.0/ruby/backward -I/Users/morgan/.rvm/rubies/ruby-2.4.0/include/ruby-2.4.0 -I../../../../ext/faster_support -I/usr/local/opt/libyaml/include -I/usr/local/opt/readline/include -I/usr/local/opt/libksba/include -I/usr/local/opt/openssl/include -I/usr/local/opt/libyaml/include -I/usr/local/opt/readline/include -I/usr/local/opt/libksba/include -I/usr/local/opt/openssl/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -fno-common -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wno-tautological-compare -Wno-parentheses-equality -Wno-constant-logical-operand -Wno-self-assign -Wunused-variable -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wshorten-64-to-32 -Wimplicit-function-declaration -Wdivision-by-zero -Wdeprecated-declarations -Wextra-tokens -fno-common -pipe -o faster_support.o ../../../../ext/faster_support/faster_support.c",
|
9
|
+
"directory": "/Users/morgan/projects/coach/faster_support/tmp/x86_64-darwin16/faster_support/2.4.0",
|
10
|
+
"file": "/Users/morgan/projects/coach/faster_support/ext/faster_support/faster_support.c"
|
11
|
+
},
|
12
|
+
{
|
13
|
+
"command": "cc -c -I. -I/Users/morgan/.rvm/rubies/ruby-2.4.0/include/ruby-2.4.0/x86_64-darwin16 -I/Users/morgan/.rvm/rubies/ruby-2.4.0/include/ruby-2.4.0/ruby/backward -I/Users/morgan/.rvm/rubies/ruby-2.4.0/include/ruby-2.4.0 -I../../../../ext/faster_support -I/usr/local/opt/libyaml/include -I/usr/local/opt/readline/include -I/usr/local/opt/libksba/include -I/usr/local/opt/openssl/include -I/usr/local/opt/libyaml/include -I/usr/local/opt/readline/include -I/usr/local/opt/libksba/include -I/usr/local/opt/openssl/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -fno-common -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wno-tautological-compare -Wno-parentheses-equality -Wno-constant-logical-operand -Wno-self-assign -Wunused-variable -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wshorten-64-to-32 -Wimplicit-function-declaration -Wdivision-by-zero -Wdeprecated-declarations -Wextra-tokens -fno-common -pipe -o object_blank.o ../../../../ext/faster_support/object_blank.c",
|
14
|
+
"directory": "/Users/morgan/projects/coach/faster_support/tmp/x86_64-darwin16/faster_support/2.4.0",
|
15
|
+
"file": "/Users/morgan/projects/coach/faster_support/ext/faster_support/object_blank.c"
|
16
|
+
},
|
17
|
+
{
|
18
|
+
"command": "cc -c -I. -I/Users/morgan/.rvm/rubies/ruby-2.4.0/include/ruby-2.4.0/x86_64-darwin16 -I/Users/morgan/.rvm/rubies/ruby-2.4.0/include/ruby-2.4.0/ruby/backward -I/Users/morgan/.rvm/rubies/ruby-2.4.0/include/ruby-2.4.0 -I../../../../ext/faster_support -I/usr/local/opt/libyaml/include -I/usr/local/opt/readline/include -I/usr/local/opt/libksba/include -I/usr/local/opt/openssl/include -I/usr/local/opt/libyaml/include -I/usr/local/opt/readline/include -I/usr/local/opt/libksba/include -I/usr/local/opt/openssl/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -fno-common -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wno-tautological-compare -Wno-parentheses-equality -Wno-constant-logical-operand -Wno-self-assign -Wunused-variable -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wshorten-64-to-32 -Wimplicit-function-declaration -Wdivision-by-zero -Wdeprecated-declarations -Wextra-tokens -fno-common -pipe -o string_blank.o ../../../../ext/faster_support/string_blank.c",
|
19
|
+
"directory": "/Users/morgan/projects/coach/faster_support/tmp/x86_64-darwin16/faster_support/2.4.0",
|
20
|
+
"file": "/Users/morgan/projects/coach/faster_support/ext/faster_support/string_blank.c"
|
21
|
+
}
|
22
|
+
]
|
@@ -0,0 +1,35 @@
|
|
1
|
+
/* Array#blank? implementation */
|
2
|
+
|
3
|
+
#include "faster_support.h"
|
4
|
+
|
5
|
+
static VALUE rb_ary_blank(VALUE ary)
|
6
|
+
{
|
7
|
+
if (RARRAY_LEN(ary) == 0) {
|
8
|
+
return Qtrue;
|
9
|
+
}
|
10
|
+
|
11
|
+
return Qfalse;
|
12
|
+
}
|
13
|
+
|
14
|
+
static VALUE rb_ary_present(VALUE ary)
|
15
|
+
{
|
16
|
+
return RB_NEGATE(rb_ary_blank(ary));
|
17
|
+
}
|
18
|
+
|
19
|
+
static VALUE rb_hash_blank(VALUE self)
|
20
|
+
{
|
21
|
+
return RHASH_EMPTY_P(self) ? Qtrue : Qfalse;
|
22
|
+
}
|
23
|
+
|
24
|
+
static VALUE rb_hash_present(VALUE self)
|
25
|
+
{
|
26
|
+
return RB_NEGATE(rb_hash_blank(self));
|
27
|
+
}
|
28
|
+
|
29
|
+
void Init_ary_blank(void)
|
30
|
+
{
|
31
|
+
rb_define_method(rb_cArray, "blank?", rb_ary_blank, 0);
|
32
|
+
rb_define_method(rb_cArray, "present?", rb_ary_present, 0);
|
33
|
+
rb_define_method(rb_cHash, "blank?", rb_hash_blank, 0);
|
34
|
+
rb_define_method(rb_cHash, "present?", rb_hash_present, 0);
|
35
|
+
}
|
@@ -0,0 +1,23 @@
|
|
1
|
+
#ifndef FASTER_SUPPORT_H
|
2
|
+
#define FASTER_SUPPORT_H 1
|
3
|
+
|
4
|
+
#include "ruby.h"
|
5
|
+
#include "ruby/encoding.h"
|
6
|
+
#include "ruby/re.h"
|
7
|
+
#include "ruby/version.h"
|
8
|
+
|
9
|
+
#define STR_ENC_GET(str) rb_enc_from_index(ENCODING_GET(str))
|
10
|
+
|
11
|
+
#ifndef RUBY_API_VERSION_CODE
|
12
|
+
#define RUBY_BEFORE_2_2 1
|
13
|
+
#else
|
14
|
+
#define RUBY_BEFORE_2_2 (RUBY_API_VERSION_CODE < 20200)
|
15
|
+
#endif /* ifndef RUBY_API_VERSION_CODE */
|
16
|
+
|
17
|
+
#define RB_NEGATE(VAL) (VAL == Qtrue ? Qfalse : Qtrue)
|
18
|
+
|
19
|
+
void Init_str_blank(void);
|
20
|
+
void Init_ary_blank(void);
|
21
|
+
void Init_obj_blank(void);
|
22
|
+
|
23
|
+
#endif /* FASTER_SUPPORT_H */
|
@@ -0,0 +1,65 @@
|
|
1
|
+
/* Object#blank? implementation */
|
2
|
+
|
3
|
+
#include "faster_support.h"
|
4
|
+
|
5
|
+
static ID id_empty;
|
6
|
+
|
7
|
+
static VALUE rb_obj_blank(VALUE obj)
|
8
|
+
{
|
9
|
+
VALUE empty;
|
10
|
+
|
11
|
+
if (rb_respond_to(obj, id_empty)) {
|
12
|
+
empty = rb_funcall(obj, id_empty, 0);
|
13
|
+
if (empty == Qnil || empty == Qfalse) {
|
14
|
+
return Qfalse;
|
15
|
+
}
|
16
|
+
|
17
|
+
return Qtrue;
|
18
|
+
}
|
19
|
+
|
20
|
+
empty = (obj == Qnil || obj == Qfalse) ? Qtrue : Qfalse;
|
21
|
+
|
22
|
+
return empty;
|
23
|
+
}
|
24
|
+
|
25
|
+
static VALUE rb_obj_present(VALUE obj)
|
26
|
+
{
|
27
|
+
return RB_NEGATE(rb_obj_blank(obj));
|
28
|
+
}
|
29
|
+
|
30
|
+
static VALUE rb_nil_blank(VALUE self)
|
31
|
+
{
|
32
|
+
return Qtrue;
|
33
|
+
}
|
34
|
+
|
35
|
+
static VALUE rb_nil_present(VALUE self)
|
36
|
+
{
|
37
|
+
return Qfalse;
|
38
|
+
}
|
39
|
+
|
40
|
+
static VALUE rb_true_blank(VALUE self)
|
41
|
+
{
|
42
|
+
return Qfalse;
|
43
|
+
}
|
44
|
+
|
45
|
+
static VALUE rb_true_present(VALUE self)
|
46
|
+
{
|
47
|
+
return Qtrue;
|
48
|
+
}
|
49
|
+
|
50
|
+
void Init_obj_blank(void)
|
51
|
+
{
|
52
|
+
id_empty = rb_intern("empty?");
|
53
|
+
rb_define_method(rb_cObject, "blank?", rb_obj_blank, 0);
|
54
|
+
rb_define_method(rb_cObject, "present?", rb_obj_present, 0);
|
55
|
+
rb_define_method(rb_cNilClass, "blank?", rb_nil_blank, 0);
|
56
|
+
rb_define_method(rb_cNilClass, "present?", rb_nil_present, 0);
|
57
|
+
rb_define_method(rb_cFalseClass, "blank?", rb_nil_blank, 0);
|
58
|
+
rb_define_method(rb_cFalseClass, "present?", rb_nil_present, 0);
|
59
|
+
rb_define_method(rb_cTrueClass, "blank?", rb_true_blank, 0);
|
60
|
+
rb_define_method(rb_cTrueClass, "present?", rb_true_present, 0);
|
61
|
+
rb_define_method(rb_cNumeric, "blank?", rb_true_blank, 0);
|
62
|
+
rb_define_method(rb_cNumeric, "present?", rb_true_present, 0);
|
63
|
+
rb_define_method(rb_cTime, "blank?", rb_true_blank, 0);
|
64
|
+
rb_define_method(rb_cTime, "present?", rb_true_present, 0);
|
65
|
+
}
|
@@ -0,0 +1,97 @@
|
|
1
|
+
/* Faster implementation of String#blank? */
|
2
|
+
|
3
|
+
#include "faster_support.h"
|
4
|
+
#include <stdio.h>
|
5
|
+
|
6
|
+
static VALUE rb_str_blank(VALUE str)
|
7
|
+
{
|
8
|
+
rb_encoding *enc;
|
9
|
+
char *s, *e;
|
10
|
+
|
11
|
+
enc = STR_ENC_GET(str);
|
12
|
+
s = RSTRING_PTR(str);
|
13
|
+
|
14
|
+
if (!s || RSTRING_LEN(str) == 0) return Qtrue;
|
15
|
+
|
16
|
+
e = RSTRING_END(str);
|
17
|
+
|
18
|
+
while (s < e) {
|
19
|
+
int n;
|
20
|
+
unsigned int cc = rb_enc_codepoint_len(s, e, &n, enc);
|
21
|
+
|
22
|
+
switch (cc) {
|
23
|
+
case 9:
|
24
|
+
case 0xa:
|
25
|
+
case 0xb:
|
26
|
+
case 0xc:
|
27
|
+
case 0xd:
|
28
|
+
case 0x20:
|
29
|
+
case 0x85:
|
30
|
+
case 0xa0:
|
31
|
+
case 0x1680:
|
32
|
+
case 0x2000:
|
33
|
+
case 0x2001:
|
34
|
+
case 0x2002:
|
35
|
+
case 0x2003:
|
36
|
+
case 0x2004:
|
37
|
+
case 0x2005:
|
38
|
+
case 0x2006:
|
39
|
+
case 0x2007:
|
40
|
+
case 0x2008:
|
41
|
+
case 0x2009:
|
42
|
+
case 0x200a:
|
43
|
+
case 0x2028:
|
44
|
+
case 0x2029:
|
45
|
+
case 0x202f:
|
46
|
+
case 0x205f:
|
47
|
+
case 0x3000:
|
48
|
+
#if RUBY_BEFORE_2_2
|
49
|
+
case 0x180e:
|
50
|
+
#endif
|
51
|
+
/* found a blank char */
|
52
|
+
break;
|
53
|
+
|
54
|
+
default:
|
55
|
+
return Qfalse;
|
56
|
+
}
|
57
|
+
|
58
|
+
s += n;
|
59
|
+
}
|
60
|
+
|
61
|
+
/* if we get here, all chars were blank chars */
|
62
|
+
return Qtrue;
|
63
|
+
}
|
64
|
+
|
65
|
+
static VALUE rb_str_blank_mri(VALUE str)
|
66
|
+
{
|
67
|
+
rb_encoding *enc;
|
68
|
+
char *s, *e;
|
69
|
+
|
70
|
+
enc = STR_ENC_GET(str);
|
71
|
+
s = RSTRING_PTR(str);
|
72
|
+
if (!s || RSTRING_LEN(str) == 0) return Qtrue;
|
73
|
+
|
74
|
+
e = RSTRING_END(str);
|
75
|
+
|
76
|
+
while (s < e) {
|
77
|
+
int n;
|
78
|
+
unsigned int cc = rb_enc_codepoint_len(s, e, &n, enc);
|
79
|
+
|
80
|
+
if (!rb_isspace(cc) && cc != 0) return Qfalse;
|
81
|
+
s += n;
|
82
|
+
}
|
83
|
+
|
84
|
+
return Qtrue;
|
85
|
+
}
|
86
|
+
|
87
|
+
static VALUE rb_str_present(VALUE str)
|
88
|
+
{
|
89
|
+
return RB_NEGATE(rb_str_blank(str));
|
90
|
+
}
|
91
|
+
|
92
|
+
void Init_str_blank(void)
|
93
|
+
{
|
94
|
+
rb_define_method(rb_cString, "blank?", rb_str_blank, 0);
|
95
|
+
rb_define_method(rb_cString, "mri_blank?", rb_str_blank_mri, 0);
|
96
|
+
rb_define_method(rb_cString, "present?", rb_str_present, 0);
|
97
|
+
}
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
# coding: utf-8
|
3
|
+
|
4
|
+
lib = File.expand_path('../lib', __FILE__)
|
5
|
+
$:.unshift(lib) unless $:.include?(lib)
|
6
|
+
require 'faster_support/version'
|
7
|
+
|
8
|
+
Gem::Specification.new do |spec|
|
9
|
+
spec.name = 'faster_support'
|
10
|
+
spec.version = FasterSupport::VERSION
|
11
|
+
spec.authors = ['J. Morgan Lieberthal']
|
12
|
+
spec.email = ['j.morgan.lieberthal@gmail.com']
|
13
|
+
|
14
|
+
spec.summary = 'Faster Implementations of ActiveSupport Methods'
|
15
|
+
spec.homepage = 'https://github.com/baberthal/faster_support'
|
16
|
+
spec.license = 'MIT'
|
17
|
+
|
18
|
+
spec.files = %x(git ls-files -z).split("\x0").reject do |f|
|
19
|
+
f.match(%r{^(test|spec|features)/})
|
20
|
+
end
|
21
|
+
spec.bindir = 'exe'
|
22
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
23
|
+
spec.require_paths = ['lib']
|
24
|
+
spec.extensions = ['ext/faster_support/extconf.rb']
|
25
|
+
|
26
|
+
spec.add_development_dependency 'bundler', '~> 1.13'
|
27
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
28
|
+
spec.add_development_dependency 'rake-compiler'
|
29
|
+
spec.add_development_dependency 'rspec', '~> 3.0'
|
30
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'json'
|
4
|
+
require_relative 'tooling'
|
5
|
+
require 'rake/clean'
|
6
|
+
|
7
|
+
namespace :tooling do
|
8
|
+
file 'compile_commands.json' do
|
9
|
+
Dir.chdir(Tooling.build_dir) do
|
10
|
+
cp 'compile_commands.json', Rake.original_dir
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
file '.color_coded' do
|
15
|
+
commands = []
|
16
|
+
JSON.parse(File.read('compile_commands.json')).each do |commanddef|
|
17
|
+
commands << commanddef['command'].split(' ')[2..-4]
|
18
|
+
end
|
19
|
+
commands = [Tooling::PRE_COMPILE_FLAGS,
|
20
|
+
commands.uniq,
|
21
|
+
Tooling::POST_COMPILE_FLAGS]
|
22
|
+
print 'Generating .color_coded...'
|
23
|
+
File.open('.color_coded', 'w') { |io| io.puts commands }
|
24
|
+
puts 'Done'
|
25
|
+
end
|
26
|
+
|
27
|
+
CLEAN.include('.color_coded')
|
28
|
+
CLEAN.include('compile_commands.json')
|
29
|
+
|
30
|
+
desc 'Generate vim tooling'
|
31
|
+
task default: ['compile_commands.json', '.color_coded']
|
32
|
+
end
|
33
|
+
|
34
|
+
desc 'Generate vim tooling (color_coded and youcompleteme)'
|
35
|
+
task tooling: [:compile, 'tooling:default']
|
@@ -0,0 +1,48 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require 'forwardable'
|
3
|
+
require 'pathname'
|
4
|
+
require 'json'
|
5
|
+
|
6
|
+
module Tooling
|
7
|
+
class << self
|
8
|
+
extend Forwardable
|
9
|
+
attr_writer :exttask
|
10
|
+
|
11
|
+
def exttask
|
12
|
+
@exttask || raise('No extension task present!')
|
13
|
+
end
|
14
|
+
|
15
|
+
def_delegators :exttask, :tmp_dir, :platform
|
16
|
+
def_delegator :exttask, :name, :extname
|
17
|
+
|
18
|
+
def platform_tmp_dir
|
19
|
+
Pathname.new(File.join(exttask.tmp_dir, exttask.platform, exttask.name))
|
20
|
+
end
|
21
|
+
|
22
|
+
def build_dir
|
23
|
+
platform_tmp_dir.join(RUBY_VERSION.to_s)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
XCODE_TOOLCHAIN_PATH = '/Applications/Xcode.app/Contents/Developer' \
|
28
|
+
'/Toolchains/XcodeDefault.xctoolchain'.freeze
|
29
|
+
PRE_COMPILE_FLAGS = %w(-x c -std=c99).freeze
|
30
|
+
|
31
|
+
POST_COMPILE_FLAGS = %W(
|
32
|
+
-isystem
|
33
|
+
/usr/local/include
|
34
|
+
-isystem
|
35
|
+
/usr/include
|
36
|
+
-isystem
|
37
|
+
/Library/Developer/CommandLineTools/usr/include
|
38
|
+
-isystem
|
39
|
+
#{XCODE_TOOLCHAIN_PATH}/usr/include
|
40
|
+
-isystem
|
41
|
+
/System/Library/Frameworks
|
42
|
+
-isystem
|
43
|
+
/Library/Frameworks
|
44
|
+
-isystem
|
45
|
+
#{XCODE_TOOLCHAIN_PATH}/usr/lib/clang/7.3.0/include
|
46
|
+
-fspell-checking
|
47
|
+
).freeze
|
48
|
+
end
|
metadata
ADDED
@@ -0,0 +1,129 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: faster_support
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- J. Morgan Lieberthal
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-01-09 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.13'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.13'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake-compiler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '3.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '3.0'
|
69
|
+
description:
|
70
|
+
email:
|
71
|
+
- j.morgan.lieberthal@gmail.com
|
72
|
+
executables: []
|
73
|
+
extensions:
|
74
|
+
- ext/faster_support/extconf.rb
|
75
|
+
extra_rdoc_files: []
|
76
|
+
files:
|
77
|
+
- ".clang-format"
|
78
|
+
- ".color_coded"
|
79
|
+
- ".gitignore"
|
80
|
+
- ".rspec"
|
81
|
+
- ".ruby-gemset"
|
82
|
+
- ".ruby-version"
|
83
|
+
- ".travis.yml"
|
84
|
+
- ".ycm_extra_conf.py"
|
85
|
+
- CODE_OF_CONDUCT.md
|
86
|
+
- Gemfile
|
87
|
+
- Guardfile
|
88
|
+
- LICENSE.txt
|
89
|
+
- README.md
|
90
|
+
- Rakefile
|
91
|
+
- bin/console
|
92
|
+
- bin/setup
|
93
|
+
- compile_commands.json
|
94
|
+
- ext/faster_support/array_blank.c
|
95
|
+
- ext/faster_support/extconf.rb
|
96
|
+
- ext/faster_support/faster_support.c
|
97
|
+
- ext/faster_support/faster_support.h
|
98
|
+
- ext/faster_support/object_blank.c
|
99
|
+
- ext/faster_support/string_blank.c
|
100
|
+
- faster_support.gemspec
|
101
|
+
- lib/faster_support.rb
|
102
|
+
- lib/faster_support/version.rb
|
103
|
+
- lib/tasks/tooling.rake
|
104
|
+
- lib/tasks/tooling.rb
|
105
|
+
homepage: https://github.com/baberthal/faster_support
|
106
|
+
licenses:
|
107
|
+
- MIT
|
108
|
+
metadata: {}
|
109
|
+
post_install_message:
|
110
|
+
rdoc_options: []
|
111
|
+
require_paths:
|
112
|
+
- lib
|
113
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
119
|
+
requirements:
|
120
|
+
- - ">="
|
121
|
+
- !ruby/object:Gem::Version
|
122
|
+
version: '0'
|
123
|
+
requirements: []
|
124
|
+
rubyforge_project:
|
125
|
+
rubygems_version: 2.6.8
|
126
|
+
signing_key:
|
127
|
+
specification_version: 4
|
128
|
+
summary: Faster Implementations of ActiveSupport Methods
|
129
|
+
test_files: []
|