obbistrano 1.1.19 → 1.1.20
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/obbistrano_tasks.rb +60 -56
- data/obbistrano.gemspec +1 -1
- metadata +1 -1
data/lib/obbistrano_tasks.rb
CHANGED
@@ -461,71 +461,75 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
461
461
|
|
462
462
|
end
|
463
463
|
|
464
|
-
end
|
465
464
|
|
465
|
+
namespace :bundle do
|
466
466
|
|
467
|
-
|
468
|
-
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
|
467
|
+
task :css do
|
468
|
+
paths = get_top_level_directories("#{deploy_to}/public/stylesheets")
|
469
|
+
paths << "#{deploy_to}/public/stylesheets/"
|
470
|
+
Dir.mkdir("#{deploy_to}/public/stylesheets/build") rescue ""
|
471
|
+
paths.each do |bundle_directory|
|
472
|
+
bundle_name = bundle_directory.gsub("#{deploy_to}/public/stylesheets/", "")
|
473
|
+
bundle_name ="common" if bundle_name.empty?
|
474
|
+
files = recursive_file_list(bundle_directory, ".css")
|
475
|
+
next if files.empty? || bundle_name == 'dev'
|
476
|
+
bundle = ''
|
477
|
+
files.each do |file_path|
|
478
|
+
bundle << File.read(file_path) << "\n"
|
479
|
+
end
|
480
|
+
target = "#{deploy_to}/public/stylesheets/build/#{bundle_name}_combined.css"
|
481
|
+
File.open(target, 'w') { |f| f.write(bundle) }
|
481
482
|
end
|
482
|
-
|
483
|
-
File.open(target, 'w') { |f| f.write(bundle) }
|
483
|
+
upload "#{deploy_to}/public/stylesheets/build", "#{deploy_to}/public/stylesheets/build"
|
484
484
|
end
|
485
|
-
|
486
|
-
|
487
|
-
|
488
|
-
|
489
|
-
|
490
|
-
|
491
|
-
|
492
|
-
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
|
485
|
+
|
486
|
+
task :js do
|
487
|
+
paths = get_top_level_directories("#{deploy_to}/public/javascripts")
|
488
|
+
paths << "#{deploy_to}/public/javascripts/"
|
489
|
+
Dir.mkdir("#{deploy_to}/public/javascripts/build") rescue ""
|
490
|
+
paths.each do |bundle_directory|
|
491
|
+
bundle_name = bundle_directory.gsub("#{deploy_to}/public/javascripts/", "")
|
492
|
+
bundle_name ="common" if bundle_name.empty?
|
493
|
+
files = recursive_file_list(bundle_directory, ".js")
|
494
|
+
next if files.empty? || bundle_name == 'dev'
|
495
|
+
bundle = ''
|
496
|
+
files.each do |file_path|
|
497
|
+
bundle << File.read(file_path) << "\n"
|
498
|
+
end
|
499
|
+
target = "#{deploy_to}/public/javascripts/build/#{bundle_name}_combined.css"
|
500
|
+
File.open(target, 'w') { |f| f.write(bundle) }
|
500
501
|
end
|
501
|
-
|
502
|
-
|
502
|
+
upload "#{deploy_to}/public/javascripts/build", "#{deploy_to}/public/javascripts/build"
|
503
|
+
|
503
504
|
end
|
504
|
-
|
505
|
-
|
506
|
-
|
507
|
-
|
508
|
-
|
509
|
-
|
510
|
-
|
511
|
-
|
512
|
-
|
513
|
-
|
514
|
-
|
515
|
-
else
|
516
|
-
next
|
505
|
+
|
506
|
+
require 'find'
|
507
|
+
def recursive_file_list(basedir, ext)
|
508
|
+
files = []
|
509
|
+
Find.find(basedir) do |path|
|
510
|
+
if FileTest.directory?(path)
|
511
|
+
if File.basename(path)[0] == ?. # Skip dot directories
|
512
|
+
Find.prune
|
513
|
+
else
|
514
|
+
next
|
515
|
+
end
|
517
516
|
end
|
517
|
+
files << path if File.extname(path) == ext
|
518
518
|
end
|
519
|
-
files
|
519
|
+
files.sort
|
520
|
+
end
|
521
|
+
|
522
|
+
def get_top_level_directories(base_path)
|
523
|
+
Dir.entries(base_path).collect do |path|
|
524
|
+
path = "#{base_path}/#{path}"
|
525
|
+
File.basename(path)[0] == ?. || !File.directory?(path) || File.basename(path)=="build" ? nil : path # not dot directories or files
|
526
|
+
end - [nil]
|
520
527
|
end
|
521
|
-
files.sort
|
522
|
-
end
|
523
528
|
|
524
|
-
def get_top_level_directories(base_path)
|
525
|
-
Dir.entries(base_path).collect do |path|
|
526
|
-
path = "#{base_path}/#{path}"
|
527
|
-
File.basename(path)[0] == ?. || !File.directory?(path) || File.basename(path)=="build" ? nil : path # not dot directories or files
|
528
|
-
end - [nil]
|
529
529
|
end
|
530
|
-
|
530
|
+
|
531
|
+
|
532
|
+
|
533
|
+
|
531
534
|
end
|
535
|
+
|
data/obbistrano.gemspec
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{obbistrano}
|
5
|
-
s.version = "1.1.
|
5
|
+
s.version = "1.1.20"
|
6
6
|
s.authors = ["Ross Riley", "One Black Bear"]
|
7
7
|
s.date = Time.now
|
8
8
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|