bower 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +5 -6
- data/Gemfile +4 -2
- data/README.md +14 -10
- data/lib/bower/environment.rb +2 -2
- data/lib/bower/version.rb +1 -1
- data/lib/generators/bower/install_generator.rb +3 -3
- data/lib/generators/templates/{component.json → bower.json} +1 -0
- data/lib/generators/templates/bowerrc +2 -4
- data/spec/bower/environment_spec.rb +2 -2
- data/spec/dummy/.bowerrc +2 -4
- data/spec/dummy/{components/component.json → bower_components/bower.json} +0 -0
- data/spec/dummy/{components → bower_components}/coolio/component.json +0 -0
- data/spec/dummy/{components → bower_components}/coolio/coolio.js +0 -0
- data/spec/dummy/config/database.yml +3 -3
- data/spec/dummy/config/initializers/session_store.rb +1 -1
- data/spec/dummy/config/initializers/wrap_parameters.rb +1 -1
- data/spec/generators/bower/install_generator_spec.rb +4 -4
- metadata +11 -11
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
@@ -12,11 +12,13 @@ end
|
|
12
12
|
group :test do
|
13
13
|
gem 'json', :platforms => :ruby_18
|
14
14
|
gem 'rspec-rails'
|
15
|
-
gem 'capybara'
|
15
|
+
gem 'capybara', '~> 2.0'
|
16
16
|
gem 'jquery-rails'
|
17
17
|
gem "sprockets", "2.2.2.backport1"
|
18
18
|
gem 'rails', '~> 3.2.12'
|
19
|
-
gem
|
19
|
+
gem "sqlite3", :platform => [:ruby, :mswin, :mingw]
|
20
|
+
gem "jdbc-sqlite3", :platform => :jruby
|
21
|
+
gem 'activerecord-jdbcsqlite3-adapter', :platform => :jruby
|
20
22
|
gem 'generator_spec'
|
21
23
|
gem 'simplecov', :require => false
|
22
24
|
end
|
data/README.md
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# Bower
|
2
|
+
[![Gem Version](https://badge.fury.io/rb/bower.png)][gem] [![Build Status](https://travis-ci.org/spagalloco/bower.png?branch=master)][travis]
|
2
3
|
|
3
|
-
[Bower](http://
|
4
|
+
[Bower](http://bower.io) integration for your ruby apps.
|
4
5
|
|
5
6
|
## Usage with Sprockets
|
6
7
|
|
@@ -12,7 +13,7 @@ Add `bower` to your application's Gemfile:
|
|
12
13
|
gem 'bower'
|
13
14
|
```
|
14
15
|
|
15
|
-
Rails 4 ships with an updated version of Sprockets that supports bower's `
|
16
|
+
Rails 4 ships with an updated version of Sprockets that supports bower's `bower.json` file. If you are running, Rails 3, then you need to require Sprockets [`2.2.2.backport1`](http://rubygems.org/gems/sprockets/versions/2.2.2.backport1):
|
16
17
|
|
17
18
|
```ruby
|
18
19
|
gem 'sprockets', '2.2.2.backport1'
|
@@ -22,19 +23,17 @@ The gem includes a generator that sets up your project:
|
|
22
23
|
|
23
24
|
rails generate bower:install
|
24
25
|
|
25
|
-
This will install a `.bowerrc`
|
26
|
+
This will install a configuration file (`.bowerrc`) in your project's root. The configuration file tells bower where to install components and where it expects `bower.json`.
|
26
27
|
|
27
28
|
```json
|
28
29
|
{
|
29
|
-
"
|
30
|
-
"
|
31
|
-
"endpoint" : "https://bower.herokuapp.com",
|
32
|
-
"searchpath" : []
|
30
|
+
"cwd" : "."
|
31
|
+
"directory" : "bower_components"
|
33
32
|
}
|
34
33
|
|
35
34
|
```
|
36
35
|
|
37
|
-
Add your dependencies to `
|
36
|
+
Add your dependencies to `bower.json` then use bower (`bower install`, etc.) as you would in any other project.
|
38
37
|
|
39
38
|
### Non-Rails Projects
|
40
39
|
|
@@ -50,7 +49,9 @@ environment.append_path Bower.environment.directory
|
|
50
49
|
|
51
50
|
## How this gem differs from other techniques
|
52
51
|
|
53
|
-
For Rails apps, integrating bower components into `lib/assets` and/or `vendor/assets` seems like the wrong approach. Since bower can support multiple searchpaths, the need to make a distinction between external dependencies and frameworks does not exist. It can all be managed in once place. This gem takes a more opinionated approach and installs components to `
|
52
|
+
For Rails apps, integrating bower components into `lib/assets` and/or `vendor/assets` seems like the wrong approach. Since bower can support multiple searchpaths, the need to make a distinction between external dependencies and frameworks does not exist. It can all be managed in once place. This gem takes a more opinionated approach and installs components to `bower_components/` in your project's root by default. You can always change it to another location.
|
53
|
+
|
54
|
+
If this approach isn't to your liking, you may want to take a look at [`bower-rails`](https://github.com/rharriso/bower-rails/).
|
54
55
|
|
55
56
|
## TODO
|
56
57
|
|
@@ -58,8 +59,11 @@ When used with Sprockets, you still need to use a `require` directive in order t
|
|
58
59
|
|
59
60
|
## Contributing
|
60
61
|
|
61
|
-
Pull requests welcome: fork, make a topic branch, commit (squash when possible) *with tests* and I'll happily consider.
|
62
|
+
Pull requests welcome: fork, make a topic branch, commit (squash when possible) *with tests* and I'll happily consider merging your contributions.
|
62
63
|
|
63
64
|
## Copyright
|
64
65
|
|
65
66
|
Copyright (c) 2013 Steve Agalloco. See [LICENSE](LICENSE.md) for details.
|
67
|
+
|
68
|
+
[gem]: https://rubygems.org/gems/bower
|
69
|
+
[travis]: http://travis-ci.org/spagalloco/bower
|
data/lib/bower/environment.rb
CHANGED
@@ -4,8 +4,8 @@ module Bower
|
|
4
4
|
class Environment
|
5
5
|
attr_accessor :directory, :json
|
6
6
|
|
7
|
-
DEFAULT_DIRECTORY = '
|
8
|
-
DEFAULT_JSON = '
|
7
|
+
DEFAULT_DIRECTORY = 'bower_components'
|
8
|
+
DEFAULT_JSON = 'bower.json'
|
9
9
|
|
10
10
|
def self.setup(bowerrc=nil)
|
11
11
|
if bowerrc && File.exists?(bowerrc)
|
data/lib/bower/version.rb
CHANGED
@@ -5,14 +5,14 @@ module Bower
|
|
5
5
|
class InstallGenerator < Rails::Generators::Base
|
6
6
|
source_root File.expand_path("../../templates", __FILE__)
|
7
7
|
|
8
|
-
desc "Creates a
|
8
|
+
desc "Creates a local configuration file and the default JSON file for Bower to use in your application."
|
9
9
|
|
10
10
|
def create_components_directory
|
11
|
-
empty_directory '
|
11
|
+
empty_directory 'bower_components'
|
12
12
|
end
|
13
13
|
|
14
14
|
def copy_component_json
|
15
|
-
copy_file '
|
15
|
+
copy_file 'bower.json', 'bower.json'
|
16
16
|
end
|
17
17
|
|
18
18
|
def copy_config
|
@@ -17,11 +17,11 @@ describe Bower::Environment do
|
|
17
17
|
subject { Bower::Environment.setup }
|
18
18
|
|
19
19
|
it 'uses a default directory' do
|
20
|
-
expect(subject.directory).to eq('
|
20
|
+
expect(subject.directory).to eq('bower_components')
|
21
21
|
end
|
22
22
|
|
23
23
|
it 'uses a default json' do
|
24
|
-
expect(subject.json).to eq('
|
24
|
+
expect(subject.json).to eq('bower.json')
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
data/spec/dummy/.bowerrc
CHANGED
File without changes
|
File without changes
|
File without changes
|
@@ -5,7 +5,7 @@
|
|
5
5
|
# gem 'sqlite3'
|
6
6
|
development:
|
7
7
|
adapter: sqlite3
|
8
|
-
database:
|
8
|
+
database: ":memory:"
|
9
9
|
pool: 5
|
10
10
|
timeout: 5000
|
11
11
|
|
@@ -14,12 +14,12 @@ development:
|
|
14
14
|
# Do not set this db to the same as development or production.
|
15
15
|
test:
|
16
16
|
adapter: sqlite3
|
17
|
-
database:
|
17
|
+
database: ":memory:"
|
18
18
|
pool: 5
|
19
19
|
timeout: 5000
|
20
20
|
|
21
21
|
production:
|
22
22
|
adapter: sqlite3
|
23
|
-
database:
|
23
|
+
database: ":memory:"
|
24
24
|
pool: 5
|
25
25
|
timeout: 5000
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# Be sure to restart your server when you modify this file.
|
2
2
|
|
3
|
-
Dummy::Application.config.session_store :cookie_store, key
|
3
|
+
Dummy::Application.config.session_store :cookie_store, :key => '_dummy_session'
|
4
4
|
|
5
5
|
# Use the database for sessions instead of the cookie-based default,
|
6
6
|
# which shouldn't be used to store highly confidential information
|
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
|
7
7
|
ActiveSupport.on_load(:action_controller) do
|
8
|
-
wrap_parameters format
|
8
|
+
wrap_parameters :format => [:json]
|
9
9
|
end
|
10
10
|
|
11
11
|
# Disable root element in JSON by default.
|
@@ -10,12 +10,12 @@ describe Bower::Generators::InstallGenerator do
|
|
10
10
|
run_generator
|
11
11
|
end
|
12
12
|
|
13
|
-
it 'creates a
|
14
|
-
assert_directory '
|
13
|
+
it 'creates a bower_components directory' do
|
14
|
+
assert_directory 'bower_components'
|
15
15
|
end
|
16
16
|
|
17
|
-
it "creates a template
|
18
|
-
assert_file "
|
17
|
+
it "creates a template bower.json" do
|
18
|
+
assert_file "bower.json"
|
19
19
|
end
|
20
20
|
|
21
21
|
it "creates a configuration file" do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bower
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-10-07 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: Bower integration for your ruby projects.
|
15
15
|
email: steve.agalloco@gmail.com
|
@@ -33,8 +33,8 @@ files:
|
|
33
33
|
- lib/bower/railtie.rb
|
34
34
|
- lib/bower/version.rb
|
35
35
|
- lib/generators/bower/install_generator.rb
|
36
|
+
- lib/generators/templates/bower.json
|
36
37
|
- lib/generators/templates/bowerrc
|
37
|
-
- lib/generators/templates/component.json
|
38
38
|
- spec/bower/environment_spec.rb
|
39
39
|
- spec/bower_spec.rb
|
40
40
|
- spec/dummy/.bowerrc
|
@@ -49,9 +49,9 @@ files:
|
|
49
49
|
- spec/dummy/app/models/.gitkeep
|
50
50
|
- spec/dummy/app/views/layouts/application.html.erb
|
51
51
|
- spec/dummy/app/views/static/home.html.erb
|
52
|
-
- spec/dummy/
|
53
|
-
- spec/dummy/
|
54
|
-
- spec/dummy/
|
52
|
+
- spec/dummy/bower_components/bower.json
|
53
|
+
- spec/dummy/bower_components/coolio/component.json
|
54
|
+
- spec/dummy/bower_components/coolio/coolio.js
|
55
55
|
- spec/dummy/config.ru
|
56
56
|
- spec/dummy/config/application.rb
|
57
57
|
- spec/dummy/config/boot.rb
|
@@ -94,7 +94,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
94
94
|
version: '0'
|
95
95
|
segments:
|
96
96
|
- 0
|
97
|
-
hash: -
|
97
|
+
hash: -1653597180272781858
|
98
98
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
99
99
|
none: false
|
100
100
|
requirements:
|
@@ -103,7 +103,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
103
103
|
version: '0'
|
104
104
|
segments:
|
105
105
|
- 0
|
106
|
-
hash: -
|
106
|
+
hash: -1653597180272781858
|
107
107
|
requirements: []
|
108
108
|
rubyforge_project:
|
109
109
|
rubygems_version: 1.8.23
|
@@ -125,9 +125,9 @@ test_files:
|
|
125
125
|
- spec/dummy/app/models/.gitkeep
|
126
126
|
- spec/dummy/app/views/layouts/application.html.erb
|
127
127
|
- spec/dummy/app/views/static/home.html.erb
|
128
|
-
- spec/dummy/
|
129
|
-
- spec/dummy/
|
130
|
-
- spec/dummy/
|
128
|
+
- spec/dummy/bower_components/bower.json
|
129
|
+
- spec/dummy/bower_components/coolio/component.json
|
130
|
+
- spec/dummy/bower_components/coolio/coolio.js
|
131
131
|
- spec/dummy/config.ru
|
132
132
|
- spec/dummy/config/application.rb
|
133
133
|
- spec/dummy/config/boot.rb
|