faastruby 0.5.22 → 0.5.23

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3e08bac2ed5dcabe21891e5945035651d1013743aadba90de392ef7295cd2a95
4
- data.tar.gz: ad2984694a429edd97df32d53cbe2594a67282f1158ae3ddc0853a9b51e150de
3
+ metadata.gz: 4bb0861a4131568e00f7008cea2ad1a83f179b739788ad09d21780e82c9edf41
4
+ data.tar.gz: be634ded83c995f6a5b86293960d09535a10509c119f49f425825664c0b0567a
5
5
  SHA512:
6
- metadata.gz: bc3264038b2bff85ad9e5b2f2a52133d0bd0c91b250a931dd6b5d467bfd02e9e9cfeeb64f19a50f4a1915867634d4ce4a5db467ebb73130a051e5eb8e420fbee
7
- data.tar.gz: 43e91e8bc235ee6de9147d8085113bc3511668349b1b5a708e7bf971fbfe9a7324bdc80f519da390b7712ed5bfe517488beb3754ac236d86e9a450c6570c1271
6
+ metadata.gz: 778433fef0a7ad573166042f0c0bc559e9ccb4218fe0ab70b845d1ff64a4e294007f817f1de452ad815574264e04b6cd928ac7a6537aaf51cf09e635ddce8cb1
7
+ data.tar.gz: 23df4f5fc80cdf5c6216d542ec6065022d605c0ce625b5810560a9a1839d3c6bd5b02852a7eb60a0de416807ebdb507e7c55ae4d51ed099c235bae359b6c50e3
data/CHANGELOG.md CHANGED
@@ -1,6 +1,13 @@
1
1
  # Changelog
2
2
 
3
- ## 0.5.22 - unreleased
3
+ ## 0.5.23 - Apr 7 2019
4
+ - Move regions configuration to a separate file, so it can be shared among different components of the gem
5
+ - Replace hardcoded URLs by the correct variables
6
+ - Fix messy env vars
7
+ - Ensure logout happens even if connection to the API fails
8
+ - Bump faastruby-rpc to 0.2.7
9
+
10
+ ## 0.5.22 - April 1 2019
4
11
  - Detect Crystal functions that have `handler.cr` inside `src` directory
5
12
  - Exclude Crystal function handler binaries when generating a deployment package
6
13
  - Move Crystal Runtime Macro to the top of the file, outside the FaaStRuby module
data/Gemfile.lock CHANGED
@@ -3,7 +3,7 @@ PATH
3
3
  specs:
4
4
  faastruby (0.5.22)
5
5
  colorize (~> 0.8)
6
- faastruby-rpc (~> 0.2.6)
6
+ faastruby-rpc (~> 0.2.7)
7
7
  listen (~> 3.1)
8
8
  oj (~> 3.6)
9
9
  puma (~> 3.12)
@@ -21,7 +21,7 @@ GEM
21
21
  specs:
22
22
  addressable (2.5.2)
23
23
  public_suffix (>= 2.0.2, < 4.0)
24
- backports (3.12.0)
24
+ backports (3.13.0)
25
25
  colorize (0.8.1)
26
26
  crack (0.4.3)
27
27
  safe_yaml (~> 1.0.0)
@@ -30,7 +30,7 @@ GEM
30
30
  unf (>= 0.0.5, < 1.0.0)
31
31
  equatable (0.5.0)
32
32
  erubis (2.7.0)
33
- faastruby-rpc (0.2.6)
33
+ faastruby-rpc (0.2.7)
34
34
  oj (~> 3.6)
35
35
  ffi (1.10.0)
36
36
  hashdiff (0.3.7)
@@ -53,7 +53,7 @@ GEM
53
53
  tty-color (~> 0.4.0)
54
54
  public_suffix (3.0.3)
55
55
  puma (3.12.1)
56
- rack (2.0.6)
56
+ rack (2.0.7)
57
57
  rack-protection (2.0.5)
58
58
  rack
59
59
  rake (10.5.0)
data/faastruby.gemspec CHANGED
@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
20
20
  spec.add_runtime_dependency 'sinatra', '~> 2.0'
21
21
  spec.add_runtime_dependency 'sinatra-contrib', '~> 2.0'
22
22
  spec.add_runtime_dependency 'puma', '~> 3.12'
23
- spec.add_runtime_dependency 'faastruby-rpc', '~> 0.2.6'
23
+ spec.add_runtime_dependency 'faastruby-rpc', '~> 0.2.7'
24
24
  spec.add_runtime_dependency 'tmuxinator', '~> 0.15'
25
25
  spec.add_runtime_dependency 'rouge', '~> 3.3'
26
26
  spec.add_runtime_dependency 'listen', '~> 3.1'
@@ -1,10 +1,8 @@
1
1
  module FaaStRuby
2
+ require "faastruby/regions"
2
3
  ROOT_DOMAIN = ENV['FAASTRUBY_ROOT_DOMAIN'] || 'faastruby.io'
3
4
  WORKSPACE_BASE_HOST = ENV['FAASTRUBY_WORKSPACE_BASE_HOST'] || 'faast.cloud'
4
- DEFAULT_REGION = 'tor1'
5
- REGIONS = [
6
- 'tor1'
7
- ]
5
+ URL_PROTOCOL = ENV['FAASTRUBY_URL_PROTOCOL'] || 'https'
8
6
  class << self
9
7
  attr_accessor :configuration
10
8
  end
@@ -26,18 +24,12 @@ module FaaStRuby
26
24
  {api_key: api_key, api_secret: api_secret}
27
25
  end
28
26
 
29
- def self.region
30
- ENV['FAASTRUBY_REGION'] ||= DEFAULT_REGION
31
- raise "No such region: #{ENV['FAASTRUBY_REGION']}" unless FaaStRuby::REGIONS.include?(ENV['FAASTRUBY_REGION'])
32
- ENV['FAASTRUBY_REGION']
33
- end
34
-
35
27
  def self.api_host
36
- ENV['FAASTRUBY_HOST'] || "https://api.#{region}.#{ROOT_DOMAIN}"
28
+ ENV['FAASTRUBY_HOST'] || "#{URL_PROTOCOL}://api.#{region}.#{ROOT_DOMAIN}"
37
29
  end
38
30
 
39
31
  def self.workspace_host_for(workspace_name)
40
- "https://#{workspace_name}.#{region}.#{WORKSPACE_BASE_HOST}"
32
+ "#{URL_PROTOCOL}://#{workspace_name}.#{region}.#{WORKSPACE_BASE_HOST}"
41
33
  end
42
34
 
43
35
  class Configuration
data/lib/faastruby/cli.rb CHANGED
@@ -6,6 +6,7 @@ module FaaStRuby
6
6
  FAASTRUBY_YAML = 'faastruby.yml'
7
7
  SPINNER_FORMAT = :spin_2
8
8
  require 'faastruby/supported_runtimes'
9
+ require 'faastruby/regions'
9
10
  class CLI
10
11
  def self.error(message, color: :red)
11
12
  message.compact.each {|m| STDERR.puts m.colorize(color)} if message.is_a?(Array)
@@ -18,6 +18,7 @@ module FaaStRuby
18
18
  end
19
19
  user.logout(all: @options['all'])
20
20
  FaaStRuby::CLI.error(user.errors) if !@options['force'] && user&.errors.any?
21
+ ensure
21
22
  @credentials_file.clear
22
23
  puts "Logout successful."
23
24
  end
@@ -9,6 +9,7 @@ module FaaStRuby
9
9
  require 'pathname'
10
10
  require 'securerandom'
11
11
  require 'faastruby/version'
12
+ require 'faastruby/regions'
12
13
  require 'faastruby/supported_runtimes'
13
14
  require 'faastruby/local/logger'
14
15
  require 'faastruby/local/functions'
@@ -70,6 +71,8 @@ module FaaStRuby
70
71
  DEFAULT_RUBY_RUNTIME = "ruby:#{CURRENT_MINOR_RUBY}".freeze
71
72
  FUNCTIONS_EVENT_QUEUE = Queue.new
72
73
  PUBLIC_EVENT_QUEUE = Queue.new
74
+ WORKSPACE_BASE_HOST = ENV['FAASTRUBY_WORKSPACE_BASE_HOST'] || 'faast.cloud'
75
+ URL_PROTOCOL = ENV['FAASTRUBY_URL_PROTOCOL'] || 'https'
73
76
  puts "Using '#{DEFAULT_RUBY_RUNTIME}' as default Ruby runtime." if RUBY_ENABLED
74
77
  puts "Using '#{DEFAULT_CRYSTAL_RUNTIME}' as default Crystal runtime." if CRYSTAL_ENABLED
75
78
  def self.workspace
@@ -139,7 +142,7 @@ module FaaStRuby
139
142
  # initial_compile
140
143
  puts "Listening for changes."
141
144
  puts "faastRuby Local is ready at http://localhost:3000"
142
- puts "Your cloud workspace address is https://#{workspace}.tor1.faast.cloud" if SYNC_ENABLED
145
+ puts "Your cloud workspace address is #{URL_PROTOCOL}://#{workspace}.#{FaaStRuby.region}.#{WORKSPACE_BASE_HOST}" if SYNC_ENABLED
143
146
  sleep
144
147
  ensure
145
148
  puts "Stopping Watchdog..."
@@ -160,7 +163,7 @@ module FaaStRuby
160
163
  def self.sync_mode_enabled
161
164
  debug __method__
162
165
  puts "Sync mode enabled."
163
- puts "Your local environment will be synced to https://#{workspace}.tor1.faast.cloud"
166
+ puts "Your local environment will be synced to #{URL_PROTOCOL}://#{workspace}.#{FaaStRuby.region}.#{WORKSPACE_BASE_HOST}"
164
167
  system("faastruby deploy --env #{DEPLOY_ENVIRONMENT}")
165
168
  true
166
169
  end
@@ -0,0 +1,12 @@
1
+ module FaaStRuby
2
+ DEFAULT_REGION = 'tor1'
3
+ REGIONS = [
4
+ 'tor1'
5
+ ]
6
+
7
+ def self.region
8
+ ENV['FAASTRUBY_REGION'] ||= DEFAULT_REGION
9
+ raise "No such region: #{ENV['FAASTRUBY_REGION']}" unless FaaStRuby::REGIONS.include?(ENV['FAASTRUBY_REGION'])
10
+ ENV['FAASTRUBY_REGION']
11
+ end
12
+ end
@@ -1,3 +1,3 @@
1
1
  module FaaStRuby
2
- VERSION = '0.5.22'
2
+ VERSION = '0.5.23'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: faastruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.22
4
+ version: 0.5.23
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paulo Arruda
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-04-01 00:00:00.000000000 Z
11
+ date: 2019-04-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client
@@ -142,14 +142,14 @@ dependencies:
142
142
  requirements:
143
143
  - - "~>"
144
144
  - !ruby/object:Gem::Version
145
- version: 0.2.6
145
+ version: 0.2.7
146
146
  type: :runtime
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
150
  - - "~>"
151
151
  - !ruby/object:Gem::Version
152
- version: 0.2.6
152
+ version: 0.2.7
153
153
  - !ruby/object:Gem::Dependency
154
154
  name: tmuxinator
155
155
  requirement: !ruby/object:Gem::Requirement
@@ -323,6 +323,7 @@ files:
323
323
  - lib/faastruby/local/processors/static_file.rb
324
324
  - lib/faastruby/local/static_files.rb
325
325
  - lib/faastruby/local/static_files/static_file.rb
326
+ - lib/faastruby/regions.rb
326
327
  - lib/faastruby/server.rb
327
328
  - lib/faastruby/server/app.rb
328
329
  - lib/faastruby/server/concurrency_controller.rb