rails960gs 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile ADDED
@@ -0,0 +1,13 @@
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 "shoulda", ">= 0"
10
+ gem "bundler", "~> 1.0.0"
11
+ gem "jeweler", "~> 1.6.2"
12
+ gem "rcov", ">= 0"
13
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,20 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ git (1.2.5)
5
+ jeweler (1.6.2)
6
+ bundler (~> 1.0)
7
+ git (>= 1.2.5)
8
+ rake
9
+ rake (0.9.2)
10
+ rcov (0.9.9)
11
+ shoulda (2.11.3)
12
+
13
+ PLATFORMS
14
+ ruby
15
+
16
+ DEPENDENCIES
17
+ bundler (~> 1.0.0)
18
+ jeweler (~> 1.6.2)
19
+ rcov
20
+ shoulda
data/LICENSE.txt ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2011 orangeweb
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 ADDED
@@ -0,0 +1,16 @@
1
+
2
+ == What is rails960gs ? ==
3
+
4
+ This is a little gem with some Helpers that make use of 960.gs more DRY with Rails.
5
+
6
+ == Install ==
7
+
8
+ type on console:
9
+
10
+ gem install rails960gs
11
+
12
+ it's all !!!!
13
+
14
+ == Usage ==
15
+
16
+ ... under development ...
data/README.rdoc ADDED
@@ -0,0 +1,32 @@
1
+ = rails960gs
2
+
3
+ == What is rails960gs ?
4
+
5
+ This is a little gem with some Helpers that make use of 960.gs more DRY with Rails.
6
+
7
+ == Install
8
+
9
+ Just type on console:
10
+
11
+ gem install rails960gs
12
+
13
+ it's all !!!!
14
+
15
+ == Usage
16
+
17
+ ... under development ...
18
+
19
+ == Contributing to rails960gs
20
+
21
+ * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
22
+ * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
23
+ * Fork the project
24
+ * Start a feature/bugfix branch
25
+ * Commit and push until you are happy with your contribution
26
+ * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
27
+ * 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.
28
+
29
+ == Copyright
30
+
31
+ Copyright (c) 2011 orangeweb. See LICENSE.txt for further details.
32
+
data/Rakefile ADDED
@@ -0,0 +1,55 @@
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 = "rails960gs"
18
+ gem.homepage = "http://github.com/orangeweb/rails960gs"
19
+ gem.license = "MIT"
20
+ gem.summary = %Q{Helpers to use 960.gs with Rails}
21
+ gem.description = %Q{Helpers to use 960.gs (12, 16, 24 cols) with Rails}
22
+ gem.email = "atendimento@orangeweb.com.br"
23
+ gem.authors = ["orangeweb"]
24
+ gem.files = FileList['lib/**/*.rb', 'bin/*', '[A-Z]*', 'test/**/*'].to_a
25
+ # dependencies defined in Gemfile
26
+ end
27
+ Jeweler::RubygemsDotOrgTasks.new
28
+
29
+ require 'rake/testtask'
30
+ Rake::TestTask.new(:test) do |test|
31
+ test.libs << 'lib' << 'test'
32
+ test.pattern = 'test/**/test_*.rb'
33
+ test.verbose = true
34
+ end
35
+
36
+ require 'rcov/rcovtask'
37
+ Rcov::RcovTask.new do |test|
38
+ test.libs << 'test'
39
+ test.pattern = 'test/**/test_*.rb'
40
+ test.verbose = true
41
+ test.rcov_opts << '--exclude "gems/*"'
42
+ end
43
+
44
+ task :default => :test
45
+
46
+ require 'rake/rdoctask'
47
+ Rake::RDocTask.new do |rdoc|
48
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
49
+
50
+ rdoc.rdoc_dir = 'rdoc'
51
+ rdoc.title = "rails960gs #{version}"
52
+ rdoc.rdoc_files.include('README*')
53
+ rdoc.rdoc_files.include('lib/**/*.rb')
54
+ end
55
+
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.2.1
@@ -0,0 +1,88 @@
1
+ require 'railtie.rb'
2
+
3
+ module Rails960gs
4
+ module ViewHelper
5
+
6
+
7
+ #Consiste a option[:class]
8
+ @@options_build = lambda do |options|
9
+ unless options.has_key?(:class) then
10
+ options[:class] = String.new
11
+ else
12
+ options[:class] = options[:class].to_s.downcase
13
+ end
14
+ end
15
+
16
+
17
+ #Monta o Container principal do 960.gs
18
+ def gs_container(options={}, &block)
19
+ @@options_build.call options
20
+ content_body = capture(&block)
21
+ options[:class].insert(-1, "container_12")
22
+ @@out = content_tag(:div, content_body, options)
23
+ @@out
24
+ end
25
+
26
+
27
+ #Monta uma Linha inteira com 12 Colunas
28
+ def gs_clear
29
+ @@options_build.call options
30
+ options[:class].insert(-1, " clear ")
31
+ @@out = content_tag(:div, "", options)
32
+ @@out
33
+ end
34
+
35
+
36
+ #Monta uma coluna com X itens e todas as opcoes do 960.gs
37
+ def gs_col cols=12, options={}, &block
38
+
39
+
40
+ if cols.to_i > 12 then raise "O numero de colunas deve ser igual ou menor que 12." end
41
+
42
+
43
+ @@options_build.call options
44
+
45
+
46
+ args = options
47
+
48
+ args[:class].insert(-1, " grid_#{cols} " )
49
+
50
+
51
+ if options.has_key?(:alpha) then
52
+ args[:class].insert(-1, " alpha ")
53
+ end
54
+
55
+
56
+ if options.has_key?(:omega) then
57
+ args[:class].insert(-1, " omega ")
58
+ end
59
+
60
+
61
+
62
+ if options.has_key?(:prefix) then
63
+ if options[:append].to_i >= 12 then raise "O numero de colunas deve ser igual ou menor que 12." end
64
+ args[:class].insert(-1, " prefix_#{options[:append]} ")
65
+ end
66
+
67
+
68
+ if options.has_key?(:suffix) then
69
+ if options[:prepend].to_i >= 12 then raise "O numero de colunas deve ser igual ou menor que 12." end
70
+ args[:class].insert(-1, " suffix_#{options[:prepend]} ")
71
+ end
72
+
73
+
74
+ if options.has_key?(:clear) then
75
+ args[:class].insert(-1, " clear ")
76
+ end
77
+
78
+ args[:class].rstrip!.lstrip!
79
+
80
+ content_body = capture(&block)
81
+
82
+ @@out = content_tag(:div, content_body, args)
83
+ @@out
84
+
85
+ end
86
+
87
+ end
88
+ end
data/lib/rails960gs.rb ADDED
@@ -0,0 +1,2 @@
1
+
2
+ require 'railtie.rb' if defined?(Rails)
data/lib/railtie.rb ADDED
@@ -0,0 +1,13 @@
1
+ require 'rails960gs/view_helper'
2
+ require 'rake'
3
+
4
+ module Rails960gs
5
+
6
+ class Railtie < Rails::Railtie
7
+
8
+ initializer "rails960gs.view_helpers" do
9
+ ActionView::Base.send :include, ViewHelper
10
+ end
11
+
12
+ end
13
+ end
data/test/helper.rb ADDED
@@ -0,0 +1,18 @@
1
+ require 'rubygems'
2
+ require 'bundler'
3
+ begin
4
+ Bundler.setup(:default, :development)
5
+ rescue Bundler::BundlerError => e
6
+ $stderr.puts e.message
7
+ $stderr.puts "Run `bundle install` to install missing gems"
8
+ exit e.status_code
9
+ end
10
+ require 'test/unit'
11
+ require 'shoulda'
12
+
13
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
14
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
15
+ require 'rails960gs'
16
+
17
+ class Test::Unit::TestCase
18
+ end
@@ -0,0 +1,7 @@
1
+ require 'helper'
2
+
3
+ class TestRails960gs < Test::Unit::TestCase
4
+ should "probably rename this file and start testing for real" do
5
+ flunk "hey buddy, you should probably rename this file and start testing for real"
6
+ end
7
+ end
metadata ADDED
@@ -0,0 +1,137 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rails960gs
3
+ version: !ruby/object:Gem::Version
4
+ hash: 21
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 2
9
+ - 1
10
+ version: 0.2.1
11
+ platform: ruby
12
+ authors:
13
+ - orangeweb
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2011-06-29 00:00:00 Z
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ version_requirements: &id001 !ruby/object:Gem::Requirement
22
+ none: false
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ hash: 3
27
+ segments:
28
+ - 0
29
+ version: "0"
30
+ type: :development
31
+ requirement: *id001
32
+ prerelease: false
33
+ name: shoulda
34
+ - !ruby/object:Gem::Dependency
35
+ version_requirements: &id002 !ruby/object:Gem::Requirement
36
+ none: false
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ hash: 23
41
+ segments:
42
+ - 1
43
+ - 0
44
+ - 0
45
+ version: 1.0.0
46
+ type: :development
47
+ requirement: *id002
48
+ prerelease: false
49
+ name: bundler
50
+ - !ruby/object:Gem::Dependency
51
+ version_requirements: &id003 !ruby/object:Gem::Requirement
52
+ none: false
53
+ requirements:
54
+ - - ~>
55
+ - !ruby/object:Gem::Version
56
+ hash: 11
57
+ segments:
58
+ - 1
59
+ - 6
60
+ - 2
61
+ version: 1.6.2
62
+ type: :development
63
+ requirement: *id003
64
+ prerelease: false
65
+ name: jeweler
66
+ - !ruby/object:Gem::Dependency
67
+ version_requirements: &id004 !ruby/object:Gem::Requirement
68
+ none: false
69
+ requirements:
70
+ - - ">="
71
+ - !ruby/object:Gem::Version
72
+ hash: 3
73
+ segments:
74
+ - 0
75
+ version: "0"
76
+ type: :development
77
+ requirement: *id004
78
+ prerelease: false
79
+ name: rcov
80
+ description: Helpers to use 960.gs (12, 16, 24 cols) with Rails
81
+ email: atendimento@orangeweb.com.br
82
+ executables: []
83
+
84
+ extensions: []
85
+
86
+ extra_rdoc_files:
87
+ - LICENSE.txt
88
+ - README
89
+ - README.rdoc
90
+ files:
91
+ - Gemfile
92
+ - Gemfile.lock
93
+ - LICENSE.txt
94
+ - README
95
+ - README.rdoc
96
+ - Rakefile
97
+ - VERSION
98
+ - lib/rails960gs.rb
99
+ - lib/rails960gs/view_helper.rb
100
+ - lib/railtie.rb
101
+ - test/helper.rb
102
+ - test/test_rails960gs.rb
103
+ homepage: http://github.com/orangeweb/rails960gs
104
+ licenses:
105
+ - MIT
106
+ post_install_message:
107
+ rdoc_options: []
108
+
109
+ require_paths:
110
+ - lib
111
+ required_ruby_version: !ruby/object:Gem::Requirement
112
+ none: false
113
+ requirements:
114
+ - - ">="
115
+ - !ruby/object:Gem::Version
116
+ hash: 3
117
+ segments:
118
+ - 0
119
+ version: "0"
120
+ required_rubygems_version: !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ">="
124
+ - !ruby/object:Gem::Version
125
+ hash: 3
126
+ segments:
127
+ - 0
128
+ version: "0"
129
+ requirements: []
130
+
131
+ rubyforge_project:
132
+ rubygems_version: 1.8.5
133
+ signing_key:
134
+ specification_version: 3
135
+ summary: Helpers to use 960.gs with Rails
136
+ test_files: []
137
+