Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Initial configuration support

  • Loading branch information...
commit c64390dfa7d752fe0acb1b3f6b8bba99433f02b3 1 parent 6396e38
Brian Ploetz authored
View
2  .rspec
@@ -0,0 +1,2 @@
+--colour
+--format documentation
View
1  .rvmrc
@@ -0,0 +1 @@
+rvm use ruby-1.9.2-p0@versionist --create
View
3  Gemfile
@@ -0,0 +1,3 @@
+source "http://rubygems.org"
+
+gemspec
View
39 Gemfile.lock
@@ -0,0 +1,39 @@
+PATH
+ remote: .
+ specs:
+ versionist (0.1.0)
+ activesupport (~> 3.0)
+ rake (>= 0.9.2)
+
+GEM
+ remote: http://rubygems.org/
+ specs:
+ activesupport (3.1.3)
+ multi_json (~> 1.0)
+ diff-lcs (1.1.3)
+ json (1.6.3)
+ multi_json (1.0.4)
+ rake (0.9.2)
+ rdoc (3.11)
+ json (~> 1.4)
+ rspec (2.7.0)
+ rspec-core (~> 2.7.0)
+ rspec-expectations (~> 2.7.0)
+ rspec-mocks (~> 2.7.0)
+ rspec-core (2.7.1)
+ rspec-expectations (2.7.0)
+ diff-lcs (~> 1.1.2)
+ rspec-mocks (2.7.0)
+ simplecov (0.5.4)
+ multi_json (~> 1.0.3)
+ simplecov-html (~> 0.5.3)
+ simplecov-html (0.5.3)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ rdoc (>= 3.11)
+ rspec (= 2.7.0)
+ simplecov (= 0.5.4)
+ versionist!
View
18 Rakefile
@@ -0,0 +1,18 @@
+require 'rspec/core/rake_task'
+
+task :build do
+ system "gem build versionist.gemspec"
+end
+
+desc "Run all specs"
+RSpec::Core::RakeTask.new(:spec) do |t|
+ t.pattern = "spec/**/*_spec.rb"
+end
+
+require 'rdoc/task'
+RDoc::Task.new do |rdoc|
+ files = ['lib/**/*.rb']
+ rdoc.rdoc_dir = 'rdoc'
+ rdoc.title = "Versionist #{Versionist::VERSION}"
+ rdoc.rdoc_files.include('lib/**/*.rb')
+end
View
15 lib/versionist.rb
@@ -0,0 +1,15 @@
+require 'versionist/railtie' if defined?(Rails) && Rails::VERSION::MAJOR == 3
+
+module Versionist
+ class Configuration
+ attr_accessor :vendor_name
+ end
+
+ def self.configuration
+ @@configuration ||= Configuration.new
+ end
+
+ def self.configure
+ yield self.configuration
+ end
+end
View
7 lib/versionist/railtie.rb
@@ -0,0 +1,7 @@
+require 'rails'
+
+module Versionist
+ class Railtie < Rails::Railtie
+ config.versionist = ActiveSupport::OrderedOptions.new
+ end
+end
View
3  lib/versionist/version.rb
@@ -0,0 +1,3 @@
+module Versionist
+ VERSION = '0.1.0'
+end
View
15 spec/configuration_spec.rb
@@ -0,0 +1,15 @@
+require 'spec_helper'
+
+describe Versionist do
+ context ".configure" do
+ before :each do
+ Versionist.configure do |config|
+ config.vendor_name = "mydomain.com"
+ end
+ end
+
+ it "should configure the vendor_name" do
+ Versionist.configuration.vendor_name.should == "mydomain.com"
+ end
+ end
+end
View
27 spec/spec_helper.rb
@@ -0,0 +1,27 @@
+$LOAD_PATH.unshift(File.dirname(__FILE__))
+$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
+
+require 'rubygems'
+require 'simplecov'
+
+SimpleCov.start
+
+gemfile = File.expand_path('../../Gemfile', __FILE__)
+begin
+ ENV['BUNDLE_GEMFILE'] = gemfile
+ require 'bundler'
+ Bundler.setup
+rescue Bundler::GemNotFound => e
+ STDERR.puts e.message
+ STDERR.puts "Try running `bundle install`."
+ exit!
+end if File.exist?(gemfile)
+
+Bundler.setup(:test) if defined?(Bundler)
+
+require 'versionist'
+require 'rspec'
+
+RSpec.configure do |config|
+ config.mock_with :rspec
+end
View
26 versionist.gemspec
@@ -0,0 +1,26 @@
+# -*- encoding: utf-8 -*-
+
+lib = File.expand_path('../lib/', __FILE__)
+$:.unshift lib unless $:.include?(lib)
+
+require 'versionist/version'
+
+Gem::Specification.new do |s|
+ s.name = 'versionist'
+ s.version = Versionist::VERSION
+ s.platform = Gem::Platform::RUBY
+ s.authors = ['Brian Ploetz']
+ s.summary = "versionist-#{Versionist::VERSION}"
+ s.description = 'A Rails 3 plugin which allows you to easily version your Rails 3 based Web Service APIs'
+ s.files = Dir['lib/**/*']
+ s.rdoc_options = ['--charset=UTF-8']
+ s.require_paths = ['lib']
+ s.required_rubygems_version = '>= 1.3.6'
+
+ s.add_dependency('rake', '>= 0.9.2')
+ s.add_dependency('activesupport', '~> 3.0')
+
+ s.add_development_dependency('rspec', '2.7.0')
+ s.add_development_dependency('rdoc', '>= 3.11')
+ s.add_development_dependency('simplecov', '0.5.4')
+end
Please sign in to comment.
Something went wrong with that request. Please try again.