Classy_Name 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +8 -0
- data/Classy_Name.gemspec +31 -0
- data/Gemfile +6 -0
- data/README.md +37 -0
- data/Rakefile +3 -0
- data/lib/Classy_Name/version.rb +1 -0
- data/lib/Classy_Name.rb +12 -0
- data/spec/Classy_Name.rb +17 -0
- data/spec/bin.rb +13 -0
- data/spec/lib/main.rb +45 -0
- metadata +120 -0
data/.gitignore
ADDED
data/Classy_Name.gemspec
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
$:.push File.expand_path("../lib", __FILE__)
|
4
|
+
require "Classy_Name/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = "Classy_Name"
|
8
|
+
s.version = Classy_Name_Version
|
9
|
+
s.authors = ["da99"]
|
10
|
+
s.email = ["i-hate-spam-45671204@mailinator.com"]
|
11
|
+
s.homepage = "https://github.com/da99/Classy_Name"
|
12
|
+
s.summary = %q{ Turn strings into an improper Camel_Case_String. }
|
13
|
+
s.description = %q{
|
14
|
+
|
15
|
+
Do you like non-standard camel-case strings? (e.g. Camel_Case_Me)
|
16
|
+
|
17
|
+
}
|
18
|
+
|
19
|
+
s.files = `git ls-files`.split("\n")
|
20
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
21
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
22
|
+
s.require_paths = ["lib"]
|
23
|
+
|
24
|
+
s.add_development_dependency 'bacon'
|
25
|
+
s.add_development_dependency 'rake'
|
26
|
+
s.add_development_dependency 'Bacon_Colored'
|
27
|
+
s.add_development_dependency 'pry'
|
28
|
+
|
29
|
+
# Specify any dependencies here; for example:
|
30
|
+
# s.add_runtime_dependency 'rest-client'
|
31
|
+
end
|
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
|
2
|
+
Classy\_Name
|
3
|
+
================
|
4
|
+
|
5
|
+
An alternative to [classify gem](https://github.com/oleander/classify).
|
6
|
+
The difference is this one does not use proper camel-case:
|
7
|
+
|
8
|
+
abc_school_house_rock
|
9
|
+
--> Abc_School_House_Rock
|
10
|
+
|
11
|
+
Installation
|
12
|
+
------------
|
13
|
+
|
14
|
+
gem install Classy_Name
|
15
|
+
|
16
|
+
Usage
|
17
|
+
------
|
18
|
+
|
19
|
+
require "Classy_Name"
|
20
|
+
|
21
|
+
Classy_Name 'my_classy_string'
|
22
|
+
# --> 'My_Classy_String'
|
23
|
+
|
24
|
+
Classy_Name '123abc'
|
25
|
+
# ---> 'Abc'
|
26
|
+
|
27
|
+
Classy_Name 'abc.123'
|
28
|
+
# ---> 'Abc_123'
|
29
|
+
|
30
|
+
Run Tests
|
31
|
+
---------
|
32
|
+
|
33
|
+
git clone git@github.com:da99/Classy_Name.git
|
34
|
+
cd Classy_Name
|
35
|
+
bundle update
|
36
|
+
bundle exec bacon spec/lib/main.rb
|
37
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
Classy_Name_Version = "0.1.0"
|
data/lib/Classy_Name.rb
ADDED
data/spec/Classy_Name.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
|
2
|
+
describe "Classy_Name" do
|
3
|
+
|
4
|
+
it "removes all non-alphanumeric characters" do
|
5
|
+
Classy_Name("abc-abc").should == "Abc_Abc"
|
6
|
+
end
|
7
|
+
|
8
|
+
it "removes any non-alphabetical characters" do
|
9
|
+
Classy_Name("123abc").should == "Abc"
|
10
|
+
end
|
11
|
+
|
12
|
+
it "strips name" do
|
13
|
+
Classy_Name(' a ').should == 'A'
|
14
|
+
end
|
15
|
+
|
16
|
+
end # === Classy_Name
|
17
|
+
|
data/spec/bin.rb
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
|
2
|
+
bins = Dir.glob("bin/*")
|
3
|
+
|
4
|
+
unless bins.empty?
|
5
|
+
describe "permissions of bin/" do
|
6
|
+
bins.each { |file|
|
7
|
+
it "should chmod 755 for: #{file}" do
|
8
|
+
`stat -c %a #{file}`.strip
|
9
|
+
.should.be == "755"
|
10
|
+
end
|
11
|
+
}
|
12
|
+
end # === permissions of bin/
|
13
|
+
end # === unless bins.empty?
|
data/spec/lib/main.rb
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
|
2
|
+
require 'rubygems'
|
3
|
+
require 'bundler'
|
4
|
+
begin
|
5
|
+
Bundler.setup(:default, :development)
|
6
|
+
rescue Bundler::BundlerError => e
|
7
|
+
$stderr.print e.message, "\n"
|
8
|
+
$stderr.print "Run `bundle install` to install missing gems\n"
|
9
|
+
exit e.status_code
|
10
|
+
end
|
11
|
+
require 'bacon'
|
12
|
+
|
13
|
+
Gem_Dir = File.expand_path( File.join(File.dirname(__FILE__) + '/../..') )
|
14
|
+
$LOAD_PATH.unshift Gem_Dir
|
15
|
+
$LOAD_PATH.unshift( Gem_Dir + "/lib" )
|
16
|
+
|
17
|
+
Bacon.summary_on_exit
|
18
|
+
|
19
|
+
require 'Classy_Name'
|
20
|
+
require 'Bacon_Colored'
|
21
|
+
require 'pry'
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
# ======== Custom code.
|
26
|
+
|
27
|
+
# Nothing yet.
|
28
|
+
|
29
|
+
|
30
|
+
|
31
|
+
|
32
|
+
# ======== Include the tests.
|
33
|
+
target_files = ARGV[1, ARGV.size - 1].select { |a| File.file?(a) }
|
34
|
+
|
35
|
+
if target_files.empty?
|
36
|
+
|
37
|
+
# include all files
|
38
|
+
Dir.glob('./spec/*.rb').each { |file|
|
39
|
+
require file.sub('.rb', '') if File.file?(file)
|
40
|
+
}
|
41
|
+
|
42
|
+
else
|
43
|
+
# Do nothing. Bacon grabs the file.
|
44
|
+
|
45
|
+
end
|
metadata
ADDED
@@ -0,0 +1,120 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: Classy_Name
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- da99
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-05-11 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: bacon
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '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: '0'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: rake
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
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: '0'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: Bacon_Colored
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
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: '0'
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: pry
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
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: '0'
|
78
|
+
description: ! "\n\n Do you like non-standard camel-case strings? (e.g. Camel_Case_Me)\n
|
79
|
+
\ \n "
|
80
|
+
email:
|
81
|
+
- i-hate-spam-45671204@mailinator.com
|
82
|
+
executables: []
|
83
|
+
extensions: []
|
84
|
+
extra_rdoc_files: []
|
85
|
+
files:
|
86
|
+
- .gitignore
|
87
|
+
- Classy_Name.gemspec
|
88
|
+
- Gemfile
|
89
|
+
- README.md
|
90
|
+
- Rakefile
|
91
|
+
- lib/Classy_Name.rb
|
92
|
+
- lib/Classy_Name/version.rb
|
93
|
+
- spec/Classy_Name.rb
|
94
|
+
- spec/bin.rb
|
95
|
+
- spec/lib/main.rb
|
96
|
+
homepage: https://github.com/da99/Classy_Name
|
97
|
+
licenses: []
|
98
|
+
post_install_message:
|
99
|
+
rdoc_options: []
|
100
|
+
require_paths:
|
101
|
+
- lib
|
102
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
103
|
+
none: false
|
104
|
+
requirements:
|
105
|
+
- - ! '>='
|
106
|
+
- !ruby/object:Gem::Version
|
107
|
+
version: '0'
|
108
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
109
|
+
none: false
|
110
|
+
requirements:
|
111
|
+
- - ! '>='
|
112
|
+
- !ruby/object:Gem::Version
|
113
|
+
version: '0'
|
114
|
+
requirements: []
|
115
|
+
rubyforge_project:
|
116
|
+
rubygems_version: 1.8.23
|
117
|
+
signing_key:
|
118
|
+
specification_version: 3
|
119
|
+
summary: Turn strings into an improper Camel_Case_String.
|
120
|
+
test_files: []
|