dkron-rb 0.11.2 → 1.0.0
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 +5 -5
- data/Gemfile +0 -0
- data/README.md +8 -7
- data/Rakefile +0 -4
- data/dkron-rb.gemspec +10 -11
- data/docs/DefaultApi.md +0 -0
- data/docs/Execution.md +0 -0
- data/docs/ExecutionsApi.md +1 -1
- data/docs/ExecutorConfig.md +0 -0
- data/docs/Job.md +0 -0
- data/docs/JobsApi.md +60 -6
- data/docs/Member.md +0 -0
- data/docs/MembersApi.md +0 -0
- data/docs/Processors.md +0 -0
- data/docs/Status.md +3 -0
- data/git_push.sh +3 -3
- data/lib/dkron-rb.rb +2 -2
- data/lib/dkron-rb/api/default_api.rb +12 -21
- data/lib/dkron-rb/api/executions_api.rb +6 -9
- data/lib/dkron-rb/api/jobs_api.rb +73 -33
- data/lib/dkron-rb/api/members_api.rb +6 -9
- data/lib/dkron-rb/api_client.rb +10 -10
- data/lib/dkron-rb/api_error.rb +2 -2
- data/lib/dkron-rb/configuration.rb +3 -3
- data/lib/dkron-rb/models/execution.rb +7 -11
- data/lib/dkron-rb/models/executor_config.rb +7 -11
- data/lib/dkron-rb/models/job.rb +9 -13
- data/lib/dkron-rb/models/member.rb +7 -11
- data/lib/dkron-rb/models/processors.rb +7 -11
- data/lib/dkron-rb/models/status.rb +37 -11
- data/lib/dkron-rb/version.rb +3 -3
- data/spec/api/default_api_spec.rb +5 -8
- data/spec/api/executions_api_spec.rb +3 -4
- data/spec/api/jobs_api_spec.rb +19 -12
- data/spec/api/members_api_spec.rb +3 -4
- data/spec/api_client_spec.rb +36 -36
- data/spec/configuration_spec.rb +10 -10
- data/spec/models/execution_spec.rb +8 -9
- data/spec/models/executor_config_spec.rb +2 -3
- data/spec/models/job_spec.rb +20 -21
- data/spec/models/member_spec.rb +13 -14
- data/spec/models/processors_spec.rb +2 -3
- data/spec/models/status_spec.rb +20 -3
- data/spec/spec_helper.rb +2 -2
- metadata +18 -45
- data/Gemfile.lock +0 -67
- data/LICENSE +0 -201
- data/bin/console +0 -14
- data/bin/setup +0 -8
- data/config.json +0 -5
- data/docs/Agent.md +0 -7
- data/docs/ExecutorShell.md +0 -10
- data/docs/InlineResponse200.md +0 -10
- data/docs/MainApi.md +0 -90
- data/docs/ProcessorFiles.md +0 -9
- data/docs/ProcessorLog.md +0 -8
- data/docs/ProcessorSyslog.md +0 -8
- data/docs/Serf.md +0 -7
- data/docs/Tags.md +0 -7
- data/lib/dkron-rb/cron.rb +0 -152
- data/lib/dkron-rb/models/agent.rb +0 -152
- data/lib/dkron-rb/models/executor_shell.rb +0 -208
- data/lib/dkron-rb/models/inline_response_200.rb +0 -181
- data/lib/dkron-rb/models/processor_files.rb +0 -198
- data/lib/dkron-rb/models/processor_log.rb +0 -189
- data/lib/dkron-rb/models/processor_syslog.rb +0 -189
- data/lib/dkron-rb/models/serf.rb +0 -152
- data/lib/dkron-rb/models/tags.rb +0 -152
- data/lib/dkron-rb/numeric_seconds.rb +0 -48
- data/lib/dkron.rb +0 -9
- data/node_modules/isarray/build/build.js +0 -209
- data/node_modules/mime/build/build.js +0 -11
- data/node_modules/mime/build/test.js +0 -57
data/lib/dkron-rb/models/serf.rb
DELETED
@@ -1,152 +0,0 @@
|
|
1
|
-
=begin
|
2
|
-
Dkron REST API
|
3
|
-
|
4
|
-
You can communicate with Dkron using a RESTful JSON API over HTTP. Dkron nodes usually listen on port `8080` for API requests. All examples in this section assume that you've found a running leader at `localhost:8080`.\n\nDkron implements a RESTful JSON API over HTTP to communicate with software clients. Dkron listens in port `8080` by default. All examples in this section assume that you're using the default port.\n\nDefault API responses are unformatted JSON add the `pretty=true` param to format the response.\n
|
5
|
-
|
6
|
-
OpenAPI spec version: 0.7.2
|
7
|
-
|
8
|
-
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
-
|
10
|
-
|
11
|
-
=end
|
12
|
-
|
13
|
-
require 'date'
|
14
|
-
|
15
|
-
module Dkron
|
16
|
-
# Serf status
|
17
|
-
class Serf
|
18
|
-
# Attribute mapping from ruby-style variable name to JSON key.
|
19
|
-
def self.attribute_map
|
20
|
-
{
|
21
|
-
|
22
|
-
}
|
23
|
-
end
|
24
|
-
|
25
|
-
# Attribute type mapping.
|
26
|
-
def self.swagger_types
|
27
|
-
{
|
28
|
-
|
29
|
-
}
|
30
|
-
end
|
31
|
-
|
32
|
-
def initialize(attributes = {})
|
33
|
-
return unless attributes.is_a?(Hash)
|
34
|
-
|
35
|
-
# convert string to symbol for hash key
|
36
|
-
attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
|
37
|
-
|
38
|
-
|
39
|
-
end
|
40
|
-
|
41
|
-
# Check equality by comparing each attribute.
|
42
|
-
def ==(o)
|
43
|
-
return true if self.equal?(o)
|
44
|
-
self.class == o.class
|
45
|
-
end
|
46
|
-
|
47
|
-
# @see the `==` method
|
48
|
-
def eql?(o)
|
49
|
-
self == o
|
50
|
-
end
|
51
|
-
|
52
|
-
# Calculate hash code according to all attributes.
|
53
|
-
def hash
|
54
|
-
[].hash
|
55
|
-
end
|
56
|
-
|
57
|
-
# build the object from hash
|
58
|
-
def build_from_hash(attributes)
|
59
|
-
return nil unless attributes.is_a?(Hash)
|
60
|
-
self.class.swagger_types.each_pair do |key, type|
|
61
|
-
if type =~ /^Array<(.*)>/i
|
62
|
-
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
63
|
-
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
64
|
-
else
|
65
|
-
#TODO show warning in debug mode
|
66
|
-
end
|
67
|
-
elsif !attributes[self.class.attribute_map[key]].nil?
|
68
|
-
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
69
|
-
else
|
70
|
-
# data not found in attributes(hash), not an issue as the data can be optional
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
|
-
self
|
75
|
-
end
|
76
|
-
|
77
|
-
def _deserialize(type, value)
|
78
|
-
case type.to_sym
|
79
|
-
when :DateTime
|
80
|
-
DateTime.parse(value)
|
81
|
-
when :Date
|
82
|
-
Date.parse(value)
|
83
|
-
when :String
|
84
|
-
value.to_s
|
85
|
-
when :Integer
|
86
|
-
value.to_i
|
87
|
-
when :Float
|
88
|
-
value.to_f
|
89
|
-
when :BOOLEAN
|
90
|
-
if value.to_s =~ /^(true|t|yes|y|1)$/i
|
91
|
-
true
|
92
|
-
else
|
93
|
-
false
|
94
|
-
end
|
95
|
-
when :Object
|
96
|
-
# generic object (usually a Hash), return directly
|
97
|
-
value
|
98
|
-
when /\AArray<(?<inner_type>.+)>\z/
|
99
|
-
inner_type = Regexp.last_match[:inner_type]
|
100
|
-
value.map { |v| _deserialize(inner_type, v) }
|
101
|
-
when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
|
102
|
-
k_type = Regexp.last_match[:k_type]
|
103
|
-
v_type = Regexp.last_match[:v_type]
|
104
|
-
{}.tap do |hash|
|
105
|
-
value.each do |k, v|
|
106
|
-
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
107
|
-
end
|
108
|
-
end
|
109
|
-
else # model
|
110
|
-
_model = Dkron.const_get(type).new
|
111
|
-
_model.build_from_hash(value)
|
112
|
-
end
|
113
|
-
end
|
114
|
-
|
115
|
-
def to_s
|
116
|
-
to_hash.to_s
|
117
|
-
end
|
118
|
-
|
119
|
-
# to_body is an alias to to_body (backward compatibility))
|
120
|
-
def to_body
|
121
|
-
to_hash
|
122
|
-
end
|
123
|
-
|
124
|
-
# return the object in the form of hash
|
125
|
-
def to_hash
|
126
|
-
hash = {}
|
127
|
-
self.class.attribute_map.each_pair do |attr, param|
|
128
|
-
value = self.send(attr)
|
129
|
-
next if value.nil?
|
130
|
-
hash[param] = _to_hash(value)
|
131
|
-
end
|
132
|
-
hash
|
133
|
-
end
|
134
|
-
|
135
|
-
# Method to output non-array value in the form of hash
|
136
|
-
# For object, use to_hash. Otherwise, just return the value
|
137
|
-
def _to_hash(value)
|
138
|
-
if value.is_a?(Array)
|
139
|
-
value.compact.map{ |v| _to_hash(v) }
|
140
|
-
elsif value.is_a?(Hash)
|
141
|
-
{}.tap do |hash|
|
142
|
-
value.each { |k, v| hash[k] = _to_hash(v) }
|
143
|
-
end
|
144
|
-
elsif value.respond_to? :to_hash
|
145
|
-
value.to_hash
|
146
|
-
else
|
147
|
-
value
|
148
|
-
end
|
149
|
-
end
|
150
|
-
|
151
|
-
end
|
152
|
-
end
|
data/lib/dkron-rb/models/tags.rb
DELETED
@@ -1,152 +0,0 @@
|
|
1
|
-
=begin
|
2
|
-
Dkron REST API
|
3
|
-
|
4
|
-
You can communicate with Dkron using a RESTful JSON API over HTTP. Dkron nodes usually listen on port `8080` for API requests. All examples in this section assume that you've found a running leader at `localhost:8080`.\n\nDkron implements a RESTful JSON API over HTTP to communicate with software clients. Dkron listens in port `8080` by default. All examples in this section assume that you're using the default port.\n\nDefault API responses are unformatted JSON add the `pretty=true` param to format the response.\n
|
5
|
-
|
6
|
-
OpenAPI spec version: 0.7.2
|
7
|
-
|
8
|
-
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
-
|
10
|
-
|
11
|
-
=end
|
12
|
-
|
13
|
-
require 'date'
|
14
|
-
|
15
|
-
module Dkron
|
16
|
-
# Tags asociated with this node
|
17
|
-
class Tags
|
18
|
-
# Attribute mapping from ruby-style variable name to JSON key.
|
19
|
-
def self.attribute_map
|
20
|
-
{
|
21
|
-
|
22
|
-
}
|
23
|
-
end
|
24
|
-
|
25
|
-
# Attribute type mapping.
|
26
|
-
def self.swagger_types
|
27
|
-
{
|
28
|
-
|
29
|
-
}
|
30
|
-
end
|
31
|
-
|
32
|
-
def initialize(attributes = {})
|
33
|
-
return unless attributes.is_a?(Hash)
|
34
|
-
|
35
|
-
# convert string to symbol for hash key
|
36
|
-
attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
|
37
|
-
|
38
|
-
|
39
|
-
end
|
40
|
-
|
41
|
-
# Check equality by comparing each attribute.
|
42
|
-
def ==(o)
|
43
|
-
return true if self.equal?(o)
|
44
|
-
self.class == o.class
|
45
|
-
end
|
46
|
-
|
47
|
-
# @see the `==` method
|
48
|
-
def eql?(o)
|
49
|
-
self == o
|
50
|
-
end
|
51
|
-
|
52
|
-
# Calculate hash code according to all attributes.
|
53
|
-
def hash
|
54
|
-
[].hash
|
55
|
-
end
|
56
|
-
|
57
|
-
# build the object from hash
|
58
|
-
def build_from_hash(attributes)
|
59
|
-
return nil unless attributes.is_a?(Hash)
|
60
|
-
self.class.swagger_types.each_pair do |key, type|
|
61
|
-
if type =~ /^Array<(.*)>/i
|
62
|
-
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
63
|
-
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
64
|
-
else
|
65
|
-
#TODO show warning in debug mode
|
66
|
-
end
|
67
|
-
elsif !attributes[self.class.attribute_map[key]].nil?
|
68
|
-
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
69
|
-
else
|
70
|
-
# data not found in attributes(hash), not an issue as the data can be optional
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
|
-
self
|
75
|
-
end
|
76
|
-
|
77
|
-
def _deserialize(type, value)
|
78
|
-
case type.to_sym
|
79
|
-
when :DateTime
|
80
|
-
DateTime.parse(value)
|
81
|
-
when :Date
|
82
|
-
Date.parse(value)
|
83
|
-
when :String
|
84
|
-
value.to_s
|
85
|
-
when :Integer
|
86
|
-
value.to_i
|
87
|
-
when :Float
|
88
|
-
value.to_f
|
89
|
-
when :BOOLEAN
|
90
|
-
if value.to_s =~ /^(true|t|yes|y|1)$/i
|
91
|
-
true
|
92
|
-
else
|
93
|
-
false
|
94
|
-
end
|
95
|
-
when :Object
|
96
|
-
# generic object (usually a Hash), return directly
|
97
|
-
value
|
98
|
-
when /\AArray<(?<inner_type>.+)>\z/
|
99
|
-
inner_type = Regexp.last_match[:inner_type]
|
100
|
-
value.map { |v| _deserialize(inner_type, v) }
|
101
|
-
when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
|
102
|
-
k_type = Regexp.last_match[:k_type]
|
103
|
-
v_type = Regexp.last_match[:v_type]
|
104
|
-
{}.tap do |hash|
|
105
|
-
value.each do |k, v|
|
106
|
-
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
107
|
-
end
|
108
|
-
end
|
109
|
-
else # model
|
110
|
-
_model = Dkron.const_get(type).new
|
111
|
-
_model.build_from_hash(value)
|
112
|
-
end
|
113
|
-
end
|
114
|
-
|
115
|
-
def to_s
|
116
|
-
to_hash.to_s
|
117
|
-
end
|
118
|
-
|
119
|
-
# to_body is an alias to to_body (backward compatibility))
|
120
|
-
def to_body
|
121
|
-
to_hash
|
122
|
-
end
|
123
|
-
|
124
|
-
# return the object in the form of hash
|
125
|
-
def to_hash
|
126
|
-
hash = {}
|
127
|
-
self.class.attribute_map.each_pair do |attr, param|
|
128
|
-
value = self.send(attr)
|
129
|
-
next if value.nil?
|
130
|
-
hash[param] = _to_hash(value)
|
131
|
-
end
|
132
|
-
hash
|
133
|
-
end
|
134
|
-
|
135
|
-
# Method to output non-array value in the form of hash
|
136
|
-
# For object, use to_hash. Otherwise, just return the value
|
137
|
-
def _to_hash(value)
|
138
|
-
if value.is_a?(Array)
|
139
|
-
value.compact.map{ |v| _to_hash(v) }
|
140
|
-
elsif value.is_a?(Hash)
|
141
|
-
{}.tap do |hash|
|
142
|
-
value.each { |k, v| hash[k] = _to_hash(v) }
|
143
|
-
end
|
144
|
-
elsif value.respond_to? :to_hash
|
145
|
-
value.to_hash
|
146
|
-
else
|
147
|
-
value
|
148
|
-
end
|
149
|
-
end
|
150
|
-
|
151
|
-
end
|
152
|
-
end
|
@@ -1,48 +0,0 @@
|
|
1
|
-
module Dkron
|
2
|
-
class NumericSeconds
|
3
|
-
attr_reader :number
|
4
|
-
|
5
|
-
def self.seconds(number, units)
|
6
|
-
new(number).send(units)
|
7
|
-
end
|
8
|
-
|
9
|
-
def initialize(number)
|
10
|
-
@number = number.to_i
|
11
|
-
end
|
12
|
-
|
13
|
-
def seconds
|
14
|
-
number
|
15
|
-
end
|
16
|
-
alias :second :seconds
|
17
|
-
|
18
|
-
def minutes
|
19
|
-
number * 60
|
20
|
-
end
|
21
|
-
alias :minute :minutes
|
22
|
-
|
23
|
-
def hours
|
24
|
-
number * 3_600
|
25
|
-
end
|
26
|
-
alias :hour :hours
|
27
|
-
|
28
|
-
def days
|
29
|
-
number * 86_400
|
30
|
-
end
|
31
|
-
alias :day :days
|
32
|
-
|
33
|
-
def weeks
|
34
|
-
number * 604_800
|
35
|
-
end
|
36
|
-
alias :week :weeks
|
37
|
-
|
38
|
-
def months
|
39
|
-
number * 2_592_000
|
40
|
-
end
|
41
|
-
alias :month :months
|
42
|
-
|
43
|
-
def years
|
44
|
-
number * 31_557_600
|
45
|
-
end
|
46
|
-
alias :year :years
|
47
|
-
end
|
48
|
-
end
|
data/lib/dkron.rb
DELETED
@@ -1,209 +0,0 @@
|
|
1
|
-
|
2
|
-
/**
|
3
|
-
* Require the given path.
|
4
|
-
*
|
5
|
-
* @param {String} path
|
6
|
-
* @return {Object} exports
|
7
|
-
* @api public
|
8
|
-
*/
|
9
|
-
|
10
|
-
function require(path, parent, orig) {
|
11
|
-
var resolved = require.resolve(path);
|
12
|
-
|
13
|
-
// lookup failed
|
14
|
-
if (null == resolved) {
|
15
|
-
orig = orig || path;
|
16
|
-
parent = parent || 'root';
|
17
|
-
var err = new Error('Failed to require "' + orig + '" from "' + parent + '"');
|
18
|
-
err.path = orig;
|
19
|
-
err.parent = parent;
|
20
|
-
err.require = true;
|
21
|
-
throw err;
|
22
|
-
}
|
23
|
-
|
24
|
-
var module = require.modules[resolved];
|
25
|
-
|
26
|
-
// perform real require()
|
27
|
-
// by invoking the module's
|
28
|
-
// registered function
|
29
|
-
if (!module.exports) {
|
30
|
-
module.exports = {};
|
31
|
-
module.client = module.component = true;
|
32
|
-
module.call(this, module.exports, require.relative(resolved), module);
|
33
|
-
}
|
34
|
-
|
35
|
-
return module.exports;
|
36
|
-
}
|
37
|
-
|
38
|
-
/**
|
39
|
-
* Registered modules.
|
40
|
-
*/
|
41
|
-
|
42
|
-
require.modules = {};
|
43
|
-
|
44
|
-
/**
|
45
|
-
* Registered aliases.
|
46
|
-
*/
|
47
|
-
|
48
|
-
require.aliases = {};
|
49
|
-
|
50
|
-
/**
|
51
|
-
* Resolve `path`.
|
52
|
-
*
|
53
|
-
* Lookup:
|
54
|
-
*
|
55
|
-
* - PATH/index.js
|
56
|
-
* - PATH.js
|
57
|
-
* - PATH
|
58
|
-
*
|
59
|
-
* @param {String} path
|
60
|
-
* @return {String} path or null
|
61
|
-
* @api private
|
62
|
-
*/
|
63
|
-
|
64
|
-
require.resolve = function(path) {
|
65
|
-
if (path.charAt(0) === '/') path = path.slice(1);
|
66
|
-
var index = path + '/index.js';
|
67
|
-
|
68
|
-
var paths = [
|
69
|
-
path,
|
70
|
-
path + '.js',
|
71
|
-
path + '.json',
|
72
|
-
path + '/index.js',
|
73
|
-
path + '/index.json'
|
74
|
-
];
|
75
|
-
|
76
|
-
for (var i = 0; i < paths.length; i++) {
|
77
|
-
var path = paths[i];
|
78
|
-
if (require.modules.hasOwnProperty(path)) return path;
|
79
|
-
}
|
80
|
-
|
81
|
-
if (require.aliases.hasOwnProperty(index)) {
|
82
|
-
return require.aliases[index];
|
83
|
-
}
|
84
|
-
};
|
85
|
-
|
86
|
-
/**
|
87
|
-
* Normalize `path` relative to the current path.
|
88
|
-
*
|
89
|
-
* @param {String} curr
|
90
|
-
* @param {String} path
|
91
|
-
* @return {String}
|
92
|
-
* @api private
|
93
|
-
*/
|
94
|
-
|
95
|
-
require.normalize = function(curr, path) {
|
96
|
-
var segs = [];
|
97
|
-
|
98
|
-
if ('.' != path.charAt(0)) return path;
|
99
|
-
|
100
|
-
curr = curr.split('/');
|
101
|
-
path = path.split('/');
|
102
|
-
|
103
|
-
for (var i = 0; i < path.length; ++i) {
|
104
|
-
if ('..' == path[i]) {
|
105
|
-
curr.pop();
|
106
|
-
} else if ('.' != path[i] && '' != path[i]) {
|
107
|
-
segs.push(path[i]);
|
108
|
-
}
|
109
|
-
}
|
110
|
-
|
111
|
-
return curr.concat(segs).join('/');
|
112
|
-
};
|
113
|
-
|
114
|
-
/**
|
115
|
-
* Register module at `path` with callback `definition`.
|
116
|
-
*
|
117
|
-
* @param {String} path
|
118
|
-
* @param {Function} definition
|
119
|
-
* @api private
|
120
|
-
*/
|
121
|
-
|
122
|
-
require.register = function(path, definition) {
|
123
|
-
require.modules[path] = definition;
|
124
|
-
};
|
125
|
-
|
126
|
-
/**
|
127
|
-
* Alias a module definition.
|
128
|
-
*
|
129
|
-
* @param {String} from
|
130
|
-
* @param {String} to
|
131
|
-
* @api private
|
132
|
-
*/
|
133
|
-
|
134
|
-
require.alias = function(from, to) {
|
135
|
-
if (!require.modules.hasOwnProperty(from)) {
|
136
|
-
throw new Error('Failed to alias "' + from + '", it does not exist');
|
137
|
-
}
|
138
|
-
require.aliases[to] = from;
|
139
|
-
};
|
140
|
-
|
141
|
-
/**
|
142
|
-
* Return a require function relative to the `parent` path.
|
143
|
-
*
|
144
|
-
* @param {String} parent
|
145
|
-
* @return {Function}
|
146
|
-
* @api private
|
147
|
-
*/
|
148
|
-
|
149
|
-
require.relative = function(parent) {
|
150
|
-
var p = require.normalize(parent, '..');
|
151
|
-
|
152
|
-
/**
|
153
|
-
* lastIndexOf helper.
|
154
|
-
*/
|
155
|
-
|
156
|
-
function lastIndexOf(arr, obj) {
|
157
|
-
var i = arr.length;
|
158
|
-
while (i--) {
|
159
|
-
if (arr[i] === obj) return i;
|
160
|
-
}
|
161
|
-
return -1;
|
162
|
-
}
|
163
|
-
|
164
|
-
/**
|
165
|
-
* The relative require() itself.
|
166
|
-
*/
|
167
|
-
|
168
|
-
function localRequire(path) {
|
169
|
-
var resolved = localRequire.resolve(path);
|
170
|
-
return require(resolved, parent, path);
|
171
|
-
}
|
172
|
-
|
173
|
-
/**
|
174
|
-
* Resolve relative to the parent.
|
175
|
-
*/
|
176
|
-
|
177
|
-
localRequire.resolve = function(path) {
|
178
|
-
var c = path.charAt(0);
|
179
|
-
if ('/' == c) return path.slice(1);
|
180
|
-
if ('.' == c) return require.normalize(p, path);
|
181
|
-
|
182
|
-
// resolve deps by returning
|
183
|
-
// the dep in the nearest "deps"
|
184
|
-
// directory
|
185
|
-
var segs = parent.split('/');
|
186
|
-
var i = lastIndexOf(segs, 'deps') + 1;
|
187
|
-
if (!i) i = 0;
|
188
|
-
path = segs.slice(0, i + 1).join('/') + '/deps/' + path;
|
189
|
-
return path;
|
190
|
-
};
|
191
|
-
|
192
|
-
/**
|
193
|
-
* Check if module is defined at `path`.
|
194
|
-
*/
|
195
|
-
|
196
|
-
localRequire.exists = function(path) {
|
197
|
-
return require.modules.hasOwnProperty(localRequire.resolve(path));
|
198
|
-
};
|
199
|
-
|
200
|
-
return localRequire;
|
201
|
-
};
|
202
|
-
require.register("isarray/index.js", function(exports, require, module){
|
203
|
-
module.exports = Array.isArray || function (arr) {
|
204
|
-
return Object.prototype.toString.call(arr) == '[object Array]';
|
205
|
-
};
|
206
|
-
|
207
|
-
});
|
208
|
-
require.alias("isarray/index.js", "isarray/index.js");
|
209
|
-
|