jhubert_common 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gemtest ADDED
File without changes
data/.gitignore ADDED
@@ -0,0 +1,3 @@
1
+ pkg/*
2
+ *.gem
3
+ .bundle
data/.rvmrc ADDED
@@ -0,0 +1,47 @@
1
+ #!/usr/bin/env bash
2
+
3
+ # This is an RVM Project .rvmrc file, used to automatically load the ruby
4
+ # development environment upon cd'ing into the directory
5
+
6
+ # First we specify our desired <ruby>[@<gemset>], the @gemset name is optional.
7
+ environment_id="ruby-1.8.7-p352@clean"
8
+
9
+ #
10
+ # Uncomment following line if you want options to be set only for given project.
11
+ #
12
+ # PROJECT_JRUBY_OPTS=( --1.9 )
13
+
14
+ #
15
+ # First we attempt to load the desired environment directly from the environment
16
+ # file. This is very fast and efficient compared to running through the entire
17
+ # CLI and selector. If you want feedback on which environment was used then
18
+ # insert the word 'use' after --create as this triggers verbose mode.
19
+ #
20
+ if [[ -d "${rvm_path:-$HOME/.rvm}/environments" \
21
+ && -s "${rvm_path:-$HOME/.rvm}/environments/$environment_id" ]]
22
+ then
23
+ \. "${rvm_path:-$HOME/.rvm}/environments/$environment_id"
24
+
25
+ if [[ -s "${rvm_path:-$HOME/.rvm}/hooks/after_use" ]]
26
+ then
27
+ . "${rvm_path:-$HOME/.rvm}/hooks/after_use"
28
+ fi
29
+ else
30
+ # If the environment file has not yet been created, use the RVM CLI to select.
31
+ if ! rvm --create "$environment_id"
32
+ then
33
+ echo "Failed to create RVM environment '${environment_id}'."
34
+ exit 1
35
+ fi
36
+ fi
37
+
38
+ #
39
+ # If you use an RVM gemset file to install a list of gems (*.gems), you can have
40
+ # it be automatically loaded. Uncomment the following and adjust the filename if
41
+ # necessary.
42
+ #
43
+ # filename=".gems"
44
+ # if [[ -s "$filename" ]] ; then
45
+ # rvm gemset import "$filename" | grep -v already | grep -v listed | grep -v complete | sed '/^$/d'
46
+ # fi
47
+
data/Gemfile ADDED
@@ -0,0 +1,9 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in jhubert_common.gemspec
4
+ gemspec
5
+
6
+ # Development dependencies
7
+ gem "rake"
8
+ gem "activesupport", "~>3.0"
9
+ gem "sqlite3-ruby"
data/Gemfile.lock ADDED
@@ -0,0 +1,38 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ jhubert_common (0.0.9)
5
+ activerecord (~> 3.0)
6
+
7
+ GEM
8
+ remote: http://rubygems.org/
9
+ specs:
10
+ activemodel (3.2.1)
11
+ activesupport (= 3.2.1)
12
+ builder (~> 3.0.0)
13
+ activerecord (3.2.1)
14
+ activemodel (= 3.2.1)
15
+ activesupport (= 3.2.1)
16
+ arel (~> 3.0.0)
17
+ tzinfo (~> 0.3.29)
18
+ activesupport (3.2.1)
19
+ i18n (~> 0.6)
20
+ multi_json (~> 1.0)
21
+ arel (3.0.0)
22
+ builder (3.0.0)
23
+ i18n (0.6.0)
24
+ multi_json (1.0.4)
25
+ rake (0.9.2.2)
26
+ sqlite3 (1.3.5)
27
+ sqlite3-ruby (1.3.3)
28
+ sqlite3 (>= 1.3.3)
29
+ tzinfo (0.3.31)
30
+
31
+ PLATFORMS
32
+ ruby
33
+
34
+ DEPENDENCIES
35
+ activesupport (~> 3.0)
36
+ jhubert_common!
37
+ rake
38
+ sqlite3-ruby
data/LICENSE ADDED
@@ -0,0 +1,7 @@
1
+ Copyright (c) 2012 Jeremy Hubert
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
+
5
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
+
7
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,5 @@
1
+ # JhubertCommon
2
+
3
+ Some basic helpers that I use in the different projects that I do. You're welcome to use these, but I recommend you fork it as I may make changes in the future that aren't compatible with your projects.
4
+
5
+ Copyright (c) 2012 Jeremy Hubert, released under the MIT license
data/Rakefile ADDED
@@ -0,0 +1,15 @@
1
+ require 'bundler'
2
+ require 'rake/testtask'
3
+ require 'rake/rdoctask'
4
+
5
+ desc 'Default: run unit tests.'
6
+ task :default => :test
7
+
8
+ desc 'Test the restful_authentication plugin.'
9
+ Rake::TestTask.new(:test) do |t|
10
+ t.libs << 'lib'
11
+ t.pattern = 'test/**/*_test.rb'
12
+ t.verbose = true
13
+ end
14
+
15
+ Bundler::GemHelper.install_tasks
@@ -0,0 +1,20 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "jhubert_common/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "jhubert_common"
7
+ s.version = JhubertCommon::VERSION
8
+ s.platform = Gem::Platform::RUBY
9
+ s.authors = ["Jeremy Hubert"]
10
+ s.email = ["jhubert@gmail.com"]
11
+ s.homepage = "https://github.com/jhubert/jhubert-common"
12
+ s.summary = %q{A set of common helpers that I use in my projects}
13
+ s.description = %q{A set of common helpers that I use in my projects}
14
+
15
+ s.add_dependency "activerecord", "~> 3.0"
16
+ s.rubyforge_project = "jhubert_common"
17
+
18
+ s.files = `git ls-files`.split("\n")
19
+ s.require_paths = ["lib"]
20
+ end
@@ -0,0 +1,3 @@
1
+ require 'active_record'
2
+
3
+ require 'jhubert_common/railtie' if defined?(Rails)
@@ -0,0 +1,7 @@
1
+ module JhubertCommon
2
+ class Railtie < Rails::Railtie
3
+ initializer "jhubert_common.view_helpers" do
4
+ ActionView::Base.send :include, ViewHelpers
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,3 @@
1
+ module JhubertCommon
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,37 @@
1
+ module JhubertCommon
2
+ module ViewHelpers
3
+ def link_to_with_class(label, path, class_name = 'current')
4
+ content_tag('li', link_to(label, path, :class => current_page?(path) ? class_name : ''), :class => current_page?(path) ? class_name : '' )
5
+ end
6
+
7
+ def analytics(account_key = nil)
8
+ return unless Rails.env.production?
9
+ html = <<-eos
10
+ <script type="text/javascript">
11
+
12
+ var _gaq = _gaq || [];
13
+ _gaq.push(['_setAccount', '#{account_key}']);
14
+ _gaq.push(['_trackPageview']);
15
+
16
+ (function() {
17
+ var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
18
+ ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
19
+ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
20
+ })();
21
+
22
+ </script>
23
+ eos
24
+ return html.html_safe
25
+ end
26
+
27
+ def flashes(*keys)
28
+ keys.collect do |key|
29
+ content_tag(:div, flash[key], { :class => "alert alert-#{key == :notice ? 'info' : key}" }, false) if flash[key]
30
+ end.join.html_safe
31
+ end
32
+
33
+ def utc_date(date)
34
+ raw %Q(<time class="utc-date" title="#{date}">#{date}</time>)
35
+ end
36
+ end
37
+ end
metadata ADDED
@@ -0,0 +1,92 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: jhubert_common
3
+ version: !ruby/object:Gem::Version
4
+ hash: 29
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 1
10
+ version: 0.0.1
11
+ platform: ruby
12
+ authors:
13
+ - Jeremy Hubert
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2012-02-19 00:00:00 Z
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: activerecord
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
25
+ requirements:
26
+ - - ~>
27
+ - !ruby/object:Gem::Version
28
+ hash: 7
29
+ segments:
30
+ - 3
31
+ - 0
32
+ version: "3.0"
33
+ type: :runtime
34
+ version_requirements: *id001
35
+ description: A set of common helpers that I use in my projects
36
+ email:
37
+ - jhubert@gmail.com
38
+ executables: []
39
+
40
+ extensions: []
41
+
42
+ extra_rdoc_files: []
43
+
44
+ files:
45
+ - .gemtest
46
+ - .gitignore
47
+ - .rvmrc
48
+ - Gemfile
49
+ - Gemfile.lock
50
+ - LICENSE
51
+ - README.md
52
+ - Rakefile
53
+ - jhubert_common.gemspec
54
+ - lib/jhubert_common.gemspec
55
+ - lib/jhubert_common/railtie.rb
56
+ - lib/jhubert_common/version.rb
57
+ - lib/jhubert_common/view_helpers.rb
58
+ homepage: https://github.com/jhubert/jhubert-common
59
+ licenses: []
60
+
61
+ post_install_message:
62
+ rdoc_options: []
63
+
64
+ require_paths:
65
+ - lib
66
+ required_ruby_version: !ruby/object:Gem::Requirement
67
+ none: false
68
+ requirements:
69
+ - - ">="
70
+ - !ruby/object:Gem::Version
71
+ hash: 3
72
+ segments:
73
+ - 0
74
+ version: "0"
75
+ required_rubygems_version: !ruby/object:Gem::Requirement
76
+ none: false
77
+ requirements:
78
+ - - ">="
79
+ - !ruby/object:Gem::Version
80
+ hash: 3
81
+ segments:
82
+ - 0
83
+ version: "0"
84
+ requirements: []
85
+
86
+ rubyforge_project: jhubert_common
87
+ rubygems_version: 1.8.15
88
+ signing_key:
89
+ specification_version: 3
90
+ summary: A set of common helpers that I use in my projects
91
+ test_files: []
92
+