factor 0.0.84 → 0.0.85

Sign up to get free protection for your applications and to get access to all the features.
@@ -6,24 +6,39 @@ module Factor
6
6
  class ServerTask < Command
7
7
  desc "start", "start the server"
8
8
  method_option :tags, :alias=>"-t", :type=>:hash, :desc=>"Optional tags to identify from workflow"
9
+ method_option :channels, :type=>:array, :desc=>"Optional channel ruby file list for development"
9
10
  def start
10
11
  engine = Factor::Runtime::Engine.new(get_config[:email],get_config[:token])
11
12
 
12
13
  options.tags.each {|tag,value| engine.tag(tag,value)} if options.tags?
13
14
 
14
- puts "loading channels"
15
+ # load channels from server
16
+ puts "loading channels from server"
15
17
  engine = @client.load_channels(engine) do |message|
16
18
  puts " #{message}"
17
19
  end
20
+
21
+ # load channels from files
22
+ if options.channels?
23
+ options.channels.each do |file|
24
+ full_file=File.expand_path(file)
25
+ puts " loading '#{full_file}'"
26
+ engine.load_channel(full_file)
27
+ puts " loaded '#{full_file}'"
28
+ end
29
+ end
30
+
18
31
  puts "loading channels complete"
19
32
 
20
- puts "loading workflows"
33
+
34
+ # load workflows from server
35
+ puts "loading workflows from server"
21
36
  engine = @client.load_workflows(engine) do |message|
22
37
  puts " #{message}"
23
38
  end
24
39
  puts "loading workflows complete"
25
40
 
26
- puts "loading credentials"
41
+ puts "loading credentials from server"
27
42
  engine = @client.load_credentials(engine) do |message|
28
43
  puts " #{message}"
29
44
  end
data/lib/client/client.rb CHANGED
@@ -43,7 +43,7 @@ module Factor
43
43
  code.call("downloading credential list")
44
44
  credentials = rest_get("credentials")
45
45
  code.call("loading credentials")
46
- engine.load_credentials(credentials)
46
+ engine.load_credentials(credentials["value"])
47
47
 
48
48
  engine
49
49
  end
@@ -31,8 +31,6 @@ module Factor
31
31
  require file
32
32
  channel_module_name = File.basename(file).gsub('.rb','').split('_').map{|ea| ea.capitalize}.join('')
33
33
  channel_module= self.class.const_get(channel_module_name)
34
- puts "[channel_module.definition['module']] #{channel_module.definition["module"]}"
35
- puts "[channel_module] #{channel_module.inspect}"
36
34
  @channel_modules[channel_module.definition["module"]]=channel_module
37
35
  end
38
36
 
@@ -75,7 +73,6 @@ module Factor
75
73
  workflow = @workflows[message.workflow]
76
74
  activity = workflow.get_activity(message.position)
77
75
  if !activity.nil?
78
- # puts "[activity] #{activity.to_s}"
79
76
  action = activity["action"]
80
77
  channel = activity["channel"]
81
78
  method = activity["method"]
@@ -85,13 +82,11 @@ module Factor
85
82
  if match(target)
86
83
 
87
84
  values = message.body.merge(@credentials)
88
- # puts "[values] #{values}"
89
85
  # this maps the input values passed in with the templated defined in the workflow
90
86
  params = Hash.new
91
87
  activity["params"].each do |key,template|
92
88
  params[key]=Mustache.render(template,values)
93
89
  end
94
- # puts "[calling] #{channel}::#{method} (#{params.to_s})"
95
90
  event = call_channel_method(channel,method,params)
96
91
 
97
92
  response_message = message.respond(event.params,event.class.name.split("::").last)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: factor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.84
4
+ version: 0.0.85
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: