Skip to content

Commit

Permalink
Merge pull request #813 from blowmage/individual-packages
Browse files Browse the repository at this point in the history
Modularize into separate gems

[closes #341]
  • Loading branch information
quartzmo committed Aug 3, 2016
2 parents 96322e9 + 861ae4f commit 6145db3
Show file tree
Hide file tree
Showing 532 changed files with 8,193 additions and 5,772 deletions.
10 changes: 0 additions & 10 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,10 @@ rvm:
- 2.0.0-p648
script:
- bundle exec rake travis
after_success:
- bundle exec rake travis:pages
matrix:
include:
- rvm: 2.3.1
env: GCLOUD_BUILD_DOCS=true
deploy:
provider: rubygems
api_key:
secure: CTbGzuCCZt4Zf3QrUjc3USK8ac205pfc81oZlTEiNnIWVexKxUuCk8JJZnTBhDFylLgKD+hoIbBii4iq1El1quUqk3VAwohUotUFKAVgle4IGSmO71beUj63x2GyY39SGK0r9ZGHVE6WC0oVu3i5wSklgxhMsREAYt872m0xDNE=
gem: gcloud
on:
tags: true
repo: GoogleCloudPlatform/gcloud-ruby
notifications:
slack:
secure: Ksji5MDNOWnuzuyu9Hblbxse6kGLdH4kXyYkF98C+wawIGLSONWWkuA65wpdqSLtBN/79RCLMWoBzKAGX4xy9BL6Rxb3rLjAMT+FVur6II2yaApzyJ0dmTVeTXnkchPcrO27FK5taPb0Ghr86DUiG3OViY/q1N0AVALDYce5tfE=
20 changes: 0 additions & 20 deletions .yardopts

This file was deleted.

35 changes: 22 additions & 13 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,16 +1,25 @@
source "http://rubygems.org"

gemspec
gem "rake"
gem "minitest", "~> 5.9"
gem "minitest-autotest", "~> 1.0"
gem "minitest-focus", "~> 1.1"
gem "minitest-rg", "~> 5.2"
gem "autotest-suffix", "~> 1.1"
gem "rubocop", "<= 0.35.1"
gem "simplecov", "~> 0.9"
gem "coveralls", "~> 0.7"
gem "yard", "~> 0.9"

# TODO: unpin rake after YARD (and other tasks) no longer depend on last_comment
gem "rake", "~> 10.0"

gem "gcloud-rdoc",
git: "https://github.com/GoogleCloudPlatform/gcloud-ruby.git",
branch: "gcloud-rdoc"
gem "yard-gcloud",
git: "https://github.com/GoogleCloudPlatform/gcloud-ruby.git",
branch: "yard-gcloud"
gem "gcloud-jsondoc",
git: "https://github.com/GoogleCloudPlatform/gcloud-ruby.git",
branch: "gcloud-jsondoc"
gem "google-cloud-core", path: "google-cloud-core"
gem "google-cloud-bigquery", path: "google-cloud-bigquery"
gem "google-cloud-datastore", path: "google-cloud-datastore"
gem "google-cloud-dns", path: "google-cloud-dns"
gem "google-cloud-logging", path: "google-cloud-logging"
gem "google-cloud-pubsub", path: "google-cloud-pubsub"
gem "google-cloud-resource_manager", path: "google-cloud-resource_manager"
gem "google-cloud-storage", path: "google-cloud-storage"
gem "google-cloud-translate", path: "google-cloud-translate"
gem "google-cloud-vision", path: "google-cloud-vision"
gem "google-cloud", path: "google-cloud"
gem "gcloud", path: "gcloud"
213 changes: 207 additions & 6 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,211 @@
require "bundler/gem_tasks"
require "bundler/setup"

require "rake/testtask"
Rake::TestTask.new(:test) do |test|
test.warning = true
test.libs << "test"
test.pattern = "test/**/*_test.rb"
task :bundleupdate do
gems.each do |gem|
Dir.chdir gem do
Bundler.with_clean_env do
header "BUNDLE UPDATE FOR #{gem}"
sh "bundle update"
end
end
end
end

desc "Runs rubocop, jsodoc, and tests for all gems individually."
task :each, :bundleupdate do |t, args|
bundleupdate = args[:bundleupdate]
Rake::Task["bundleupdate"].invoke if bundleupdate
gems.each do |gem|
Dir.chdir gem do
Bundler.with_clean_env do
header "RUBOCOP, JSONDOC, TESTS FOR #{gem}"
sh "bundle exec rake rubocop"
sh "bundle exec rake jsondoc"
sh "bundle exec rake test"
end
end
end
end

desc "Runs tests for all gems."
task :test do
gems.each do |gem|
$LOAD_PATH.unshift "#{gem}/lib", "#{gem}/test"
Dir.glob("#{gem}/test/**/*_test.rb").each { |file| require_relative file }
$LOAD_PATH.delete "#{gem}/lib"
$LOAD_PATH.delete "#{gem}/test"
end
end

namespace :test do
desc "Runs tests for all gems individually."
task :each, :bundleupdate do |t, args|
bundleupdate = args[:bundleupdate]
Rake::Task["bundleupdate"].invoke if bundleupdate
gems.each do |gem|
Dir.chdir gem do
Bundler.with_clean_env do
header "RUNNING TESTS FOR #{gem}"
sh "bundle exec rake test"
end
end
end
end

desc "Runs tests with coverage for all gems."
task :coverage do
FileUtils.remove_dir "coverage", force: true
FileUtils.mkdir "coverage"

require "simplecov"
SimpleCov.start do
command_name :coverage
track_files "lib/**/*.rb"
add_filter "test/"
gems.each { |gem| add_group gem, "#{gem}/lib" }
end

header "Running tests and coverage report"
Rake::Task["test"].invoke
end

desc "Runs coveralls report for all gems."
task :coveralls do
require "simplecov"
require "coveralls"
SimpleCov.formatter = Coveralls::SimpleCov::Formatter

Rake::Task["test:coverage"].invoke
end
end

desc "Runs acceptance tests for all gems."
task :acceptance do
gems.each do |gem|
$LOAD_PATH.unshift "#{gem}/lib", "#{gem}/acceptance"
Dir.glob("#{gem}/acceptance/**/*_test.rb").each { |file| require_relative file }
$LOAD_PATH.delete "#{gem}/lib"
$LOAD_PATH.delete "#{gem}/acceptance"
end
end

namespace :acceptance do
desc "Runs acceptance tests for all gems individually."
task :each, :bundleupdate do |t, args|
bundleupdate = args[:bundleupdate]
Rake::Task["bundleupdate"].invoke if bundleupdate
gems.each do |gem|
Dir.chdir gem do
Bundler.with_clean_env do
header "ACCEPTANCE TESTS FOR #{gem}"
sh "bundle exec rake acceptance"
end
end
end
end

desc "Runs acceptance tests with coverage for all gems."
task :coverage do
FileUtils.remove_dir "coverage", force: true
FileUtils.mkdir "coverage"

require "simplecov"
SimpleCov.start do
command_name :coverage
track_files "lib/**/*.rb"
add_filter "acceptance/"
gems.each { |gem| add_group gem, "#{gem}/lib" }
end

header "Running acceptance tests and coverage report"
Rake::Task["acceptance"].invoke
end

desc "Runs acceptance:cleanup for all gems."
task :cleanup, :bundleupdate do |t, args|
bundleupdate = args[:bundleupdate]
Rake::Task["bundleupdate"].invoke if bundleupdate
gems.each do |gem|
cd gem do
Bundler.with_clean_env do
sh "bundle exec rake acceptance:cleanup"
end
end
end
end
end

desc "Runs rubocop report for all gems individually."
task :rubocop, :bundleupdate do |t, args|
bundleupdate = args[:bundleupdate]
Rake::Task["bundleupdate"].invoke if bundleupdate
header "Running rubocop reports"
gems.each do |gem|
Dir.chdir gem do
Bundler.with_clean_env do
header "RUBOCOP REPORT FOR #{gem}"
sh "bundle exec rake rubocop"
end
end
end
end

desc "Runs jsondoc report for all gems individually."
task :jsondoc, :bundleupdate do |t, args|
bundleupdate = args[:bundleupdate]
Rake::Task["bundleupdate"].invoke if bundleupdate
header "Running jsondoc reports"
gems.each do |gem|
Dir.chdir gem do
Bundler.with_clean_env do
header "JSONDOC FOR #{gem}"
sh "bundle exec rake jsondoc"
end
end
end
end

desc "Start an interactive shell."
task :console, :bundleupdate do |t, args|
bundleupdate = args[:bundleupdate]
Dir.chdir "google-cloud" do
Bundler.with_clean_env do
sh "bundle update" if bundleupdate
sh "bundle exec rake console"
end
end
end

desc "Runs tests and reports for CI."
task :travis do
Rake::Task["bundleupdate"].invoke
Rake::Task["rubocop"].invoke
Rake::Task["jsondoc"].invoke
Rake::Task["test:coveralls"].invoke

if ENV["TRAVIS_BRANCH"] == "master" &&
ENV["TRAVIS_PULL_REQUEST"] == "false"
header "Preparing to run acceptance tests"
# Decrypt the keyfile
`openssl aes-256-cbc -K $encrypted_629ec55f39b2_key -iv $encrypted_629ec55f39b2_iv -in keyfile.json.enc -out keyfile.json -d`

Rake::Task["acceptance"].invoke
else
header "Skipping acceptance tests"
end
end

def gems
`git ls-files -- */*.gemspec`.split("\n").map { |gem| gem.split("/").first }.sort
end

def header str
line_length = str.length + 8
puts ""
puts "#" * line_length
puts "### #{str} ###"
puts "#" * line_length
puts ""
end

task :default => :test
1 change: 1 addition & 0 deletions acceptance/data/data
44 changes: 0 additions & 44 deletions gcloud.gemspec

This file was deleted.

File renamed without changes.
16 changes: 16 additions & 0 deletions gcloud/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Gemfile.lock
keyfile.json
coverage/*
doc/*
pkg/*
html/*
jsondoc/*

# Ignore vagrant directory
.vagrant

# Ignore YARD stuffs
.yardoc

# directories left by gh-pages
_site/*

0 comments on commit 6145db3

Please sign in to comment.