builtinextension 0.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/.document ADDED
@@ -0,0 +1,5 @@
1
+ lib/**/*.rb
2
+ bin/*
3
+ -
4
+ features/**/*.feature
5
+ LICENSE.txt
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --color
data/Gemfile ADDED
@@ -0,0 +1,15 @@
1
+ source "http://rubygems.org"
2
+ # Add dependencies required to use your gem here.
3
+ # Example:
4
+ # gem "activesupport", ">= 2.3.5"
5
+
6
+ # Add dependencies to develop your gem here.
7
+ # Include everything needed to run rake, tests, features, etc.
8
+ group :development do
9
+ gem "rspec", "~> 2.8.0"
10
+ gem "rdoc", "~> 3.12"
11
+
12
+ gem "bundler", "~> 1.1.3"
13
+ gem "jeweler", "~> 1.8.3"
14
+ gem "simplecov", ">= 0"
15
+ end
data/LICENSE.txt ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2012 ippei94da
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,19 @@
1
+ = builtinextension
2
+
3
+ Description goes here.
4
+
5
+ == Contributing to builtinextension
6
+
7
+ * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
8
+ * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
9
+ * Fork the project.
10
+ * Start a feature/bugfix branch.
11
+ * Commit and push until you are happy with your contribution.
12
+ * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
13
+ * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
14
+
15
+ == Copyright
16
+
17
+ Copyright (c) 2012 ippei94da. See LICENSE.txt for
18
+ further details.
19
+
data/Rakefile ADDED
@@ -0,0 +1,54 @@
1
+ # encoding: utf-8
2
+
3
+ require 'rubygems'
4
+ require 'bundler'
5
+ begin
6
+ Bundler.setup(:default, :development)
7
+ rescue Bundler::BundlerError => e
8
+ $stderr.puts e.message
9
+ $stderr.puts "Run `bundle install` to install missing gems"
10
+ exit e.status_code
11
+ end
12
+ require 'rake'
13
+
14
+ require 'jeweler'
15
+ Jeweler::Tasks.new do |gem|
16
+ # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
17
+ gem.name = "builtinextension"
18
+ gem.homepage = "http://github.com/ippei94da/builtinextension"
19
+ gem.license = "MIT"
20
+ gem.summary = %Q{Method as extension for builtin classes.}
21
+ gem.description = %Q{Frequently used methods for builtin classes,
22
+ e.g., String, Array, etc.
23
+ These methods are not implemented in Ruby and
24
+ are doubted to offer to be implemented into Ruby core system.
25
+ A main target is my personal programming.
26
+ }
27
+ gem.email = "ippei94da@gmail.com"
28
+ gem.authors = ["ippei94da"]
29
+ # dependencies defined in Gemfile
30
+ end
31
+ Jeweler::RubygemsDotOrgTasks.new
32
+
33
+ require 'rspec/core'
34
+ require 'rspec/core/rake_task'
35
+ RSpec::Core::RakeTask.new(:spec) do |spec|
36
+ spec.pattern = FileList['spec/**/*_spec.rb']
37
+ end
38
+
39
+ RSpec::Core::RakeTask.new(:rcov) do |spec|
40
+ spec.pattern = 'spec/**/*_spec.rb'
41
+ spec.rcov = true
42
+ end
43
+
44
+ task :default => :spec
45
+
46
+ require 'rdoc/task'
47
+ Rake::RDocTask.new do |rdoc|
48
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
49
+
50
+ rdoc.rdoc_dir = 'rdoc'
51
+ rdoc.title = "builtinextension #{version}"
52
+ rdoc.rdoc_files.include('README*')
53
+ rdoc.rdoc_files.include('lib/**/*.rb')
54
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.0.0
@@ -0,0 +1,64 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = "builtinextension"
8
+ s.version = "0.0.0"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["ippei94da"]
12
+ s.date = "2012-04-02"
13
+ s.description = "Frequently used methods for builtin classes,\n e.g., String, Array, etc.\n These methods are not implemented in Ruby and\n are doubted to offer to be implemented into Ruby core system.\n A main target is my personal programming.\n "
14
+ s.email = "ippei94da@gmail.com"
15
+ s.extra_rdoc_files = [
16
+ "LICENSE.txt",
17
+ "README.rdoc"
18
+ ]
19
+ s.files = [
20
+ ".document",
21
+ ".rspec",
22
+ "Gemfile",
23
+ "LICENSE.txt",
24
+ "README.rdoc",
25
+ "Rakefile",
26
+ "VERSION",
27
+ "builtinextension.gemspec",
28
+ "lib/builtinextension.rb",
29
+ "lib/string_escape_zsh.rb",
30
+ "spec/builtinextension_spec.rb",
31
+ "spec/spec_helper.rb",
32
+ "spec/string_escape_zsh_spec.rb"
33
+ ]
34
+ s.homepage = "http://github.com/ippei94da/builtinextension"
35
+ s.licenses = ["MIT"]
36
+ s.require_paths = ["lib"]
37
+ s.rubygems_version = "1.8.21"
38
+ s.summary = "Method as extension for builtin classes."
39
+
40
+ if s.respond_to? :specification_version then
41
+ s.specification_version = 3
42
+
43
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
44
+ s.add_development_dependency(%q<rspec>, ["~> 2.8.0"])
45
+ s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
46
+ s.add_development_dependency(%q<bundler>, ["~> 1.1.3"])
47
+ s.add_development_dependency(%q<jeweler>, ["~> 1.8.3"])
48
+ s.add_development_dependency(%q<simplecov>, [">= 0"])
49
+ else
50
+ s.add_dependency(%q<rspec>, ["~> 2.8.0"])
51
+ s.add_dependency(%q<rdoc>, ["~> 3.12"])
52
+ s.add_dependency(%q<bundler>, ["~> 1.1.3"])
53
+ s.add_dependency(%q<jeweler>, ["~> 1.8.3"])
54
+ s.add_dependency(%q<simplecov>, [">= 0"])
55
+ end
56
+ else
57
+ s.add_dependency(%q<rspec>, ["~> 2.8.0"])
58
+ s.add_dependency(%q<rdoc>, ["~> 3.12"])
59
+ s.add_dependency(%q<bundler>, ["~> 1.1.3"])
60
+ s.add_dependency(%q<jeweler>, ["~> 1.8.3"])
61
+ s.add_dependency(%q<simplecov>, [">= 0"])
62
+ end
63
+ end
64
+
File without changes
@@ -0,0 +1,24 @@
1
+ #! /usr/bin/ruby -w
2
+
3
+ class String
4
+
5
+ #zsh で特殊な意味を持つ文字をバックスラッシュでエスケープする。
6
+ def escape_zsh
7
+ temp = dup
8
+ temp.gsub!('\\', '\\\\\\') #最初にしないと他の結果をさらに置換してしまう
9
+ #temp.gsub!('/', '/') #「/」はディレクトリ区切り文字なのでエスケープしない
10
+ temp.gsub!(' ', '\ ') ; temp.gsub!('!', '\!') ; temp.gsub!('"', '\"') ;
11
+ temp.gsub!('#', '\#') ; temp.gsub!('$', '\$') ; temp.gsub!('%', '\%') ;
12
+ temp.gsub!(')', '\)') ; temp.gsub!('(', '\(') ; temp.gsub!('*', '\*') ;
13
+ temp.gsub!(',', '\,') ; #temp.gsub!('-', '\-') ; #temp.gsub!('.', '\.') ;
14
+ temp.gsub!(':', '\:') ; temp.gsub!(';', '\;') ; temp.gsub!('<', '\<') ;
15
+ temp.gsub!('=', '\=') ; temp.gsub!('>', '\>') ; temp.gsub!('?', '\?') ;
16
+ temp.gsub!('@', '\@') ; temp.gsub!('[', '\[') ; temp.gsub!(']', '\]') ;
17
+ temp.gsub!('^', '\^') ; temp.gsub!('_', '\_') ; temp.gsub!('{', '\{') ;
18
+ temp.gsub!('|', '\|') ; temp.gsub!('}', '\}') ; temp.gsub!('~', '\~') ;
19
+ temp.gsub!('`', '\\\`') ; temp.gsub!('&', '\\\&') ;
20
+ temp.gsub!('+', '\\\+') ; temp.gsub!("'", "\\\\'") ;
21
+ return temp
22
+ end
23
+
24
+ end
@@ -0,0 +1,7 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
+
3
+ describe "Builtinextension" do
4
+ it "fails" do
5
+ fail "hey buddy, you should probably rename this file and start specing for real"
6
+ end
7
+ end
@@ -0,0 +1,12 @@
1
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
2
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
3
+ require 'rspec'
4
+ require 'builtinextension'
5
+
6
+ # Requires supporting files with custom matchers and macros, etc,
7
+ # in ./support/ and its subdirectories.
8
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
9
+
10
+ RSpec.configure do |config|
11
+
12
+ end
@@ -0,0 +1,85 @@
1
+ #! /usr/bin/env ruby
2
+ # coding: utf-8
3
+
4
+ require 'lib/string_escape_zsh.rb'
5
+ #require 'test/unit'
6
+
7
+ describe String, "with chars to be escaped" do
8
+ before do
9
+ @s00 = "0123456789abcdefghijklmnopqrstuvwxyz"
10
+ @s10 = "\\abc\\"
11
+ @s11 = '/abc/'
12
+ @s12 = ' abc '
13
+ @s13 = '!abc!'
14
+ @s14 = '"abc"'
15
+ @s15 = '#abc#'
16
+ @s16 = '$abc$'
17
+ @s17 = '%abc%'
18
+ @s18 = ')abc)'
19
+ @s19 = '(abc('
20
+ @s20 = '*abc*'
21
+ @s21 = ',abc,'
22
+ @s22 = '-abc-'
23
+ @s23 = '.abc.'
24
+ @s24 = ':abc:'
25
+ @s25 = ';abc;'
26
+ @s26 = '<abc<'
27
+ @s27 = '=abc='
28
+ @s28 = '>abc>'
29
+ @s29 = '?abc?'
30
+ @s30 = '@abc@'
31
+ @s31 = '[abc['
32
+ @s32 = ']abc]'
33
+ @s33 = '^abc^'
34
+ @s34 = '_abc_'
35
+ @s35 = '{abc{'
36
+ @s36 = '|abc|'
37
+ @s37 = '}abc}'
38
+ @s38 = '~abc~'
39
+ @s39 = '`abc`'
40
+ @s40 = '&abc&'
41
+ @s41 = '+abc+'
42
+ @s42 = "'abc'"
43
+ end
44
+
45
+ it "should not escape" do
46
+ @s00.escape_zsh.should == "0123456789abcdefghijklmnopqrstuvwxyz"
47
+ end
48
+
49
+ it "should escape" do
50
+ @s10.escape_zsh.should == "\\\\abc\\\\"
51
+ @s11.escape_zsh.should == "/abc/"
52
+ @s12.escape_zsh.should == "\\ abc\\ "
53
+ @s13.escape_zsh.should == "\\!abc\\!"
54
+ @s14.escape_zsh.should == '\\"abc\\"'
55
+ @s15.escape_zsh.should == "\\#abc\\#"
56
+ @s16.escape_zsh.should == "\\$abc\\$"
57
+ @s17.escape_zsh.should == "\\%abc\\%"
58
+ @s18.escape_zsh.should == "\\)abc\\)"
59
+ @s19.escape_zsh.should == "\\(abc\\("
60
+ @s20.escape_zsh.should == "\\*abc\\*"
61
+ @s21.escape_zsh.should == "\\,abc\\,"
62
+ @s22.escape_zsh.should == "-abc-"
63
+ @s23.escape_zsh.should == ".abc."
64
+ @s24.escape_zsh.should == "\\:abc\\:"
65
+ @s25.escape_zsh.should == "\\;abc\\;"
66
+ @s26.escape_zsh.should == "\\<abc\\<"
67
+ @s27.escape_zsh.should == "\\=abc\\="
68
+ @s28.escape_zsh.should == "\\>abc\\>"
69
+ @s29.escape_zsh.should == "\\?abc\\?"
70
+ @s30.escape_zsh.should == "\\@abc\\@"
71
+ @s31.escape_zsh.should == "\\[abc\\["
72
+ @s32.escape_zsh.should == "\\]abc\\]"
73
+ @s33.escape_zsh.should == "\\^abc\\^"
74
+ @s34.escape_zsh.should == "\\_abc\\_"
75
+ @s35.escape_zsh.should == "\\{abc\\{"
76
+ @s36.escape_zsh.should == "\\|abc\\|"
77
+ @s37.escape_zsh.should == "\\}abc\\}"
78
+ @s38.escape_zsh.should == "\\~abc\\~"
79
+ @s39.escape_zsh.should == "\\`abc\\`"
80
+ @s40.escape_zsh.should == "\\&abc\\&"
81
+ @s41.escape_zsh.should == "\\+abc\\+"
82
+ @s42.escape_zsh.should == "\\'abc\\'"
83
+ end
84
+
85
+ end
metadata ADDED
@@ -0,0 +1,146 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: builtinextension
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - ippei94da
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-04-02 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rspec
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: 2.8.0
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: 2.8.0
30
+ - !ruby/object:Gem::Dependency
31
+ name: rdoc
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ~>
36
+ - !ruby/object:Gem::Version
37
+ version: '3.12'
38
+ type: :development
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: '3.12'
46
+ - !ruby/object:Gem::Dependency
47
+ name: bundler
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ~>
52
+ - !ruby/object:Gem::Version
53
+ version: 1.1.3
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: 1.1.3
62
+ - !ruby/object:Gem::Dependency
63
+ name: jeweler
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ~>
68
+ - !ruby/object:Gem::Version
69
+ version: 1.8.3
70
+ type: :development
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ~>
76
+ - !ruby/object:Gem::Version
77
+ version: 1.8.3
78
+ - !ruby/object:Gem::Dependency
79
+ name: simplecov
80
+ requirement: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ! '>='
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
86
+ type: :development
87
+ prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
+ description: ! "Frequently used methods for builtin classes,\n e.g., String, Array,
95
+ etc.\n These methods are not implemented in Ruby and\n are doubted to offer
96
+ to be implemented into Ruby core system.\n A main target is my personal programming.\n
97
+ \ "
98
+ email: ippei94da@gmail.com
99
+ executables: []
100
+ extensions: []
101
+ extra_rdoc_files:
102
+ - LICENSE.txt
103
+ - README.rdoc
104
+ files:
105
+ - .document
106
+ - .rspec
107
+ - Gemfile
108
+ - LICENSE.txt
109
+ - README.rdoc
110
+ - Rakefile
111
+ - VERSION
112
+ - builtinextension.gemspec
113
+ - lib/builtinextension.rb
114
+ - lib/string_escape_zsh.rb
115
+ - spec/builtinextension_spec.rb
116
+ - spec/spec_helper.rb
117
+ - spec/string_escape_zsh_spec.rb
118
+ homepage: http://github.com/ippei94da/builtinextension
119
+ licenses:
120
+ - MIT
121
+ post_install_message:
122
+ rdoc_options: []
123
+ require_paths:
124
+ - lib
125
+ required_ruby_version: !ruby/object:Gem::Requirement
126
+ none: false
127
+ requirements:
128
+ - - ! '>='
129
+ - !ruby/object:Gem::Version
130
+ version: '0'
131
+ segments:
132
+ - 0
133
+ hash: 252585359
134
+ required_rubygems_version: !ruby/object:Gem::Requirement
135
+ none: false
136
+ requirements:
137
+ - - ! '>='
138
+ - !ruby/object:Gem::Version
139
+ version: '0'
140
+ requirements: []
141
+ rubyforge_project:
142
+ rubygems_version: 1.8.21
143
+ signing_key:
144
+ specification_version: 3
145
+ summary: Method as extension for builtin classes.
146
+ test_files: []