diff --git a/lib/tasks/gemfiles.rake b/lib/tasks/gemfiles.rake new file mode 100644 index 0000000..223d012 --- /dev/null +++ b/lib/tasks/gemfiles.rake @@ -0,0 +1,28 @@ +namespace :gemfiles do + desc "Generates rails4.Gemfile and no-rails.Gemfile" + task :generate do + FileUtils.mkdir_p("test/gemfiles") + FileUtils.rm(Dir["test/gemfiles/*.Gemfile.lock"]) + + original_gemfile = File.read("Gemfile") + original_gemfile.sub!(/(gemspec name:.*)/) { "#{Regexp.last_match[1]}, path: \"../../\"" } + original_gemfile.sub!(/(gemspec\(name:.*)\)/) { "#{Regexp.last_match[1]}, path: \"../../\")" } + original_gemfile.sub!(/^group :development do$.*?^end$\n\n/m, "") + + rails4_version = "4.2.8" + rails4_gemfile = "#{original_gemfile}\ngem \"actionpack\", \"#{rails4_version}\"\n" + rails4_path = "test/gemfiles/rails4.Gemfile" + File.write(rails4_path, rails4_gemfile) + + no_rails_gemfile = original_gemfile.dup + no_rails_gemfile.sub!(/(gemspec\(name:.*)/) { "#{Regexp.last_match[1]} unless plugin == \"rails\"" } + no_rails_gemfile.sub!(/^.*rspec-rails.*$\n/, "") + no_rails_path = "test/gemfiles/no-rails.Gemfile" + File.write(no_rails_path, no_rails_gemfile) + + Bundler.with_clean_env do + system("BUNDLE_GEMFILE=#{rails4_path} bundle install") + system("BUNDLE_GEMFILE=#{no_rails_path} bundle install") + end + end +end diff --git a/test/gemfiles/no-rails.Gemfile b/test/gemfiles/no-rails.Gemfile new file mode 100644 index 0000000..67a7874 --- /dev/null +++ b/test/gemfiles/no-rails.Gemfile @@ -0,0 +1,40 @@ +source "https://rubygems.org" + +# Declare your gem's dependencies in diaspora_federation.gemspec. +# Bundler will treat runtime dependencies like base dependencies, and +# development dependencies will be added by default to the :development group. +gemspec name: "diaspora_federation", path: "../../" + +Dir["diaspora_federation-*.gemspec"].each do |gemspec| + plugin = gemspec.scan(/diaspora_federation-(.*)\.gemspec/).flatten.first + gemspec(name: "diaspora_federation-#{plugin}", development_group: plugin, path: "../../") unless plugin == "rails" +end + +# Declare any dependencies that are still in development here instead of in +# your gemspec. These might include edge Rails or gems from your path or +# Git. Remember to move these dependencies to your gemspec before releasing +# your gem to rubygems.org. + +group :test do + # rspec formatter + gem "fuubar", "2.2.0", require: false + gem "nyan-cat-formatter", require: false + + # test coverage + gem "codeclimate-test-reporter", "~> 1.0.0", require: false + gem "simplecov", "0.13.0", require: false + gem "simplecov-rcov", "0.2.3", require: false + + # test helpers + gem "json-schema-rspec", "0.0.4" + gem "rspec-collection_matchers", "~> 1.1.2" + gem "rspec-json_expectations", "~> 2.1" + gem "webmock", "~> 2.0" +end + +group :development, :test do + gem "rake" + + # unit tests + gem "rspec", "~> 3.5.0" +end diff --git a/test/gemfiles/no-rails.Gemfile.lock b/test/gemfiles/no-rails.Gemfile.lock new file mode 100644 index 0000000..5e06d54 --- /dev/null +++ b/test/gemfiles/no-rails.Gemfile.lock @@ -0,0 +1,111 @@ +PATH + remote: ../.. + specs: + diaspora_federation (0.1.8) + faraday (>= 0.9.0, < 0.13.0) + faraday_middleware (>= 0.10.0, < 0.12.0) + nokogiri (~> 1.6, >= 1.6.8) + typhoeus (~> 1.0) + valid (~> 1.0) + diaspora_federation-json_schema (0.1.8) + diaspora_federation-test (0.1.8) + diaspora_federation (= 0.1.8) + fabrication (~> 2.16.0) + uuid (~> 2.3.8) + +GEM + remote: https://rubygems.org/ + specs: + addressable (2.5.1) + public_suffix (~> 2.0, >= 2.0.2) + codeclimate-test-reporter (1.0.8) + simplecov (<= 0.13) + crack (0.4.3) + safe_yaml (~> 1.0.0) + diff-lcs (1.3) + docile (1.1.5) + ethon (0.10.1) + ffi (>= 1.3.0) + fabrication (2.16.1) + faraday (0.12.0.1) + multipart-post (>= 1.2, < 3) + faraday_middleware (0.11.0.1) + faraday (>= 0.7.4, < 1.0) + ffi (1.9.18) + fuubar (2.2.0) + rspec-core (~> 3.0) + ruby-progressbar (~> 1.4) + hashdiff (0.3.2) + json (2.0.3) + json-schema (2.8.0) + addressable (>= 2.4) + json-schema-rspec (0.0.4) + json-schema (~> 2.5) + rspec + macaddr (1.7.1) + systemu (~> 2.6.2) + mini_portile2 (2.1.0) + multipart-post (2.0.0) + nokogiri (1.7.1) + mini_portile2 (~> 2.1.0) + nyan-cat-formatter (0.11) + rspec (>= 2.99, >= 2.14.2, < 4) + public_suffix (2.0.5) + rake (12.0.0) + rspec (3.5.0) + rspec-core (~> 3.5.0) + rspec-expectations (~> 3.5.0) + rspec-mocks (~> 3.5.0) + rspec-collection_matchers (1.1.3) + rspec-expectations (>= 2.99.0.beta1) + rspec-core (3.5.4) + rspec-support (~> 3.5.0) + rspec-expectations (3.5.0) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.5.0) + rspec-json_expectations (2.1.0) + rspec-mocks (3.5.0) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.5.0) + rspec-support (3.5.0) + ruby-progressbar (1.8.1) + safe_yaml (1.0.4) + simplecov (0.13.0) + docile (~> 1.1.0) + json (>= 1.8, < 3) + simplecov-html (~> 0.10.0) + simplecov-html (0.10.0) + simplecov-rcov (0.2.3) + simplecov (>= 0.4.1) + systemu (2.6.5) + typhoeus (1.1.2) + ethon (>= 0.9.0) + uuid (2.3.8) + macaddr (~> 1.0) + valid (1.2.0) + webmock (2.3.2) + addressable (>= 2.3.6) + crack (>= 0.3.2) + hashdiff + +PLATFORMS + ruby + +DEPENDENCIES + codeclimate-test-reporter (~> 1.0.0) + diaspora_federation! + diaspora_federation-json_schema! + diaspora_federation-test! + fuubar (= 2.2.0) + json-schema-rspec (= 0.0.4) + nyan-cat-formatter + rake + rspec (~> 3.5.0) + rspec-collection_matchers (~> 1.1.2) + rspec-json_expectations (~> 2.1) + simplecov (= 0.13.0) + simplecov-rcov (= 0.2.3) + webmock (~> 2.0) + +BUNDLED WITH + 1.14.6 diff --git a/test/gemfiles/rails4.Gemfile b/test/gemfiles/rails4.Gemfile new file mode 100644 index 0000000..f8e3efe --- /dev/null +++ b/test/gemfiles/rails4.Gemfile @@ -0,0 +1,43 @@ +source "https://rubygems.org" + +# Declare your gem's dependencies in diaspora_federation.gemspec. +# Bundler will treat runtime dependencies like base dependencies, and +# development dependencies will be added by default to the :development group. +gemspec name: "diaspora_federation", path: "../../" + +Dir["diaspora_federation-*.gemspec"].each do |gemspec| + plugin = gemspec.scan(/diaspora_federation-(.*)\.gemspec/).flatten.first + gemspec(name: "diaspora_federation-#{plugin}", development_group: plugin, path: "../../") +end + +# Declare any dependencies that are still in development here instead of in +# your gemspec. These might include edge Rails or gems from your path or +# Git. Remember to move these dependencies to your gemspec before releasing +# your gem to rubygems.org. + +group :test do + # rspec formatter + gem "fuubar", "2.2.0", require: false + gem "nyan-cat-formatter", require: false + + # test coverage + gem "codeclimate-test-reporter", "~> 1.0.0", require: false + gem "simplecov", "0.13.0", require: false + gem "simplecov-rcov", "0.2.3", require: false + + # test helpers + gem "json-schema-rspec", "0.0.4" + gem "rspec-collection_matchers", "~> 1.1.2" + gem "rspec-json_expectations", "~> 2.1" + gem "webmock", "~> 2.0" +end + +group :development, :test do + gem "rake" + + # unit tests + gem "rspec", "~> 3.5.0" + gem "rspec-rails", "~> 3.5.1" +end + +gem "actionpack", "4.2.8" diff --git a/test/gemfiles/rails4.Gemfile.lock b/test/gemfiles/rails4.Gemfile.lock new file mode 100644 index 0000000..9cc394e --- /dev/null +++ b/test/gemfiles/rails4.Gemfile.lock @@ -0,0 +1,169 @@ +PATH + remote: ../.. + specs: + diaspora_federation (0.1.8) + faraday (>= 0.9.0, < 0.13.0) + faraday_middleware (>= 0.10.0, < 0.12.0) + nokogiri (~> 1.6, >= 1.6.8) + typhoeus (~> 1.0) + valid (~> 1.0) + diaspora_federation-json_schema (0.1.8) + diaspora_federation-rails (0.1.8) + actionpack (>= 4.2, < 6) + diaspora_federation (= 0.1.8) + diaspora_federation-test (0.1.8) + diaspora_federation (= 0.1.8) + fabrication (~> 2.16.0) + uuid (~> 2.3.8) + +GEM + remote: https://rubygems.org/ + specs: + actionpack (4.2.8) + actionview (= 4.2.8) + activesupport (= 4.2.8) + rack (~> 1.6) + rack-test (~> 0.6.2) + rails-dom-testing (~> 1.0, >= 1.0.5) + rails-html-sanitizer (~> 1.0, >= 1.0.2) + actionview (4.2.8) + activesupport (= 4.2.8) + builder (~> 3.1) + erubis (~> 2.7.0) + rails-dom-testing (~> 1.0, >= 1.0.5) + rails-html-sanitizer (~> 1.0, >= 1.0.3) + activesupport (4.2.8) + i18n (~> 0.7) + minitest (~> 5.1) + thread_safe (~> 0.3, >= 0.3.4) + tzinfo (~> 1.1) + addressable (2.5.1) + public_suffix (~> 2.0, >= 2.0.2) + builder (3.2.3) + codeclimate-test-reporter (1.0.8) + simplecov (<= 0.13) + crack (0.4.3) + safe_yaml (~> 1.0.0) + diff-lcs (1.3) + docile (1.1.5) + erubis (2.7.0) + ethon (0.10.1) + ffi (>= 1.3.0) + fabrication (2.16.1) + faraday (0.12.0.1) + multipart-post (>= 1.2, < 3) + faraday_middleware (0.11.0.1) + faraday (>= 0.7.4, < 1.0) + ffi (1.9.18) + fuubar (2.2.0) + rspec-core (~> 3.0) + ruby-progressbar (~> 1.4) + hashdiff (0.3.2) + i18n (0.8.1) + json (2.0.3) + json-schema (2.8.0) + addressable (>= 2.4) + json-schema-rspec (0.0.4) + json-schema (~> 2.5) + rspec + loofah (2.0.3) + nokogiri (>= 1.5.9) + macaddr (1.7.1) + systemu (~> 2.6.2) + mini_portile2 (2.1.0) + minitest (5.10.1) + multipart-post (2.0.0) + nokogiri (1.7.1) + mini_portile2 (~> 2.1.0) + nyan-cat-formatter (0.11) + rspec (>= 2.99, >= 2.14.2, < 4) + public_suffix (2.0.5) + rack (1.6.5) + rack-test (0.6.3) + rack (>= 1.0) + rails-deprecated_sanitizer (1.0.3) + activesupport (>= 4.2.0.alpha) + rails-dom-testing (1.0.8) + activesupport (>= 4.2.0.beta, < 5.0) + nokogiri (~> 1.6) + rails-deprecated_sanitizer (>= 1.0.1) + rails-html-sanitizer (1.0.3) + loofah (~> 2.0) + railties (4.2.8) + actionpack (= 4.2.8) + activesupport (= 4.2.8) + rake (>= 0.8.7) + thor (>= 0.18.1, < 2.0) + rake (12.0.0) + rspec (3.5.0) + rspec-core (~> 3.5.0) + rspec-expectations (~> 3.5.0) + rspec-mocks (~> 3.5.0) + rspec-collection_matchers (1.1.3) + rspec-expectations (>= 2.99.0.beta1) + rspec-core (3.5.4) + rspec-support (~> 3.5.0) + rspec-expectations (3.5.0) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.5.0) + rspec-json_expectations (2.1.0) + rspec-mocks (3.5.0) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.5.0) + rspec-rails (3.5.2) + actionpack (>= 3.0) + activesupport (>= 3.0) + railties (>= 3.0) + rspec-core (~> 3.5.0) + rspec-expectations (~> 3.5.0) + rspec-mocks (~> 3.5.0) + rspec-support (~> 3.5.0) + rspec-support (3.5.0) + ruby-progressbar (1.8.1) + safe_yaml (1.0.4) + simplecov (0.13.0) + docile (~> 1.1.0) + json (>= 1.8, < 3) + simplecov-html (~> 0.10.0) + simplecov-html (0.10.0) + simplecov-rcov (0.2.3) + simplecov (>= 0.4.1) + systemu (2.6.5) + thor (0.19.4) + thread_safe (0.3.6) + typhoeus (1.1.2) + ethon (>= 0.9.0) + tzinfo (1.2.3) + thread_safe (~> 0.1) + uuid (2.3.8) + macaddr (~> 1.0) + valid (1.2.0) + webmock (2.3.2) + addressable (>= 2.3.6) + crack (>= 0.3.2) + hashdiff + +PLATFORMS + ruby + +DEPENDENCIES + actionpack (= 4.2.8) + codeclimate-test-reporter (~> 1.0.0) + diaspora_federation! + diaspora_federation-json_schema! + diaspora_federation-rails! + diaspora_federation-test! + fuubar (= 2.2.0) + json-schema-rspec (= 0.0.4) + nyan-cat-formatter + rake + rspec (~> 3.5.0) + rspec-collection_matchers (~> 1.1.2) + rspec-json_expectations (~> 2.1) + rspec-rails (~> 3.5.1) + simplecov (= 0.13.0) + simplecov-rcov (= 0.2.3) + webmock (~> 2.0) + +BUNDLED WITH + 1.14.6