Bower and Rails




Bower

Administrador de paquetes para la web


¿Qué administra?


Instalación
Manejo de versiones
Manejo de dependencias
Búsqueda


Ruby on Rails

Assets pipeline
= require

¿css?
¿js?
¿images?
¿fonts?
¿templates?


¿Cómo los integro?


Bower

bower.json
package.json
application.rb

bower.json

{
  "name": "developexpert",
  "version": "1.0.0",
  "homepage": "https://github.com/tangosource/developexpert",
  "authors": [
    "Daniel Gaytan "
  ],
  "license": "MIT",
  "ignore": [
    "**/.*",
    "node_modules",
    "bower_components",
    "vendor/assets/components"
  ],
  "dependencies": {
    "angular": "1.2.12",
    "angular-strap": "~2.0.0",    "angular-animate": "1.2.11",
    "angular-resource": "1.2.11",
    "angular-route": "1.2.11",
    "bootstrap": "3.1.0",
    "chosen": "https://github.com/harvesthq/chosen/releases/download/v1.1.0/chosen_v1.1.0.zip",
    "angular-chosen-localytics": "1.0.5"
  },
  "resolutions": {
    "angular": "1.2.12",
    "chosen": "e-tag:face03d32"
  }
}

Package.json

{
  "name": "DevelopExpert",
  "version": "1.0.0",
  "dependencies": {
    "bower": "~1.2"
  },
  "engine": {
    "node": "0.10.x",
    "npm": "1.3.x"
  },
  "scripts": {
    "postinstall": "./node_modules/bower/bin/bower install"
  }
} 

Application.rb

    # We don't want the default of everything that isn't js or css, because it pulls too many things in
    config.assets.precompile.shift

    # Assets that can be referenced in a stylesheet_link_tag or javascript_include_tag
    config.assets.precompile += ['application/*']

    # Paths from where required files in manifests can be found
    config.assets.paths << Rails.root.join('vendor', 'assets', 'components')
    config.assets.paths << Rails.root.join('app', 'assets', 'fonts')
    config.assets.paths << Rails.root.join('vendor', 'assets', 'stylesheets')

    # Explicitly register the extensions we are interested in compiling     config.assets.precompile.push(Proc.new do |path|       File.extname(path).in? [         '.html', '.erb', '.haml',                 # Templates         '.png',  '.gif', '.jpg', '.jpeg', '.svg', # Images         '.eot',  '.otf', '.svc', '.woff', '.ttf', # Fonts       ]     end)

bower install


bower chosen#*                  cached https://github.com/harvesthq/chosen/releases/download/v1.1.0/chosen_v1.1.0.zip#e-tag:face03d32
bower chosen#*                validate e-tag:face03d32 against https://github.com/harvesthq/chosen/releases/download/v1.1.0/chosen_v1.1.0.zip#*
bower angular#1.2.12            cached git://github.com/angular/bower-angular.git#1.2.12
bower angular#1.2.12          validate 1.2.12 against git://github.com/angular/bower-angular.git#1.2.12
bower angular-resource#1.2.11   cached git://github.com/angular/bower-angular-resource.git#1.2.11
bower angular-resource#1.2.11 validate 1.2.11 against git://github.com/angular/bower-angular-resource.git#1.2.11

Incompatibilidades

Please note that,
    angular-animate#1.2.11, angular-resource#1.2.11, angular-route#1.2.11 depend on angular#1.2.11 which resolved to 1.2.11
    developexpert depend on angular#1.2.12 which resolved to 1.2.12
    angular-chosen-localytics#1.0.5 depend on angular#>=1.2.0 which resolved to 1.2.15
    angular-strap#2.0.0-rc.4 depend on angular#~1.2.10 which resolved to 1.2.15

Resort to using angular#1.2.12 which resolved to 1.2.12
Code incompatibilities may occur.

Please note that,
    developexpert depend on chosen#* which resolved to e-tag:face03d32
    angular-chosen-localytics#1.0.5 depend on chosen#~1.0.0 which resolved to 1.0.0
Resort to using chosen#e-tag:face03d32 which resolved to e-tag:face03d32
Code incompatibilities may occur. 

Conclusión

bower angular-strap#~2.0.0                     install angular-strap#2.0.0-rc.4
bower angular-chosen-localytics#1.0.5          install angular-chosen-localytics#1.0.5
bower angular#1.2.12                           install angular#1.2.12
bower angular-resource#1.2.11                  install angular-resource#1.2.11
bower angular-route#1.2.11                     install angular-route#1.2.11
bower angular-animate#1.2.11                   install angular-animate#1.2.11
bower chosen#*                                 install chosen#e-tag:face03d32
bower bootstrap#3.1.0                          install bootstrap#3.1.0
bower jquery#>= 1.9.0                          install jquery#2.1.0
angular-strap#2.0.0-rc.4 vendor/assets/components/angular-strap
├── angular#1.2.12
└── bootstrap#3.1.0

angular-chosen-localytics#1.0.5 vendor/assets/components/angular-chosen-localytics
├── angular#1.2.12
└── chosen#e-tag:face03d32

angular#1.2.12 vendor/assets/components/angular

angular-resource#1.2.11 vendor/assets/components/angular-resource
└── angular#1.2.12




Bonus: .GitIgnore

vendor/assets/components




Gracias !

Preguntas?







Contacto


dgaytan6@gmail.com
github.com/daniel-g

Bower and Rails

By Daniel Alejandro Gaytán Valencia