factor 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -5,8 +5,11 @@ module Factor
5
5
  module CLI
6
6
  class ServerTask < Command
7
7
  desc "start", "start the server"
8
+ method_option :tags, :alias=>"-t", :type=>:hash, :desc=>"Optional tags to identify from workflow"
8
9
  def start
9
10
  engine = Factor::Runtime::Engine.new(get_config[:email],get_config[:token])
11
+
12
+ options.tags.each {|tag,value| engine.tag(tag,value)}
10
13
 
11
14
  puts "loading channels"
12
15
  engine = @client.load_channels(engine)
data/lib/client/client.rb CHANGED
@@ -8,7 +8,8 @@ require 'open-uri'
8
8
  module Factor
9
9
  module Client
10
10
  class Client
11
- HOST = "http://factor.io"
11
+ #HOST = "http://factor.io"
12
+ HOST = "http://localhost:3000"
12
13
 
13
14
  def register(email,password)
14
15
  end
@@ -2,7 +2,6 @@ require 'rubygems'
2
2
  require 'factor'
3
3
  require 'mustache'
4
4
  require 'facter'
5
- require 'siren'
6
5
 
7
6
 
8
7
  module Factor
@@ -16,8 +15,12 @@ module Factor
16
15
  @workflows = Hash.new
17
16
  @message_bus = MessageBus.new(username,token)
18
17
  @credentials = Hash.new
18
+ @tags = Hash.new
19
19
  end
20
20
 
21
+ def tag(key,value)
22
+ @tags[key]=value
23
+ end
21
24
 
22
25
  # load the channel by referencing the .rb file
23
26
  # the filename is lowercase with "_" for spaces
@@ -114,8 +117,9 @@ module Factor
114
117
 
115
118
  def match(target)
116
119
  return true if target==nil || target==""
117
- [key,value]=target.split("=")
118
- Facter[key]==value
120
+ facts Facter.collection.merge(@tags)
121
+ key,value=target.split("=")
122
+ facts[key]==value
119
123
  end
120
124
 
121
125
 
@@ -21,7 +21,8 @@ module Factor
21
21
  # the exchange routes it to the queues based on the route_key
22
22
  def start(topic="workflow",&code)
23
23
  EventMachine.run do
24
- connection_settings={:host=>@host,:user=>@username,:password=>@token,:vhost=>@vhost}
24
+ #connection_settings={:host=>@host,:user=>@username,:password=>@token,:vhost=>@vhost}
25
+ connection_settings={:host=>@host}
25
26
  @connection = AMQP.connect(connection_settings)
26
27
  @channel = AMQP::Channel.new(connection)
27
28
  @exchange = @channel.topic(topic,:auto_delete=>true) # new topic exchange
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.7
4
+ version: 0.0.8
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -139,22 +139,6 @@ dependencies:
139
139
  - - ! '>='
140
140
  - !ruby/object:Gem::Version
141
141
  version: '0'
142
- - !ruby/object:Gem::Dependency
143
- name: siren
144
- requirement: !ruby/object:Gem::Requirement
145
- none: false
146
- requirements:
147
- - - ! '>='
148
- - !ruby/object:Gem::Version
149
- version: '0'
150
- type: :runtime
151
- prerelease: false
152
- version_requirements: !ruby/object:Gem::Requirement
153
- none: false
154
- requirements:
155
- - - ! '>='
156
- - !ruby/object:Gem::Version
157
- version: '0'
158
142
  - !ruby/object:Gem::Dependency
159
143
  name: facter
160
144
  requirement: !ruby/object:Gem::Requirement