summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorelijah <elijah@riseup.net>2013-02-28 19:50:53 -0800
committerelijah <elijah@riseup.net>2013-02-28 19:50:53 -0800
commite9a8318dc42146209e4acecc93c4ff62ab6feb7c (patch)
tree4fb6cef95626b708e04b6da93c7b0be7f0fe5718
parent56a42b9858058473a07f254c49d0bb00dadce2d9 (diff)
clean up include paths, require newer rake version.
-rw-r--r--Gemfile54
-rw-r--r--Rakefile8
-rwxr-xr-xbin/leap6
-rw-r--r--leap_cli.gemspec4
-rw-r--r--lib/leap_cli.rb1
-rw-r--r--lib/leap_cli/load_paths.rb15
-rw-r--r--lib/leap_cli/version.rb2
-rw-r--r--test/test_helper.rb2
-rw-r--r--test/unit/command_line_test.rb2
-rw-r--r--test/unit/config_object_list_test.rb2
-rw-r--r--test/unit/config_object_test.rb2
-rw-r--r--test/unit/test_helper.rb2
12 files changed, 55 insertions, 45 deletions
diff --git a/Gemfile b/Gemfile
index b0b375c..9cf9329 100644
--- 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
diff --git a/Rakefile b/Rakefile
index e25ce30..fc23a32 100644
--- 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
diff --git a/bin/leap b/bin/leap
index d711dfe..683959a 100755
--- 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
diff --git a/leap_cli.gemspec b/leap_cli.gemspec
index b9e1c29..c01555e 100644
--- a/leap_cli.gemspec
+++ b/leap_cli.gemspec
@@ -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')
diff --git a/lib/leap_cli.rb b/lib/leap_cli.rb
index 714211a..1921357 100644
--- a/lib/leap_cli.rb
+++ b/lib/leap_cli.rb
@@ -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
index 0000000..265a644
--- /dev/null
+++ b/lib/leap_cli/load_paths.rb
@@ -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
diff --git a/lib/leap_cli/version.rb b/lib/leap_cli/version.rb
index fa7ec92..baf3fe9 100644
--- a/lib/leap_cli/version.rb
+++ b/lib/leap_cli/version.rb
@@ -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
diff --git a/test/test_helper.rb b/test/test_helper.rb
index c75222b..a031caa 100644
--- a/test/test_helper.rb
+++ b/test/test_helper.rb
@@ -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'
diff --git a/test/unit/command_line_test.rb b/test/unit/command_line_test.rb
index ec4c2d6..97a4042 100644
--- a/test/unit/command_line_test.rb
+++ b/test/unit/command_line_test.rb
@@ -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
diff --git a/test/unit/config_object_list_test.rb b/test/unit/config_object_list_test.rb
index ecb6d4e..122c6cd 100644
--- a/test/unit/config_object_list_test.rb
+++ b/test/unit/config_object_list_test.rb
@@ -1,4 +1,4 @@
-require File.dirname(__FILE__) + '/test_helper'
+require File.expand_path('../test_helper', __FILE__)
class ConfigObjectListTest < MiniTest::Unit::TestCase
diff --git a/test/unit/config_object_test.rb b/test/unit/config_object_test.rb
index 79cf596..b50318a 100644
--- a/test/unit/config_object_test.rb
+++ b/test/unit/config_object_test.rb
@@ -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
diff --git a/test/unit/test_helper.rb b/test/unit/test_helper.rb
index ade21a0..25a36de 100644
--- a/test/unit/test_helper.rb
+++ b/test/unit/test_helper.rb
@@ -1 +1 @@
-require File.dirname(File.dirname(__FILE__)) + '/test_helper' \ No newline at end of file
+require File.expand_path('../../test_helper', __FILE__)