bootstrap-assets 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,5 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
5
+ tmp/*
@@ -0,0 +1,8 @@
1
+ CHANGELOG
2
+ =========
3
+
4
+ 1.0.0 - 17/05/2012
5
+ ------------------
6
+
7
+ * Initial 1.0.0 release
8
+
data/Gemfile ADDED
@@ -0,0 +1,2 @@
1
+ source :rubygems
2
+ gemspec
@@ -0,0 +1,77 @@
1
+ # Bootstrap Assets
2
+
3
+ Bootstrap is Twitter's toolkit for kickstarting CSS for websites, apps, and more. It includes base CSS styles for typography, forms, buttons, tables, grids, navigation, alerts, and more. http://twitter.github.com/bootstrap
4
+
5
+ Bootstap Assets integrates Bootstrap toolkit for Rails 3.1 Asset Pipeline. Bootstap Assets downloads stylesheets and javascript files from Bootstrap github repository into vendor/assets folder and generates files to load Bootstrap in application.
6
+
7
+ Sponsored by [Evil Martians].
8
+ [Evil Martians]: http://evilmartians.com/
9
+
10
+ ## Installing Gem
11
+
12
+ Include Bootstrap in Gemfile:
13
+
14
+ ```ruby
15
+ group :development do
16
+ gem "bootstrap-assets"
17
+ end
18
+ ```
19
+
20
+ ## Installing to Rails application
21
+
22
+ You can run following generator to get started with Twitter Bootstrap.
23
+
24
+ Install:
25
+
26
+ rails g bootstrap_assets:install
27
+
28
+ It should download all slim and js files to vendor/assets folder.
29
+
30
+
31
+ ## Using stylesheets
32
+
33
+ You have to require Bootstrap (bootstrap.css.less) in your application.css
34
+
35
+ ```css
36
+ /*
37
+ *= require 'twitter/bootstrap'
38
+ */
39
+ ```
40
+
41
+ ## Using Javascripts
42
+
43
+ You have to require Bootstrap JS (bootstrap.js) in your application.js to include all plugins
44
+
45
+ ```js
46
+ //= require twitter/bootstrap
47
+ ```
48
+
49
+ You may add Javascripts plugins individually
50
+
51
+ ```js
52
+ //= require twitter/bootstrap/bootstrap-alert
53
+ ```
54
+
55
+
56
+ ## License
57
+
58
+ Copyright (c) 2012 Andrey Deryabin
59
+
60
+ Permission is hereby granted, free of charge, to any person obtaining
61
+ a copy of this software and associated documentation files (the
62
+ "Software"), to deal in the Software without restriction, including
63
+ without limitation the rights to use, copy, modify, merge, publish,
64
+ distribute, sublicense, and/or sell copies of the Software, and to
65
+ permit persons to whom the Software is furnished to do so, subject to
66
+ the following conditions:
67
+
68
+ The above copyright notice and this permission notice shall be
69
+ included in all copies or substantial portions of the Software.
70
+
71
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
72
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
73
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
74
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
75
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
76
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
77
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,19 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "bootstrap-assets/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "bootstrap-assets"
7
+ s.platform = Gem::Platform::RUBY
8
+ s.version = BootstrapAssets::VERSION
9
+ s.authors = ["Andrey Deryabin"]
10
+ s.email = ["deriabin@gmail.com"]
11
+ s.homepage = "http://github.com/aderyabin/bootstrap-assets"
12
+ s.summary = %q{Twitter Bootstrap toolkit for Rails 3.1 Asset Pipeline}
13
+ s.description = %q{Twitter Bootstrap toolkit for Rails 3.1 Asset Pipeline}
14
+ s.files = `git ls-files`.split("\n")
15
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
16
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
17
+ s.require_paths = ["lib"]
18
+ s.add_runtime_dependency "less-rails", "~> 2.2.0"
19
+ end
@@ -0,0 +1 @@
1
+ require 'less-rails'
@@ -0,0 +1,3 @@
1
+ module BootstrapAssets
2
+ VERSION = "1.0.0"
3
+ end
@@ -0,0 +1,76 @@
1
+ require 'rails/generators'
2
+ require 'net/http'
3
+ require "fileutils"
4
+
5
+ module BootstrapAssets
6
+ module Generators
7
+ class InstallGenerator < ::Rails::Generators::Base
8
+
9
+ desc "This generator installs Twitter Bootstrap to Asset Pipeline"
10
+
11
+ def download_assets
12
+ plugins = %w(alert button carousel collapse dropdown modal popover scrollspy tab tooltip transition typeahead)
13
+ less = %w(accordion alerts bootstrap breadcrumbs button-groups buttons carousel close code component-animations dropdowns forms grid hero-unit labels-badges layouts mixins modals navbar navs pager pagination popovers progress-bars reset responsive-767px-max responsive-768px-979px responsive-1200px-min responsive-navbar responsive-utilities responsive scaffolding sprites tables thumbnails tooltip type utilities variables wells)
14
+ images = %w(glyphicons-halflings-white glyphicons-halflings)
15
+
16
+
17
+ js_path = 'vendor/assets/javascripts/twitter/bootstrap'
18
+ less_path = 'vendor/assets/stylesheets/twitter/bootstrap'
19
+ img_path = 'vendor/assets/images/twitter/bootstrap'
20
+
21
+ FileUtils.mkdir_p(js_path)
22
+ FileUtils.mkdir_p(less_path)
23
+ FileUtils.mkdir_p(img_path)
24
+
25
+ plugins.each do |plugin|
26
+ filename = "bootstrap-#{plugin}.js"
27
+ download("https://raw.github.com/twitter/bootstrap/master/js/#{filename}", "#{js_path}/#{filename}")
28
+ end
29
+
30
+ less.each do |l|
31
+ filename = "#{l}.less"
32
+ download("https://raw.github.com/twitter/bootstrap/master/less/#{filename}", "#{less_path}/#{filename}")
33
+ end
34
+
35
+ images.each do |image|
36
+ filename = "#{image}.png"
37
+ download("https://github.com/twitter/bootstrap/raw/master/img/#{filename}", "#{img_path}/#{filename}")
38
+ end
39
+ end
40
+
41
+ def add_assets
42
+ text = <<-EOF
43
+ @import "twitter/bootstrap/bootstrap";
44
+ // Set the correct sprite paths
45
+ @iconSpritePath: asset-path('twitter/bootstrap/glyphicons-halflings.png');
46
+ @iconWhiteSpritePath: asset-path('twitter/bootstrap/glyphicons-halflings-white.png');
47
+ EOF
48
+
49
+ add_bootstrap_file 'vendor/assets/stylesheets/twitter/bootstrap.css.less', text
50
+ add_bootstrap_file 'vendor/assets/stylesheets/twitter/responsive.css.less', '@import "twitter/bootstrap/responsive";'
51
+ add_bootstrap_file 'vendor/assets/javascripts/twitter/bootstrap.js', '//=require_directory "./bootstrap"'
52
+ end
53
+
54
+ protected
55
+
56
+ def download(source, target)
57
+ puts "Downloading: #{source}"
58
+ uri = URI(source)
59
+ Net::HTTP.start(uri.host, uri.port, :use_ssl => uri.scheme == 'https') do |http|
60
+ request = Net::HTTP::Get.new uri.request_uri
61
+ http.request request do |response|
62
+ open target, 'wb' do |io|
63
+ response.read_body do |chunk|
64
+ io.write chunk
65
+ end
66
+ end
67
+ end
68
+ end
69
+ end
70
+
71
+ def add_bootstrap_file(filename, text)
72
+ create_file filename, text unless File.exist?(filename)
73
+ end
74
+ end
75
+ end
76
+ end
metadata ADDED
@@ -0,0 +1,71 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: bootstrap-assets
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Andrey Deryabin
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-05-18 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: less-rails
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: 2.2.0
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: 2.2.0
30
+ description: Twitter Bootstrap toolkit for Rails 3.1 Asset Pipeline
31
+ email:
32
+ - deriabin@gmail.com
33
+ executables: []
34
+ extensions: []
35
+ extra_rdoc_files: []
36
+ files:
37
+ - .gitignore
38
+ - CHANGELOG.md
39
+ - Gemfile
40
+ - README.md
41
+ - bootstrap-assets.gemspec
42
+ - lib/bootstrap-assets.rb
43
+ - lib/bootstrap-assets/version.rb
44
+ - lib/generators/bootstrap_assets/install/install_generator.rb
45
+ - vendor/assets/images/bootstrap/glyphicons-halflings-white.png
46
+ - vendor/assets/images/bootstrap/glyphicons-halflings.png
47
+ homepage: http://github.com/aderyabin/bootstrap-assets
48
+ licenses: []
49
+ post_install_message:
50
+ rdoc_options: []
51
+ require_paths:
52
+ - lib
53
+ required_ruby_version: !ruby/object:Gem::Requirement
54
+ none: false
55
+ requirements:
56
+ - - ! '>='
57
+ - !ruby/object:Gem::Version
58
+ version: '0'
59
+ required_rubygems_version: !ruby/object:Gem::Requirement
60
+ none: false
61
+ requirements:
62
+ - - ! '>='
63
+ - !ruby/object:Gem::Version
64
+ version: '0'
65
+ requirements: []
66
+ rubyforge_project:
67
+ rubygems_version: 1.8.24
68
+ signing_key:
69
+ specification_version: 3
70
+ summary: Twitter Bootstrap toolkit for Rails 3.1 Asset Pipeline
71
+ test_files: []