Skip to content

Commit

Permalink
Merge pull request #9 from tumugi/update-tumugi-to-0.6
Browse files Browse the repository at this point in the history
Update tumugi to 0.6
  • Loading branch information
hakobera authored Jul 18, 2016
2 parents 418e41d + fa86eed commit acb624d
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 13 deletions.
6 changes: 4 additions & 2 deletions examples/example.rb
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
task :task1 do
requires :folder
param :day, type: :time, auto_bind: true, required: true
requires :folder

output do
target(:google_drive_file,
name: "test_#{day.strftime('%Y%m%d')}.txt",
parents: input.folder_id)
end

run do
log 'task1#run'
output.open('w') {|f| f.puts('done') }
end
end

task :folder, type: :google_drive_folder do
param_set :name, 'xyz'
name 'xyz'
end
20 changes: 14 additions & 6 deletions test/cli_test.rb
Original file line number Diff line number Diff line change
@@ -1,17 +1,25 @@
require_relative './test_helper'
require 'tumugi/cli'

class Tumugi::Plugin::GoogleDriveCLITest < Test::Unit::TestCase
class Tumugi::Plugin::GoogleDriveCLITest < Tumugi::Test::TumugiTestCase
examples = {
'example' => ['example.rb', 'task1'],
}

def invoke(file, task, options)
Tumugi::CLI.new.invoke(:run_, [task], options.merge(file: "./examples/#{file}", quiet: true))
setup do
system('rm -rf tmp/*')
end

data(examples)
test 'success' do |(file, task)|
assert_true(invoke(file, task, worker: 4, params: { 'day' => '2016-05-01' }, config: "./examples/tumugi_config_example.rb"))
data do
data_set = {}
examples.each do |k, v|
[1, 2, 8].each do |n|
data_set["#{k}_workers_#{n}"] = (v.dup << n)
end
end
data_set
end
test 'success' do |(file, task, worker)|
assert_run_success("examples/#{file}", task, workers: worker, params: { "day" => "2016-05-01" }, config: "./examples/tumugi_config_example.rb")
end
end
4 changes: 2 additions & 2 deletions test/plugin/task/google_drive_folder_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
class Tumugi::Plugin::GoogleDriveFolderTaskTest < Test::Unit::TestCase
setup do
@klass = Class.new(Tumugi::Plugin::GoogleDriveFolderTask)
@klass.param_set :name, 'folder1'
@klass.set :name, 'folder1'
end

sub_test_case "parameters" do
Expand All @@ -20,7 +20,7 @@ class Tumugi::Plugin::GoogleDriveFolderTaskTest < Test::Unit::TestCase
})
test "raise error when required parameter is not set" do |params|
params.each do |param|
@klass.param_set(param, nil)
@klass.set(param, nil)
end
assert_raise(Tumugi::ParameterError) do
@klass.new
Expand Down
6 changes: 4 additions & 2 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@
require 'test/unit'
require 'test/unit/rr'

require 'json'

require 'tumugi'
require 'tumugi/test/helper'
include Tumugi::Test::Helpers

require 'json'

Dir.mkdir('tmp') unless Dir.exist?('tmp')

Expand Down
3 changes: 2 additions & 1 deletion tumugi-plugin-google_drive.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ Gem::Specification.new do |spec|

spec.required_ruby_version = '>= 2.1'

spec.add_runtime_dependency "tumugi", ">= 0.5.1"
spec.add_runtime_dependency "tumugi", ">= 0.6.1"
spec.add_runtime_dependency "google-api-client", "~> 0.9.3"
spec.add_runtime_dependency "json", "~> 1.8.3" # json 2.0 does not work with JRuby + MultiJson

spec.add_development_dependency "bundler", "~> 1.11"
spec.add_development_dependency "rake", "~> 10.0"
Expand Down

0 comments on commit acb624d

Please sign in to comment.