File tree Expand file tree Collapse file tree 3 files changed +24
-10
lines changed Expand file tree Collapse file tree 3 files changed +24
-10
lines changed Original file line number Diff line number Diff line change @@ -81,8 +81,8 @@ def final_assets_path
81
81
end
82
82
83
83
def group_assets_path group
84
- group_options = Hash === group . last ? group . pop : { }
85
- group_options [ :assets_path ] || @assets_path
84
+ group_options = Hash === group . last ? group . last : { :assets_path => @assets_path }
85
+ group_options [ :assets_path ]
86
86
end
87
87
88
88
private
Original file line number Diff line number Diff line change @@ -6,12 +6,20 @@ module BowerRails
6
6
class Railtie < Rails ::Railtie
7
7
railtie_name :bower
8
8
9
- BowerRails ::Dsl . config = { :root_path => Rails . root }
10
- dsl = BowerRails ::Dsl . evalute ( File . join ( "Jsfile" ) )
9
+ if File . exist? ( File . join ( "Jsfile" ) )
10
+ BowerRails ::Dsl . config = { :root_path => Rails . root }
11
+ dsl = BowerRails ::Dsl . evalute ( File . join ( "Jsfile" ) )
11
12
12
- config . after_initialize do |app |
13
- dsl . final_assets_path . map do |assets_root , assets_path |
14
- app . config . assets . paths << Rails . root . join ( assets_root , assets_path , "bower_components" )
13
+ config . before_initialize do |app |
14
+ dsl . final_assets_path . map do |assets_root , assets_path |
15
+ app . config . assets . paths << Rails . root . join ( assets_root , assets_path , "bower_components" )
16
+ end
17
+ end
18
+ else
19
+ config . before_initialize do |app |
20
+ [ "lib" , "vendor" ] . each do |dir |
21
+ app . config . assets . paths << Rails . root . join ( dir , 'assets' , 'bower_components' )
22
+ end
15
23
end
16
24
end
17
25
Original file line number Diff line number Diff line change @@ -84,17 +84,23 @@ def perform_command remove_components = true
84
84
FileUtils . rm_rf ( "bower_components" ) if remove_components
85
85
86
86
#create bower json
87
- File . open ( "bower.json" , "w" ) do |f |
87
+ File . open ( "bower.json" , "w" ) do |f |
88
88
f . write ( data . to_json )
89
89
end
90
90
91
+ #create .bowerrc
92
+ File . open ( ".bowerrc" , "w" ) do |f |
93
+ f . write ( JSON . pretty_generate ( { :directory => "bower_components" } ) )
94
+ end
95
+
91
96
#run command
92
97
yield
93
98
94
99
#remove bower file
95
100
FileUtils . rm ( "bower.json" )
96
101
97
- end if data
98
-
102
+ #remove .bowerrc
103
+ FileUtils . rm ( ".bowerrc" )
104
+ end if data && !data [ "dependencies" ] . empty?
99
105
end
100
106
end
You can’t perform that action at this time.
0 commit comments