semantic_id 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +4 -0
- data/Gemfile +4 -0
- data/README.md +8 -0
- data/Rakefile +1 -0
- data/init.rb +1 -0
- data/lib/semantic_id.rb +20 -0
- data/lib/semantic_id/version.rb +3 -0
- data/semantic_id.gemspec +22 -0
- metadata +66 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
# SemanticID
|
2
|
+
_A simple helper for generating semantic css "namespace" selectors for your Rails views._
|
3
|
+
|
4
|
+
This is my first attempt at making a gem plugin, so it's really rough... but it works :)
|
5
|
+
|
6
|
+
TODO:
|
7
|
+
- Add real tests!
|
8
|
+
- Learn the "real" way to extend ActiveSupport
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'bundler/gem_tasks'
|
data/init.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'semantic_id'
|
data/lib/semantic_id.rb
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'semantic_id/version'
|
2
|
+
|
3
|
+
module ::ActionView::Helpers::TextHelper
|
4
|
+
|
5
|
+
def semantic_id
|
6
|
+
string = String.new
|
7
|
+
|
8
|
+
case
|
9
|
+
when controller.action_name =~ /new|edit/
|
10
|
+
string += controller.action_name + "_"
|
11
|
+
when controller.action_name =~ /index|create/
|
12
|
+
string += controller.controller_name
|
13
|
+
else
|
14
|
+
string += controller.controller_name.singularize
|
15
|
+
end
|
16
|
+
|
17
|
+
string += "_view"
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
data/semantic_id.gemspec
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "semantic_id/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "semantic_id"
|
7
|
+
s.version = SemanticId::VERSION
|
8
|
+
s.authors = ["Andrew Burleson"]
|
9
|
+
s.email = ["andrew@eighty-b.com"]
|
10
|
+
s.homepage = "http://github.com/burlesona/semantic_id"
|
11
|
+
s.summary = %q{Generates semantic CSS "namespace" selectors for Rails views.}
|
12
|
+
s.description = %q{Semantic_ID is a very simple helper that creates a view-specific semantic selector string following the same convention as the Rails Route Helpers. IE, the ExamplesController#Index view would return "examples_view".}
|
13
|
+
|
14
|
+
s.rubyforge_project = "semantic_id"
|
15
|
+
|
16
|
+
s.add_development_dependency "rspec"
|
17
|
+
|
18
|
+
s.files = `git ls-files`.split("\n")
|
19
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
20
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
21
|
+
s.require_paths = ["lib"]
|
22
|
+
end
|
metadata
ADDED
@@ -0,0 +1,66 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: semantic_id
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Andrew Burleson
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2011-06-25 00:00:00.000000000Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rspec
|
16
|
+
requirement: &2156085980 !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: *2156085980
|
25
|
+
description: Semantic_ID is a very simple helper that creates a view-specific semantic
|
26
|
+
selector string following the same convention as the Rails Route Helpers. IE, the
|
27
|
+
ExamplesController#Index view would return "examples_view".
|
28
|
+
email:
|
29
|
+
- andrew@eighty-b.com
|
30
|
+
executables: []
|
31
|
+
extensions: []
|
32
|
+
extra_rdoc_files: []
|
33
|
+
files:
|
34
|
+
- .gitignore
|
35
|
+
- Gemfile
|
36
|
+
- README.md
|
37
|
+
- Rakefile
|
38
|
+
- init.rb
|
39
|
+
- lib/semantic_id.rb
|
40
|
+
- lib/semantic_id/version.rb
|
41
|
+
- semantic_id.gemspec
|
42
|
+
homepage: http://github.com/burlesona/semantic_id
|
43
|
+
licenses: []
|
44
|
+
post_install_message:
|
45
|
+
rdoc_options: []
|
46
|
+
require_paths:
|
47
|
+
- lib
|
48
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
55
|
+
none: false
|
56
|
+
requirements:
|
57
|
+
- - ! '>='
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: '0'
|
60
|
+
requirements: []
|
61
|
+
rubyforge_project: semantic_id
|
62
|
+
rubygems_version: 1.8.5
|
63
|
+
signing_key:
|
64
|
+
specification_version: 3
|
65
|
+
summary: Generates semantic CSS "namespace" selectors for Rails views.
|
66
|
+
test_files: []
|