Add some loading changes

Joel AZEMAR committed Apr 22, 2014
commit 57edc8b4219a99bc454be7c4c48d5d85fa48dc36
Showing 4 changed files with 15 additions and 12 deletions
Rakefile +1 -2
@@ @@ -4,7 +4,6 @@ require 'bundler/gem_tasks'
require 'vcr'
require 'rspec'
- require 'rspec/core/rake_task'
require 'locomotive/wagon'
require 'locomotive/wagon/version'
@@ @@ -27,6 +26,6 @@ namespace :development do
end
end
+ require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new('spec')
-
task default: :spec
bin/wagon +7 -2
@@ @@ -1,6 +1,11 @@
+ #!/usr/bin/env ruby
+
+ require 'rubygems'
+ require 'bundler/setup'
+
$stdout.sync = true
- require_relative 'locomotive/wagon'
- require_relative 'locomotive/wagon/cli'
+ require_relative '../lib/locomotive/wagon'
+ require_relative '../lib/locomotive/wagon/cli'
Locomotive::Wagon::CLI::Main.start
locomotive/wagon.rb b/lib/locomotive/wagon.rb +5 -7
@@ @@ -1,4 +1,8 @@
+ require 'rubygems'
+ require 'bundler/setup'
+
require 'common'
+
require 'locomotive/wagon/initializers'
require 'locomotive/wagon/version'
require 'locomotive/wagon/listen'
@@ @@ -32,7 +36,6 @@ module Locomotive
def self.serve(path, options)
if reader = self.require_mounter(path, true)
- Bundler.require 'misc'
require 'locomotive/steam/server'
app = Locomotive::Steam::Server.new(reader)
@@ @@ -80,7 +83,6 @@ module Locomotive
# @param [ Array ] *args The arguments for the generator
#
def self.generate(name, *args)
- Bundler.require 'misc'
lib = "locomotive/wagon/generators/#{name}"
require lib
@@ @@ -101,7 +103,6 @@ module Locomotive
reader.mounting_point.site.domains = connection_info['domains'] if connection_info["domains"]
reader.mounting_point.site.subdomain = connection_info['subdomain'] if connection_info["subdomain"]
require 'bundler'
- Bundler.require 'misc'
writer = Locomotive::Mounter::Writer::Api.instance
self.validate_resources(options[:resources], writer.writers)
@@ @@ -125,8 +126,6 @@ module Locomotive
def self.pull(path, connection_info, options = {})
self.require_mounter(path)
- Bundler.require 'misc' unless options[:disable_misc]
-
connection_info[:uri] = "#{connection_info.delete(:host)}/locomotive/api"
_options = { console: true }.merge(options).symbolize_keys
@@ @@ -190,9 +189,7 @@ module Locomotive
#
def self.require_mounter(path, get_reader = false)
Locomotive::Common::Logger.setup(File.expand_path(File.join(path, 'log', 'wagon.log')))
-
require 'locomotive/mounter'
-
Locomotive::Mounter.logger = Locomotive::Common::Logger.instance.logger
if get_reader
@@ @@ -207,6 +204,7 @@ module Locomotive
end
protected
+
def self.validate_resources(resources, writers_or_readers)
return if resources.nil?
valid_resources = writers_or_readers.map { |thing| thing.to_s.demodulize.gsub(/Writer$|Reader$/, '').underscore }
spec/integration/cli/push_spec.rb +2 -1
@@ @@ -9,6 +9,7 @@ describe Locomotive::Wagon::CLI do
deploy = YAML.load_file('site/config/deploy.yml')
deploy["staging"] = deploy["production"].merge("domains" => ["staging.example.com"], "subdomain" => "staging", "host" => "staging.example.com:3000")
File.write('site/config/deploy.yml', deploy.to_yaml)
+
VCR.use_cassette("staging") do
Locomotive::Wagon::CLI::Main.start(['push', 'staging', 'site', '-f'])
end
@@ @@ -16,4 +17,4 @@ describe Locomotive::Wagon::CLI do
WebMock.should_not have_requested(:put, /sites\/.+.json\?auth_token=.+/).with(body: /site\[subdomain\]=sample/)
WebMock.should have_requested(:put, /sites\/.+.json\?auth_token=.+/).with(body: /site\[subdomain\]=staging&site\[domains\]\[\]=staging.example.com/).once
end
- end
\ No newline at end of file
+ end