get development working with bundler
This commit is contained in:
parent
f170d5ada2
commit
3e0365b8e5
1
.gitignore
vendored
1
.gitignore
vendored
@ -6,5 +6,6 @@ pkg/*
|
||||
Manifest
|
||||
*.gemspec
|
||||
tmp/*
|
||||
.bundle/*
|
||||
|
||||
|
||||
|
14
Gemfile
14
Gemfile
@ -1,7 +1,9 @@
|
||||
gem 'rainbow'
|
||||
|
||||
group :test do
|
||||
gem 'rspec'
|
||||
gem 'autotest'
|
||||
gem 'mocha'
|
||||
end
|
||||
gem 'echoe'
|
||||
gem 'rspec'
|
||||
gem 'autotest'
|
||||
gem 'mocha'
|
||||
gem 'reek'
|
||||
gem 'sdoc'
|
||||
gem 'sdoc-helpers', :require => 'sdoc_helpers'
|
||||
gem 'rdiscount'
|
||||
|
57
Gemfile.lock
Normal file
57
Gemfile.lock
Normal file
@ -0,0 +1,57 @@
|
||||
GEM
|
||||
specs:
|
||||
autotest (4.4.1)
|
||||
diff-lcs (1.1.2)
|
||||
echoe (4.3.1)
|
||||
gemcutter
|
||||
rubyforge
|
||||
gemcutter (0.6.1)
|
||||
json (1.4.6)
|
||||
json_pure (1.4.3)
|
||||
mocha (0.9.8)
|
||||
rake
|
||||
rainbow (1.1)
|
||||
rake (0.8.7)
|
||||
rdiscount (1.6.5)
|
||||
rdoc (2.4.3)
|
||||
reek (1.2.8)
|
||||
ruby2ruby (~> 1.2)
|
||||
ruby_parser (~> 2.0)
|
||||
sexp_processor (~> 3.0)
|
||||
rspec (2.0.1)
|
||||
rspec-core (~> 2.0.1)
|
||||
rspec-expectations (~> 2.0.1)
|
||||
rspec-mocks (~> 2.0.1)
|
||||
rspec-core (2.0.1)
|
||||
rspec-expectations (2.0.1)
|
||||
diff-lcs (>= 1.1.2)
|
||||
rspec-mocks (2.0.1)
|
||||
rspec-core (~> 2.0.1)
|
||||
rspec-expectations (~> 2.0.1)
|
||||
ruby2ruby (1.2.4)
|
||||
ruby_parser (~> 2.0)
|
||||
sexp_processor (~> 3.0)
|
||||
ruby_parser (2.0.4)
|
||||
sexp_processor (~> 3.0)
|
||||
rubyforge (2.0.4)
|
||||
json_pure (>= 1.1.7)
|
||||
sdoc (0.2.20)
|
||||
json (>= 1.1.3)
|
||||
rdoc (= 2.4.3)
|
||||
sdoc-helpers (0.1.4)
|
||||
sdoc (~> 0.2)
|
||||
sexp_processor (3.0.4)
|
||||
|
||||
PLATFORMS
|
||||
ruby
|
||||
|
||||
DEPENDENCIES
|
||||
autotest
|
||||
echoe
|
||||
mocha
|
||||
rainbow
|
||||
rdiscount
|
||||
reek
|
||||
rspec
|
||||
sdoc
|
||||
sdoc-helpers
|
16
Rakefile
16
Rakefile
@ -1,13 +1,15 @@
|
||||
require 'rubygems'
|
||||
require 'bundler'
|
||||
|
||||
Bundler.require(:default)
|
||||
|
||||
$LOAD_PATH << 'lib'
|
||||
|
||||
require 'rubygems'
|
||||
require 'yaml'
|
||||
|
||||
require 'apache'
|
||||
require 'spec/rake/spectask'
|
||||
require 'sdoc'
|
||||
require 'rspec/core/rake_task'
|
||||
require 'sdoc_helpers/markdown'
|
||||
require 'echoe'
|
||||
|
||||
namespace :apache do
|
||||
desc "Generate the configs"
|
||||
@ -28,11 +30,11 @@ end
|
||||
|
||||
namespace :spec do
|
||||
desc "Run RCov tests"
|
||||
Spec::Rake::SpecTask.new('rcov') do |t|
|
||||
t.spec_files = FileList['spec/*.rb']
|
||||
RSpec::Core::RakeTask.new(:rcov) do |t|
|
||||
t.pattern = 'spec/*.rb'
|
||||
t.rcov = true
|
||||
t.rcov_opts = ['--exclude', 'spec', '--exclude', 'gems']
|
||||
t.spec_opts = ['-b']
|
||||
t.rspec_opts = ['-b']
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -4,6 +4,7 @@ require 'bundler'
|
||||
Bundler.require(:default)
|
||||
|
||||
require 'fileutils'
|
||||
require 'rainbow'
|
||||
|
||||
Dir[File.join(File.dirname(__FILE__), '*.rb')].each { |f| require f }
|
||||
|
||||
|
@ -1,8 +1,9 @@
|
||||
Bundler.require(:default)
|
||||
|
||||
require 'fileutils'
|
||||
require 'yaml'
|
||||
require 'apache/config'
|
||||
require 'apache/rake/create'
|
||||
require 'rainbow'
|
||||
|
||||
CONFIG = Hash[YAML.load_file('config.yml').collect { |k,v| [ k.to_sym, v ] }]
|
||||
|
||||
@ -14,17 +15,29 @@ def get_environments
|
||||
}.flatten.uniq.sort.collect { |name| name[1..-1] }
|
||||
end
|
||||
|
||||
namespace :apache do
|
||||
desc "Create all defined configs for the specified environment"
|
||||
task :create, :environment do |t, args|
|
||||
if !args[:environment]
|
||||
def get_default_environment
|
||||
File.read('.environment').strip rescue nil
|
||||
end
|
||||
|
||||
def need_environment
|
||||
puts "You need to specify an environment. Available environments:"
|
||||
puts
|
||||
puts get_environments.collect { |env| "rake apache:create[#{env}]" } * "\n"
|
||||
puts
|
||||
puts "Additionally, you can set a default environment for this server:"
|
||||
puts
|
||||
puts "rake apache:default[#{get_environments.first}]"
|
||||
exit 1
|
||||
end
|
||||
end
|
||||
|
||||
APACHE_ENV = (args[:environment] || 'production').to_sym
|
||||
task :default => 'apache:create'
|
||||
|
||||
namespace :apache do
|
||||
desc "Create all defined configs for the specified environment"
|
||||
task :create, :environment do |t, args|
|
||||
need_environment if !args[:environment] && !get_default_environment
|
||||
|
||||
APACHE_ENV = (args[:environment] || get_default_environment).to_sym
|
||||
|
||||
CONFIG[:source_path] = File.expand_path(CONFIG[:source])
|
||||
CONFIG[:dest_path] = File.expand_path(CONFIG[:destination])
|
||||
@ -44,4 +57,17 @@ namespace :apache do
|
||||
task :environments do
|
||||
puts get_environments * "\n"
|
||||
end
|
||||
|
||||
desc "Set the default environment (currently #{get_default_environment || 'nil'})"
|
||||
task :default, :environment do |t, args|
|
||||
need_environment if !args[:environment]
|
||||
|
||||
if get_environments.include?(args[:environment])
|
||||
File.open('.environment', 'w') { |fh| fh.puts args[:environment] }
|
||||
puts "Calls to apache:create will now use #{args[:environment]} when you don't specify the environment."
|
||||
else
|
||||
puts "You need to specify a valid default environment. Here are the possibilities:"
|
||||
Rake::Task['apache:environments'].invoke
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user