Permalink
Browse files

Add development tools (guard, yard, simplecov, pry)

  • Loading branch information...
1 parent 6beaf7c commit b6d474e6392eea85b1b4b9f8506f21e0e0480f6c Gabriel Evans committed Nov 17, 2012
Showing with 115 additions and 15 deletions.
  1. +28 −0 .pryrc
  2. +3 −0 .yardopts
  3. +16 −0 Guardfile
  4. +24 −10 Rakefile
  5. +22 −4 eventful-ruby.gemspec
  6. +2 −0 spec/config.sample.yml
  7. +20 −1 spec/spec_helper.rb
View
@@ -0,0 +1,28 @@
+#!/usr/bin/env ruby
+# -*- mode: ruby -*-
+# vi: set ft=ruby :
+
+require 'rubygems'
+require 'bundler'
+begin
+ Bundler.setup(:default, :development)
+rescue Bundler::BundlerError => e
+ $stderr.puts e.message
+ $stderr.puts "Run `bundle install` to install missing gems"
+ exit e.status_code
+end
+
+require 'pathname'
+$LOAD_PATH.unshift(Pathname.getwd.join('lib').to_s)
+require 'eventful-ruby'
+
+config_file = Pathname.new(Pathname.getwd.join('spec/config.yml'))
+if config_file.exist?
+ Eventful.api_key = YAML.load_file(config_file.to_s)['api_key']
+else
+ abort "Please setup a spec/config.yml file"
+end
+
+def reload!
+ Dir["#{Dir.pwd}/lib/**/*.rb"].each { |f| load f }
+end
View
@@ -0,0 +1,3 @@
+--title 'eventful-ruby Documentation'
+--charset utf-8
+--markup markdown
View
@@ -0,0 +1,16 @@
+guard 'bundler' do
+ watch('Gemfile')
+ watch('eventful-ruby.gemspec')
+end
+
+guard 'rspec' do
+ watch(%r{^spec/.+_spec\.rb$})
+ watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
+ watch('spec/spec_helper.rb') { "spec" }
+end
+
+guard 'yard' do
+ watch(%r{app/.+\.rb})
+ watch(%r{lib/.+\.rb})
+ watch(%r{ext/.+\.c})
+end
View
@@ -1,16 +1,30 @@
#!/usr/bin/env rake
-require "bundler/gem_tasks"
+require 'rubygems'
+require 'bundler'
+begin
+ Bundler.setup(:default, :development)
+rescue Bundler::BundlerError => e
+ $stderr.puts e.message
+ $stderr.puts "Run `bundle install` to install missing gems"
+ exit e.status_code
+end
require 'rake'
-require 'rspec/core/rake_task'
+require 'bundler/gem_tasks'
-namespace :spec do
- RSpec::Core::RakeTask.new(:normal) do |t|
- t.pattern ='spec/**/*_spec.rb'
- t.rcov = false
- end
+require 'rspec/core'
+require 'rspec/core/rake_task'
+RSpec::Core::RakeTask.new(:spec) do |spec|
+ spec.pattern = FileList['spec/**/*_spec.rb']
end
-desc 'RSpec tests'
-task 'spec' => 'spec:normal'
+task :default => :spec
-task 'default' => 'spec'
+require 'yard'
+YARD::Rake::YardocTask.new
+
+desc 'Start Pry with all runtime dependencies loaded'
+task :console, :script do |t, args|
+ command = 'bundle exec pry'
+ command += "-r #{args[:script]}" if args[:script]
+ sh command
+end
View
@@ -14,13 +14,31 @@ Gem::Specification.new do |gem|
gem.name = "eventful-ruby"
gem.require_paths = ["lib"]
gem.version = Eventful::VERSION
-
- gem.add_dependency 'faraday', '< 0.9.0'
+
+ gem.add_dependency 'faraday', '>= 0.8.0', '< 0.9.0'
gem.add_dependency 'faraday_middleware', '0.9.0'
gem.add_dependency 'nokogiri', '~> 1.5.5'
- gem.add_dependency 'multi_xml', '~> 0.5'
-
+ gem.add_dependency 'multi_xml', '~> 0.5'
+
+ # Basic
+ gem.add_development_dependency 'rake'
+ gem.add_development_dependency 'bundler'
+ gem.add_development_dependency 'yard'
+ gem.add_development_dependency 'redcarpet'
+
+ # Testing
gem.add_development_dependency 'rspec'
+ gem.add_development_dependency 'simplecov'
gem.add_development_dependency 'vcr'
gem.add_development_dependency 'webmock'
+
+ # Development tools & helpers
+ gem.add_development_dependency 'pry'
+ gem.add_development_dependency 'guard'
+ gem.add_development_dependency 'guard-bundler'
+ gem.add_development_dependency 'guard-rspec'
+ gem.add_development_dependency 'guard-yard'
+ gem.add_development_dependency 'rb-fsevent'
+ gem.add_development_dependency 'rb-inotify'
+ gem.add_development_dependency 'growl'
end
@@ -0,0 +1,2 @@
+# You can find your Eventful app key by visiting http://api.eventful.com/
+api_key: "changeme"
View
@@ -8,14 +8,33 @@
exit e.status_code
end
+unless ENV['CI']
+ require 'simplecov'
+ SimpleCov.start
+end
+
require 'rspec/autorun'
require 'webmock/rspec'
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
$LOAD_PATH.unshift(File.dirname(__FILE__))
require 'eventful-ruby'
-Eventful.api_key = YAML.load_file(File.join(File.dirname(__FILE__), 'config.yml'))['api_key']
+require 'pathname'
+config_file = Pathname.new(File.join(File.dirname(__FILE__), 'config.yml'))
+if config_file.exist?
+ Eventful.api_key = YAML.load_file(config_file.to_s)['api_key']
+else
+ abort "Please setup a spec/config.yml file"
+end
+
+RSpec.configure do |config|
+ # Run specs in random order to surface order dependencies. If you find an
+ # order dependency and want to debug it, you can fix the order by providing
+ # the seed, which is printed after each run.
+ # --seed 1234
+ config.order = 'random'
+end
# Requires supporting files with custom matchers and macros, etc,
# in ./support/ and its subdirectories.

0 comments on commit b6d474e

Please sign in to comment.