bundler-bower 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 12b871ccc9ca1ac06ece906a8c49d7d0d44a421e
4
+ data.tar.gz: ac02c42269b8081cd3d0bf109e374c7ca693856a
5
+ SHA512:
6
+ metadata.gz: 8770cf4e380fd5a72816bb518fccda9d4e119551a556aacc364e91ef7f0cd1c64fa442f35739e9f831d8c7bd1441e1c59884712d667e3f83384fb0c1eb53ae05
7
+ data.tar.gz: 4ed73de006241580beffe12cc3f1daad527ad4bd6ab063076e429324939ada5049b52fd4e0240beb5bcc4cd1264d480fc6a66e7de4a4411edb9bc640e863d7da
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/.travis.yml ADDED
@@ -0,0 +1,14 @@
1
+ before_script:
2
+ - npm install -g bower
3
+ rvm:
4
+ - 2.0.0
5
+ - ruby-head
6
+ - jruby-head
7
+ - jruby-19mode
8
+ - rbx-19mode
9
+ matrix:
10
+ allow_failures:
11
+ - rvm: ruby-head
12
+ - rvm: jruby-head
13
+ - rvm: jruby-19mode
14
+ - rvm: rbx-19mode
data/Gemfile ADDED
@@ -0,0 +1,8 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
4
+
5
+ gem 'rspec'
6
+ gem 'bogus'
7
+ gem 'bbq-spawn'
8
+ gem 'coveralls', require: false
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Piotr Niełacny
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,79 @@
1
+ bundler-bower
2
+ ==============
3
+
4
+ [![Build Status](https://secure.travis-ci.org/LTe/bundler-bower.png)](http://travis-ci.org/LTe/bundler-bower)
5
+ [![Dependency Status](https://gemnasium.com/LTe/bundler-bower.png)](https://gemnasium.com/LTe/bundler-bower)
6
+ [![Code Climate](https://codeclimate.com/github/LTe/bundler-bower.png)](https://codeclimate.com/github/LTe/bundler-bower)
7
+ [![Coverage Status](https://coveralls.io/repos/LTe/bundler-bower/badge.png?branch=master)](https://coveralls.io/r/LTe/bundler-bower?branch=master)
8
+ [![Gem Version](https://badge.fury.io/rb/dht.png)](http://badge.fury.io/rb/dht)
9
+
10
+ Bower support for bundler. You can use assets from bower directly in `Gemfile`
11
+
12
+ ### Requirements
13
+
14
+ * bower
15
+ * ruby 2.0 (or with `Module#prepend` support)
16
+
17
+ ## Installation
18
+
19
+ Execute:
20
+
21
+ ```ruby
22
+ gem install 'bundler-bower'
23
+ ```
24
+
25
+ Add this line to your application's Gemfile:
26
+
27
+ ```ruby
28
+ require "bundler/bower"
29
+ ```
30
+
31
+ ## Usage
32
+
33
+ Add to your Gemfile require method.
34
+
35
+ ```ruby
36
+ # Gemfile
37
+ source 'https://rubygems.org'
38
+ require 'bundler/bower'
39
+
40
+ gem 'rake'
41
+
42
+ asset 'backbone', "0.9"
43
+ asset 'moment'
44
+ ```
45
+
46
+ You can use DSL from [bower-rails](https://github.com/42dev/bower-rails). Click [here](https://github.com/42dev/bower-rails#ruby-dsl-configuration) for details. Only `group` method is not supported.
47
+
48
+ And just execute `bundle install`.
49
+
50
+ ```
51
+ Using rake (10.1.0)
52
+ Using bundler (1.3.5)
53
+ bower backbone#0.9 cached git://github.com/jashkenas/backbone.git#0.9.10
54
+ bower backbone#0.9 validate 0.9.10 against git://github.com/jashkenas/backbone.git#0.9
55
+ bower moment#* cached git://github.com/timrwood/moment.git#2.4.0
56
+ bower moment#* validate 2.4.0 against git://github.com/timrwood/moment.git#*
57
+ bower moment#* install moment#2.4.0
58
+ bower backbone#0.9 install backbone#0.9.10
59
+
60
+ moment#2.4.0 bower_components/moment
61
+
62
+ backbone#0.9.10 bower_components/backbone
63
+ bower check-new Checking for new versions of the project dependencies..
64
+ dsl-generated dependencies /home/lite/work/bundler-bower/spec/dummy/vendor/assets
65
+ ├── backbone#0.9.10 (latest is 1.1.0)
66
+ └── moment#2.4.0
67
+ Your bundle is complete!
68
+ Use `bundle show [gemname]` to see where a bundled gem is installed.
69
+ ```
70
+
71
+ When you execute `bundle` or `bundle install` bundler-bower will execute `bower install`. But when you execute `bundle update` bundler-bower will execute `bower update`. When bundler quits you can find your assets in `vendor/assets/bower_components`. Of course you can change this directory by `assets_path` method.
72
+
73
+ ## Contributing
74
+
75
+ 1. Fork it
76
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
77
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
78
+ 4. Push to the branch (`git push origin my-new-feature`)
79
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,5 @@
1
+ require 'rspec/core/rake_task'
2
+ require 'bundler/gem_tasks'
3
+
4
+ task :default => :spec
5
+ RSpec::Core::RakeTask.new :spec
@@ -0,0 +1,25 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'bundler/bower/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "bundler-bower"
8
+ spec.version = Bundler::Bower::VERSION
9
+ spec.authors = ["Piotr Niełacny"]
10
+ spec.email = ["piotr.nielacny@gmail.com"]
11
+ spec.description = %q{Write a gem description}
12
+ spec.summary = %q{integration bundler with bower}
13
+ spec.homepage = "https://github.com/LTe/bundler-bower"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_dependency "bower-rails", "~> 0.5"
22
+
23
+ spec.add_development_dependency "bundler", "~> 1.3"
24
+ spec.add_development_dependency "rake"
25
+ end
@@ -0,0 +1,14 @@
1
+ require 'bundler/bower/rake'
2
+
3
+ module Bundler
4
+ module Bower
5
+ module BundlerInstaller
6
+ def run(options)
7
+ result = super
8
+ Bundler::Bower::Rake.new(options).perform
9
+ result
10
+ end
11
+ end
12
+ end
13
+ end
14
+
@@ -0,0 +1,13 @@
1
+ module Bundler
2
+ module Bower
3
+ module FakeDsl
4
+ module BowerRails
5
+ def group(*)
6
+ end
7
+
8
+ def method_missing(*)
9
+ end
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,13 @@
1
+ module Bundler
2
+ module Bower
3
+ module FakeDsl
4
+ module Bundler
5
+ def asset(*)
6
+ end
7
+
8
+ def assets_path(*)
9
+ end
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,38 @@
1
+ require 'json'
2
+ require 'bower-rails'
3
+
4
+ module Bundler
5
+ module Bower
6
+ class Rake
7
+ def initialize(options)
8
+ @options = options
9
+ end
10
+
11
+ def perform
12
+ dsl = BowerRails::Dsl.evalute("Gemfile")
13
+
14
+ dsl.write_bower_json
15
+ dsl.write_dotbowerrc
16
+
17
+ dsl.directories.each do |dir|
18
+ Dir.chdir(dir) do
19
+ system(command)
20
+ system('bower list')
21
+ end
22
+ end
23
+ end
24
+
25
+ def update?
26
+ @options["update"]
27
+ end
28
+
29
+ def command
30
+ if update?
31
+ 'bower update'
32
+ else
33
+ 'bower install'
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,5 @@
1
+ module Bundler
2
+ module Bower
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
@@ -0,0 +1,10 @@
1
+ require "bundler/bower/version"
2
+ require "bundler"
3
+ require "bower-rails"
4
+ require "bundler/bower/fake_dsl/bundler"
5
+ require "bundler/bower/fake_dsl/bower-rails"
6
+ require "bundler/bower/bundler_installer"
7
+
8
+ Bundler::Dsl.send(:include, Bundler::Bower::FakeDsl::Bundler)
9
+ BowerRails::Dsl.send(:prepend, Bundler::Bower::FakeDsl::BowerRails)
10
+ Bundler::Installer.send(:prepend, Bundler::Bower::BundlerInstaller)
@@ -0,0 +1,13 @@
1
+ require 'spec_helper'
2
+
3
+ describe "Integration test" do
4
+ let(:directory) { File.join(File.dirname(__FILE__), "../../dummy") }
5
+ let(:test_node) { TestNode.new(:gemfile => "#{directory}/Gemfile", :type => "install") }
6
+
7
+ before { Dir.chdir(directory) { test_node.spawn } }
8
+ after { FileUtils.rm_rf("#{ directory}/vendor") }
9
+
10
+ it "download backbone" do
11
+ File.exist?("#{directory}/vendor/assets/bower_components/backbone/backbone.js").should be_true
12
+ end
13
+ end
@@ -0,0 +1,38 @@
1
+ require 'spec_helper'
2
+
3
+ module Bundler::Bower
4
+ describe Rake do
5
+ let(:options) { {} }
6
+ subject { Rake.new(options) }
7
+
8
+ describe "during bundle (install)" do
9
+ describe "#update?" do
10
+ it "returns false" do
11
+ subject.update?.should be_false
12
+ end
13
+ end
14
+
15
+ describe "#command" do
16
+ it "returns 'bower install'" do
17
+ subject.command.should == "bower install"
18
+ end
19
+ end
20
+ end
21
+
22
+ describe "during bundle update" do
23
+ let(:options) { {"update" => true} }
24
+
25
+ describe "#update?" do
26
+ it "returns true" do
27
+ subject.update?.should be_true
28
+ end
29
+ end
30
+
31
+ describe "#command" do
32
+ it "returns 'bower install'" do
33
+ subject.command.should == "bower update"
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,8 @@
1
+ $LOAD_PATH << File.dirname(__FILE__) + '/../../lib'
2
+ require 'bundler/bower'
3
+
4
+ gem 'rake'
5
+
6
+ asset 'backbone', "0.9"
7
+ asset 'moment'
8
+
@@ -0,0 +1,16 @@
1
+ $LOAD_PATH << File.dirname(__FILE__) + '/..'
2
+
3
+ require 'coveralls'
4
+ Coveralls.wear!
5
+
6
+ require 'rspec'
7
+ require 'bogus/rspec'
8
+ require 'bbq/spawn'
9
+ require 'bundler/bower'
10
+ require 'fileutils'
11
+
12
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
13
+
14
+ Bogus.configure do |c|
15
+ c.search_modules << BowerRails
16
+ end
@@ -0,0 +1,36 @@
1
+ require 'bbq/spawn'
2
+
3
+ class TestNode
4
+ include Bbq::Spawn
5
+
6
+ attr_reader :type, :gemfile
7
+
8
+ def initialize(options = {})
9
+ @type = options[:type] || "install"
10
+ @gemfile = options[:gemfile] || "Gemfile"
11
+ end
12
+
13
+ def spawn
14
+ orchestrator.start
15
+ end
16
+
17
+ def stop
18
+ orchestrator.stop
19
+ end
20
+
21
+ private
22
+
23
+ def executor
24
+ executor = Executor.new("bundle", type)
25
+ process = executor.instance_variable_get(:@process)
26
+ process.environment["BUNDLE_GEMFILE"] = gemfile
27
+
28
+ executor
29
+ end
30
+
31
+ def orchestrator
32
+ @orchestrator ||= Orchestrator.new.tap do |orchestrator|
33
+ orchestrator.coordinate(executor, :banner => "Your bundle is complete!")
34
+ end
35
+ end
36
+ end
metadata ADDED
@@ -0,0 +1,109 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: bundler-bower
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Piotr Niełacny
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-11-01 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bower-rails
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '0.5'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '0.5'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: '1.3'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: '1.3'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ description: Write a gem description
56
+ email:
57
+ - piotr.nielacny@gmail.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - .gitignore
63
+ - .travis.yml
64
+ - Gemfile
65
+ - LICENSE.txt
66
+ - README.md
67
+ - Rakefile
68
+ - bundler-bower.gemspec
69
+ - lib/bundler/bower.rb
70
+ - lib/bundler/bower/bundler_installer.rb
71
+ - lib/bundler/bower/fake_dsl/bower-rails.rb
72
+ - lib/bundler/bower/fake_dsl/bundler.rb
73
+ - lib/bundler/bower/rake.rb
74
+ - lib/bundler/bower/version.rb
75
+ - spec/bundler/bower/integration_spec.rb
76
+ - spec/bundler/bower/rake_spec.rb
77
+ - spec/dummy/Gemfile
78
+ - spec/spec_helper.rb
79
+ - spec/support/test_node.rb
80
+ homepage: https://github.com/LTe/bundler-bower
81
+ licenses:
82
+ - MIT
83
+ metadata: {}
84
+ post_install_message:
85
+ rdoc_options: []
86
+ require_paths:
87
+ - lib
88
+ required_ruby_version: !ruby/object:Gem::Requirement
89
+ requirements:
90
+ - - '>='
91
+ - !ruby/object:Gem::Version
92
+ version: '0'
93
+ required_rubygems_version: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - '>='
96
+ - !ruby/object:Gem::Version
97
+ version: '0'
98
+ requirements: []
99
+ rubyforge_project:
100
+ rubygems_version: 2.0.3
101
+ signing_key:
102
+ specification_version: 4
103
+ summary: integration bundler with bower
104
+ test_files:
105
+ - spec/bundler/bower/integration_spec.rb
106
+ - spec/bundler/bower/rake_spec.rb
107
+ - spec/dummy/Gemfile
108
+ - spec/spec_helper.rb
109
+ - spec/support/test_node.rb