crummy-schema-dot-org 1.9.0

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.
Files changed (85) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +8 -0
  3. data/.rvmrc +48 -0
  4. data/.travis.yml +7 -0
  5. data/Appraisals +9 -0
  6. data/CHANGELOG +47 -0
  7. data/Gemfile +3 -0
  8. data/MIT-LICENSE +20 -0
  9. data/README.md +216 -0
  10. data/Rakefile +25 -0
  11. data/crummy-schema-dot-org.gemspec +31 -0
  12. data/example/.gitignore +5 -0
  13. data/example/.rspec +1 -0
  14. data/example/.rvmrc +48 -0
  15. data/example/Gemfile +30 -0
  16. data/example/README.md +40 -0
  17. data/example/Rakefile +7 -0
  18. data/example/app/assets/images/rails.png +0 -0
  19. data/example/app/assets/javascripts/application.js +9 -0
  20. data/example/app/assets/javascripts/pages.js.coffee +3 -0
  21. data/example/app/assets/javascripts/post.js.coffee +3 -0
  22. data/example/app/assets/stylesheets/application.css +7 -0
  23. data/example/app/assets/stylesheets/layout.css.sass +26 -0
  24. data/example/app/assets/stylesheets/post.css.scss +3 -0
  25. data/example/app/controllers/application_controller.rb +6 -0
  26. data/example/app/controllers/pages_controller.rb +5 -0
  27. data/example/app/controllers/posts_controller.rb +19 -0
  28. data/example/app/helpers/application_helper.rb +9 -0
  29. data/example/app/helpers/pages_helper.rb +2 -0
  30. data/example/app/helpers/post_helper.rb +2 -0
  31. data/example/app/mailers/.gitkeep +0 -0
  32. data/example/app/models/.gitkeep +0 -0
  33. data/example/app/models/category.rb +6 -0
  34. data/example/app/models/post.rb +19 -0
  35. data/example/app/views/layouts/application.html.haml +16 -0
  36. data/example/app/views/pages/index.html.haml +4 -0
  37. data/example/app/views/posts/index.html.haml +5 -0
  38. data/example/app/views/posts/new.html.haml +1 -0
  39. data/example/app/views/posts/show.html.haml +3 -0
  40. data/example/config.ru +4 -0
  41. data/example/config/application.rb +48 -0
  42. data/example/config/boot.rb +6 -0
  43. data/example/config/database.yml +25 -0
  44. data/example/config/environment.rb +5 -0
  45. data/example/config/environments/development.rb +30 -0
  46. data/example/config/environments/production.rb +60 -0
  47. data/example/config/environments/test.rb +39 -0
  48. data/example/config/initializers/backtrace_silencers.rb +7 -0
  49. data/example/config/initializers/inflections.rb +10 -0
  50. data/example/config/initializers/mime_types.rb +5 -0
  51. data/example/config/initializers/secret_token.rb +7 -0
  52. data/example/config/initializers/session_store.rb +8 -0
  53. data/example/config/initializers/wrap_parameters.rb +14 -0
  54. data/example/config/locales/en.yml +5 -0
  55. data/example/config/routes.rb +5 -0
  56. data/example/db/migrate/20111104103150_create_posts.rb +10 -0
  57. data/example/db/migrate/20111104103738_create_categories.rb +12 -0
  58. data/example/db/migrate/20111104104040_add_category_id_to_posts.rb +5 -0
  59. data/example/db/schema.rb +32 -0
  60. data/example/db/seeds.rb +15 -0
  61. data/example/doc/README_FOR_APP +2 -0
  62. data/example/lib/assets/.gitkeep +0 -0
  63. data/example/lib/tasks/.gitkeep +0 -0
  64. data/example/log/.gitkeep +0 -0
  65. data/example/public/404.html +26 -0
  66. data/example/public/422.html +26 -0
  67. data/example/public/500.html +26 -0
  68. data/example/public/favicon.ico +0 -0
  69. data/example/public/robots.txt +5 -0
  70. data/example/script/rails +6 -0
  71. data/example/spec/controllers/posts_controller_spec.rb +7 -0
  72. data/example/spec/spec_helper.rb +38 -0
  73. data/example/vendor/assets/stylesheets/.gitkeep +0 -0
  74. data/example/vendor/plugins/.gitkeep +0 -0
  75. data/gemfiles/rails3_2.gemfile +8 -0
  76. data/gemfiles/rails4_0.gemfile +8 -0
  77. data/init.rb +1 -0
  78. data/lib/crummy.rb +69 -0
  79. data/lib/crummy/action_controller.rb +83 -0
  80. data/lib/crummy/action_view.rb +29 -0
  81. data/lib/crummy/railtie.rb +18 -0
  82. data/lib/crummy/standard_renderer.rb +173 -0
  83. data/lib/crummy/version.rb +6 -0
  84. data/test/standard_renderer_test.rb +172 -0
  85. metadata +216 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 5c73e692824e6b5c66d82c932e62fbf255434c47217a8790698ff2cae90e55f1
4
+ data.tar.gz: cc320bbdc1cea5760f19b0aebbf2043c0a07b8e7c1de5f9944703efa60c7feef
5
+ SHA512:
6
+ metadata.gz: 89f7f623c15e0af2d0a0f006e9201f57cf1a1a3138169538081dcccf670ee8161687738e84c27cd68e7d373202276bbfe4d726a89c5740380572ad0c082c12bb
7
+ data.tar.gz: 17a4539328022c18c33533c384e9f6a5c2ec25ada60216c2ba7f915ff891f6894f81ca613eca2fed5d7721e674960f682fe2a23a932f978ecdffb0da13e4f833
@@ -0,0 +1,8 @@
1
+ rdoc
2
+ nbproject
3
+ *.gem
4
+ .bundle
5
+ pkg/*
6
+ Gemfile.lock
7
+ *.gemfile.lock
8
+ .idea
data/.rvmrc ADDED
@@ -0,0 +1,48 @@
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
+ # Only full ruby name is supported here, for short names use:
8
+ # echo "rvm use 1.9.3" > .rvmrc
9
+ environment_id="ruby-1.9.3-head@crummy"
10
+
11
+ # Uncomment the following lines if you want to verify rvm version per project
12
+ # rvmrc_rvm_version="1.17.7 (stable)" # 1.10.1 seams as a safe start
13
+ # eval "$(echo ${rvm_version}.${rvmrc_rvm_version} | awk -F. '{print "[[ "$1*65536+$2*256+$3" -ge "$4*65536+$5*256+$6" ]]"}' )" || {
14
+ # echo "This .rvmrc file requires at least RVM ${rvmrc_rvm_version}, aborting loading."
15
+ # return 1
16
+ # }
17
+
18
+ # First we attempt to load the desired environment directly from the environment
19
+ # file. This is very fast and efficient compared to running through the entire
20
+ # CLI and selector. If you want feedback on which environment was used then
21
+ # insert the word 'use' after --create as this triggers verbose mode.
22
+ if [[ -d "${rvm_path:-$HOME/.rvm}/environments"
23
+ && -s "${rvm_path:-$HOME/.rvm}/environments/$environment_id" ]]
24
+ then
25
+ \. "${rvm_path:-$HOME/.rvm}/environments/$environment_id"
26
+ [[ -s "${rvm_path:-$HOME/.rvm}/hooks/after_use" ]] &&
27
+ \. "${rvm_path:-$HOME/.rvm}/hooks/after_use" || true
28
+ else
29
+ # If the environment file has not yet been created, use the RVM CLI to select.
30
+ rvm --create "$environment_id" || {
31
+ echo "Failed to create RVM environment '${environment_id}'."
32
+ return 1
33
+ }
34
+ fi
35
+
36
+ # If you use bundler, this might be useful to you:
37
+ # if [[ -s Gemfile ]] && {
38
+ # ! builtin command -v bundle >/dev/null ||
39
+ # builtin command -v bundle | GREP_OPTIONS= \grep $rvm_path/bin/bundle >/dev/null
40
+ # }
41
+ # then
42
+ # printf "%b" "The rubygem 'bundler' is not installed. Installing it now.\n"
43
+ # gem install bundler
44
+ # fi
45
+ # if [[ -s Gemfile ]] && builtin command -v bundle >/dev/null
46
+ # then
47
+ # bundle install | GREP_OPTIONS= \grep -vE '^Using|Your bundle is complete'
48
+ # fi
@@ -0,0 +1,7 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.9.3
4
+ - 2.2.2
5
+ gemfile:
6
+ - gemfiles/rails3_2.gemfile
7
+ - gemfiles/rails4_0.gemfile
@@ -0,0 +1,9 @@
1
+ appraise "rails3_2" do
2
+ gem 'activesupport', '>= 3.0', '< 4'
3
+ gem 'actionpack', '>= 3.0', '< 4'
4
+ end
5
+
6
+ appraise "rails4_0" do
7
+ gem 'activesupport', '>= 4.0.0.beta', '< 5'
8
+ gem 'actionpack', '>= 4.0.0.beta', '< 5'
9
+ end
@@ -0,0 +1,47 @@
1
+ 1.8.0
2
+ * [ADDED] You can now set each parameters individually for each crumb
3
+ * [ADDED] You can now set each crumb on right or left side
4
+ * [ADDED] You can now use a html in a crumb name
5
+ * [REFACTORED] Don't render empty html_options for tags.
6
+
7
+ 1.7.2
8
+ * [ADDED] :truncate option to shorten text in breadcrumbs
9
+ * [ADDED] Added ability to pass html link options through to renderer
10
+
11
+ 1.7.1
12
+ * [ADDED] :last_crumb_linked option to disable linking crumb on current page
13
+
14
+ 1.7.0
15
+ * [ADDED] Added option for google microdata
16
+ * [REFACTORED] Cleaned up development internals
17
+
18
+ 1.6.0
19
+ * [FIXED] A fix for the escaped html problem in :html_list
20
+
21
+ 1.5
22
+ * [ADDED] Global configuration options
23
+ * [REFACTORED] HTML now uses content_tags
24
+
25
+ 1.3.6
26
+ * [FIXED] :li_class fixed in StandardRenderer#crumb_to_html_list
27
+
28
+ 1.3.5
29
+ * [FIXED] Spacing in name argument was causing errors.
30
+ * [FIXED] Bug where everything was getting parsed as an Array.
31
+
32
+ 1.3
33
+ * [FIXED] html_safe! is no longer called by default. That's the user's prerogative to do now.
34
+ * [ADDED] Allow record to respond to to_s even if you pass a url or block.
35
+ * [ADDED] Allow name to be a proc or lambda method
36
+ * [ADDED] clear crumbs as before filter
37
+
38
+ 1.2
39
+ * [ADDED] html_list format option
40
+ * [FIXED] Bug with Passenger and REE deployments
41
+
42
+ 1.1.1
43
+
44
+ * [FIXED] issue with undefined method escape_once for Rails 3.
45
+ * [FIXED] spelling of separator
46
+
47
+ 1.1.0
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source "https://rubygems.org"
2
+
3
+ gemspec
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2013 Zach Inglis
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.
@@ -0,0 +1,216 @@
1
+ # Crummy with Schema.org support
2
+
3
+ Crummy is a simple and tasty way to add breadcrumbs to your Rails applications.
4
+
5
+ ## Install
6
+
7
+ Simply add the dependency to your Gemfile:
8
+
9
+ ```ruby
10
+ gem "crummy-schema-dot-org", "~> 1.9.0"
11
+ ```
12
+
13
+ # Example
14
+
15
+ In your controllers you may add\_crumb either like a before\_filter or
16
+ within a method (It is also available to views).
17
+
18
+ ```ruby
19
+ class ApplicationController
20
+ add_crumb "Home", '/'
21
+ end
22
+
23
+ class BusinessController < ApplicationController
24
+ add_crumb("Businesses") { |instance| instance.send :businesses_path }
25
+ add_crumb("Comments", only: "comments") { |instance| instance.send :businesses_comments_path }
26
+ before_filter :load_comment, only: "show"
27
+ add_crumb :comment, only: "show"
28
+
29
+ # Example for nested routes:
30
+ add_crumb(:document) { [:account, :document] }
31
+
32
+ def show
33
+ add_crumb @business.display_name, @business
34
+ end
35
+
36
+ def load_comment
37
+ @comment = Comment.find(params[:id])
38
+ end
39
+ end
40
+ ```
41
+
42
+ Then in your view:
43
+
44
+ ```erb
45
+ <%= render_crumbs %>
46
+ ```
47
+
48
+ ## Html options for breadcrumb link
49
+
50
+ You can set the html options with *link_html_options*.
51
+ These are added to the *a* tag.
52
+
53
+ ```ruby
54
+ add_crumb "Home", '/', link_html_options: {title: "my link title"}
55
+ ```
56
+
57
+ ##You can set html instead text in first parameter.
58
+ If tag <code>a</code> present in this html, tag a not be a wrapper.
59
+
60
+ ```ruby
61
+ add_crumb "<a class='glyphicons shield' href='/support'><i></i>Support</a>".html_safe, "", {}
62
+ ```
63
+
64
+ ## Options for render\_crumbs
65
+
66
+ `render_crumbs` renders the list of crumbs as either html or xml
67
+
68
+ The output format. Can either be :xml or :html or :html\_list. Defaults
69
+ to :html
70
+
71
+ ```ruby
72
+ format: (:html|:html_list|:xml)
73
+ ```
74
+
75
+ The separator text. It does not assume you want spaces on either side so
76
+ you must specify. Defaults to `&raquo;` for :html and
77
+ `<crumb>` for :xml
78
+
79
+ ```ruby
80
+ separator: string
81
+ ```
82
+
83
+ Render links in the output. Defaults to *true*
84
+
85
+ ```ruby
86
+ links: false
87
+ ```
88
+
89
+ Render
90
+ [Richsnipet](http:/support.google.com/webmasters/bin/answer.py?hl=en&answer=99170&topic=1088472&ctx=topic/)
91
+ Default to *false*
92
+
93
+ ```ruby
94
+ microdata: true
95
+ ```
96
+
97
+ Optionally disable linking of the last crumb, Defaults to *true*
98
+
99
+ ```ruby
100
+ last_crumb_linked: false
101
+ ```
102
+
103
+ With this option, output will be blank if there are no breadcrumbs.
104
+
105
+ ```ruby
106
+ skip_if_blank: true
107
+ ```
108
+
109
+ ### Examples
110
+
111
+ ```ruby
112
+ render_crumbs #=> <a href="/">Home</a> &raquo; <a href="/businesses">Businesses</a>
113
+ render_crumbs separator: ' | ' #=> <a href="/">Home</a> | <a href="/businesses">Businesses</a>
114
+ render_crumbs format: :xml #=> <crumb href="/">Home</crumb><crumb href="/businesses">Businesses</crumb>
115
+ render_crumbs format: :html_list #=> <ol class="" id=""><li class=""><a href="/">Home</a></li><li class=""><a href="/">Businesses</a></li></ol>
116
+ render_crumbs format: :html_list, :microdata => true
117
+ #=> <ol class="" id=""><li class="" itemscope="itemscope" itemtype="http://data-vocabulary.org/Breadcrumb">
118
+ # <a href="/" itemprop="url"><span itemprop="title">Home</span></a></li></ol>
119
+ add_crumb support_link, {:right_side => true, :links => "/support", :li_right_class => "pull-right hidden-phone"}
120
+ #=> <li class="pull-right hidden-phone">
121
+ #=> <span><a class="glyphicons shield" href="/support">
122
+ #=> <i></i>Support</a>
123
+ #=> </span>
124
+ #=> </li>
125
+ #=> <li class="divider pull-right hidden-phone"></li>
126
+ ```
127
+
128
+ A crumb with a nil argument for the link will output an unlinked crumb.
129
+
130
+ With `format: :html_list` you can specify additional `params: :li_class, :ol_class, :ol_id`
131
+
132
+ ### App-wide configuration
133
+
134
+ You have the option to pre-configure any of the Crummy options in an
135
+ application-wide configuration. The options above are available to
136
+ configure, with the exception of `:separator`, as well as many others.
137
+
138
+ The biggest difference is that `:separator` is not an option. Instead,
139
+ you have format-specific configuration options: `:html_separator`,
140
+ `:xml_separator`, and `:html_list_separator`. `:separator` can still be
141
+ overridden in the view.
142
+
143
+ Insert the following in a file named `config/initializers/crummy.rb`:
144
+
145
+ ```ruby
146
+ Crummy.configure do |config|
147
+ config.format = :xml
148
+ end
149
+ ```
150
+
151
+ Possible parameters for configuration are:
152
+
153
+ ```ruby
154
+ :format
155
+ :links
156
+ :skip_if_blank
157
+ :html_separator
158
+ :xml_separator
159
+ :html_list_separator
160
+ :html_list_right_separator
161
+ :first_class
162
+ :last_class
163
+ :ol_id
164
+ :ol_class
165
+ :li_class
166
+ :li_right_class
167
+ :microdata
168
+ :last_crumb_linked
169
+ :truncate
170
+ :right_side
171
+ ```
172
+
173
+ See `lib/crummy.rb` for a list of these parameters and their defaults.
174
+
175
+ ###Individually for each crumb configuration:
176
+ ```ruby
177
+ add_crumb support_link, {:right_side => true, :links => "/support", : li_class => "my_class", :li_right_class => "pull-right hidden-phone"}
178
+ ```
179
+ Simple add that parameter to options hash.
180
+
181
+
182
+ ## Live example application
183
+
184
+ An example application is available right inside this gem. That application is documented, see `example/README` for details about usage.
185
+
186
+ ## Todo
187
+
188
+ - Accept collections of models as a single argument
189
+ - Accept instances of models as a single argument
190
+ - Allow for variables in names. (The workaround is to do your own
191
+ before\_filter for that currently)
192
+ - Make a crumbs? type method
193
+
194
+ ## Credits
195
+
196
+ - [Zach Inglis](http://zachinglis.com) of [Superhero Studios](http://superhero-studios.com)
197
+ - [Andrew Nesbitt](http://github.com/andrew)
198
+ - [Rein Henrichs](http://reinh.com)
199
+ - [Les Hill](http://blog.leshill.org/)
200
+ - [Sandro Turriate](http://turriate.com/)
201
+ - [Przemysław
202
+ Kowalczyk](http://szeryf.wordpress.com/2008/06/13/easy-and-flexible-breadcrumbs-for-rails/)
203
+ - feature ideas
204
+ - [Sharad Jain](http://github.com/sjain)
205
+ - [Max Riveiro](http://github.com/kavu)
206
+ - [Kamil K. Lemański](http://kml.jogger.pl)
207
+ - [Brian Cobb](http://bcobb.net/)
208
+ - [Kir Shatrov](http://github.com/shatrov) ([Evrone
209
+ company](http://evrone.com))
210
+ - [sugilog](http://github.com/sugilog)
211
+ - [Trond Arve Nordheim](http://github.com/tanordheim)
212
+ - [Jan Szumiec](http://github.com/jasiek)
213
+ - [Jeff Browning](http://github.com/jbrowning)
214
+ - [Bill Turner](http://github.com/billturner)
215
+
216
+ **Copyright 2008-2013 Zach Inglis, released under the MIT license**
@@ -0,0 +1,25 @@
1
+ #!/usr/bin/env rake
2
+ require 'bundler/gem_tasks'
3
+ require 'appraisal'
4
+
5
+ desc 'Default: run unit tests.'
6
+ task :default => :test
7
+
8
+ require 'rake/testtask'
9
+ desc 'Test the crummy plugin.'
10
+ Rake::TestTask.new(:test) do |t|
11
+ t.libs << 'lib'
12
+ t.pattern = 'test/**/*_test.rb'
13
+ t.verbose = true
14
+ end
15
+
16
+ require 'rdoc/task'
17
+
18
+ desc 'Generate documentation for the crummy plugin.'
19
+ Rake::RDocTask.new(:rdoc) do |rdoc|
20
+ rdoc.rdoc_dir = 'rdoc'
21
+ rdoc.title = 'Crummy: Tasty Breadcrumbs'
22
+ rdoc.options << '--line-numbers' << '--inline-source'
23
+ rdoc.rdoc_files.include('README.textile')
24
+ rdoc.rdoc_files.include('lib/**/*.rb')
25
+ end
@@ -0,0 +1,31 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "crummy/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "crummy-schema-dot-org"
7
+ s.version = Crummy::VERSION
8
+ s.platform = Gem::Platform::RUBY
9
+ s.licenses = ['MIT']
10
+
11
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
+ s.authors = ["Zach Inglis", "Andrew Nesbitt", "Gowtham Gts"]
13
+ s.summary = "Tasty breadcrumbs!"
14
+ s.description = "Crummy Schema.org is an extension to original crummy gem supporting schema.org type"
15
+ s.email = "gts+crummy@gowtham.dev"
16
+ s.extra_rdoc_files = ["README.md"]
17
+
18
+ s.files = `git ls-files`.split("\n")
19
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
20
+
21
+ s.homepage = "http://github.com/gowthamgts/crummy-schema-dot-org"
22
+ s.require_paths = [%q{lib}]
23
+ s.rubygems_version = %q{1.8.8}
24
+
25
+ s.add_development_dependency 'rake'
26
+ s.add_development_dependency 'bundler', '~> 1.0'
27
+ s.add_development_dependency 'activesupport'
28
+ s.add_development_dependency 'actionpack'
29
+ s.add_development_dependency 'appraisal'
30
+ s.add_development_dependency 'test-unit'
31
+ end
@@ -0,0 +1,5 @@
1
+ .bundle
2
+ db/*.sqlite3
3
+ log/*.log
4
+ tmp/
5
+ .sass-cache/
@@ -0,0 +1 @@
1
+ --color --format documentation
@@ -0,0 +1,48 @@
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
+ # Only full ruby name is supported here, for short names use:
8
+ # echo "rvm use 1.9.3" > .rvmrc
9
+ environment_id="ruby-1.9.3-head@crummy-test"
10
+
11
+ # Uncomment the following lines if you want to verify rvm version per project
12
+ # rvmrc_rvm_version="1.17.7 (stable)" # 1.10.1 seams as a safe start
13
+ # eval "$(echo ${rvm_version}.${rvmrc_rvm_version} | awk -F. '{print "[[ "$1*65536+$2*256+$3" -ge "$4*65536+$5*256+$6" ]]"}' )" || {
14
+ # echo "This .rvmrc file requires at least RVM ${rvmrc_rvm_version}, aborting loading."
15
+ # return 1
16
+ # }
17
+
18
+ # First we attempt to load the desired environment directly from the environment
19
+ # file. This is very fast and efficient compared to running through the entire
20
+ # CLI and selector. If you want feedback on which environment was used then
21
+ # insert the word 'use' after --create as this triggers verbose mode.
22
+ if [[ -d "${rvm_path:-$HOME/.rvm}/environments"
23
+ && -s "${rvm_path:-$HOME/.rvm}/environments/$environment_id" ]]
24
+ then
25
+ \. "${rvm_path:-$HOME/.rvm}/environments/$environment_id"
26
+ [[ -s "${rvm_path:-$HOME/.rvm}/hooks/after_use" ]] &&
27
+ \. "${rvm_path:-$HOME/.rvm}/hooks/after_use" || true
28
+ else
29
+ # If the environment file has not yet been created, use the RVM CLI to select.
30
+ rvm --create "$environment_id" || {
31
+ echo "Failed to create RVM environment '${environment_id}'."
32
+ return 1
33
+ }
34
+ fi
35
+
36
+ # If you use bundler, this might be useful to you:
37
+ # if [[ -s Gemfile ]] && {
38
+ # ! builtin command -v bundle >/dev/null ||
39
+ # builtin command -v bundle | GREP_OPTIONS= \grep $rvm_path/bin/bundle >/dev/null
40
+ # }
41
+ # then
42
+ # printf "%b" "The rubygem 'bundler' is not installed. Installing it now.\n"
43
+ # gem install bundler
44
+ # fi
45
+ # if [[ -s Gemfile ]] && builtin command -v bundle >/dev/null
46
+ # then
47
+ # bundle install | GREP_OPTIONS= \grep -vE '^Using|Your bundle is complete'
48
+ # fi