abid 0.2.8 → 0.3.0.pre.alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +4 -0
- data/.yardopts +1 -0
- data/abid.gemspec +19 -18
- data/lib/abid.rb +2 -0
- data/lib/abid/abid_module.rb +4 -0
- data/lib/abid/application.rb +7 -25
- data/lib/abid/config.rb +67 -0
- data/lib/abid/error.rb +3 -0
- data/lib/abid/task.rb +1 -1
- data/lib/abid/version.rb +1 -1
- metadata +21 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 84be77dd59b4a3d27716db8501118f9df14df077
|
4
|
+
data.tar.gz: 9cfae6fa33ba3b746eeb215592fe36c824eacaec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: efc5b93b010454faa05029162fb5848ec60609a95283e1120e12699dea36d0ef6ec621784cfe25fc9ec7cbdd6b559f8eb070cbca396c05c38ba32c2f2d80e084
|
7
|
+
data.tar.gz: f89f4eacf5bb56985af9ca165a41235ccbe692f0c2415b8578ccec6380acbfa8523bf4fa4ea179c502ebe0a6522f687aa7c108662df77fca71b322fc3ea9630c
|
data/.gitignore
CHANGED
data/.yardopts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
-m markdown
|
data/abid.gemspec
CHANGED
@@ -4,29 +4,30 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
require 'abid/version'
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
|
-
spec.name =
|
7
|
+
spec.name = 'abid'
|
8
8
|
spec.version = Abid::VERSION
|
9
|
-
spec.authors = [
|
10
|
-
spec.email = [
|
9
|
+
spec.authors = ['Hikaru Ojima']
|
10
|
+
spec.email = ['amijo4rihaku@gmail.com']
|
11
11
|
|
12
|
-
spec.summary =
|
13
|
-
spec.description =
|
14
|
-
spec.homepage =
|
15
|
-
spec.license =
|
12
|
+
spec.summary = 'Abid is a simple Workflow Engine based on Rake.'
|
13
|
+
spec.description = 'Abid is a simple Workflow Engine based on Rake.'
|
14
|
+
spec.homepage = 'https://github.com/ojima-h/abid'
|
15
|
+
spec.license = 'MIT'
|
16
16
|
|
17
17
|
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features|sample)/}) }
|
18
|
-
spec.bindir =
|
18
|
+
spec.bindir = 'exe'
|
19
19
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
|
-
spec.require_paths = [
|
20
|
+
spec.require_paths = ['lib']
|
21
21
|
|
22
|
-
spec.add_development_dependency
|
23
|
-
spec.add_development_dependency
|
24
|
-
spec.add_development_dependency
|
22
|
+
spec.add_development_dependency 'bundler', '~> 1.10'
|
23
|
+
spec.add_development_dependency 'minitest'
|
24
|
+
spec.add_development_dependency 'pry-byebug'
|
25
|
+
spec.add_development_dependency 'yard'
|
25
26
|
|
26
|
-
spec.add_dependency
|
27
|
-
spec.add_dependency
|
28
|
-
spec.add_dependency
|
29
|
-
spec.add_dependency
|
30
|
-
spec.add_dependency
|
31
|
-
spec.add_dependency
|
27
|
+
spec.add_dependency 'rake', '~> 10.0'
|
28
|
+
spec.add_dependency 'concurrent-ruby-ext'
|
29
|
+
spec.add_dependency 'inifile'
|
30
|
+
spec.add_dependency 'sequel'
|
31
|
+
spec.add_dependency 'sqlite3'
|
32
|
+
spec.add_dependency 'rbtree'
|
32
33
|
end
|
data/lib/abid.rb
CHANGED
data/lib/abid/abid_module.rb
CHANGED
data/lib/abid/application.rb
CHANGED
@@ -3,15 +3,13 @@ module Abid
|
|
3
3
|
include Abid::TaskManager
|
4
4
|
|
5
5
|
attr_reader :worker
|
6
|
-
attr_reader :config
|
7
6
|
|
8
7
|
def initialize
|
9
8
|
super
|
10
9
|
@rakefiles = %w(abidfile Abidfile abidfile.rb Abidfile.rb) << abidfile
|
11
10
|
@worker = Worker.new(self)
|
12
11
|
|
13
|
-
|
14
|
-
@config.merge!(IniFile.load('config/abid.conf'))
|
12
|
+
Abid.config.load
|
15
13
|
end
|
16
14
|
|
17
15
|
def run
|
@@ -48,18 +46,6 @@ module Abid
|
|
48
46
|
self[name].async_invoke(*args).wait!
|
49
47
|
end
|
50
48
|
|
51
|
-
def default_config
|
52
|
-
{}
|
53
|
-
end
|
54
|
-
|
55
|
-
def default_database_config
|
56
|
-
{
|
57
|
-
adapter: 'sqlite',
|
58
|
-
database: File.join(Dir.pwd, 'abid.db'),
|
59
|
-
max_connections: 1
|
60
|
-
}
|
61
|
-
end
|
62
|
-
|
63
49
|
def standard_rake_options
|
64
50
|
super.each do |opt|
|
65
51
|
case opt.first
|
@@ -78,10 +64,6 @@ module Abid
|
|
78
64
|
def abid_options # :nodoc:
|
79
65
|
sort_options(
|
80
66
|
[
|
81
|
-
['--retry-failed-job',
|
82
|
-
'Retry failed job.',
|
83
|
-
proc { options.retry_failed_job = true }
|
84
|
-
],
|
85
67
|
['--repair',
|
86
68
|
'Run the task in repair mode.',
|
87
69
|
proc { options.repair = true }
|
@@ -132,12 +114,12 @@ module Abid
|
|
132
114
|
|
133
115
|
def database
|
134
116
|
return @database if @database
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
@database = Sequel.connect(**
|
117
|
+
|
118
|
+
# symbolize keys
|
119
|
+
params = {}
|
120
|
+
Abid.config.database.each { |k, v| params[k.to_sym] = v }
|
121
|
+
|
122
|
+
@database = Sequel.connect(**params)
|
141
123
|
end
|
142
124
|
end
|
143
125
|
end
|
data/lib/abid/config.rb
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
module Abid
|
2
|
+
class Config < Hash
|
3
|
+
DEFAULT_DATABASE_CONFIG = {
|
4
|
+
'adapter' => 'sqlite',
|
5
|
+
'database' => './abid.db',
|
6
|
+
'max_connections' => 1
|
7
|
+
}.freeze
|
8
|
+
|
9
|
+
# Config#load searches config file in `search_path` list.
|
10
|
+
#
|
11
|
+
# You can append an additinal config file path:
|
12
|
+
#
|
13
|
+
# Config.search_path.unshift('your_config_file')
|
14
|
+
#
|
15
|
+
# @return [Array<String>] search path
|
16
|
+
def self.search_path
|
17
|
+
@search_path ||= [
|
18
|
+
'./config/abid.yml'
|
19
|
+
]
|
20
|
+
end
|
21
|
+
|
22
|
+
# @return [Hash] database configuration
|
23
|
+
attr_reader :database
|
24
|
+
|
25
|
+
def initialize
|
26
|
+
super
|
27
|
+
@database = {}
|
28
|
+
end
|
29
|
+
|
30
|
+
# Load config file.
|
31
|
+
#
|
32
|
+
# If `config_file` is specified and does not exist, it raises an error.
|
33
|
+
#
|
34
|
+
# If `config_file` is not specified, it searches config file in
|
35
|
+
# Config.earch_path.
|
36
|
+
#
|
37
|
+
# When #load is called again, original cofnigurations is cleared.
|
38
|
+
#
|
39
|
+
# @param config_file [String] config file
|
40
|
+
# @return [Config] self
|
41
|
+
def load(config_file = nil)
|
42
|
+
replace(load_config_file(config_file))
|
43
|
+
@database = load_database_config
|
44
|
+
self
|
45
|
+
end
|
46
|
+
|
47
|
+
private
|
48
|
+
|
49
|
+
def load_config_file(file_path)
|
50
|
+
return YAML.load_file(file_path) if file_path
|
51
|
+
|
52
|
+
load_default_config_file
|
53
|
+
rescue => e
|
54
|
+
raise Error, 'failed to load config file: ' + e.message
|
55
|
+
end
|
56
|
+
|
57
|
+
def load_default_config_file
|
58
|
+
file_path = self.class.search_path.find { |path| File.exist?(path) }
|
59
|
+
return {} unless file_path
|
60
|
+
YAML.load_file(file_path)
|
61
|
+
end
|
62
|
+
|
63
|
+
def load_database_config
|
64
|
+
fetch('database') { DEFAULT_DATABASE_CONFIG.dup }
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
data/lib/abid/error.rb
ADDED
data/lib/abid/task.rb
CHANGED
@@ -107,7 +107,7 @@ module Abid
|
|
107
107
|
def concerned?
|
108
108
|
state.reload
|
109
109
|
|
110
|
-
if !application.options.
|
110
|
+
if !application.options.repair && state.failed? && !top_level?
|
111
111
|
fail "#{name} -- task has been failed"
|
112
112
|
end
|
113
113
|
|
data/lib/abid/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: abid
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0.pre.alpha.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hikaru Ojima
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-11-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -52,6 +52,20 @@ dependencies:
|
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: yard
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: rake
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -146,6 +160,7 @@ extra_rdoc_files: []
|
|
146
160
|
files:
|
147
161
|
- ".gitignore"
|
148
162
|
- ".travis.yml"
|
163
|
+
- ".yardopts"
|
149
164
|
- CODE_OF_CONDUCT.md
|
150
165
|
- Gemfile
|
151
166
|
- LICENSE.txt
|
@@ -159,7 +174,9 @@ files:
|
|
159
174
|
- lib/abid.rb
|
160
175
|
- lib/abid/abid_module.rb
|
161
176
|
- lib/abid/application.rb
|
177
|
+
- lib/abid/config.rb
|
162
178
|
- lib/abid/dsl_definition.rb
|
179
|
+
- lib/abid/error.rb
|
163
180
|
- lib/abid/mixin_task.rb
|
164
181
|
- lib/abid/params_parser.rb
|
165
182
|
- lib/abid/play.rb
|
@@ -190,9 +207,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
190
207
|
version: '0'
|
191
208
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
192
209
|
requirements:
|
193
|
-
- - "
|
210
|
+
- - ">"
|
194
211
|
- !ruby/object:Gem::Version
|
195
|
-
version:
|
212
|
+
version: 1.3.1
|
196
213
|
requirements: []
|
197
214
|
rubyforge_project:
|
198
215
|
rubygems_version: 2.4.5.1
|