From cb135b51133600d0725b79e637f510b99267a2d9 Mon Sep 17 00:00:00 2001 From: John Faucett Date: Tue, 18 Mar 2014 17:05:33 +0100 Subject: [PATCH 1/4] Add versioning tests, update gemspec --- .rspec | 2 ++ Gemfile | 11 +------- Gemfile.lock | 44 ++++++++++++++++++------------- VERSION | 2 +- redmine-ruby.gemspec | 40 +++++++++------------------- spec/redmine-ruby/redmine_spec.rb | 41 ++++++++++++++++++++++++++++ spec/spec_helper.rb | 23 ++++++++++++++++ test/helper.rb | 18 ------------- test/test_redmine-ruby.rb | 7 ----- 9 files changed, 107 insertions(+), 81 deletions(-) create mode 100644 .rspec create mode 100644 spec/redmine-ruby/redmine_spec.rb create mode 100644 spec/spec_helper.rb delete mode 100644 test/helper.rb delete mode 100644 test/test_redmine-ruby.rb diff --git a/.rspec b/.rspec new file mode 100644 index 0000000..5f16476 --- /dev/null +++ b/.rspec @@ -0,0 +1,2 @@ +--color +--format progress diff --git a/Gemfile b/Gemfile index 765d729..857c670 100644 --- a/Gemfile +++ b/Gemfile @@ -1,12 +1,3 @@ source "http://rubygems.org" -gem 'her' -gem 'faraday_middleware' -gem 'multi_xml' - -group :development do - gem "shoulda", ">= 0" - gem "rdoc", "~> 3.12" - gem "bundler", ">= 1.0.0" - gem "jeweler", "~> 1.8.4" -end +gemspec \ No newline at end of file diff --git a/Gemfile.lock b/Gemfile.lock index bbfd837..f86d3f5 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,3 +1,11 @@ +PATH + remote: . + specs: + redmine-ruby (0.2.7) + faraday_middleware + her + multi_xml + GEM remote: http://rubygems.org/ specs: @@ -12,30 +20,32 @@ GEM tzinfo (~> 0.3.37) atomic (1.1.10) builder (3.1.4) - faraday (0.8.8) + diff-lcs (1.2.5) + faraday (0.8.9) multipart-post (~> 1.2.0) faraday_middleware (0.9.0) faraday (>= 0.7.4, < 0.9) - git (1.2.5) her (0.6.8) activemodel (>= 3.0.0) activesupport (>= 3.0.0) faraday (~> 0.8) multi_json (~> 1.7) i18n (0.6.4) - jeweler (1.8.4) - bundler (~> 1.0) - git (>= 1.2.5) - rake - rdoc - json (1.8.0) + json (1.8.1) minitest (4.7.5) multi_json (1.7.7) - multi_xml (0.5.4) + multi_xml (0.5.5) multipart-post (1.2.0) - rake (10.1.0) - rdoc (3.12.2) + rdoc (4.1.1) json (~> 1.4) + rspec (2.14.1) + rspec-core (~> 2.14.0) + rspec-expectations (~> 2.14.0) + rspec-mocks (~> 2.14.0) + rspec-core (2.14.8) + rspec-expectations (2.14.5) + diff-lcs (>= 1.1.3, < 2.0) + rspec-mocks (2.14.6) shoulda (3.5.0) shoulda-context (~> 1.0, >= 1.0.1) shoulda-matchers (>= 1.4.1, < 3.0) @@ -50,10 +60,8 @@ PLATFORMS ruby DEPENDENCIES - bundler (>= 1.0.0) - faraday_middleware - her - jeweler (~> 1.8.4) - multi_xml - rdoc (~> 3.12) - shoulda + bundler (>= 1.0) + rdoc (~> 4.1) + redmine-ruby! + rspec (~> 2.14) + shoulda (~> 3.5) diff --git a/VERSION b/VERSION index b003284..967b33f 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.2.7 +0.2.7 \ No newline at end of file diff --git a/redmine-ruby.gemspec b/redmine-ruby.gemspec index 335657a..c9169b3 100644 --- a/redmine-ruby.gemspec +++ b/redmine-ruby.gemspec @@ -18,38 +18,24 @@ Gem::Specification.new() do |s| "LICENSE.txt", "README.md" ] - s.files = [ - ".document", - "Gemfile", - "Gemfile.lock", - "LICENSE.txt", - "README.md", - "Rakefile", - "VERSION", - "lib/redmine-ruby.rb", - "lib/redmine-ruby/base.rb", - "lib/redmine-ruby/custom_field.rb", - "lib/redmine-ruby/exception.rb", - "lib/redmine-ruby/issue.rb", - "lib/redmine-ruby/middleware/xml_parser.rb", - "lib/redmine-ruby/project.rb", - "lib/redmine-ruby/time_entry.rb", - "lib/redmine-ruby/upload.rb", - "redmine-ruby.gemspec", - "test/helper.rb", - "test/test_redmine-ruby.rb" - ] + + s.files = `git ls-files`.split($/) + s.test_files = s.files.grep(%r{^(spec|features)}) + s.homepage = "http://github.com/GeneralScripting/redmine-ruby" s.licenses = ["MIT"] s.require_paths = ["lib"] s.rubygems_version = "1.8.25" s.summary = "Ruby Redmine Client using Her" - s.add_runtime_dependency(%q, [">= 0"]) - s.add_runtime_dependency(%q, [">= 0"]) - s.add_runtime_dependency(%q, [">= 0"]) - s.add_development_dependency(%q, [">= 0"]) - s.add_development_dependency(%q, ["~> 3.12"]) - s.add_development_dependency(%q, [">= 1.0.0"]) + s.add_runtime_dependency 'her', '>= 0' + s.add_runtime_dependency 'faraday_middleware', '>= 0' + s.add_runtime_dependency 'multi_xml', '>= 0' + + s.add_development_dependency 'bundler', '>= 1.0' + s.add_development_dependency 'rdoc', '~> 4.1' + s.add_development_dependency 'rspec', '~> 2.14' + s.add_development_dependency 'shoulda', '~> 3.5' + end diff --git a/spec/redmine-ruby/redmine_spec.rb b/spec/redmine-ruby/redmine_spec.rb new file mode 100644 index 0000000..a994622 --- /dev/null +++ b/spec/redmine-ruby/redmine_spec.rb @@ -0,0 +1,41 @@ +require 'spec_helper' + +describe Redmine do + + context "versioning" do + + it "should have a version constant" do + Redmine.constants.should include(:VERSION) + end + + it "should have a version file" do + version_file = File.join(REDMINE_RUBY_ROOT, 'VERSION') + expect( File.exists?(version_file) ).to eq(true) + end + + it "should have a version file with just one line and no newline" do + version_file = File.join(REDMINE_RUBY_ROOT, 'VERSION') + version_file_data = File.read(version_file) + lines = version_file_data.split('\n') + + expect(lines.count).to eq(1) + expect(version_file_data.index("\n")).to be_nil + + end + + it "the VERSION constant should always equal the contents of the VERSION file" do + version_file_version = File.read(File.join(REDMINE_RUBY_ROOT, 'VERSION')) + expect(Redmine::VERSION).to eq(version_file_version) + end + + end + + + context "resources" do + + + + end + + +end \ No newline at end of file diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb new file mode 100644 index 0000000..3d750bc --- /dev/null +++ b/spec/spec_helper.rb @@ -0,0 +1,23 @@ +# This file was generated by the `rspec --init` command. Conventionally, all +# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`. +# Require this file using `require "spec_helper"` to ensure that it is only +# loaded once. +# + +$LOAD_PATH.unshift File.expand_path('../lib', __FILE__) +require 'redmine-ruby' + +REDMINE_RUBY_ROOT = File.expand_path('../../', __FILE__) + +# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration +RSpec.configure do |config| + config.treat_symbols_as_metadata_keys_with_true_values = true + config.run_all_when_everything_filtered = true + config.filter_run :focus + + # 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 diff --git a/test/helper.rb b/test/helper.rb deleted file mode 100644 index 057dfc5..0000000 --- a/test/helper.rb +++ /dev/null @@ -1,18 +0,0 @@ -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 'test/unit' -require 'shoulda' - -$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) -$LOAD_PATH.unshift(File.dirname(__FILE__)) -require 'redmine-ruby' - -class Test::Unit::TestCase -end diff --git a/test/test_redmine-ruby.rb b/test/test_redmine-ruby.rb deleted file mode 100644 index 9f51ff8..0000000 --- a/test/test_redmine-ruby.rb +++ /dev/null @@ -1,7 +0,0 @@ -require 'helper' - -class TestRedmineRuby < Test::Unit::TestCase - should "probably rename this file and start testing for real" do - flunk "hey buddy, you should probably rename this file and start testing for real" - end -end From 35be50899e7012514c985030ccca48bb13e44d3a Mon Sep 17 00:00:00 2001 From: John Faucett Date: Tue, 18 Mar 2014 17:09:38 +0100 Subject: [PATCH 2/4] Add travis.yml --- .travis.yml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..5ff6b53 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,19 @@ +language: ruby +rvm: + - 1.9.3 + - 2.0.0 + - ruby-head +script: + - bundle exec rspec + +branches: + only: + - master + +matrix: + allow_failures: + - rvm: ruby-head + +notifications: + email: + - jwaterfaucett@gmail.com \ No newline at end of file From 26904dbd0648b76a311b8d2ed96f202754123829 Mon Sep 17 00:00:00 2001 From: John Faucett Date: Tue, 18 Mar 2014 18:27:51 +0100 Subject: [PATCH 3/4] Make redmine-ruby debuggable via flag --- lib/redmine-ruby.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/redmine-ruby.rb b/lib/redmine-ruby.rb index 0d086b0..bcdcfa8 100644 --- a/lib/redmine-ruby.rb +++ b/lib/redmine-ruby.rb @@ -20,15 +20,17 @@ module Redmine VERSION = "0.2.7" class Client - attr_accessor :url, :token, :api + attr_accessor :url, :token, :api, :debug - def initialize(url, token) + def initialize(url, token, debug=false) self.url = url self.token = token self.api = Her::API.new + self.debug = debug self.api.setup url: url, ssl: { verify: false } do |c| c.use Faraday::Request::BasicAuthentication, token, '' c.use Faraday::Request::UrlEncoded + c.use Faraday::Response::Logger if debug c.use Redmine::Middleware::XmlParser c.use Faraday::Adapter::NetHttp end From c1affeb6ea86242b8bb27ac8dddbcc96f85419cc Mon Sep 17 00:00:00 2001 From: John Faucett Date: Tue, 18 Mar 2014 18:29:12 +0100 Subject: [PATCH 4/4] Bump Version to 0.2.8 --- VERSION | 2 +- lib/redmine-ruby.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/VERSION b/VERSION index 967b33f..08456a4 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.2.7 \ No newline at end of file +0.2.8 \ No newline at end of file diff --git a/lib/redmine-ruby.rb b/lib/redmine-ruby.rb index bcdcfa8..5e9300f 100644 --- a/lib/redmine-ruby.rb +++ b/lib/redmine-ruby.rb @@ -17,7 +17,7 @@ require 'redmine-ruby/tracker.rb' module Redmine - VERSION = "0.2.7" + VERSION = "0.2.8" class Client attr_accessor :url, :token, :api, :debug