firespring_dev_commands 2.1.1.pre.alpha.5 → 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/firespring_dev_commands/aws/account.rb +1 -0
- data/lib/firespring_dev_commands/aws/credentials.rb +1 -0
- data/lib/firespring_dev_commands/common.rb +2 -2
- data/lib/firespring_dev_commands/slack/global.rb +6 -1
- data/lib/firespring_dev_commands/slack.rb +5 -0
- data/lib/firespring_dev_commands/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: abb45242307cc08509ddc63a507488ce03e1d545ef01abc2f909d2b09382c8a1
|
4
|
+
data.tar.gz: 2f65a0f2845675e4930ff062865d47535c086b88267be51bba1e142f4b678057
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7d699f6345d0cae3650009a92330ee4b46882c849ac85fe6cb99e53861e9a57bd9e53e119e28be8ffbce6066d9e021985a7e93734aec848705b227cdd291522a
|
7
|
+
data.tar.gz: 972fd3a65395c8cff43136fb5cadaf96f1ab554c78feb917c9f7fccb765f3210d680e7e653f46693d9568f42bf04ef7a670e4036cf0eedec33e214b969e62ea0
|
@@ -23,6 +23,7 @@ module Dev
|
|
23
23
|
# The name of the file containing the Aws settings
|
24
24
|
CONFIG_FILE = "#{Dev::Aws::CONFIG_DIR}/config".freeze
|
25
25
|
|
26
|
+
# Returns the config ini file associated with this object
|
26
27
|
def self.config_ini
|
27
28
|
IniFile.new(filename: CONFIG_FILE, default: 'default')
|
28
29
|
end
|
@@ -11,6 +11,7 @@ module Dev
|
|
11
11
|
# The local file where temporary credentials are stored
|
12
12
|
CONFIG_FILE = "#{Dev::Aws::CONFIG_DIR}/credentials".freeze
|
13
13
|
|
14
|
+
# Returns the config ini file associated with this object
|
14
15
|
def self.config_ini
|
15
16
|
IniFile.new(filename: CONFIG_FILE, default: 'default')
|
16
17
|
end
|
@@ -89,8 +89,8 @@ module Dev
|
|
89
89
|
true
|
90
90
|
end
|
91
91
|
|
92
|
-
# Remove all leading non
|
93
|
-
# Remove all trailing non
|
92
|
+
# Remove all leading non left-curly-brace characters
|
93
|
+
# Remove all trailing non right-curly-brace characters
|
94
94
|
def strip_non_json(str)
|
95
95
|
str.sub(/\A[^{]*{/m, '{').sub(/}[^}]*\z/m, '}')
|
96
96
|
end
|
@@ -3,21 +3,26 @@ require 'dotenv'
|
|
3
3
|
|
4
4
|
module Dev
|
5
5
|
class Slack
|
6
|
+
# A class to manage slack global configuration settings
|
6
7
|
class Global
|
7
8
|
# The filename where we store the local auth information
|
8
9
|
CONFIG_FILE = "#{Dir.home}/.env.slack".freeze
|
9
10
|
|
11
|
+
# The name of the environmental setting which holds the slack token
|
10
12
|
SLACK_API_TOKEN = 'SLACK_API_TOKEN'.freeze
|
11
13
|
|
14
|
+
# Method to load the slack config file and then configure slack
|
12
15
|
def configure
|
13
16
|
# Always load the env slack auth
|
14
17
|
Dotenv.load(CONFIG_FILE) if File.exist?(CONFIG_FILE)
|
15
18
|
|
16
19
|
::Slack.configure do |c|
|
17
|
-
c.token = ENV.fetch(
|
20
|
+
c.token = ENV.fetch(SLACK_API_TOKEN, nil)
|
18
21
|
c.logger = LOG if ENV['ENABLE_SLACK_DEBUG'].to_s.strip == 'true'
|
19
22
|
end
|
20
23
|
end
|
24
|
+
|
25
|
+
# Run the configure when creating this class to load any existing settings
|
21
26
|
new.configure
|
22
27
|
|
23
28
|
# Write the new slack auth value to the env file
|
@@ -1,18 +1,23 @@
|
|
1
1
|
require 'slack'
|
2
2
|
|
3
3
|
module Dev
|
4
|
+
# The main slack class for posting/uploading messages
|
4
5
|
class Slack
|
6
|
+
# The attribute which contains the underlying slack web client object
|
5
7
|
attr_accessor :client
|
6
8
|
|
9
|
+
# Create a new slack web client and make sure it has valid credentials
|
7
10
|
def initialize
|
8
11
|
@client = ::Slack::Web::Client.new
|
9
12
|
@client.auth_test
|
10
13
|
end
|
11
14
|
|
15
|
+
# Post the text to the given channel
|
12
16
|
def post(channel:, text:)
|
13
17
|
client.chat_postMessage(channel:, text:)
|
14
18
|
end
|
15
19
|
|
20
|
+
# Upload the text to the give channel as a text file
|
16
21
|
def upload_text(channel:, text:, title: 'Text File', filename: 'file.txt')
|
17
22
|
raise 'text should be a string' unless text.is_a?(String)
|
18
23
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: firespring_dev_commands
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.1
|
4
|
+
version: 2.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Firespring
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-08-
|
11
|
+
date: 2023-08-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -330,9 +330,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
330
330
|
version: '3.1'
|
331
331
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
332
332
|
requirements:
|
333
|
-
- - "
|
333
|
+
- - ">="
|
334
334
|
- !ruby/object:Gem::Version
|
335
|
-
version:
|
335
|
+
version: '0'
|
336
336
|
requirements: []
|
337
337
|
rubygems_version: 3.4.10
|
338
338
|
signing_key:
|