bowdler 0.0.5
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.
- checksums.yaml +7 -0
- data/.gitignore +18 -0
- data/.travis.yml +15 -0
- data/Gemfile +8 -0
- data/LICENSE.txt +22 -0
- data/README.md +84 -0
- data/Rakefile +5 -0
- data/bowdler.gemspec +23 -0
- data/lib/bowdler.rb +5 -0
- data/lib/bowdler/bundler_installer.rb +18 -0
- data/lib/bowdler/rake.rb +47 -0
- data/lib/bowdler/simple_dsl.rb +58 -0
- data/lib/bowdler/version.rb +3 -0
- data/spec/bowdler/integration_spec.rb +24 -0
- data/spec/bowdler/rake_spec.rb +50 -0
- data/spec/bowerfile/Bowerfile +2 -0
- data/spec/bowerfile/Gemfile +4 -0
- data/spec/bowerfile_assets_path/Bowerfile +4 -0
- data/spec/bowerfile_assets_path/Gemfile +4 -0
- data/spec/spec_helper.rb +16 -0
- data/spec/support/test_node.rb +36 -0
- metadata +100 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 3a714539ff9b4f6dc0a15c5e934ebcd51099bcbd
|
4
|
+
data.tar.gz: c65bbf41411cddc4672e6092e5c2846988ab35a4
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: c958d35cafe7b6541a7acdced385a59d9552990bda816947d5ea49e55fe0a9c0c4254d2dfbf482a75caabd6bbf2200c2a7ce5d1e45f292a69a197b234219bb52
|
7
|
+
data.tar.gz: afbf0300de87919cced773fc030e7437d1545d77890972f4c21b0591cd770030252c008ad8759cfc6d2a69a665ebfa038abe28553fc72e0c407936e087bd327b
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
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,84 @@
|
|
1
|
+
bowdler
|
2
|
+
==============
|
3
|
+
|
4
|
+
bower as you bundle, no bs.
|
5
|
+
|
6
|
+
### Requirements
|
7
|
+
|
8
|
+
* [node](http://nodejs.org)
|
9
|
+
* [bower](https://github.com/bower/bower) (>= 0.10.0) installed with npm
|
10
|
+
* ruby >= 1.9
|
11
|
+
|
12
|
+
## How
|
13
|
+
|
14
|
+
Install:
|
15
|
+
|
16
|
+
```ruby
|
17
|
+
gem install 'bowdler'
|
18
|
+
```
|
19
|
+
|
20
|
+
Add this line to your application's Gemfile:
|
21
|
+
|
22
|
+
```ruby
|
23
|
+
# Gemfile
|
24
|
+
source 'https://rubygems.org'
|
25
|
+
|
26
|
+
require 'bowdler'
|
27
|
+
```
|
28
|
+
|
29
|
+
Create a `Bowerfile` alongside your `Gemfile`:
|
30
|
+
|
31
|
+
```ruby
|
32
|
+
# Bowerfile
|
33
|
+
|
34
|
+
asset 'backbone', '0.9'
|
35
|
+
# ...
|
36
|
+
```
|
37
|
+
|
38
|
+
And your done. Do a `bundle install`:
|
39
|
+
|
40
|
+
```
|
41
|
+
Using rake (10.1.0)
|
42
|
+
Using bundler (1.3.5)
|
43
|
+
bower backbone#0.9 cached git://github.com/jashkenas/backbone.git#0.9.10
|
44
|
+
bower backbone#0.9 validate 0.9.10 against git://github.com/jashkenas/backbone.git#0.9
|
45
|
+
bower backbone#0.9 install backbone#0.9.10
|
46
|
+
|
47
|
+
backbone#0.9.10 bower_components/backbone
|
48
|
+
bower check-new Checking for new versions of the project dependencies..
|
49
|
+
dsl-generated dependencies /home/lite/work/bundler-bower/spec/dummy/vendor/assets
|
50
|
+
├── backbone#0.9.10 (latest is 1.1.0)
|
51
|
+
Your bundle is complete!
|
52
|
+
Use `bundle show [gemname]` to see where a bundled gem is installed.
|
53
|
+
```
|
54
|
+
|
55
|
+
Execute `bundle` or `bundle install`, bowdler will execute `bower install`. Executing `bundle update`, bowdler will execute `bower update`.
|
56
|
+
After that, check for your bower assets on `vendor`. You can change the default directory with the `assets_path` method, like this:
|
57
|
+
|
58
|
+
```ruby
|
59
|
+
# Bowerfile
|
60
|
+
assets_path 'source/vendor' # usefull along with Middleman gem
|
61
|
+
|
62
|
+
asset 'backbone', '0.9'
|
63
|
+
# ...
|
64
|
+
```
|
65
|
+
|
66
|
+
Ommit the version and stay fresh with the latest releases.
|
67
|
+
|
68
|
+
```ruby
|
69
|
+
# Bowerfile
|
70
|
+
assets_path 'source/vendor'
|
71
|
+
|
72
|
+
asset 'jquery'
|
73
|
+
asset 'backbone'
|
74
|
+
# ...
|
75
|
+
```
|
76
|
+
|
77
|
+
## Credits
|
78
|
+
|
79
|
+
Initially, this was supposed to be a [bundler-bower](https://github.com/LTe/bundler-bower) fork,
|
80
|
+
but it was so complex to simplify it (like when using it with (Middleman)[http://middlemanapp.com]),
|
81
|
+
that I've ended up stripping out most of the code, modding some parts and packing everything on a
|
82
|
+
separate gem.
|
83
|
+
|
84
|
+
There's also some pieces of code taken from [bower-rails](https://github.com/42dev/bower-rails).
|
data/Rakefile
ADDED
data/bowdler.gemspec
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'bowdler/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'bowdler'
|
8
|
+
spec.version = Bowdler::VERSION
|
9
|
+
spec.authors = ['Rafael Belvederese']
|
10
|
+
spec.email = ['rafael@blvz.im']
|
11
|
+
spec.description = %q{Create a Bowerfile alongside your Gemfile and just bundle.}
|
12
|
+
spec.summary = %q{bower while you bundle.}
|
13
|
+
spec.homepage = "https://github.com/blvz/bowdler"
|
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_development_dependency 'bundler', '~> 1.3'
|
22
|
+
spec.add_development_dependency 'rake'
|
23
|
+
end
|
data/lib/bowdler.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'bowdler/rake'
|
2
|
+
|
3
|
+
module Bowdler
|
4
|
+
module BundlerInstaller
|
5
|
+
def self.included(base)
|
6
|
+
base.class_eval do
|
7
|
+
alias :old_run :run
|
8
|
+
|
9
|
+
def run(options)
|
10
|
+
result = old_run(options)
|
11
|
+
Bowdler::Rake.new(options).perform
|
12
|
+
result
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
data/lib/bowdler/rake.rb
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
require 'json'
|
2
|
+
require 'bowdler/simple_dsl'
|
3
|
+
|
4
|
+
module Bowdler
|
5
|
+
class Rake
|
6
|
+
DEPENDENCY_FILES = %w{Bowerfile}.freeze
|
7
|
+
|
8
|
+
def initialize(options)
|
9
|
+
@options = options
|
10
|
+
end
|
11
|
+
|
12
|
+
def dependency_file
|
13
|
+
entries = Dir.entries(Dir.pwd)
|
14
|
+
DEPENDENCY_FILES.detect { |file| entries.include?(file) }
|
15
|
+
end
|
16
|
+
|
17
|
+
def perform
|
18
|
+
case dependency_file
|
19
|
+
when 'Bowerfile' then perform_simple_dsl('Bowerfile')
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def perform_simple_dsl(file)
|
24
|
+
dsl = Bowdler::SimpleDsl.evalute(file)
|
25
|
+
|
26
|
+
dsl.write_bower_json
|
27
|
+
dsl.write_dotbowerrc
|
28
|
+
|
29
|
+
system(command)
|
30
|
+
system('bower list')
|
31
|
+
|
32
|
+
dsl.delete_bower_json
|
33
|
+
end
|
34
|
+
|
35
|
+
def update?
|
36
|
+
@options['update']
|
37
|
+
end
|
38
|
+
|
39
|
+
def command
|
40
|
+
if update?
|
41
|
+
'bower update'
|
42
|
+
else
|
43
|
+
'bower install'
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
require 'json'
|
2
|
+
|
3
|
+
module Bowdler
|
4
|
+
class SimpleDsl
|
5
|
+
|
6
|
+
def self.evalute(filename)
|
7
|
+
new.tap { |dsl| dsl.eval_file(File.join(dsl.root_path, filename)) }
|
8
|
+
end
|
9
|
+
|
10
|
+
attr_reader :bower_directory, :root_path
|
11
|
+
|
12
|
+
def initialize
|
13
|
+
@root_path = Dir.pwd
|
14
|
+
@assets = {}
|
15
|
+
@bower_directory = 'vendor'
|
16
|
+
end
|
17
|
+
|
18
|
+
def eval_file(file)
|
19
|
+
instance_eval(File.open(file, 'rb') { |f| f.read }, file.to_s)
|
20
|
+
end
|
21
|
+
|
22
|
+
def asset(name, version = 'latest')
|
23
|
+
@assets[name] = version
|
24
|
+
end
|
25
|
+
|
26
|
+
def assets_path(path)
|
27
|
+
@bower_directory = path
|
28
|
+
end
|
29
|
+
|
30
|
+
def generate_dotbowerrc
|
31
|
+
contents = JSON.parse(File.read(File.join(@root_path, '.bowerrc'))) rescue {}
|
32
|
+
contents['directory'] = @bower_directory
|
33
|
+
JSON.pretty_generate(contents)
|
34
|
+
end
|
35
|
+
|
36
|
+
def write_dotbowerrc
|
37
|
+
open(File.join(@root_path, '.bowerrc'), 'w') {|f| f.write(generate_dotbowerrc)}
|
38
|
+
end
|
39
|
+
|
40
|
+
def write_bower_json
|
41
|
+
open(File.join(@root_path, 'bower.json'), 'w') {|f| f.write(dependencies_to_json(@assets))}
|
42
|
+
end
|
43
|
+
|
44
|
+
def delete_bower_json
|
45
|
+
File.delete(File.join(@root_path, 'bower.json'))
|
46
|
+
end
|
47
|
+
|
48
|
+
def dependencies_to_json(data)
|
49
|
+
JSON.pretty_generate({
|
50
|
+
:name => 'bundler-bower generated',
|
51
|
+
:dependencies => data
|
52
|
+
})
|
53
|
+
end
|
54
|
+
|
55
|
+
def method_missing(*)
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'Integration test' do
|
4
|
+
let(:test_node) { TestNode.new(:gemfile => "#{directory}/Gemfile", :type => 'install') }
|
5
|
+
|
6
|
+
before { Dir.chdir(directory) { test_node.spawn } }
|
7
|
+
after { FileUtils.rm_rf("#{directory}/vendor") }
|
8
|
+
|
9
|
+
describe 'Bowerfile' do
|
10
|
+
let(:directory) { File.join(File.dirname(__FILE__), '../bowerfile') }
|
11
|
+
|
12
|
+
it 'download backbone' do
|
13
|
+
File.exist?("#{directory}/vendor/backbone/backbone.js").should be_true
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
describe 'Bowerfile with custom install path' do
|
18
|
+
let(:directory) { File.join(File.dirname(__FILE__), '../bowerfile_assets_path') }
|
19
|
+
|
20
|
+
it 'download backbone' do
|
21
|
+
File.exist?("#{directory}/vendor/assets/backbone/backbone.js").should be_true
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Bowdler
|
4
|
+
describe Rake do
|
5
|
+
let(:options) { {} }
|
6
|
+
subject { Rake.new(options) }
|
7
|
+
|
8
|
+
describe 'recognize dependency file' do
|
9
|
+
before { stub(Dir).entries(any_args) { files } }
|
10
|
+
|
11
|
+
context 'Bowerfile and Gemfile' do
|
12
|
+
let(:files) { ['Gemfile', 'Bowerfile', 'other-file' ].shuffle }
|
13
|
+
|
14
|
+
it 'returns Bowerfile' do
|
15
|
+
subject.dependency_file.should == 'Bowerfile'
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
describe 'during bundle (install)' do
|
21
|
+
describe '#update?' do
|
22
|
+
it 'returns false' do
|
23
|
+
subject.update?.should be_false
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
describe '#command' do
|
28
|
+
it "returns 'bower install'" do
|
29
|
+
subject.command.should == 'bower install'
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
describe 'during bundle update' do
|
35
|
+
let(:options) { {'update' => true} }
|
36
|
+
|
37
|
+
describe '#update?' do
|
38
|
+
it 'returns true' do
|
39
|
+
subject.update?.should be_true
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
describe '#command' do
|
44
|
+
it "returns 'bower install'" do
|
45
|
+
subject.command.should == 'bower update'
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -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 'bowdler'
|
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 << Bowdler
|
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,100 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: bowdler
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.5
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Rafael Belvederese
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-05-03 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.3'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.3'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
description: Create a Bowerfile alongside your Gemfile and just bundle.
|
42
|
+
email:
|
43
|
+
- rafael@blvz.im
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- .gitignore
|
49
|
+
- .travis.yml
|
50
|
+
- Gemfile
|
51
|
+
- LICENSE.txt
|
52
|
+
- README.md
|
53
|
+
- Rakefile
|
54
|
+
- bowdler.gemspec
|
55
|
+
- lib/bowdler.rb
|
56
|
+
- lib/bowdler/bundler_installer.rb
|
57
|
+
- lib/bowdler/rake.rb
|
58
|
+
- lib/bowdler/simple_dsl.rb
|
59
|
+
- lib/bowdler/version.rb
|
60
|
+
- spec/bowdler/integration_spec.rb
|
61
|
+
- spec/bowdler/rake_spec.rb
|
62
|
+
- spec/bowerfile/Bowerfile
|
63
|
+
- spec/bowerfile/Gemfile
|
64
|
+
- spec/bowerfile_assets_path/Bowerfile
|
65
|
+
- spec/bowerfile_assets_path/Gemfile
|
66
|
+
- spec/spec_helper.rb
|
67
|
+
- spec/support/test_node.rb
|
68
|
+
homepage: https://github.com/blvz/bowdler
|
69
|
+
licenses:
|
70
|
+
- MIT
|
71
|
+
metadata: {}
|
72
|
+
post_install_message:
|
73
|
+
rdoc_options: []
|
74
|
+
require_paths:
|
75
|
+
- lib
|
76
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
77
|
+
requirements:
|
78
|
+
- - '>='
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
version: '0'
|
81
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
82
|
+
requirements:
|
83
|
+
- - '>='
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0'
|
86
|
+
requirements: []
|
87
|
+
rubyforge_project:
|
88
|
+
rubygems_version: 2.0.3
|
89
|
+
signing_key:
|
90
|
+
specification_version: 4
|
91
|
+
summary: bower while you bundle.
|
92
|
+
test_files:
|
93
|
+
- spec/bowdler/integration_spec.rb
|
94
|
+
- spec/bowdler/rake_spec.rb
|
95
|
+
- spec/bowerfile/Bowerfile
|
96
|
+
- spec/bowerfile/Gemfile
|
97
|
+
- spec/bowerfile_assets_path/Bowerfile
|
98
|
+
- spec/bowerfile_assets_path/Gemfile
|
99
|
+
- spec/spec_helper.rb
|
100
|
+
- spec/support/test_node.rb
|