]> gitweb.fluxo.info Git - leap/leap_cli.git/commitdiff
clean up include paths, require newer rake version.
authorelijah <elijah@riseup.net>
Fri, 1 Mar 2013 03:50:53 +0000 (19:50 -0800)
committerelijah <elijah@riseup.net>
Fri, 1 Mar 2013 03:50:53 +0000 (19:50 -0800)
12 files changed:
Gemfile
Rakefile
bin/leap
leap_cli.gemspec
lib/leap_cli.rb
lib/leap_cli/load_paths.rb [new file with mode: 0644]
lib/leap_cli/version.rb
test/test_helper.rb
test/unit/command_line_test.rb
test/unit/config_object_list_test.rb
test/unit/config_object_test.rb
test/unit/test_helper.rb

diff --git a/Gemfile b/Gemfile
index b0b375c20bb83c2c6745011abe78af8ef051c9dd..9cf93297781859d7a6046899607b4608cda39eb6 100644 (file)
--- a/Gemfile
+++ b/Gemfile
@@ -1,33 +1,33 @@
 source :rubygems
 gemspec
 
-#
-# Specify support gems used that we might also develop locally.
-#
-# Available options:
-#
-# :dev_path - the development path of the gem. this path is used if running in 'development mode'.
-#
-# :vendor_path - where this gem is vendored. this path is used if it exists and we are running in 'production mode'
-#
-development_gems = {
-  'supply_drop' => {:dev_path => '../gems/supply_drop', :vendor_path => 'vendor/supply_drop'},
-  'certificate_authority' => {:dev_path => '../gems/certificate_authority', :vendor_path => 'vendor/certificate_authority'}
-}
+# #
+# Specify support gems used that we might also develop locally.
+# #
+# Available options:
+# #
+# :dev_path - the development path of the gem. this path is used if running in 'development mode'.
+# #
+# :vendor_path - where this gem is vendored. this path is used if it exists and we are running in 'production mode'
+# #
+development_gems = {
+  'supply_drop' => {:dev_path => '../gems/supply_drop', :vendor_path => 'vendor/supply_drop'},
+  'certificate_authority' => {:dev_path => '../gems/certificate_authority', :vendor_path => 'vendor/certificate_authority'}
+}
 
-#
-# A little bit of code to magically pick the correct gem
-#
+# #
+# A little bit of code to magically pick the correct gem
+# #
 
-mode = :production
+mode = :production
 
-gem_root = File.dirname(__FILE__)
-path_key = mode == :development ? :dev_path : :vendor_path
-development_gems.each do |gem_name, options|
-  path = File.expand_path(options[path_key], gem_root)
-  if File.directory?(path)
-    gem gem_name, :path => path
-  else
-    gem gem_name
-  end
-end
\ No newline at end of file
+gem_root = File.dirname(__FILE__)
+path_key = mode == :development ? :dev_path : :vendor_path
+development_gems.each do |gem_name, options|
+  path = File.expand_path(options[path_key], gem_root)
+  if File.directory?(path)
+    gem gem_name, :path => path
+  else
+    gem gem_name
+  end
+end
\ No newline at end of file
index e25ce305c62f2ba67e762955c720ca078c526809..fc23a32525ee46574d7d886a64df17c3e089f705 100644 (file)
--- a/Rakefile
+++ b/Rakefile
@@ -2,6 +2,7 @@ require "rubygems"
 require "pty"
 require "fileutils"
 require "rake/testtask"
+require 'paint'
 
 ##
 ## HELPER
@@ -27,11 +28,8 @@ $spec_path = 'leap_cli.gemspec'
 $base_dir  = File.dirname(__FILE__)
 $spec      = eval(File.read(File.join($base_dir, $spec_path)))
 $gem_path  = File.join($base_dir, 'pkg', "#{$spec.name}-#{$spec.version}.gem")
-require    File.join([$base_dir, 'lib','leap_cli','version.rb'])
-LeapCli::REQUIRE_PATHS.each do |path|
-  path = File.expand_path(path, $base_dir)
-  $LOAD_PATH.unshift path unless $LOAD_PATH.include?(path)
-end
+
+require File.join([$base_dir, 'lib','leap_cli','load_paths'])
 
 def built_gem_path
   Dir[File.join($base_dir, "#{$spec.name}-*.gem")].sort_by{|f| File.mtime(f)}.last
index d711dfedd111e8d7b9e228ed23fa30d498e99b5c..683959a47779cca86bd7e14b1a1a096ef4599519 100755 (executable)
--- a/bin/leap
+++ b/bin/leap
@@ -15,11 +15,7 @@ rescue LoadError
   #
   require 'rubygems'
   base_dir = File.expand_path('..', File.dirname(File.symlink?(__FILE__) ? File.readlink(__FILE__) : __FILE__))
-  require File.join([base_dir, 'lib','leap_cli','version.rb'])
-  LeapCli::REQUIRE_PATHS.each do |path|
-    path = File.expand_path(path, base_dir)
-    $LOAD_PATH.unshift path unless $LOAD_PATH.include?(path)
-  end
+  require File.join(base_dir, 'lib','leap_cli','load_paths')
   require 'leap_cli'
 end
 
index b9e1c296062ec3eb0e9d7a7c26be589237b47fd6..c01555e2b761ad2e29271afd459c7847beeb6527 100644 (file)
@@ -26,7 +26,7 @@ spec = Gem::Specification.new do |s|
   s.files += ["bin/leap"]
   s.files += `find vendor -name '*.rb'`.split("\n")
   s.files += `find vendor/vagrant_ssh_keys -name '*.pub' -o -name '*.key'`.split("\n")
-  s.require_paths += LeapCli::REQUIRE_PATHS
+  s.require_paths += LeapCli::LOAD_PATHS
   s.bindir = 'bin'
   s.executables << 'leap'
 
@@ -43,7 +43,7 @@ spec = Gem::Specification.new do |s|
   ##
 
   # test
-  s.add_development_dependency('rake')
+  s.add_development_dependency('rake', '>= 10.0.3')
   s.add_development_dependency('minitest')
   #s.add_development_dependency('rdoc')
   #s.add_development_dependency('aruba')
index 714211a188656c2df38593b6ea7a1e13987c8dbc..1921357539530e6a854ed752bcee261e2610a48b 100644 (file)
@@ -2,6 +2,7 @@ module LeapCli; end
 
 require 'leap_cli/version.rb'
 require 'leap_cli/requirements.rb'
+
 require 'leap_cli/leapfile.rb'
 require 'core_ext/hash'
 require 'core_ext/boolean'
diff --git a/lib/leap_cli/load_paths.rb b/lib/leap_cli/load_paths.rb
new file mode 100644 (file)
index 0000000..265a644
--- /dev/null
@@ -0,0 +1,15 @@
+#
+# Bundle and rubygems each have their own way of modifying $LOAD_PATH.
+#
+# We want to make sure that the right paths are loaded, including the
+# vendored gems, regardless of how leap is run.
+#
+#
+
+require File.expand_path('../version', __FILE__)
+
+base_leap_dir = File.expand_path('../../..', __FILE__)
+LeapCli::LOAD_PATHS.each do |path|
+  path = File.expand_path(path, base_leap_dir)
+  $LOAD_PATH.unshift(path) unless $LOAD_PATH.include?(path)
+end
\ No newline at end of file
index fa7ec92dc2b116e054e7767febf45be9e978fd72..baf3fe9278f05b6214a7d6e850cdd44f55bdecd6 100644 (file)
@@ -3,6 +3,6 @@ module LeapCli
     VERSION = '0.1.6'
     SUMMARY = 'Command line interface to the LEAP platform'
     DESCRIPTION = 'The command "leap" can be used to manage a bevy of servers running the LEAP platform from the comfort of your own home.'
-    REQUIRE_PATHS = ['lib', 'vendor/supply_drop/lib', 'vendor/certificate_authority/lib']
+    LOAD_PATHS = ['lib', 'vendor/supply_drop/lib', 'vendor/certificate_authority/lib']
   end
 end
index c75222b547d02087ae44ac4bc36fac24a528f7ce..a031caa53c29b22106c24ad667630d9d61d54475 100644 (file)
@@ -1,5 +1,5 @@
-$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/../lib')
 require 'rubygems'
+require File.expand_path('../../lib/leap_cli/load_paths', __FILE__)
 require 'minitest/autorun'
 require 'leap_cli'
 
index ec4c2d6a3e648c9293029f4c9f3e343eedc578f0..97a4042d30cb907b50527b3eebf763e421ce39a1 100644 (file)
@@ -1,4 +1,4 @@
-require File.expand_path('test_helper', File.dirname(__FILE__))
+require File.expand_path('../test_helper', __FILE__)
 
 class CommandLineTest < MiniTest::Unit::TestCase
 
index ecb6d4eafa0e14e16592da62ecf8b6a90cda47fd..122c6cd39ed8f3e14c741c26dcacebbfdaa326ea 100644 (file)
@@ -1,4 +1,4 @@
-require File.dirname(__FILE__) + '/test_helper'
+require File.expand_path('../test_helper', __FILE__)
 
 class ConfigObjectListTest < MiniTest::Unit::TestCase
 
index 79cf5967539d1138d9cf56e34968cc5458da8809..b50318afcbfed4e55eb6814fca77fac0f6c0296e 100644 (file)
@@ -1,4 +1,4 @@
-require File.expand_path('test_helper', File.dirname(__FILE__))
+require File.expand_path('../test_helper', __FILE__)
 
 class ConfigObjectTest < MiniTest::Unit::TestCase
 
index ade21a0ea0de451307f16e24ac4df7c7db859566..25a36de7ca8b229777869b22dff6bec78593baf1 100644 (file)
@@ -1 +1 @@
-require File.dirname(File.dirname(__FILE__)) + '/test_helper'
\ No newline at end of file
+require File.expand_path('../../test_helper', __FILE__)