slnky 0.1.6 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/capistrano/tasks/slnky.rake +7 -0
- data/lib/slnky/generator.rb +4 -1
- data/lib/slnky/service.rb +7 -1
- data/lib/slnky/template/service/{.gitignore → .gitignore.erb} +3 -1
- data/lib/slnky/template/service/{Gemfile → Gemfile.erb} +1 -1
- data/lib/slnky/template/service/deploy.env +4 -0
- data/lib/slnky/template/service/log/.keep +0 -0
- data/lib/slnky/template/service/upstart/init.conf.erb +1 -1
- data/lib/slnky/version.rb +1 -1
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eb1a2cf60af39bc1f8527438296e6960c6c5f258
|
4
|
+
data.tar.gz: 86dc87e48e935e746ab38192df0ff11bc30b3e37
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 75311b244e94a31513dd13f0a827d42190c83d8b03aa682cc3d9fd4a60dac761771b8305a9f2b0fcb7661d14e1e79ef7e47273800e50285bc3114b9fcbfe62d8
|
7
|
+
data.tar.gz: 2cfd7f0987911b410db2c331003f1353dacbc6242547426073ace4e181f41b126a5bac58c1d84cf67a68c3015c7d07d785eab5ca8fac51b6910d1ea998a71e4b
|
data/lib/slnky/generator.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'erb'
|
2
2
|
require 'tilt'
|
3
|
+
require 'find'
|
3
4
|
|
4
5
|
module Slnky
|
5
6
|
module Generator
|
@@ -20,10 +21,12 @@ module Slnky
|
|
20
21
|
FileUtils.cp_r(@template, @dir)
|
21
22
|
puts "#{@dir}:"
|
22
23
|
# process templates
|
23
|
-
|
24
|
+
Find.find(@dir).each do |f|
|
24
25
|
next unless File.file?(f) && File.extname(f) == '.erb'
|
25
26
|
template(f)
|
26
27
|
end
|
28
|
+
# make service executable
|
29
|
+
`chmod 755 #{dir}/service`
|
27
30
|
# git init
|
28
31
|
puts "initializing git..."
|
29
32
|
`cd #{@dir} && git init . || true`
|
data/lib/slnky/service.rb
CHANGED
@@ -2,6 +2,7 @@ require 'slnky/version'
|
|
2
2
|
require 'slnky/message'
|
3
3
|
require 'amqp'
|
4
4
|
require 'open-uri'
|
5
|
+
require 'json'
|
5
6
|
|
6
7
|
module Slnky
|
7
8
|
module Service
|
@@ -9,7 +10,8 @@ module Slnky
|
|
9
10
|
def initialize(url)
|
10
11
|
@server = url
|
11
12
|
@name = self.class.name.split('::').last.downcase
|
12
|
-
|
13
|
+
json = open("#{@server}/configs/#{@name}") {|f| f.read }
|
14
|
+
@config = JSON.parse(json)
|
13
15
|
@host = @config['rabbit']['host']
|
14
16
|
@port = @config['rabbit']['port']
|
15
17
|
@subscriptions = {}
|
@@ -39,6 +41,10 @@ module Slnky
|
|
39
41
|
if @subscriptions[payload.name]
|
40
42
|
@subscriptions[payload.name].call(payload)
|
41
43
|
end
|
44
|
+
# TODO: support this better
|
45
|
+
if @subscriptions['*']
|
46
|
+
@subscriptions['*'].call(payload)
|
47
|
+
end
|
42
48
|
end
|
43
49
|
|
44
50
|
@periodics.each do |p|
|
File without changes
|
data/lib/slnky/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: slnky
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shawn Catanzarite
|
@@ -151,17 +151,19 @@ files:
|
|
151
151
|
- lib/slnky/message.rb
|
152
152
|
- lib/slnky/service.rb
|
153
153
|
- lib/slnky/template/service/.env.sample
|
154
|
-
- lib/slnky/template/service/.gitignore
|
154
|
+
- lib/slnky/template/service/.gitignore.erb
|
155
155
|
- lib/slnky/template/service/.rspec
|
156
156
|
- lib/slnky/template/service/.travis.yml
|
157
157
|
- lib/slnky/template/service/CODE_OF_CONDUCT.md
|
158
158
|
- lib/slnky/template/service/Capfile
|
159
|
-
- lib/slnky/template/service/Gemfile
|
159
|
+
- lib/slnky/template/service/Gemfile.erb
|
160
160
|
- lib/slnky/template/service/config/deploy.rb.erb
|
161
161
|
- lib/slnky/template/service/config/deploy/production.rb
|
162
162
|
- lib/slnky/template/service/config/deploy/staging.rb
|
163
|
+
- lib/slnky/template/service/deploy.env
|
163
164
|
- lib/slnky/template/service/lib/capistrano/tasks/NAME.rake.erb
|
164
165
|
- lib/slnky/template/service/lib/slnky/service/NAME.rb.erb
|
166
|
+
- lib/slnky/template/service/log/.keep
|
165
167
|
- lib/slnky/template/service/service.erb
|
166
168
|
- lib/slnky/template/service/spec/slnky/service/NAME_spec.rb.erb
|
167
169
|
- lib/slnky/template/service/spec/spec_helper.rb.erb
|