x 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of x might be problematic. Click here for more details.
- data/.gitignore +1 -0
- data/README.md +25 -0
- data/Rakefile +12 -0
- data/VERSION +1 -0
- data/lib/x.rb +31 -0
- data/pkg/x-0.0.1.gem +0 -0
- data/test/x_test.rb +18 -0
- data/x.gemspec +47 -0
- metadata +62 -0
data/.gitignore
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
*.swp
|
data/README.md
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
X
|
2
|
+
=
|
3
|
+
|
4
|
+
Ruby utilities.
|
5
|
+
|
6
|
+
Converting
|
7
|
+
----------
|
8
|
+
|
9
|
+
'coca cola'.camel_case # 'CocaCola'
|
10
|
+
'http://snake-case.com'.snake_case # 'http_snake_case_com'
|
11
|
+
|
12
|
+
Filing
|
13
|
+
------
|
14
|
+
|
15
|
+
File.here # 'test'
|
16
|
+
File.up / 'lib' / 'x' # 'test/../lib/x'
|
17
|
+
File.up(2) / 'x' / 'README' # 'test/../../x/README'
|
18
|
+
|
19
|
+
Testing
|
20
|
+
-------
|
21
|
+
|
22
|
+
should "name" do
|
23
|
+
assert true
|
24
|
+
end
|
25
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'jeweler'
|
2
|
+
|
3
|
+
Jeweler::Tasks.new do |gemspec|
|
4
|
+
gemspec.name = "x"
|
5
|
+
gemspec.summary = "Ruby utilities."
|
6
|
+
gemspec.description = "Ruby utilities."
|
7
|
+
gemspec.email = "dcroak@thoughtbot.com"
|
8
|
+
gemspec.homepage = "http://github.com/dancroak/x"
|
9
|
+
gemspec.authors = ["Dan Croak"]
|
10
|
+
end
|
11
|
+
|
12
|
+
Jeweler::GemcutterTasks.new
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.0.1
|
data/lib/x.rb
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
class String
|
2
|
+
def /(path)
|
3
|
+
File.join(self, path)
|
4
|
+
end
|
5
|
+
|
6
|
+
def camel_case
|
7
|
+
gsub(' ', '_').gsub(/(?:^|_)(.)/) { $1.upcase }
|
8
|
+
end
|
9
|
+
|
10
|
+
def snake_case
|
11
|
+
sub(/\W+/, "_").gsub('-', '_').gsub('.', '_').downcase
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
class Test::Unit::TestCase
|
16
|
+
def self.should(name, &block)
|
17
|
+
define_method("test_#{name.snake_case}", &block)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
class File
|
22
|
+
def self.here
|
23
|
+
dirname(caller[0].split(':').first)
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.up(dir_count = 1)
|
27
|
+
path = dirname(caller[0].split(':').first)
|
28
|
+
dir_count.times { path = path / '..' }
|
29
|
+
path
|
30
|
+
end
|
31
|
+
end
|
data/pkg/x-0.0.1.gem
ADDED
Binary file
|
data/test/x_test.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
require File.join(File.dirname(__FILE__), '..', 'lib', 'x')
|
3
|
+
|
4
|
+
class XTest < Test::Unit::TestCase
|
5
|
+
should "convert to camel case" do
|
6
|
+
assert_equal 'CocaCola', 'coca cola'.camel_case
|
7
|
+
end
|
8
|
+
|
9
|
+
should "convert to snake case" do
|
10
|
+
assert_equal 'http_snake_case_com', 'http://snake-case.com'.snake_case
|
11
|
+
end
|
12
|
+
|
13
|
+
should "join file paths" do
|
14
|
+
assert_equal 'test', File.here
|
15
|
+
assert_equal 'test/../lib/x', File.up / 'lib' / 'x'
|
16
|
+
assert_equal 'test/../../x/README', File.up(2) / 'x' / 'README'
|
17
|
+
end
|
18
|
+
end
|
data/x.gemspec
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{x}
|
8
|
+
s.version = "0.0.1"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Dan Croak"]
|
12
|
+
s.date = %q{2009-11-08}
|
13
|
+
s.description = %q{Ruby utilities.}
|
14
|
+
s.email = %q{dcroak@thoughtbot.com}
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"README.md"
|
17
|
+
]
|
18
|
+
s.files = [
|
19
|
+
".gitignore",
|
20
|
+
"README.md",
|
21
|
+
"Rakefile",
|
22
|
+
"VERSION",
|
23
|
+
"lib/x.rb",
|
24
|
+
"pkg/x-0.0.1.gem",
|
25
|
+
"test/x_test.rb",
|
26
|
+
"x.gemspec"
|
27
|
+
]
|
28
|
+
s.homepage = %q{http://github.com/dancroak/x}
|
29
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
30
|
+
s.require_paths = ["lib"]
|
31
|
+
s.rubygems_version = %q{1.3.5}
|
32
|
+
s.summary = %q{Ruby utilities.}
|
33
|
+
s.test_files = [
|
34
|
+
"test/x_test.rb"
|
35
|
+
]
|
36
|
+
|
37
|
+
if s.respond_to? :specification_version then
|
38
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
39
|
+
s.specification_version = 3
|
40
|
+
|
41
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
42
|
+
else
|
43
|
+
end
|
44
|
+
else
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
metadata
ADDED
@@ -0,0 +1,62 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: x
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Dan Croak
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-11-08 00:00:00 -05:00
|
13
|
+
default_executable:
|
14
|
+
dependencies: []
|
15
|
+
|
16
|
+
description: Ruby utilities.
|
17
|
+
email: dcroak@thoughtbot.com
|
18
|
+
executables: []
|
19
|
+
|
20
|
+
extensions: []
|
21
|
+
|
22
|
+
extra_rdoc_files:
|
23
|
+
- README.md
|
24
|
+
files:
|
25
|
+
- .gitignore
|
26
|
+
- README.md
|
27
|
+
- Rakefile
|
28
|
+
- VERSION
|
29
|
+
- lib/x.rb
|
30
|
+
- pkg/x-0.0.1.gem
|
31
|
+
- test/x_test.rb
|
32
|
+
- x.gemspec
|
33
|
+
has_rdoc: true
|
34
|
+
homepage: http://github.com/dancroak/x
|
35
|
+
licenses: []
|
36
|
+
|
37
|
+
post_install_message:
|
38
|
+
rdoc_options:
|
39
|
+
- --charset=UTF-8
|
40
|
+
require_paths:
|
41
|
+
- lib
|
42
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - ">="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: "0"
|
47
|
+
version:
|
48
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
49
|
+
requirements:
|
50
|
+
- - ">="
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: "0"
|
53
|
+
version:
|
54
|
+
requirements: []
|
55
|
+
|
56
|
+
rubyforge_project:
|
57
|
+
rubygems_version: 1.3.5
|
58
|
+
signing_key:
|
59
|
+
specification_version: 3
|
60
|
+
summary: Ruby utilities.
|
61
|
+
test_files:
|
62
|
+
- test/x_test.rb
|