Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Using Gemfile and updating gemspecs, RSpec and cucumber

  • Loading branch information...
commit b9ac6b4fc4d98530de6def62dae52ec83001e9bf 1 parent 5d96667
@vicentemundim vicentemundim authored
View
4 .gitignore
@@ -18,6 +18,8 @@ coverage
rdoc
pkg
nbproject
+.bundle
+.rvmrc
## PROJECT::SPECIFIC
-.document
+.document
View
4 Gemfile
@@ -0,0 +1,4 @@
+source "http://rubygems.org"
+
+# Specify your gem's dependencies in foo.gemspec
+gemspec
View
64 Gemfile.lock
@@ -0,0 +1,64 @@
+PATH
+ remote: .
+ specs:
+ mugshot (0.5.0)
+ activesupport (~> 2.3.5)
+ blankslate (>= 2.1.2.3)
+ rmagick (>= 2.12.2)
+ sinatra (>= 0.9.4)
+ uuid (>= 2.0.2)
+
+GEM
+ remote: http://rubygems.org/
+ specs:
+ activesupport (2.3.10)
+ blankslate (2.1.2.3)
+ builder (3.0.0)
+ cucumber (0.10.0)
+ builder (>= 2.1.2)
+ diff-lcs (~> 1.1.2)
+ gherkin (~> 2.3.2)
+ json (~> 1.4.6)
+ term-ansicolor (~> 1.0.5)
+ diff-lcs (1.1.2)
+ fakeweb (1.3.0)
+ gherkin (2.3.3)
+ json (~> 1.4.6)
+ json (1.4.6)
+ macaddr (1.0.0)
+ rack (1.2.1)
+ rack-test (0.5.6)
+ rack (>= 1.0)
+ rcov (0.9.9)
+ rmagick (2.13.1)
+ rspec (2.3.0)
+ rspec-core (~> 2.3.0)
+ rspec-expectations (~> 2.3.0)
+ rspec-mocks (~> 2.3.0)
+ rspec-core (2.3.1)
+ rspec-expectations (2.3.0)
+ diff-lcs (~> 1.1.2)
+ rspec-mocks (2.3.0)
+ sinatra (1.1.2)
+ rack (~> 1.1)
+ tilt (~> 1.2)
+ term-ansicolor (1.0.5)
+ tilt (1.2.1)
+ uuid (2.3.1)
+ macaddr (~> 1.0)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ activesupport (~> 2.3.5)
+ blankslate (>= 2.1.2.3)
+ cucumber (>= 0.6.2)
+ fakeweb
+ mugshot!
+ rack-test (>= 0.5.1)
+ rcov (>= 0.9.8)
+ rmagick (>= 2.12.2)
+ rspec (>= 2.3.0)
+ sinatra (>= 0.9.4)
+ uuid (>= 2.0.2)
View
55 Rakefile
@@ -4,59 +4,16 @@ require "rake"
task :default => [:spec, :features]
-begin
- require 'jeweler'
- namespace :gem do
- @jeweler_tasks = Jeweler::Tasks.new do |gem|
- gem.name = "mugshot"
- gem.summary = %Q{Dead simple image server}
- gem.description = %Q{Dead simple image server}
- gem.email = %w{cainanunes@gmail.com fabriciolopesvital@gmail.com gcirne@gmail.com jose@peleteiro.net}
- gem.homepage = "http://mugshot.ws"
- gem.authors = ["Cainã Nunes", "Fabrício Lopes", "Guilherme Cirne", "Jose Peleteiro"]
- gem.files = FileList["lib/**/*"]
- gem.test_files = FileList["spec/**/*"] + FileList["features/**/*"]
-
- gem.add_dependency "activesupport", "~> 2.3.5"
- gem.add_dependency "sinatra", ">= 0.9.4"
- gem.add_dependency "rmagick", ">= 2.12.2"
- gem.add_dependency "uuid", ">= 2.0.2"
- gem.add_dependency "blankslate", ">= 2.1.2.3"
-
- gem.add_development_dependency "fakeweb"
- gem.add_development_dependency "rspec", ">= 2.0.0.beta.8"
- gem.add_development_dependency "rcov", ">= 0.9.8"
- gem.add_development_dependency "cucumber", ">= 0.6.2"
- gem.add_development_dependency "rack-test", ">= 0.5.1"
-
- # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
- end
-
- desc 'Install runtime and development dependencies'
- task :install_dependencies do
- @jeweler_tasks.jeweler.gemspec.dependencies.each do |dependency|
- begin
- Gem.activate dependency.name, dependency.version_requirements.to_s
- rescue LoadError
- system %Q{gem install #{dependency.name} --version "#{dependency.version_requirements}"}
- end
- end
- end
-
- Jeweler::GemcutterTasks.new
- end
-rescue LoadError
- puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
-end
+require 'bundler'
+Bundler::GemHelper.install_tasks
begin
require 'rspec/core/rake_task'
desc "Run all examples using rcov"
- Rspec::Core::RakeTask.new :spec do |t|
+ RSpec::Core::RakeTask.new :spec do |t|
t.rcov = true
t.rcov_opts = %[--failure-threshold 100 --output doc/coverage -Ilib -Ispec --exclude "spec,gems/*,/Library/Ruby/*,.bundle"]
end
- task :spec => 'gem:check_dependencies'
task :default => :spec
rescue LoadError
task :spec do
@@ -66,10 +23,10 @@ end
begin
require 'cucumber/rake/task'
- Cucumber::Rake::Task.new(:features)
- task :features => 'gem:check_dependencies'
+ Cucumber::Rake::Task.new(:cucumber)
+ task :cucumber
rescue LoadError
- task :features do
+ task :cucumber do
abort "Cucumber is not available. In order to run features, you must: sudo gem install cucumber"
end
end
View
2  VERSION
@@ -1 +1 @@
-0.4.2
+0.5.0
View
2  features/support/env.rb
@@ -11,7 +11,7 @@
require 'RMagick'
module CucumberWorld
- include Rspec::Matchers
+ include RSpec::Matchers
include Rack::Test::Methods
mattr_accessor :storage
View
2  lib/mugshot/fs_storage.rb
@@ -2,7 +2,7 @@
require 'fileutils'
class Mugshot::FSStorage < Mugshot::Storage
def write(bin)
- returning asset_id do |id|
+ asset_id.tap do |id|
File.open(File.join(@root_path, id), "w") do |fw|
fw.write(bin)
end
View
3  lib/mugshot/version.rb
@@ -0,0 +1,3 @@
+module Mugshot
+ VERSION = "0.5.0"
+end
View
130 mugshot.gemspec
@@ -1,111 +1,35 @@
-# Generated by jeweler
-# DO NOT EDIT THIS FILE DIRECTLY
-# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
# -*- encoding: utf-8 -*-
+$:.push File.expand_path("../lib", __FILE__)
+require "mugshot/version"
Gem::Specification.new do |s|
- s.name = %q{mugshot}
- s.version = "0.4.2"
-
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
- s.authors = ["Cain\303\243 Nunes", "Fabr\303\255cio Lopes", "Guilherme Cirne", "Jose Peleteiro"]
- s.date = %q{2010-05-13}
- s.description = %q{Dead simple image server}
- s.email = ["cainanunes@gmail.com", "fabriciolopesvital@gmail.com", "gcirne@gmail.com", "jose@peleteiro.net"]
- s.extra_rdoc_files = [
- "LICENSE",
- "README.md"
- ]
- s.files = [
- "lib/mugshot.rb",
- "lib/mugshot/application.rb",
- "lib/mugshot/fs_storage.rb",
- "lib/mugshot/http_storage.rb",
- "lib/mugshot/image.rb",
- "lib/mugshot/magick_factory.rb",
- "lib/mugshot/public/crossdomain.xml",
- "lib/mugshot/storage.rb"
- ]
+ s.name = "mugshot"
+ s.version = Mugshot::VERSION
+ s.authors = ["Cain\303\243 Nunes", "Fabr\303\255cio Lopes", "Guilherme Cirne", "Jose Peleteiro", "Vicente Mundim"]
+ s.email = ["cainanunes@gmail.com", "fabriciolopesvital@gmail.com", "gcirne@gmail.com", "jose@peleteiro.net", "vicente.mundim@gmail.com"]
s.homepage = %q{http://mugshot.ws}
- s.rdoc_options = ["--charset=UTF-8"]
- s.require_paths = ["lib"]
- s.rubygems_version = %q{1.3.6}
s.summary = %q{Dead simple image server}
- s.test_files = [
- "spec/files",
- "spec/files/firefox_png.png",
- "spec/files/test.jpg",
- "spec/files/test_png.png",
- "spec/mugshot",
- "spec/mugshot/application_spec.rb",
- "spec/mugshot/fs_storage_spec.rb",
- "spec/mugshot/http_storage_spec.rb",
- "spec/mugshot/image_spec.rb",
- "spec/mugshot/magick_factory_spec.rb",
- "spec/spec_helper.rb",
- "spec/test.html",
- "features/convert_image_format.feature",
- "features/crop_image.feature",
- "features/define_image_quality.feature",
- "features/resize_image.feature",
- "features/retrieve_image_with_any_name.feature",
- "features/set_background.feature",
- "features/step_definitions",
- "features/step_definitions/all_steps.rb",
- "features/support",
- "features/support/env.rb",
- "features/support/files",
- "features/support/files/test-cropped_to_300x200.jpg",
- "features/support/files/test-resized_to_200x.jpg",
- "features/support/files/test-resized_to_200x200.jpg",
- "features/support/files/test-resized_to_x200.jpg",
- "features/support/files/test-with_75%_of_compression.jpg",
- "features/support/files/test.gif",
- "features/support/files/test.jpg",
- "features/support/files/test.png",
- "features/support/files/with_alpha_channel-with_a_red_background.jpg",
- "features/support/files/with_alpha_channel.png",
- "features/upload_image.feature"
- ]
+ s.description = %q{The basic idea of Mugshot is that you upload the largest/highest quality images possible. When retrieving the images you apply different operations to it such as: resizing, rounded corners, transparency and anything else we can think of!}
+ s.date = %q{2010-12-28}
- if s.respond_to? :specification_version then
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
- s.specification_version = 3
+ s.rubyforge_project = "mugshot"
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
- s.add_runtime_dependency(%q<activesupport>, ["~> 2.3.5"])
- s.add_runtime_dependency(%q<sinatra>, [">= 0.9.4"])
- s.add_runtime_dependency(%q<rmagick>, [">= 2.12.2"])
- s.add_runtime_dependency(%q<uuid>, [">= 2.0.2"])
- s.add_runtime_dependency(%q<blankslate>, [">= 2.1.2.3"])
- s.add_development_dependency(%q<fakeweb>, [">= 0"])
- s.add_development_dependency(%q<rspec>, [">= 2.0.0.beta.8"])
- s.add_development_dependency(%q<rcov>, [">= 0.9.8"])
- s.add_development_dependency(%q<cucumber>, [">= 0.6.2"])
- s.add_development_dependency(%q<rack-test>, [">= 0.5.1"])
- else
- s.add_dependency(%q<activesupport>, ["~> 2.3.5"])
- s.add_dependency(%q<sinatra>, [">= 0.9.4"])
- s.add_dependency(%q<rmagick>, [">= 2.12.2"])
- s.add_dependency(%q<uuid>, [">= 2.0.2"])
- s.add_dependency(%q<blankslate>, [">= 2.1.2.3"])
- s.add_dependency(%q<fakeweb>, [">= 0"])
- s.add_dependency(%q<rspec>, [">= 2.0.0.beta.8"])
- s.add_dependency(%q<rcov>, [">= 0.9.8"])
- s.add_dependency(%q<cucumber>, [">= 0.6.2"])
- s.add_dependency(%q<rack-test>, [">= 0.5.1"])
- end
- else
- s.add_dependency(%q<activesupport>, ["~> 2.3.5"])
- s.add_dependency(%q<sinatra>, [">= 0.9.4"])
- s.add_dependency(%q<rmagick>, [">= 2.12.2"])
- s.add_dependency(%q<uuid>, [">= 2.0.2"])
- s.add_dependency(%q<blankslate>, [">= 2.1.2.3"])
- s.add_dependency(%q<fakeweb>, [">= 0"])
- s.add_dependency(%q<rspec>, [">= 2.0.0.beta.8"])
- s.add_dependency(%q<rcov>, [">= 0.9.8"])
- s.add_dependency(%q<cucumber>, [">= 0.6.2"])
- s.add_dependency(%q<rack-test>, [">= 0.5.1"])
- end
-end
+ s.rdoc_options = ["--charset=UTF-8"]
+ s.extra_rdoc_files = ["LICENSE", "README.md"]
+
+ s.files = `git ls-files -- lib/*`.split("\n")
+ s.test_files = `git ls-files -- {spec,features}/*`.split("\n")
+ s.require_paths = ["lib"]
+
+ s.add_runtime_dependency(%q<activesupport>, ["~> 2.3.5"])
+ s.add_runtime_dependency(%q<sinatra>, [">= 0.9.4"])
+ s.add_runtime_dependency(%q<rmagick>, [">= 2.12.2"])
+ s.add_runtime_dependency(%q<uuid>, [">= 2.0.2"])
+ s.add_runtime_dependency(%q<blankslate>, [">= 2.1.2.3"])
+ s.add_development_dependency(%q<fakeweb>, [">= 0"])
+ s.add_development_dependency(%q<rspec>, [">= 2.3.0"])
+ s.add_development_dependency(%q<rcov>, [">= 0.9.8"])
+ s.add_development_dependency(%q<cucumber>, [">= 0.6.2"])
+ s.add_development_dependency(%q<rack-test>, [">= 0.5.1"])
+end
View
4 spec/mugshot/application_spec.rb
@@ -3,8 +3,8 @@
describe Mugshot::Application do
before :each do
- @storage = stub(Mugshot::Storage, :null_object => true)
- @image = stub(Mugshot::Image, :null_object => true)
+ @storage = stub(Mugshot::Storage).as_null_object
+ @image = stub(Mugshot::Image, :blank? => false).as_null_object
@storage.stub!(:read).with("image_id").and_return(@image)
def app
View
2  spec/mugshot/image_spec.rb
@@ -3,7 +3,7 @@
describe Mugshot::Image do
before :each do
- @magick_image = mock(Magick::Image, :null_object => true, :columns => 100, :rows => 100)
+ @magick_image = mock(Magick::Image, :columns => 100, :rows => 100).as_null_object
@magick_image.instance_eval do # TODO: Explain it
def to_blob(&block)
block.call if block.present?
Please sign in to comment.
Something went wrong with that request. Please try again.