Skip to content

Commit

Permalink
switch to bundler
Browse files Browse the repository at this point in the history
  • Loading branch information
morgoth committed Nov 15, 2010
1 parent c17316c commit 764a380
Show file tree
Hide file tree
Showing 15 changed files with 85 additions and 145 deletions.
5 changes: 0 additions & 5 deletions .document

This file was deleted.

8 changes: 3 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
*.sw?
.DS_Store
coverage
rdoc
pkg
pkg/*
*.gem
.bundle
5 changes: 5 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
source :rubygems

gem "rake"

gemspec
23 changes: 23 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
PATH
remote: .
specs:
alexa (0.1.0)
xml-simple

GEM
remote: http://rubygems.org/
specs:
rake (0.8.7)
shoulda (2.11.3)
test-unit (2.1.1)
xml-simple (1.0.12)

PLATFORMS
ruby

DEPENDENCIES
alexa!
rake
shoulda
test-unit
xml-simple
2 changes: 1 addition & 1 deletion README.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ You can set configuration in block like this:

== Copyright

Copyright (c) 2009 Wojciech Wnętrzak. See LICENSE for details.
Copyright (c) 2010 Wojciech Wnętrzak. See LICENSE for details.
60 changes: 6 additions & 54 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,60 +1,12 @@
# encoding: UTF-8
require "bundler"
Bundler::GemHelper.install_tasks
Bundler.setup

require 'rubygems'
require 'rake'

begin
require 'jeweler'
Jeweler::Tasks.new do |gem|
gem.name = "alexa"
gem.description = %Q{Alexa Web Information Service library (AWIS)}
gem.summary = %Q{Alexa Web Information Service library}
gem.email = "w.wnetrzak@gmail.com"
gem.homepage = "http://github.com/morgoth/alexa"
gem.authors = ["Wojciech Wnętrzak"]
gem.add_dependency('xml-simple')
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
end

rescue LoadError
puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
end

require 'rake/testtask'
require "rake/testtask"
Rake::TestTask.new(:test) do |test|
test.libs << 'lib' << 'test'
test.pattern = 'test/**/*_test.rb'
test.libs << "lib" << "test"
test.pattern = "test/**/*_test.rb"
test.verbose = true
end

begin
require 'rcov/rcovtask'
Rcov::RcovTask.new do |test|
test.libs << 'test'
test.pattern = 'test/**/*_test.rb'
test.verbose = true
end
rescue LoadError
task :rcov do
abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
end
end


task :default => :test

require 'rake/rdoctask'
Rake::RDocTask.new do |rdoc|
if File.exist?('VERSION.yml')
config = YAML.load(File.read('VERSION.yml'))
version = "#{config[:major]}.#{config[:minor]}.#{config[:patch]}"
else
version = ""
end

rdoc.rdoc_dir = 'rdoc'
rdoc.title = "alexa #{version}"
rdoc.rdoc_files.include('README*')
rdoc.rdoc_files.include('lib/**/*.rb')
end

1 change: 0 additions & 1 deletion VERSION

This file was deleted.

71 changes: 18 additions & 53 deletions alexa.gemspec
Original file line number Diff line number Diff line change
@@ -1,61 +1,26 @@
# 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 "alexa/version"

Gem::Specification.new do |s|
s.name = %q{alexa}
s.version = "0.1.0"

s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Wojciech Wnętrzak"]
s.date = %q{2010-01-28}
s.name = "alexa"
s.version = Alexa::VERSION
s.platform = Gem::Platform::RUBY
s.authors = ["Wojciech Wnętrzak"]
s.email = ["w.wnetrzak@gmail.com"]
s.homepage = "https://github.com/morgoth/alexa"
s.summary = %q{Alexa Web Information Service library}
s.description = %q{Alexa Web Information Service library (AWIS)}
s.email = %q{w.wnetrzak@gmail.com}
s.extra_rdoc_files = [
"LICENSE",
"README.rdoc"
]
s.files = [
".document",
".gitignore",
"LICENSE",
"README.rdoc",
"Rakefile",
"VERSION",
"alexa.gemspec",
"lib/alexa.rb",
"lib/alexa/config.rb",
"lib/alexa/url_info.rb",
"test/config_test.rb",
"test/fixtures/empty.xml",
"test/fixtures/polsl.xml",
"test/fixtures/polsl_small.xml",
"test/test_helper.rb",
"test/url_info_test.rb"
]
s.homepage = %q{http://github.com/morgoth/alexa}
s.rdoc_options = ["--charset=UTF-8"]

s.rubyforge_project = "alexa"

s.files = `git ls-files`.split("\n")
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
s.require_paths = ["lib"]
s.rubygems_version = %q{1.3.5}
s.summary = %q{Alexa Web Information Service library}
s.test_files = [
"test/url_info_test.rb",
"test/config_test.rb",
"test/test_helper.rb"
]

if s.respond_to? :specification_version then
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
s.specification_version = 3
s.add_dependency "xml-simple"

if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
s.add_runtime_dependency(%q<xml-simple>, [">= 0"])
else
s.add_dependency(%q<xml-simple>, [">= 0"])
end
else
s.add_dependency(%q<xml-simple>, [">= 0"])
end
s.add_development_dependency "test-unit"
s.add_development_dependency "shoulda"
end

7 changes: 3 additions & 4 deletions lib/alexa.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#/usr/bin/ruby
require "cgi"
require "base64"
require "openssl"
Expand All @@ -8,8 +7,9 @@
require "xmlsimple"
require "time"

require 'alexa/config'
require 'alexa/url_info'
require "alexa/config"
require "alexa/url_info"
require "alexa/version"

module Alexa
def self.url_info(options = {})
Expand All @@ -19,4 +19,3 @@ def self.url_info(options = {})
url_info
end
end

12 changes: 6 additions & 6 deletions lib/alexa/url_info.rb
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,12 @@ def generate_url(action, access_key_id, signature, timestamp, response_group, ho
url = URI.parse(
"http://awis.amazonaws.com/?" +
{
"Action" => action,
"AWSAccessKeyId" => access_key_id,
"Signature" => signature,
"Timestamp" => timestamp,
"ResponseGroup" => response_group,
"Url" => host
"Action" => action,
"AWSAccessKeyId" => access_key_id,
"Signature" => signature,
"Timestamp" => timestamp,
"ResponseGroup" => response_group,
"Url" => host
}.to_a.collect{ |item| item.first + "=" + CGI::escape(item.last) }.sort.join("&")
)
end
Expand Down
3 changes: 3 additions & 0 deletions lib/alexa/version.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module Alexa
VERSION = "0.1.0"
end
2 changes: 1 addition & 1 deletion test/config_test.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require 'test_helper'
require 'helper'

class ConfigTest < Test::Unit::TestCase
context "Config test" do
Expand Down
15 changes: 15 additions & 0 deletions test/helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Bundler.require
require "test/unit"
require "shoulda"

$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
$LOAD_PATH.unshift(File.dirname(__FILE__))
require 'alexa'

class Test::Unit::TestCase
def fixture_file(filename)
return '' if filename == ''
file_path = File.expand_path(File.dirname(__FILE__) + '/fixtures/' + filename)
File.read(file_path)
end
end
14 changes: 0 additions & 14 deletions test/test_helper.rb

This file was deleted.

2 changes: 1 addition & 1 deletion test/url_info_test.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require 'test_helper'
require 'helper'

class UrlInfoTest < Test::Unit::TestCase
context "Alexa::UrlInfo" do
Expand Down

0 comments on commit 764a380

Please sign in to comment.