<commit_before>#! /usr/bin/env ruby

require 'csv'
require 'json'
require 'fog'
require 'httparty'

def notify_slack(version)
  slack_url = "https://swarmize.slack.com/services/hooks/incoming-webhook?token=#{CONFIG['slack_key']}"
  host = "http://swarmize-prod.elasticbeanstalk.com"

  HTTParty.post(slack_url, body: {channel: '#general', username: 'deploybot', text: "Deployed version #{version} to <#{host}>"}.to_json)
end

# stick your standard Amazon creds in the main project directory.
creds = CSV.read('../credentials.csv', :headers => true)[0]

KEY = creds['Access Key Id']
SECRET = creds['Secret Access Key']

CONFIG = JSON.parse(File.read('deploy.json'))

currentrev = `git log --pretty=format:'%h' -n 1`
package_filename = "package-#{currentrev}.zip"
package_version = "package-#{currentrev}"

s3 = Fog::Storage.new({
  :provider                 => 'AWS',
  :aws_access_key_id        => KEY,
  :aws_secret_access_key    => SECRET,
  :path_style => true,
  :region => CONFIG['aws_region']
})
<commit_msg>Specify appname in deploy message.<commit_after>#! /usr/bin/env ruby

require 'csv'
require 'json'
require 'fog'
require 'httparty'

def notify_slack(version)
  slack_url = "https://swarmize.slack.com/services/hooks/incoming-webhook?token=#{CONFIG['slack_key']}"
  host = "http://swarmize-prod.elasticbeanstalk.com"

  HTTParty.post(slack_url, body: {channel: '#general', username: 'deploybot', text: "Deployed #{CONFIG['appname']} version #{version} to <#{host}>"}.to_json)
end

# stick your standard Amazon creds in the main project directory.
creds = CSV.read('../credentials.csv', :headers => true)[0]

KEY = creds['Access Key Id']
SECRET = creds['Secret Access Key']

CONFIG = JSON.parse(File.read('deploy.json'))

currentrev = `git log --pretty=format:'%h' -n 1`
package_filename = "package-#{currentrev}.zip"
package_version = "package-#{currentrev}"

s3 = Fog::Storage.new({
  :provider                 => 'AWS',
  :aws_access_key_id        => KEY,
  :aws_secret_access_key    => SECRET,
  :path_style => true,
  :region => CONFIG['aws_region']
})

{'fraction_non_alphanumeric': 0.17101449275362318, 'fraction_numerical': 0.002898550724637681, 'mean_word_length': 4.705234159779614, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 17, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5972095', 'n_tokens_mistral': 740, 'n_tokens_neox': 729, 'n_words': 157}