source
stringclasses
1 value
repo
stringlengths
5
63
repo_url
stringlengths
24
82
path
stringlengths
5
167
language
stringclasses
1 value
license
stringclasses
5 values
stars
int64
10
51.4k
ref
stringclasses
23 values
size_bytes
int64
200
258k
text
stringlengths
137
258k
github
joshnesbitt/project
https://github.com/joshnesbitt/project
spec/lib/workflow_spec.rb
Ruby
mit
48
master
850
module Project describe Workflow do before do Workflow.clear_all @data = { :one => ['one', 'two', 'three'], :two => ['one', 'two', 'three', 'four'] } end it "should set a workflow" do Workflow.set(:one, @data[:one]) Workflow.store[:one].should...
github
joshnesbitt/project
https://github.com/joshnesbitt/project
spec/lib/lookup_spec.rb
Ruby
mit
48
master
1,270
module Project describe Lookup do before do Lookup.clear_all @data = { :one => { :workflow => :default, :path => "/one/two/three" }, :two => { :workflow => :other, :path => "/one/two/three/four" } } end ...
github
joshnesbitt/project
https://github.com/joshnesbitt/project
spec/lib/errors_spec.rb
Ruby
mit
48
master
577
module Project describe ProjectError do it "should have a base error class" do error = ProjectError.new("Error data") error.data.should == "Error data" ProjectError.ancestors.should include(StandardError) end it "should have the correct error classes available" do ...
github
joshnesbitt/project
https://github.com/joshnesbitt/project
lib/project.rb
Ruby
mit
48
master
629
$:.unshift File.dirname(__FILE__) module Project ROOT = File.expand_path(File.dirname(__FILE__) + "/..") CONFIG = if(xdg = ENV["XDG_CONFIG_HOME"]) File.join(xdg, 'project', 'config.yaml') else File.join(ENV["HOME"], '.project') end SHELL_BINARY = ENV["SHELL"] end ...
github
joshnesbitt/project
https://github.com/joshnesbitt/project
lib/project/loader.rb
Ruby
mit
48
master
1,111
module Project require 'project/project' require 'project/workflow' require 'fileutils' require 'yaml' class Loader class << self def config_path(path=nil) path ? (@config_path = path) : @config_path end end attr_reader :raw_config def initialize @template_pat...
github
joshnesbitt/project
https://github.com/joshnesbitt/project
lib/project/errors.rb
Ruby
mit
48
master
267
module Project class ProjectError < StandardError attr_accessor :data def initialize(data) self.data = data super end end class AbstractClassError < ProjectError; end class MissingTemplateVariable < ProjectError; end end
github
joshnesbitt/project
https://github.com/joshnesbitt/project
lib/project/runner.rb
Ruby
mit
48
master
1,080
module Project class Runner attr_accessor :key, :project, :workflow def initialize(key) exit_with "No project key given" if key.nil? self.key = key.chomp.to_sym Loader.new.load! self.project = Project.find(self.key) exit_with "No project found using key '#{self...
github
joshnesbitt/project
https://github.com/joshnesbitt/project
lib/project/command_set.rb
Ruby
mit
48
master
496
require 'open3' module Project class CommandSet attr_accessor :project, :workflow def initialize(project, workflow) self.project, self.workflow = project, workflow end def execute! stdin, stdout, stderr = Open3::popen3 SHELL_BINARY self.workflow.each do |command| ...
github
joshnesbitt/project
https://github.com/joshnesbitt/project
lib/project/lookup.rb
Ruby
mit
48
master
708
module Project class Lookup class << self def store @store = {} unless @store @store end def set(key, data) store[key.to_sym] = data end alias :register :set def get(key) store[key.to_sym] ? return_object(store[key.to_sym]) : nil end ...
github
joshnesbitt/project
https://github.com/joshnesbitt/project
lib/project/template.rb
Ruby
mit
48
master
639
module Project class Template attr_accessor :subject, :replacements REGEX = /%([a-z|A-Z|1-9|_]*)?/ def initialize(subject, replacements) self.subject = subject self.replacements = replacements end def parse! matches = self.subject.scan(REGEX) matches.flatten!...
github
capicue/pgn
https://github.com/capicue/pgn
pgn.gemspec
Ruby
mit
48
master
920
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'pgn/version' Gem::Specification.new do |spec| spec.name = "pgn" spec.version = PGN::VERSION spec.authors = ["Stacey Touset"] spec.email = ["stacey@touset.org"...
github
capicue/pgn
https://github.com/capicue/pgn
lib/pgn.rb
Ruby
mit
48
master
706
require "pgn/board" require "pgn/fen" require "pgn/game" require "pgn/move" require "pgn/move_calculator" require "pgn/parser" require "pgn/position" require "pgn/version" module PGN # @param pgn [String] a pgn representation of one or more chess games # @return [Array<PGN::Game>] a list of games # # @note Th...
github
capicue/pgn
https://github.com/capicue/pgn
lib/pgn/board.rb
Ruby
mit
48
master
5,117
module PGN # {PGN::Board} represents the squares of a chess board and the pieces on # each square. It is responsible for translating between a human readable # format (white queen's rook on the bottom left) and the obvious # internal representation (white queen's rook is position [0,0]). It # takes care of co...
github
capicue/pgn
https://github.com/capicue/pgn
lib/pgn/fen.rb
Ruby
mit
48
master
4,048
module PGN # {PGN::FEN} is responsible for translating between strings in FEN # notation and an internal representation of the board. # # @see http://en.wikipedia.org/wiki/Forsyth-Edwards_Notation # Forsyth-Edwards notation # # @!attribute board # @return [PGN::Board] a {PGN::Board} object for the c...
github
capicue/pgn
https://github.com/capicue/pgn
lib/pgn/game.rb
Ruby
mit
48
master
3,467
require 'io/console' module PGN class MoveText attr_accessor :notation, :annotation, :comment, :variations def initialize(notation, annotation = nil, comment = nil, variations = nil) @notation = notation @annotation = annotation @comment = comment @variations = variations end...
github
capicue/pgn
https://github.com/capicue/pgn
lib/pgn/move.rb
Ruby
mit
48
master
3,982
module PGN # {PGN::Move} knows how to parse a move string in standard algebraic # notation to extract all relevant information. # # @see http://en.wikipedia.org/wiki/Algebraic_notation_(chess) Standard # Algebraic Notation # # @!attribute san # @return [String] the move string # @example # ...
github
capicue/pgn
https://github.com/capicue/pgn
lib/pgn/position.rb
Ruby
mit
48
master
3,515
module PGN # {PGN::Position} encapsulates all of the information necessary to # completely understand a chess position. It can be turned into a FEN string # or perform a move. # # @!attribute board # @return [PGN::Board] the board for the position # # @!attribute player # @return [Symbol] the play...
github
capicue/pgn
https://github.com/capicue/pgn
lib/pgn/parser.rb
Ruby
mit
48
master
4,842
require 'whittle' module PGN # {PGN::Parser} uses the whittle gem to parse pgn files based on their # context free grammar. # class Parser < Whittle::Parser rule(wsp: /\s+/).skip! rule('[') rule(']') rule('(') rule(')') start(:pgn_database) rule(:pgn_database) do |r| r[].as...
github
capicue/pgn
https://github.com/capicue/pgn
lib/pgn/move_calculator.rb
Ruby
mit
48
master
9,258
module PGN # {PGN::MoveCalculator} is responsible for computing all of the ways that a # specific move changes the current position. This includes which squares on # the board need to be updated, new castling restrictions, the en passant # square and whether to update fullmove and halfmove counters. # # @!a...
github
capicue/pgn
https://github.com/capicue/pgn
spec/parser_spec.rb
Ruby
mit
48
master
3,126
require 'spec_helper' describe PGN do describe '.parse' do it 'should return a list of games' do games = PGN.parse(File.read('./examples/immortal_game.pgn')) games.length.should == 1 game = games.first game.result.should == '1-0' game.tags['White'].should == 'Adolf Anderssen' ...
github
capicue/pgn
https://github.com/capicue/pgn
spec/game_spec.rb
Ruby
mit
48
master
827
require "spec_helper" describe PGN::Game do describe "#positions" do it "should not raise an error" do tags = {"White" => "Deep Blue", "Black" => "Kasparov"} moves = %w{e4 c5 c3 d5 exd5 Qxd5 d4 Nf6 Nf3 Bg4 Be2 e6 h3 Bh5 O-O Nc6 Be3 cxd4 cxd4 Bb4 a3 Ba5 Nc3 Qd6 Nb5 Qe7 Ne5 Bxe2 Qxe2 O-O Rac1 Rac8 B...
github
capicue/pgn
https://github.com/capicue/pgn
spec/spec_helper.rb
Ruby
mit
48
master
749
require 'pgn' # 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. # # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Confi...
github
capicue/pgn
https://github.com/capicue/pgn
spec/fen_spec.rb
Ruby
mit
48
master
4,069
require "spec_helper" describe PGN::FEN do describe "castling availability" do it "should remove all castling availabilitiy after castling" do pos = PGN::FEN.new("rnbqk2r/1p3pbp/p2p1np1/2pP4/P3PB2/2N2N2/1P3PPP/R2QKB1R b KQkq e3 0 8").to_position next_pos = pos.move("O-O") next_pos.to_fen.castli...
github
capicue/pgn
https://github.com/capicue/pgn
spec/position_spec.rb
Ruby
mit
48
master
1,459
require 'spec_helper' describe PGN::Position do describe "start" do it "should have fullmove 1" do pos = PGN::Position.start pos.fullmove.should == 1 end end context "disambiguating moves" do describe "using SAN square disambiguation" do pos = PGN::FEN.new("r1bqkb1r/pp1p1p...
github
headius/spoon
https://github.com/headius/spoon
spoon.gemspec
Ruby
apache-2.0
48
master
449
Gem::Specification.new do |s| s.name = "spoon" s.version = "0.0.7.dev" s.authors = ["Charles Oliver Nutter"] s.date = Time.now.strftime('%Y-%m-%d') s.description = s.summary = "Spoon is an FFI binding of the posix_spawn function (and Windows equivalent), providing fork+exec functionality in a single shot." ...
github
headius/spoon
https://github.com/headius/spoon
examples/ls.rb
Ruby
apache-2.0
48
master
934
# Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under th...
github
headius/spoon
https://github.com/headius/spoon
examples/vi.rb
Ruby
apache-2.0
48
master
596
# Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under th...
github
headius/spoon
https://github.com/headius/spoon
lib/spoon.rb
Ruby
apache-2.0
48
master
678
# Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under th...
github
headius/spoon
https://github.com/headius/spoon
lib/spoon/unix.rb
Ruby
apache-2.0
48
master
5,750
# Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under th...
github
headius/spoon
https://github.com/headius/spoon
lib/spoon/windows.rb
Ruby
apache-2.0
48
master
1,646
# Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under th...
github
tumugi/tumugi
https://github.com/tumugi/tumugi
tumugi.gemspec
Ruby
apache-2.0
48
master
1,469
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'tumugi/version' Gem::Specification.new do |spec| spec.name = 'tumugi' spec.version = Tumugi::VERSION spec.authors = ['Kazuyuki Honda'] spec.email = ['hakobera...
github
tumugi/tumugi
https://github.com/tumugi/tumugi
test/task_test.rb
Ruby
apache-2.0
48
master
9,264
require_relative './test_helper' require 'tumugi/task' require 'tumugi/target' class Tumugi::TaskTest < Test::Unit::TestCase class ExistOutput < Tumugi::Target def exist?; true end end class NotExistOutput < Tumugi::Target def exist?; false end end class TestTask < Tumugi::Task param :param_str...
github
tumugi/tumugi
https://github.com/tumugi/tumugi
test/logger_test.rb
Ruby
apache-2.0
48
master
1,430
require_relative './test_helper' require 'tumugi/logger/logger' class Tumugi::LoggerTest < Test::Unit::TestCase setup do @logger = Tumugi::Logger.instance @logger.workflow_id = "test" @logger.init @log_file = 'tmp/test.log' end teardown do File.delete(@log_file) if File.exist?(@log_file) e...
github
tumugi/tumugi
https://github.com/tumugi/tumugi
test/plugin_test.rb
Ruby
apache-2.0
48
master
1,116
require 'test_helper' require 'tumugi/registry' class Tumugi::PluginTest < Test::Unit::TestCase sub_test_case 'target' do test 'should raise error when target is not registered' do assert_raise do Tumugi::Plugin.lookup_target(:not_registered) end end test 'can lookup default plugin' ...
github
tumugi/tumugi
https://github.com/tumugi/tumugi
test/test_helper.rb
Ruby
apache-2.0
48
master
633
require 'simplecov' require 'coveralls' SimpleCov.formatter = Coveralls::SimpleCov::Formatter SimpleCov.start do add_filter '/test/' add_filter do |src| src.filename =~ /.*\.erb$/ end end $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__) require 'test/unit' require 'test/unit/rr' require 'tumugi'...
github
tumugi/tumugi
https://github.com/tumugi/tumugi
test/target_test.rb
Ruby
apache-2.0
48
master
250
require_relative './test_helper' require 'tumugi/target' class Tumugi::TargetTest < Test::Unit::TestCase test '#exist? should raise NotImplementedError' do assert_raise(NotImplementedError) do Tumugi::Target.new.exist? end end end
github
tumugi/tumugi
https://github.com/tumugi/tumugi
test/atomic_file_test.rb
Ruby
apache-2.0
48
master
818
require_relative './test_helper' require 'fileutils' require 'tempfile' require 'tumugi/atomic_file' class Tumugi::AtomicFileTest < Test::Unit::TestCase class AtomicTestFile < Tumugi::AtomicFile def move_to_final_destination(tmp_file) FileUtils.move(tmp_file.path, path) end end setup do @path ...
github
tumugi/tumugi
https://github.com/tumugi/tumugi
test/workflow_test.rb
Ruby
apache-2.0
48
master
841
require_relative './test_helper' require 'tumugi/workflow' class Tumugi::WorkflowTest < Test::Unit::TestCase setup do @workflow = Tumugi::Workflow.new end test '#initialize' do assert_not_nil(@workflow.id) end sub_test_case '#setup_logger' do test 'default log level is INFO' do @workflow....
github
tumugi/tumugi
https://github.com/tumugi/tumugi
test/dag_test.rb
Ruby
apache-2.0
48
master
1,380
require_relative './test_helper' require 'tumugi/dag' require 'tumugi/task' class Tumugi::DAGTest < Test::Unit::TestCase setup do @dag = Tumugi::DAG.new end test '#initialize' do assert_equal([], @dag.tsort) end sub_test_case '#add_task' do class Task1 < Tumugi::Task end class Task2 < ...
github
tumugi/tumugi
https://github.com/tumugi/tumugi
test/config_test.rb
Ruby
apache-2.0
48
master
2,022
require_relative './test_helper' require 'tumugi/config' class Tumugi::ConfigTest < Test::Unit::TestCase setup do @config = Tumugi::Config.new end teardown do Tumugi::Config.reset_config_sections end test 'default value' do assert_equal(1, @config.workers) assert_equal(3, @config.max_retry)...
github
tumugi/tumugi
https://github.com/tumugi/tumugi
test/tumugi_test.rb
Ruby
apache-2.0
48
master
1,882
require_relative './test_helper' class TumugiTest < Test::Unit::TestCase test 'it has a version number' do refute_nil ::Tumugi::VERSION end sub_test_case '#workflow' do test 'returns Tumugi::Workflow instance' do assert_equal(Tumugi::Workflow, Tumugi.workflow.class) end test 'returns same...
github
tumugi/tumugi
https://github.com/tumugi/tumugi
test/dsl_test.rb
Ruby
apache-2.0
48
master
325
require_relative './test_helper' require 'tumugi/dsl' class Tumugi::DSLTest < Test::Unit::TestCase include Tumugi::DSL test '#task' do mock.proxy(Tumugi::TaskDefinition).define(:test1) result = task(:test1) {} assert_equal(Tumugi::TaskDefinition, result.class) assert_equal(:test1, result.id) end...
github
tumugi/tumugi
https://github.com/tumugi/tumugi
test/task_definition_test.rb
Ruby
apache-2.0
48
master
6,644
require_relative './test_helper' require 'tumugi/task_definition' class Tumugi::TaskDefinitionTest < Test::Unit::TestCase setup do @task_def = Tumugi::TaskDefinition.new(:test, a: 'b') end sub_test_case 'initialize' do test 'id' do assert_equal(:test, @task_def.id) assert_equal('b', @task_de...
github
tumugi/tumugi
https://github.com/tumugi/tumugi
test/cli_test.rb
Ruby
apache-2.0
48
master
4,576
require_relative './test_helper' require 'tumugi/cli' class Tumugi::CLITest < Tumugi::Test::TumugiTestCase examples = { 'concurrent_task_run' => ['concurrent_task_run.rb', 'task1'], 'data_pipeline' => ['data_pipeline.rb', 'sum'], 'simple' => ['simple.rb', 'task1'], 'target' => ['target.rb', 'task1'],...
github
tumugi/tumugi
https://github.com/tumugi/tumugi
test/error_test.rb
Ruby
apache-2.0
48
master
1,424
require_relative './test_helper' require 'tumugi/error' class Tumugi::TumugiErrorTest < Test::Unit::TestCase test 'TumugiError' do err = Tumugi::TumugiError.new assert_equal('Tumugi::TumugiError', err.message) assert_nil(err.reason) err = Tumugi::TumugiError.new('message') assert_equal('message'...
github
tumugi/tumugi
https://github.com/tumugi/tumugi
test/dag_result_reporter_test.rb
Ruby
apache-2.0
48
master
1,860
require_relative './test_helper' require 'tumugi/dag_result_reporter' class Tumugi::DAGResultReporterTest < Test::Unit::TestCase class TestTask < Tumugi::Task param :param1, type: :string, default: "value1" param :param2, type: :time, default: Time.parse("2016-06-01 09:00:00 UTC") def requires Tes...
github
tumugi/tumugi
https://github.com/tumugi/tumugi
test/plugin/local_file_system_test.rb
Ruby
apache-2.0
48
master
3,981
require_relative '../test_helper' require 'tumugi/plugin/local_file_system' require 'fileutils' class Tumugi::Plugin::LocalFileSystemTest < Test::Unit::TestCase setup do @fs = Tumugi::Plugin::LocalFileSystem.new @dir_name = "#{SecureRandom.uuid}" @file_name = "local_file_system_test_file" @dir = "tmp...
github
tumugi/tumugi
https://github.com/tumugi/tumugi
test/plugin/file_system_target_test.rb
Ruby
apache-2.0
48
master
491
require_relative '../test_helper' require 'tumugi/plugin/file_system_target' class Tumugi::Plugin::FileSystemTargetTest < Test::Unit::TestCase setup do @path = '/path/to/file' @target = Tumugi::Plugin::FileSystemTarget.new(@path) end test "initialize" do assert_equal(@path, @target.path) end te...
github
tumugi/tumugi
https://github.com/tumugi/tumugi
test/plugin/atomic_local_file_test.rb
Ruby
apache-2.0
48
master
697
require_relative '../test_helper' require 'tempfile' require 'tumugi/plugin/atomic_local_file' class Tumugi::Plugin::AtomicLocalFileTest < Test::Unit::TestCase setup do @path = "tmp/atomic_test_file_#{SecureRandom.uuid}" @file = Tumugi::Plugin::AtomicLocalFile.new(@path) end sub_test_case '#open' do ...
github
tumugi/tumugi
https://github.com/tumugi/tumugi
test/plugin/target/local_file_test.rb
Ruby
apache-2.0
48
master
1,688
require_relative '../../test_helper' require 'tumugi/plugin/target/local_file' class Tumugi::Plugin::LocalFileTargetTest < Test::Unit::TestCase setup do @path = "tmp/local_file_target_test_file_#{SecureRandom.uuid}" end test 'plugin' do assert_equal(Tumugi::Plugin::LocalFileTarget, Tumugi::Plugin.lookup...
github
tumugi/tumugi
https://github.com/tumugi/tumugi
test/plugin/task/external_test.rb
Ruby
apache-2.0
48
master
382
require_relative '../../test_helper' require 'tumugi/plugin/task/external' class Tumugi::Plugin::ExternalTaskTest < Test::Unit::TestCase setup do @task = Tumugi::Plugin::ExternalTask.new end test 'plugin' do assert_equal(Tumugi::Plugin::ExternalTask, Tumugi::Plugin.lookup_task('external')) end test...
github
tumugi/tumugi
https://github.com/tumugi/tumugi
test/mixin/task_helper_test.rb
Ruby
apache-2.0
48
master
557
require_relative '../test_helper' require 'tumugi/mixin/task_helper' class Tumugi::Mixin::TaskHelperTest < Test::Unit::TestCase include Tumugi::Mixin::TaskHelper sub_test_case '#target' do test 'should return instance of specified target' do path = 'test.txt' t = target(:local_file, path) as...
github
tumugi/tumugi
https://github.com/tumugi/tumugi
test/mixin/human_redable_test.rb
Ruby
apache-2.0
48
master
749
require_relative '../test_helper' require 'tumugi/mixin/human_readable' class Tumugi::Mixin::HumanReadableTest < Test::Unit::TestCase include Tumugi::Mixin::HumanReadable data( '0' => ['00:00:00', 0], '1' => ['00:00:01', 1], '2' => ['00:00:02', 2], '59' => ['00:00:59', 59], '60'...
github
tumugi/tumugi
https://github.com/tumugi/tumugi
test/mixin/listable_test.rb
Ruby
apache-2.0
48
master
422
require_relative '../test_helper' require 'tumugi/mixin/listable' class Tumugi::Mixin::ListableTest < Test::Unit::TestCase include Tumugi::Mixin::Listable data( 'nil' => [[], nil], 'array' => [[1,2], [1,2]], 'hash' => [['val1', 'val2'], {key1: 'val1', key2: 'val2'}], 'object' => [['test'], '...
github
tumugi/tumugi
https://github.com/tumugi/tumugi
test/command/new_test.rb
Ruby
apache-2.0
48
master
1,106
require_relative '../test_helper' require 'tumugi/command/new' class Tumugi::Command::NewTest < Test::Unit::TestCase setup do @cmd = Tumugi::Command::New.new end sub_test_case '#execute' do test 'plugin' do output_path = './tmp/test_command_new_execute_plugin' @cmd.execute('plugin', 'test', ...
github
tumugi/tumugi
https://github.com/tumugi/tumugi
test/command/show_test.rb
Ruby
apache-2.0
48
master
1,115
require_relative '../test_helper' require 'tumugi/dag' require 'tumugi/task' require 'tumugi/command/show' class Tumugi::Command::ShowTest < Test::Unit::TestCase setup do @cmd = Tumugi::Command::Show.new @dag = Tumugi::DAG.new task = Tumugi::Task.new task.id = :task1 @dag.add_task(task) end ...
github
tumugi/tumugi
https://github.com/tumugi/tumugi
test/command/run_test.rb
Ruby
apache-2.0
48
master
1,442
require_relative '../test_helper' require 'tumugi/dag' require 'tumugi/task' require 'tumugi/command/run' class Tumugi::Command::RunTest < Test::Unit::TestCase class TestTask < Tumugi::Task def run sleep 2 end end setup do @cmd = Tumugi::Command::Run.new @dag = Tumugi::DAG.new @task = ...
github
tumugi/tumugi
https://github.com/tumugi/tumugi
test/executor/local_executor_test.rb
Ruby
apache-2.0
48
master
2,703
require_relative '../test_helper' require 'tumugi/dag' require 'tumugi/task' require 'tumugi/executor/local_executor' class Tumugi::Executor::LocalExecutorTest < Test::Unit::TestCase class TestTask < Tumugi::Task def run sleep 2 end end setup do @dag = Tumugi::DAG.new @task = TestTask.new ...
github
tumugi/tumugi
https://github.com/tumugi/tumugi
test/parameter/converter_test.rb
Ruby
apache-2.0
48
master
2,755
require_relative '../test_helper' require 'tumugi/parameter/converter' class Tumugi::Parameter::ConverterTest < Test::Unit::TestCase setup do @converter = Tumugi::Parameter::Converter end data({ "string" => ["a", "a"], "empty" => ["", ""], "nil" => [nil, nil], }) test 'string' do |(expec...
github
tumugi/tumugi
https://github.com/tumugi/tumugi
test/parameter/parameter_proxy_test.rb
Ruby
apache-2.0
48
master
1,554
require_relative '../test_helper' require 'tumugi/parameter/parameter_proxy' class Tumugi::Parameter::ParameterProxyTest < Test::Unit::TestCase setup do @proxy = Tumugi::Parameter::ParameterProxy.new('name') end test '#initialize' do assert_equal('name', @proxy.name) assert_equal({}, @proxy.params) ...
github
tumugi/tumugi
https://github.com/tumugi/tumugi
test/parameter/parameter_test.rb
Ruby
apache-2.0
48
master
3,742
require_relative '../test_helper' require 'tumugi/parameter/parameter' class Tumugi::Parameter::ParameterTest < Test::Unit::TestCase sub_test_case '#initialize' do test 'without options, returns default options' do param = Tumugi::Parameter::Parameter.new(:name) assert_equal(false, param.auto_bind?) ...
github
tumugi/tumugi
https://github.com/tumugi/tumugi
lib/tumugi.rb
Ruby
apache-2.0
48
master
755
require 'tumugi/workflow' require 'tumugi/config' require 'tumugi/error' require 'tumugi/version' require 'tumugi/logger/logger' module Tumugi class << self def workflow @workflow ||= Tumugi::Workflow.new end # alias for backward compatibility alias_method :app, :workflow alias_method :appl...
github
tumugi/tumugi
https://github.com/tumugi/tumugi
lib/tumugi/error.rb
Ruby
apache-2.0
48
master
521
module Tumugi class TumugiError < StandardError attr_reader :reason def initialize(message=nil, reason=nil) super(message) @reason = reason end end class ConfigError < TumugiError end class ParameterError < TumugiError end class TimeoutError < TumugiError end class FileSys...
github
tumugi/tumugi
https://github.com/tumugi/tumugi
lib/tumugi/file_system.rb
Ruby
apache-2.0
48
master
1,158
require 'tumugi' require 'tumugi/error' module Tumugi # This class defines interfaces of file system # such as local file, Amazon S3, Google Cloud Storage class FileSystem def exist?(path) raise NotImplementedError, "You must implement #{self.class}##{__method__}" end def remove(path, recursiv...
github
tumugi/tumugi
https://github.com/tumugi/tumugi
lib/tumugi/registry.rb
Ruby
apache-2.0
48
master
1,345
module Tumugi class Registry DEFAULT_PLUGIN_PATH = File.expand_path('plugin', __FILE__) def initialize(kind, search_prefix) @kind = kind @search_prefix = search_prefix @map = {} @paths = [DEFAULT_PLUGIN_PATH] end attr_reader :kind, :paths def register(type, value) ...
github
tumugi/tumugi
https://github.com/tumugi/tumugi
lib/tumugi/target.rb
Ruby
apache-2.0
48
master
337
require 'tumugi' module Tumugi class Target def initialize super() end def exist? raise NotImplementedError, "You must implement #{self.class}##{__method__}" end def logger @logger ||= Tumugi::ScopedLogger.new(self.class.name) end def log(msg) logger.info(msg) ...
github
tumugi/tumugi
https://github.com/tumugi/tumugi
lib/tumugi/dag.rb
Ruby
apache-2.0
48
master
605
require 'tsort' require 'tumugi/mixin/listable' module Tumugi class DAG include TSort include Tumugi::Mixin::Listable attr_reader :tasks def initialize @tasks = {} end def tsort_each_node(&block) @tasks.each_key(&block) end def tsort_each_child(node, &block) @tas...
github
tumugi/tumugi
https://github.com/tumugi/tumugi
lib/tumugi/workflow.rb
Ruby
apache-2.0
48
master
3,338
require 'tumugi/dag' require 'tumugi/dsl' require 'tumugi/error' require 'tumugi/plugin' require 'tumugi/target' require 'tumugi/command/run' require 'tumugi/command/show' require 'tumugi/mixin/human_readable' require 'securerandom' module Tumugi class Workflow include Tumugi::Mixin::HumanReadable attr_rea...
github
tumugi/tumugi
https://github.com/tumugi/tumugi
lib/tumugi/config.rb
Ruby
apache-2.0
48
master
1,655
require 'tumugi/error' module Tumugi class Config attr_accessor :workers attr_accessor :max_retry attr_accessor :retry_interval attr_accessor :timeout @@sections ||= {} def self.register_section(name, *args) @@sections[name] = Struct.new(camelize(name), *args) logger.info { "reg...
github
tumugi/tumugi
https://github.com/tumugi/tumugi
lib/tumugi/dag_result_reporter.rb
Ruby
apache-2.0
48
master
1,032
require 'terminal-table' require 'tumugi/mixin/listable' module Tumugi class DAGResultReporter include Tumugi::Mixin::Listable def show(dag) headings = ['Task', 'Requires', 'Parameters', 'State', 'Elapsed'] Terminal::Table.new title: "Workflow Result", headings: headings do |t| dag.tsort...
github
tumugi/tumugi
https://github.com/tumugi/tumugi
lib/tumugi/atomic_file.rb
Ruby
apache-2.0
48
master
1,015
require 'tempfile' require 'forwardable' module Tumugi class AtomicFile extend Forwardable def_delegators :@temp_file, :bin_mode?, :print, :printf, :putc, :puts, :write, :seek, :set_encoding, :sync, :sync=, :sysseek, :syswrite, :write, :write_nonblock, :flush def initialize(path) ...
github
tumugi/tumugi
https://github.com/tumugi/tumugi
lib/tumugi/cli.rb
Ruby
apache-2.0
48
master
3,728
require 'thor' require 'tumugi' require 'tumugi/command/new' module Tumugi class CLI < Thor package_name "tumugi" default_command "run_" class << self def common_options option :file, aliases: '-f', desc: 'Workflow file name', required: true option :config, aliases: '-c', desc: 'Co...
github
tumugi/tumugi
https://github.com/tumugi/tumugi
lib/tumugi/task.rb
Ruby
apache-2.0
48
master
4,640
require 'tumugi/event' require 'tumugi/logger/scoped_logger' require 'tumugi/mixin/listable' require 'tumugi/mixin/task_helper' require 'tumugi/mixin/parameterizable' require 'tumugi/mixin/human_readable' module Tumugi class Task include Tumugi::Mixin::Parameterizable include Tumugi::Mixin::Listable incl...
github
tumugi/tumugi
https://github.com/tumugi/tumugi
lib/tumugi/task_definition.rb
Ruby
apache-2.0
48
master
4,538
require 'tumugi/event' require 'tumugi/plugin' require 'tumugi/task' require 'tumugi/logger/logger' require 'tumugi/mixin/listable' require 'tumugi/mixin/task_helper' module Tumugi class TaskDefinition include Tumugi::Mixin::Listable include Tumugi::Mixin::TaskHelper def self.define(id, opts={}, &block)...
github
tumugi/tumugi
https://github.com/tumugi/tumugi
lib/tumugi/plugin.rb
Ruby
apache-2.0
48
master
1,135
require 'tumugi' require 'tumugi/registry' module Tumugi module Plugin TARGET_REGISTRY = Registry.new(:target, 'tumugi/plugin/target/') TASK_REGISTRY = Registry.new(:task, 'tumugi/plugin/task/') def self.register_target(type, klass) register_impl('target', TARGET_REGISTRY, type, klass) end...
github
tumugi/tumugi
https://github.com/tumugi/tumugi
lib/tumugi/dsl.rb
Ruby
apache-2.0
48
master
295
# Tumugi DSL functions. require 'tumugi/task_definition' module Tumugi module DSL def task(*args, &block) Tumugi::TaskDefinition.define(*args, &block) end end end # Extend the main object with the DSL commands. # This allows top-level calls to task, etc. extend Tumugi::DSL
github
tumugi/tumugi
https://github.com/tumugi/tumugi
lib/tumugi/test/helper.rb
Ruby
apache-2.0
48
master
1,182
require 'test/unit' require 'test/unit/rr' require 'tumugi' require 'tumugi/cli' module Tumugi module Test module Helpers def capture_stdout out = StringIO.new $stdout = out yield return out.string ensure $stdout = STDOUT end end class TumugiTes...
github
tumugi/tumugi
https://github.com/tumugi/tumugi
lib/tumugi/parameter/parameter.rb
Ruby
apache-2.0
48
master
1,345
require 'tumugi/error' require 'tumugi/parameter/converter' module Tumugi module Parameter class Parameter attr_accessor :name def initialize(name, opts={}) @name = name @opts = opts validate end def get if auto_bind? value = search_from_workflo...
github
tumugi/tumugi
https://github.com/tumugi/tumugi
lib/tumugi/parameter/converter.rb
Ruby
apache-2.0
48
master
1,161
require 'time' module Tumugi module Parameter class StringConverter def convert(value, opts={}) value end end class IntegerConverter def convert(value, opts={}) Integer(value) end end class FloatConverter def convert(value, opts={}) Float(va...
github
tumugi/tumugi
https://github.com/tumugi/tumugi
lib/tumugi/parameter/parameter_proxy.rb
Ruby
apache-2.0
48
master
770
require 'tumugi/parameter/parameter' module Tumugi module Parameter class ParameterProxy attr_accessor :name, :params, :param_defaults, :param_auto_bind_enabled def initialize(name) @name = name @params = {} @param_defaults = {} end def merge(other) merge...
github
tumugi/tumugi
https://github.com/tumugi/tumugi
lib/tumugi/mixin/human_readable.rb
Ruby
apache-2.0
48
master
371
module Tumugi module Mixin module HumanReadable def human_readable_time(seconds) [[60, :s], [60, :m], [10000, :h]].map{|count, name| if seconds > 0 seconds, n = seconds.divmod(count) "#{sprintf('%02d', n)}" else '00' end }.com...
github
tumugi/tumugi
https://github.com/tumugi/tumugi
lib/tumugi/mixin/task_helper.rb
Ruby
apache-2.0
48
master
210
require 'tumugi/plugin' module Tumugi module Mixin module TaskHelper def target(type, *args) klass = Tumugi::Plugin.lookup_target(type) klass.new(*args) end end end end
github
tumugi/tumugi
https://github.com/tumugi/tumugi
lib/tumugi/mixin/listable.rb
Ruby
apache-2.0
48
master
276
module Tumugi module Mixin module Listable def list(obj) if obj.nil? [] elsif obj.is_a?(Array) obj elsif obj.is_a?(Hash) obj.map { |k,v| v } else [obj] end end end end end
github
tumugi/tumugi
https://github.com/tumugi/tumugi
lib/tumugi/mixin/parameterizable.rb
Ruby
apache-2.0
48
master
3,041
require 'tumugi/error' require 'tumugi/logger/logger' require 'tumugi/parameter/parameter_proxy' module Tumugi module Mixin module Parameterizable def self.included(mod) mod.extend(ClassMethods) end def initialize super() proxy = self.class.merged_parameter_proxy ...
github
tumugi/tumugi
https://github.com/tumugi/tumugi
lib/tumugi/logger/logger.rb
Ruby
apache-2.0
48
master
1,314
require 'forwardable' require 'json' require 'logger' require 'singleton' module Tumugi class Logger include Singleton extend Forwardable def_delegators :@logger, :debug, :debug?, :error, :error?, :fatal, :fatal?, :info, :info?, :warn, :warn?, ...
github
tumugi/tumugi
https://github.com/tumugi/tumugi
lib/tumugi/logger/scoped_logger.rb
Ruby
apache-2.0
48
master
977
require 'tumugi/logger/logger' require 'forwardable' module Tumugi class ScopedLogger extend Forwardable def_delegators :@logger, :init, :verbose!, :quiet!, :workflow_id, :workflow_id=, :debug?, :error?, :fatal?, :info?, :warn?, :level def initialize(scope) @scope = sc...
github
tumugi/tumugi
https://github.com/tumugi/tumugi
lib/tumugi/command/run.rb
Ruby
apache-2.0
48
master
725
require 'tumugi/dag_result_reporter' require 'tumugi/executor/local_executor' module Tumugi module Command class Run def execute(dag, options={}) worker_num = options[:workers] || Tumugi.config.workers executor = Tumugi::Executor::LocalExecutor.new(dag, worker_num: worker_num, run_all: opti...
github
tumugi/tumugi
https://github.com/tumugi/tumugi
lib/tumugi/command/new.rb
Ruby
apache-2.0
48
master
699
require_relative './new/plugin_generator' require_relative './new/project_generator' module Tumugi module Command class New def execute(type, name, options={}) generator = create_generator(type, name, options) generator.generate end def logger @logger ||= Tumugi::Scoped...
github
tumugi/tumugi
https://github.com/tumugi/tumugi
lib/tumugi/command/show.rb
Ruby
apache-2.0
48
master
1,331
require 'graphviz' require 'tmpdir' require 'fileutils' require 'tumugi/mixin/listable' module Tumugi module Command class Show include Tumugi::Mixin::Listable @@supported_formats = ['dot', 'png', 'jpg', 'svg', 'pdf'] def execute(dag, options={}) out = options[:out] if out ...
github
tumugi/tumugi
https://github.com/tumugi/tumugi
lib/tumugi/command/new/project_generator.rb
Ruby
apache-2.0
48
master
1,014
require_relative 'generator' module Tumugi module Command class New class ProjectGenerator < Generator def data_dir "#{File.expand_path(File.dirname(__FILE__))}/../../data/new/project" end def dest_dir File.join(options[:path] || '.', name) end ...
github
tumugi/tumugi
https://github.com/tumugi/tumugi
lib/tumugi/command/new/plugin_generator.rb
Ruby
apache-2.0
48
master
1,805
require_relative 'generator' module Tumugi module Command class New class PluginGenerator < Generator def data_dir "#{File.expand_path(File.dirname(__FILE__))}/../../data/new/plugin" end def dest_dir File.join(options[:path] || '.', full_project_name) en...
github
tumugi/tumugi
https://github.com/tumugi/tumugi
lib/tumugi/command/new/generator.rb
Ruby
apache-2.0
48
master
1,596
require 'fileutils' require 'erubis' module Tumugi module Command class New class Generator attr_reader :name, :options def initialize(name, options={}) @name = name @options = options end def generate if File.exist?(dest_dir) && !options[:for...
github
tumugi/tumugi
https://github.com/tumugi/tumugi
lib/tumugi/plugin/atomic_local_file.rb
Ruby
apache-2.0
48
master
234
require 'fileutils' require 'tumugi/atomic_file' module Tumugi module Plugin class AtomicLocalFile < AtomicFile def move_to_final_destination(temp_file) FileUtils.move(temp_file, path) end end end end
github
tumugi/tumugi
https://github.com/tumugi/tumugi
lib/tumugi/plugin/file_system_target.rb
Ruby
apache-2.0
48
master
533
require 'tumugi/target' require 'tumugi/file_system' require 'tumugi/error' module Tumugi module Plugin class FileSystemTarget < Target attr_reader :path def initialize(path) @path = path end def fs raise NotImplementedError, "You must implement #{self.class}##{__method_...
github
tumugi/tumugi
https://github.com/tumugi/tumugi
lib/tumugi/plugin/local_file_system.rb
Ruby
apache-2.0
48
master
1,527
require 'fileutils' require 'tumugi/file_system' require 'tumugi/error' module Tumugi module Plugin class LocalFileSystem def exist?(path) File.exist?(path) end def remove(path, recursive: true) if recursive && directory?(path) FileUtils.rm_r(path) else ...
github
tumugi/tumugi
https://github.com/tumugi/tumugi
lib/tumugi/plugin/target/local_file.rb
Ruby
apache-2.0
48
master
589
require 'tumugi/plugin/atomic_local_file' require 'tumugi/plugin/file_system_target' require 'tumugi/plugin/local_file_system' module Tumugi module Plugin class LocalFileTarget < FileSystemTarget Plugin.register_target('local_file', self) def fs @fs ||= LocalFileSystem.new end d...
github
tumugi/tumugi
https://github.com/tumugi/tumugi
lib/tumugi/executor/local_executor.rb
Ruby
apache-2.0
48
master
3,766
require 'much-timeout' require 'concurrent' require 'tumugi' require 'tumugi/error' module Tumugi module Executor class LocalExecutor def initialize(dag, worker_num: 1, run_all: false) @dag = dag @main_task = dag.tsort.last @worker_num = worker_num @run_all = run_all ...
github
tumugi/tumugi
https://github.com/tumugi/tumugi
examples/concurrent_task_run.rb
Ruby
apache-2.0
48
master
472
class FileTask < Tumugi::Task Tumugi::Plugin.register_task(:local_file, self) def output target(:local_file, "tmp/tumugi_#{self.id}.txt") end def run log 'sleep 2 seconds' sleep 2 output.open('w') {|f| f.puts('done') } end end task :task1, type: :local_file do requires (1..10).map {|i| :"...
github
tumugi/tumugi
https://github.com/tumugi/tumugi
examples/fail_last_task.rb
Ruby
apache-2.0
48
master
279
task :task1 do requires [:task2, :task3] run { raise "error in #{id}" } end task :task2 do requires [:task4] run { log 'task2#run' } end task :task3 do requires [:task4] run { log 'task3#run' } end task :task4 do run do log 'task4#run' sleep 1 end end
github
tumugi/tumugi
https://github.com/tumugi/tumugi
examples/task_inheritance.rb
Ruby
apache-2.0
48
master
695
class FileTask < Tumugi::Task Tumugi::Plugin.register_task(:file, self) param :param1, type: :string def output target(:local_file, "tmp/#{id}.txt") end def run log "#{id}#run" log param1 output.open('w') do |f| f.puts('done') end end end # Task type can specified by task plugi...