obbistrano 1.1.15 → 1.1.17

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.
@@ -113,8 +113,8 @@ Capistrano::Configuration.instance(:must_exist).load do
113
113
  deploy_check
114
114
  php_wax_deploy if defined? "#{phpwax}"
115
115
  cms_deploy if defined? "#{cms}"
116
- css_build
117
- js_build
116
+ bundle.css
117
+ bundle.js
118
118
  end
119
119
 
120
120
  task :deploy_check do
@@ -286,28 +286,22 @@ Capistrano::Configuration.instance(:must_exist).load do
286
286
 
287
287
  desc "Restarts the web server."
288
288
  task :restart do
289
- detect_os
290
- s_namespace = eval(server_type)
291
- s_namespace.restart
289
+ fedora.restart
292
290
  end
293
291
 
294
292
  desc "Creates a new Apache VHost."
295
293
  task :vhost do
296
294
  config_check
297
295
  needs_root
298
- detect_os
299
- s_namespace = eval(server_type)
300
- s_namespace.vhost
301
- s_namespace.restart
296
+ fedora.vhost
297
+ fedora.restart
302
298
  end
303
299
 
304
300
  desc "Sets up a new user."
305
301
  task :setup_user do
306
302
  config_check
307
303
  needs_root
308
- detect_os
309
- s_namespace = eval(server_type)
310
- s_namespace.setup_user
304
+ fedora.setup_user
311
305
  end
312
306
 
313
307
  desc "Creates or gets an ssh key for the application"
@@ -376,20 +370,6 @@ Capistrano::Configuration.instance(:must_exist).load do
376
370
  setup_user
377
371
  end
378
372
  end
379
-
380
- task :detect_os do
381
- logger.level = -1
382
- with_user("root", "#{root_pass}") do
383
- begin
384
- run "cat /etc/fedora-release"
385
- set :server_type, "fedora"
386
- rescue
387
- run "cat /etc/debian_version"
388
- set :server_type, "ubuntu"
389
- end
390
- end
391
- logger.level = 2
392
- end
393
373
 
394
374
  end
395
375
 
@@ -457,7 +437,7 @@ Capistrano::Configuration.instance(:must_exist).load do
457
437
 
458
438
  task :restart do
459
439
  with_user("root", "#{root_pass}") do
460
- run "/etc/rc.d/init.d/httpd restart"
440
+ run "/etc/init.d/httpd restart"
461
441
  end
462
442
  end
463
443
 
@@ -484,5 +464,68 @@ Capistrano::Configuration.instance(:must_exist).load do
484
464
  end
485
465
 
486
466
 
467
+ namespace :bundle do
468
+
469
+ task :css do
470
+ paths = get_top_level_directories("#{deploy_to}/public/stylesheets")
471
+ paths << "#{deploy_to}/public/stylesheets/"
472
+ Dir.mkdir("#{deploy_to}/public/stylesheets/build") rescue ""
473
+ paths.each do |bundle_directory|
474
+ bundle_name = bundle_directory.gsub("#{deploy_to}/public/stylesheets/", "")
475
+ bundle_name ="common" if bundle_name.empty?
476
+ files = recursive_file_list(bundle_directory, ".css")
477
+ next if files.empty? || bundle_name == 'dev'
478
+ bundle = ''
479
+ files.each do |file_path|
480
+ bundle << File.read(file_path) << "\n"
481
+ end
482
+ target = "#{deploy_to}/public/stylesheets/build/#{bundle_name}_combined.css"
483
+ File.open(target, 'w') { |f| f.write(bundle) }
484
+ end
485
+ upload "#{deploy_to}/public/stylesheets/build", "#{deploy_to}/public/stylesheets/build"
486
+ end
487
+
488
+ task :js do
489
+ paths = get_top_level_directories("#{deploy_to}/public/javascripts")
490
+ paths << "#{deploy_to}/public/javascripts/"
491
+ Dir.mkdir("#{deploy_to}/public/javascripts/build") rescue ""
492
+ paths.each do |bundle_directory|
493
+ bundle_name = bundle_directory.gsub("#{deploy_to}/public/javascripts/", "")
494
+ bundle_name ="common" if bundle_name.empty?
495
+ files = recursive_file_list(bundle_directory, ".js")
496
+ next if files.empty? || bundle_name == 'dev'
497
+ bundle = ''
498
+ files.each do |file_path|
499
+ bundle << File.read(file_path) << "\n"
500
+ end
501
+ target = "#{deploy_to}/public/javascripts/build/#{bundle_name}_combined.css"
502
+ File.open(target, 'w') { |f| f.write(bundle) }
503
+ end
504
+ upload "#{deploy_to}/public/javascripts/build", "#{deploy_to}/public/javascripts/build"
505
+
506
+ end
507
+
508
+ require 'find'
509
+ def recursive_file_list(basedir, ext)
510
+ files = []
511
+ Find.find(basedir) do |path|
512
+ if FileTest.directory?(path)
513
+ if File.basename(path)[0] == ?. # Skip dot directories
514
+ Find.prune
515
+ else
516
+ next
517
+ end
518
+ end
519
+ files << path if File.extname(path) == ext
520
+ end
521
+ files.sort
522
+ end
487
523
 
488
-
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
+ end
530
+
531
+ end
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.15"
5
+ s.version = "1.1.17"
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=
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: obbistrano
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.15
4
+ version: 1.1.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ross Riley
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2009-11-12 00:00:00 +00:00
13
+ date: 2009-12-15 00:00:00 +00:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency