rrake 0.3.1 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NjMxYWY3ZjQwZjgxN2ZlYTE5MDFlZWZhMDBkNTVlNmRlZTljYTI4Yg==
4
+ MTEyYmE5ZmEzY2EyMWVjYTUxOGMxYzUwYWE5OTdlMTFiMTEzMGNjOA==
5
5
  data.tar.gz: !binary |-
6
- ZDU0MjIxMWQwOWYzY2M5YWM2NDU5NDYzZWY3YmM3ZjkyNWQ4OGNkOA==
6
+ NzU2YTI1OWI5NmJlYzdmZGRlYWEwNWZmZGFmZTk1YTZiMzM1MWY3Yg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- MzgzMzBiM2FkNGZiMjk3YzFhYjY0NTlmYmEzYTI3ZjZiNTA4YzIxNTdhNGZm
10
- YzU3MGMwNDJmN2I0OTVkM2E0ODJhMWRlM2IzZGY5NmNlZTBmMDRhMzNkYmEw
11
- N2RlZmY1ZTMwN2MyZWFiYzllNGNiZTczMjI5ZTNkNTNlMTVmMmU=
9
+ ZGZhZmUzNWYwYzlkMzc2MTVkMmRjODYzN2NkNWQ1ODRhZDU3MGVkN2JkYWYz
10
+ MWVmNjQ2YTRhNDFlNDcwYWQxYmVhNjZiOTI0OTcyMzZkM2UyODM4M2FhMDI1
11
+ YjEyMzkyOGNmNjI0NzUzOTUxMGVlNTNkNDQyMWFmOGNmNTkyZTk=
12
12
  data.tar.gz: !binary |-
13
- NjEwYjQ4NDQyYjhjNTI3YWNkY2Q1M2Q3ZGMwOTgyYjMxYjY4NWZiODA4YTVj
14
- ZWJlMDZjYWMyNjQ5ZjE4YmU5ZmViZGFiMjEyNDFkYzJmNDYzNzhhYTg4MDA0
15
- NmU3Y2VmMjBiOTE1MWJlNjJkZDU2NjFlNjdlNGQ5N2RlNzg5NGE=
13
+ ODAzNTA3NzViMTRiYjE3NzI5YzMyN2ZkZTViMGZkYTVjZWM0MDg4ZjYwYTk5
14
+ MmE3Njc0MDBjZjNjNjE3ZTg4NmU0NjRkZjA3NDYzZDRmNjllYTRjOGU2Yjhh
15
+ OTZiY2FmMzM2MDEzZTI4ZGYzMWJlMDFmMDM1NzI0YjFlNzMwN2Q=
data/exe/issue_rake ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+ require 'rubygems'
3
+ require 'rrake'
4
+
5
+ Rrake::IssueRrake.new.issue_command ARGV.first
6
+
data/lib/rrake.rb CHANGED
@@ -15,9 +15,9 @@ module Rrake
15
15
  @logger = Logger.new logfile
16
16
  @stop = false
17
17
 
18
- raise RuntimeError, "Please ensure AWS_ACCESS_KEY is set." if @awsAccessKeyId.empty?
19
- raise RuntimeError, "Please ensure AWS_SECRET_ACCESS_KEY is set." if @awsSecretAccessKey.empty?
20
- raise RuntimeError, "Please ensure RRAKE_QUEUE is set." if @rrakeQueue.empty?
18
+ @logger.fatal "Please ensure AWS_ACCESS_KEY is set." if @awsAccessKeyId.nil? or @awsAccessKeyId.empty?
19
+ @logger.fatal "Please ensure AWS_SECRET_ACCESS_KEY is set." if @awsSecretAccessKey.nil? or @awsSecretAccessKey.empty?
20
+ @logger.fatal "Please ensure RRAKE_QUEUE is set." if @rrakeQueue.nil? or @rrakeQueue.empty?
21
21
 
22
22
  @logger.info "RRake is ready to do your remote bidding."
23
23
  end
@@ -51,4 +51,30 @@ module Rrake
51
51
  end
52
52
 
53
53
  end
54
+
55
+ class IssueRrake
56
+
57
+ def initialize
58
+ @awsAccessKeyId = ENV['AWS_ACCESS_KEY']
59
+ @awsSecretAccessKey = ENV['AWS_SECRET_ACCESS_KEY']
60
+ @rrakeTopic = ENV['RRAKE_TOPIC']
61
+ logfile = ENV['RRAKE_LOGFILE_PATH'].nil? ? STDOUT : File.open(ENV['RRAKE_LOGFILE_PATH'], 'a')
62
+ @logger = Logger.new logfile
63
+
64
+ @logger.fatal "Please ensure AWS_ACCESS_KEY is set." if @awsAccessKeyId.nil? or @awsAccessKeyId.empty?
65
+ @logger.fatal "Please ensure AWS_SECRET_ACCESS_KEY is set." if @awsSecretAccessKey.nil? or @awsSecretAccessKey.empty?
66
+ @logger.fatal "Please ensure RRAKE_TOPIC is set." if @rrakeTopic.nil? or @rrakeTopic.empty?
67
+ end
68
+
69
+ def issue_command(command)
70
+ @logger.info "Issueing Command: #{command}"
71
+ sns = AWS::SNS.new(region: 'us-east-1', access_key_id: @awsAccessKeyId, secret_access_key: @awsSecretAccessKey)
72
+ @logger.info sns.topics[@rrakeTopic].publish(command)
73
+ rescue Exception => ex
74
+ @logger.error "Something cause an SQS failure."
75
+ @logger.error ex
76
+ end
77
+
78
+ end
79
+
54
80
  end
data/lib/rrake/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Rrake
2
- VERSION = "0.3.1"
2
+ VERSION = "0.4.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rrake
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - EmergeAdapt
@@ -71,6 +71,7 @@ description: Runs 'local' rake commands requested remotely via SNS. For example
71
71
  email:
72
72
  - development@emergeadapt.com
73
73
  executables:
74
+ - issue_rake
74
75
  - rrake
75
76
  extensions: []
76
77
  extra_rdoc_files: []
@@ -84,6 +85,7 @@ files:
84
85
  - Rakefile
85
86
  - bin/console
86
87
  - bin/setup
88
+ - exe/issue_rake
87
89
  - exe/rrake
88
90
  - lib/rrake.rb
89
91
  - lib/rrake/version.rb