evesync 1.0.3 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +18 -10
  3. data/bin/evesync +31 -0
  4. data/lib/evesync.rb +1 -1
  5. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 95ec2a2e3dc4003e312336aa8587b7f951e6cf8c280117b3e93f467154bd1324
4
- data.tar.gz: f5cdbade0becf9af5c8748a31fcc5e116e69f14744c0d716a172e256343bd759
3
+ metadata.gz: 89f74020a22ae230f9ff9d31d26a7983acde3cc073a4ef9e70e6f053d028e91f
4
+ data.tar.gz: 593bfa7b50fd6a2f17818cb00a9e1394c3409808c724469bc3bad706ead0e4ff
5
5
  SHA512:
6
- metadata.gz: 45c1c3567b398d297301d06a2bffb11355c851b929788b64c798b697b5869dd497b00df2d7a79ec6e4cfcbe046707cf4f9aeff0084d0d11cbd6ace30ede174a4
7
- data.tar.gz: 29974c36900490b25914ac79a7f9b699452dfaf3e8b51d8b7b8969fdbff04ed96f106d41a1ec2f7e29882cb73076054ef3f46e62972e18cee13a287035719704
6
+ metadata.gz: 596d803d35d866764391284a1c65eead4e73d7ab7a73304d5d7f4b6275943988b829b340f87b676f3fc8aef99b589df2a5bbbd42297a22e577edaf4839a0f4c7
7
+ data.tar.gz: 5520247054b67b98b9753c07bf50ef099ea01e3f9777beaf23cbf0a2cf9947022e50e274ebb6c5bdebccde17c779361797d31b3d8acdb8f00c0afcbb90109f2d
data/Rakefile CHANGED
@@ -68,17 +68,25 @@ task :down do
68
68
  sh 'docker-compose rm --force ||:'
69
69
  end
70
70
 
71
- task :rpm do
72
- relase = `git rev-list HEAD master --count`
73
- sh("rpmbuild -bb "\
74
- "--define 'VERSION #{VERSION}' "\
75
- "--define 'RELEASE #{release}' "\
76
- "--define '_builddir #{Dir.pwd}' "\
77
- "--define '_rpmdir #{Dir.pwd}/RPM/' "\
78
- "evesync.spec")
79
- sh('chown -R 1000:1000 RPM')
71
+
72
+ namespace :rhel do
73
+ begin
74
+ @release = `git rev-list HEAD master --count`
75
+ rescue
76
+ @release = 0
77
+ end
78
+
79
+ task :rpm do
80
+ sh("rpmbuild -bb "\
81
+ "--define 'VERSION #{VERSION}' "\
82
+ "--define 'RELEASE #{@release}' "\
83
+ "--define '_builddir #{Dir.pwd}' "\
84
+ "--define '_rpmdir #{Dir.pwd}/RPM/' "\
85
+ "evesync.spec")
86
+ sh('chown -R 1000:1000 RPM')
87
+ end
80
88
  end
81
89
 
82
90
  task :'build-rpm' do
83
- sh('echo rake rpm | docker-compose run build-centos')
91
+ sh('echo rake rhel:rpm | docker-compose run build-centos')
84
92
  end
@@ -5,6 +5,7 @@ require 'optparse'
5
5
  require 'socket'
6
6
  require 'find'
7
7
  require 'zip'
8
+ require 'fileutils'
8
9
  require 'evesync'
9
10
  require 'evesync/log'
10
11
  require 'evesync/utils'
@@ -64,6 +65,36 @@ OptionParser.new do |parser|
64
65
  puts parser
65
66
  exit
66
67
  end
68
+
69
+ # TODO: refactor
70
+ parser.on('-r', '--run', 'Start daemons') do
71
+ r, w = IO.pipe
72
+ data_pid = spawn('evedatad', :err => '/var/log/evesync/evedatad.log', :out=>:err)
73
+ mon_pid = spawn('evemond', :err => '/var/log/evesync/evemond.log', :out=>:err)
74
+ hand_pid = spawn('evehand', :err => '/var/log/evesync/evehand.log', :out=>:err)
75
+ sync_pid = spawn('evesyncd', :err => '/var/log/evesync/evesyncd.log', :out=>:err)
76
+ FileUtils.mkdir_p('/var/run/evesync')
77
+ File.write('/var/run/evesync/evedatad.pid', data_pid)
78
+ File.write('/var/run/evesync/evemond.pid', mon_pid)
79
+ File.write('/var/run/evesync/evehand.pid', hand_pid)
80
+ File.write('/var/run/evesync/evesyncd.pid', sync_pid)
81
+ end
82
+
83
+ parser.on('-k', '--kill', 'Stop daemons') do
84
+ begin
85
+ Process.kill('TERM', File.read('/var/run/evesync/evemond.pid').to_i)
86
+ Process.kill('TERM', File.read('/var/run/evesync/evehand.pid').to_i)
87
+ Process.kill('TERM', File.read('/var/run/evesync/evesyncd.pid').to_i)
88
+ Process.kill('TERM', File.read('/var/run/evesync/evedatad.pid').to_i)
89
+ rescue Errno::ESRCH => e
90
+ puts('Some process already killed')
91
+ rescue StandardError => e
92
+ puts("Error: #{e}")
93
+ puts('Something went wrong while killing processes. Do it yourself!')
94
+ ensure
95
+ FileUtils.rm_f Dir.glob('/var/run/evesync/*.pid')
96
+ end
97
+ end
67
98
  end.parse!
68
99
 
69
100
  def force_sync
@@ -1,3 +1,3 @@
1
1
  module Evesync
2
- VERSION = '1.0.3'.freeze
2
+ VERSION = '1.0.4'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: evesync
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kiselev Valentine