jombo 0.0.1.beta7

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.
data/.gitignore ADDED
@@ -0,0 +1,19 @@
1
+ *.gem
2
+ *.rbc
3
+ *~
4
+ .bundle
5
+ .config
6
+ .DS_Store
7
+ .yardoc
8
+ coverage
9
+ doc/
10
+ Gemfile.lock
11
+ InstalledFiles
12
+ lib/bundler/man
13
+ pkg
14
+ rdoc
15
+ spec/reports
16
+ test/tmp
17
+ test/version_tmp
18
+ tmp
19
+ _yardoc
data/.rvmrc ADDED
@@ -0,0 +1,2 @@
1
+ # Use this gemset. If it does not exist, create it.
2
+ rvm use ruby-1.9.3-p0@jombo-gem --create
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'http://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in jombo.gemspec
4
+ gemspec
data/README.md ADDED
@@ -0,0 +1,47 @@
1
+ # jombo
2
+
3
+ ## Preamble
4
+
5
+ `jombo` is a gem that packages the asset files used in Jombo from Twitter.
6
+
7
+ Please note that this project tracks the 2.0 work-in-progress branch. This branch is very fluid at the moment so things will more than likely not work they way you expect.
8
+
9
+ ## Back-story
10
+
11
+ I'm a phenomenal fan of [Jombo](http://twitter.github.com/bootstrap/) from Twitter. One might even say a cheerleader! Anyhow, I use [Rails](http://rubyonrails.org/) and wanted to experiment with the bleeding edge of Jombo as it was being developed. Manually adding adding and updating the assets in one project was fine. Doing it for two or three projects over-and-over started to become cumbersome.
12
+
13
+ I had never made a gem before. The shiny new Rails 3.1.x asset pipeline offered an interesting new piece of learning. So, here it is, my first Ruby gem in living history.
14
+
15
+ This is all very new to me so if you have contributions, bring them but be gentle.
16
+
17
+ ## Setup
18
+
19
+ In a Rails 3.1.x project add the gem to your assets group in your `Gemfile`. It is currently in beta:
20
+
21
+ gem "jombo", "~> 0.0.1.beta1"
22
+
23
+ Bundle the gem using bundler:
24
+
25
+ bundle
26
+
27
+ Once your bundle is updated, you can automatically add the assets to your CSS and Javascript manifest files using the generator:
28
+
29
+ rails generate boostrap:install
30
+
31
+ Alternatively, you can manually require the assets by adding:
32
+
33
+ //= require bootstrap
34
+
35
+ to your `application.js` and
36
+
37
+ *= require bootstrap
38
+
39
+ to your `application.css`.
40
+
41
+ You may need to restart your application for the changes to reflect (I find this behaviour a bit odd and am looking in to why).
42
+
43
+ ## Usage
44
+
45
+ Once the setup is complete, you'll be able to use Jombo. For that I recommend you have a look at [their](http://twitter.github.com/bootstrap/) documentation.
46
+
47
+ Enjoy!
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env rake
2
+ require "bundler/gem_tasks"
data/jombo.gemspec ADDED
@@ -0,0 +1,19 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/jombo/version', __FILE__)
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.authors = ["Silumesii Maboshe"]
6
+ gem.email = ["silumesii@pencilcasestudios.com"]
7
+ gem.description = %q{Package Bootstrap from Twitter (2.0 work-in-progress branch) assets as a gem.}
8
+ gem.summary = %q{This gem allows you to use Bootstrap from Twitter with the Rails 3.1.x asset pipline.}
9
+ gem.homepage = "http://github.com/smaboshe/jombo"
10
+
11
+ gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
12
+ gem.files = `git ls-files`.split("\n")
13
+ gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
14
+ gem.name = "jombo"
15
+ gem.require_paths = ["lib"]
16
+ gem.version = Jombo::VERSION
17
+
18
+ #gem.add_development_dependency "rspec", "~> 2.6"
19
+ end
data/lib/jombo.rb ADDED
@@ -0,0 +1,8 @@
1
+ require "jombo/version"
2
+ require "jombo/generators/install_generator"
3
+
4
+ module Jombo
5
+ class Engine < Rails::Engine
6
+ # Allows Rails to automatically include assets
7
+ end
8
+ end
@@ -0,0 +1,14 @@
1
+ require 'rails/generators'
2
+
3
+ module Jombo
4
+ module Generators
5
+ class InstallGenerator < Rails::Generators::Base
6
+ source_root File.join(File.dirname(__FILE__), 'templates')
7
+
8
+ def add_assets
9
+ insert_into_file "app/assets/javascripts/application.js", "//= require bootstrap\n", :after => "jquery_ujs\n"
10
+ insert_into_file "app/assets/stylesheets/application.css", " *= require bootstrap\n", :after => "require_self\n"
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,3 @@
1
+ module Jombo
2
+ VERSION = "0.0.1.beta7"
3
+ end
@@ -0,0 +1,78 @@
1
+ /* ==========================================================
2
+ * bootstrap-alert.js v2.0.0
3
+ * http://twitter.github.com/bootstrap/javascript.html#alerts
4
+ * ==========================================================
5
+ * Copyright 2011 Twitter, Inc.
6
+ *
7
+ * Licensed under the Apache License, Version 2.0 (the "License");
8
+ * you may not use this file except in compliance with the License.
9
+ * You may obtain a copy of the License at
10
+ *
11
+ * http://www.apache.org/licenses/LICENSE-2.0
12
+ *
13
+ * Unless required by applicable law or agreed to in writing, software
14
+ * distributed under the License is distributed on an "AS IS" BASIS,
15
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ * See the License for the specific language governing permissions and
17
+ * limitations under the License.
18
+ * ========================================================== */
19
+
20
+
21
+ !function( $ ){
22
+
23
+ "use strict"
24
+
25
+ /* ALERT CLASS DEFINITION
26
+ * ====================== */
27
+
28
+ var dismiss = '[data-dismiss="alert"]'
29
+ , Alert = function ( el ) {
30
+ $(el).delegate(dismiss, 'click', this.close)
31
+ }
32
+
33
+ Alert.prototype = {
34
+
35
+ constructor: Alert
36
+
37
+ , close: function ( e ) {
38
+ var $element = $(this)
39
+
40
+ $element = $element.hasClass('alert-message') ? $element : $element.parent()
41
+ e && e.preventDefault()
42
+ $element.removeClass('in')
43
+
44
+ function removeElement() {
45
+ $element.remove()
46
+ }
47
+
48
+ $.support.transition && $element.hasClass('fade') ?
49
+ $element.bind($.support.transition.end, removeElement) :
50
+ removeElement()
51
+ }
52
+
53
+ }
54
+
55
+
56
+ /* ALERT PLUGIN DEFINITION
57
+ * ======================= */
58
+
59
+ $.fn.alert = function ( option ) {
60
+ return this.each(function () {
61
+ var $this = $(this)
62
+ , data = $this.data('alert')
63
+ if (!data) $this.data('alert', (data = new Alert(this)))
64
+ if (typeof option == 'string') data[option].call($this)
65
+ })
66
+ }
67
+
68
+ $.fn.alert.Alert = Alert
69
+
70
+
71
+ /* ALERT DATA-API
72
+ * ============== */
73
+
74
+ $(function () {
75
+ $('body').delegate(dismiss, 'click.alert.data-api', Alert.prototype.close)
76
+ })
77
+
78
+ }( window.jQuery || window.ender )
@@ -0,0 +1,98 @@
1
+ /* ============================================================
2
+ * bootstrap-buttons.js v2.0.0
3
+ * http://twitter.github.com/bootstrap/javascript.html#buttons
4
+ * ============================================================
5
+ * Copyright 2011 Twitter, Inc.
6
+ *
7
+ * Licensed under the Apache License, Version 2.0 (the "License");
8
+ * you may not use this file except in compliance with the License.
9
+ * You may obtain a copy of the License at
10
+ *
11
+ * http://www.apache.org/licenses/LICENSE-2.0
12
+ *
13
+ * Unless required by applicable law or agreed to in writing, software
14
+ * distributed under the License is distributed on an "AS IS" BASIS,
15
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ * See the License for the specific language governing permissions and
17
+ * limitations under the License.
18
+ * ============================================================ */
19
+
20
+ !function( $ ){
21
+
22
+ "use strict"
23
+
24
+ /* BUTTON PUBLIC CLASS DEFINITION
25
+ * ============================== */
26
+
27
+ var Button = function (element, options) {
28
+ this.$element = $(element)
29
+ this.settings = $.extend({}, $.fn.button.defaults, options)
30
+ }
31
+
32
+ Button.prototype = {
33
+
34
+ constructor: Button
35
+
36
+ , setState: function (state) {
37
+ var d = 'disabled'
38
+ , $el = this.$element
39
+ , data = $el.data()
40
+ , val = $el.is('input') ? 'val' : 'html'
41
+
42
+ state = state + 'Text'
43
+ data.resetText || $el.data('resetText', $el[val]())
44
+
45
+ $el[val](data[state] || this.settings[state])
46
+
47
+ // push to event loop to allow forms to submit
48
+ setTimeout(function () {
49
+ state == 'loadingText' ?
50
+ $el.addClass(d).attr(d, d) :
51
+ $el.removeClass(d).removeAttr(d)
52
+ }, 0)
53
+ }
54
+
55
+ , toggle: function () {
56
+ var $parent = this.$element.parent('[data-toggle="buttons-radio"]')
57
+
58
+ $parent && $parent
59
+ .find('.active')
60
+ .removeClass('active')
61
+
62
+ this.$element.toggleClass('active')
63
+ }
64
+
65
+ }
66
+
67
+
68
+ /* BUTTON PLUGIN DEFINITION
69
+ * ======================== */
70
+
71
+ $.fn.button = function ( option ) {
72
+ return this.each(function () {
73
+ var $this = $(this)
74
+ , data = $this.data('button')
75
+ , options = typeof option == 'object' && option
76
+ if (!data) $this.data('button', (data = new Button(this, options)))
77
+ if (option == 'toggle') data.toggle()
78
+ else if (option) data.setState(option)
79
+ })
80
+ }
81
+
82
+ $.fn.button.defaults = {
83
+ loadingText: 'loading...'
84
+ }
85
+
86
+ $.fn.button.Button = Button
87
+
88
+
89
+ /* BUTTON DATA-API
90
+ * =============== */
91
+
92
+ $(function () {
93
+ $('body').delegate('[data-toggle^=button]', 'click.button.data-api', function (e) {
94
+ $(e.srcElement).button('toggle')
95
+ })
96
+ })
97
+
98
+ }( window.jQuery || window.ender )
@@ -0,0 +1,59 @@
1
+ /* ==========================================================
2
+ * bootstrap-carousel.js v2.0.0
3
+ * http://twitter.github.com/bootstrap/javascript.html#alerts
4
+ * ==========================================================
5
+ * Copyright 2011 Twitter, Inc.
6
+ *
7
+ * Licensed under the Apache License, Version 2.0 (the "License");
8
+ * you may not use this file except in compliance with the License.
9
+ * You may obtain a copy of the License at
10
+ *
11
+ * http://www.apache.org/licenses/LICENSE-2.0
12
+ *
13
+ * Unless required by applicable law or agreed to in writing, software
14
+ * distributed under the License is distributed on an "AS IS" BASIS,
15
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ * See the License for the specific language governing permissions and
17
+ * limitations under the License.
18
+ * ========================================================== */
19
+
20
+
21
+ !function( $ ){
22
+
23
+ "use strict"
24
+
25
+ /* CAROUSEL CLASS DEFINITION
26
+ * ========================= */
27
+
28
+ var Carousel = function ( el ) {
29
+ $(el).delegate(dismiss, 'click', this.close)
30
+ }
31
+
32
+ Carousel.prototype = {
33
+
34
+ }
35
+
36
+
37
+ /* CAROUSEL PLUGIN DEFINITION
38
+ * ========================== */
39
+
40
+ $.fn.carousel = function ( option ) {
41
+ return this.each(function () {
42
+ var $this = $(this)
43
+ , data = $this.data('alert')
44
+ if (!data) $this.data('alert', (data = new Alert(this)))
45
+ if (typeof option == 'string') data[option].call($this)
46
+ })
47
+ }
48
+
49
+ $.fn.carousel.Carousel = Carousel
50
+
51
+
52
+ /* CAROUSEL DATA-API
53
+ * ================= */
54
+
55
+ // $(function () {
56
+ // $('body').delegate(dismiss, 'click.alert.data-api', Alert.prototype.close)
57
+ // })
58
+
59
+ }( window.jQuery || window.ender )
@@ -0,0 +1,135 @@
1
+ /* =============================================================
2
+ * bootstrap-collapsible.js v2.0.0
3
+ * http://twitter.github.com/bootstrap/javascript.html#collapsible
4
+ * =============================================================
5
+ * Copyright 2011 Twitter, Inc.
6
+ *
7
+ * Licensed under the Apache License, Version 2.0 (the "License");
8
+ * you may not use this file except in compliance with the License.
9
+ * You may obtain a copy of the License at
10
+ *
11
+ * http://www.apache.org/licenses/LICENSE-2.0
12
+ *
13
+ * Unless required by applicable law or agreed to in writing, software
14
+ * distributed under the License is distributed on an "AS IS" BASIS,
15
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ * See the License for the specific language governing permissions and
17
+ * limitations under the License.
18
+ * ============================================================ */
19
+
20
+ (function( $ ){
21
+
22
+ "use strict"
23
+
24
+ var Collapse = function ( element, options ) {
25
+ this.$element = $(element)
26
+ this.settings = $.extend({}, $.fn.collapse.defaults, options)
27
+
28
+ if (this.settings["parent"]) {
29
+ this.$parent = $(this.settings["parent"])
30
+ }
31
+
32
+ this.settings.toggle && this.toggle()
33
+ }
34
+
35
+ Collapse.prototype = {
36
+
37
+ constructor: Collapse
38
+
39
+ , dimension: function () {
40
+ var hasWidth = this.$element.hasClass('width')
41
+ return hasWidth ? 'width' : 'height'
42
+ }
43
+
44
+ , show: function () {
45
+ var dimension = this.dimension()
46
+ , scroll = $.camelCase(['scroll', dimension].join('-'))
47
+ , actives = this.$parent && this.$parent.find('.in')
48
+ , hasData
49
+
50
+ if (actives && actives.length) {
51
+ hasData = actives.data('collapse')
52
+ actives.collapse('hide')
53
+ hasData || actives.data('collapse', null)
54
+ }
55
+
56
+ this.$element[dimension](0)
57
+ this.transition('addClass', 'show', 'shown')
58
+ this.$element[dimension](this.$element[0][scroll])
59
+
60
+ }
61
+
62
+ , hide: function () {
63
+ var dimension = this.dimension()
64
+ this.reset(this.$element[dimension]())
65
+ this.transition('removeClass', 'hide', 'hidden')
66
+ this.$element[dimension](0)
67
+ }
68
+
69
+ , reset: function ( size ) {
70
+ var dimension = this.dimension()
71
+
72
+ this.$element
73
+ .removeClass('collapse')
74
+ [dimension](size || '')
75
+ [0].offsetWidth
76
+
77
+ this.$element.addClass('collapse')
78
+ }
79
+
80
+ , transition: function ( method, startEvent, completeEvent ) {
81
+ var that = this
82
+ , complete = function () {
83
+ if (startEvent == 'show') that.reset()
84
+ that.$element.trigger(completeEvent)
85
+ }
86
+
87
+ this.$element
88
+ .trigger(startEvent)
89
+ [method]('in')
90
+
91
+ $.support.transition && this.$element.hasClass('collapse') ?
92
+ this.$element.one($.support.transition.end, complete) :
93
+ complete()
94
+ }
95
+
96
+ , toggle: function () {
97
+ this[this.$element.hasClass('in') ? 'hide' : 'show']()
98
+ }
99
+
100
+ }
101
+
102
+ /* COLLAPSIBLE PLUGIN DEFINITION
103
+ * ============================== */
104
+
105
+ $.fn.collapse = function ( option ) {
106
+ return this.each(function () {
107
+ var $this = $(this)
108
+ , data = $this.data('collapse')
109
+ , options = typeof option == 'object' && option
110
+ if (!data) $this.data('collapse', (data = new Collapse(this, options)))
111
+ if (typeof option == 'string') data[option]()
112
+ })
113
+ }
114
+
115
+ $.fn.collapse.defaults = {
116
+ toggle: true
117
+ }
118
+
119
+ $.fn.collapse.Collapse = Collapse
120
+
121
+
122
+ /* COLLAPSIBLE DATA-API
123
+ * ==================== */
124
+
125
+ $(function () {
126
+ $('body').delegate('[data-toggle=collapse]', 'click.collapse.data-api', function ( e ) {
127
+ var $this = $(this)
128
+ , target = $this.attr('data-target') || $this.attr('href')
129
+ , option = $(target).data('collapse') ? 'toggle' : $this.data()
130
+ e.preventDefault()
131
+ $(target).collapse(option)
132
+ })
133
+ })
134
+
135
+ })( window.jQuery || window.ender )