faastruby 0.5.21 → 0.5.22

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: cd84b2b2ee1f246df6e56a22a2f1038af7428ad4c3386e67243b87a425558076
4
- data.tar.gz: 14678528dcb82549ebb862df407253102c4254687340260045a365209c3260c7
3
+ metadata.gz: 3e08bac2ed5dcabe21891e5945035651d1013743aadba90de392ef7295cd2a95
4
+ data.tar.gz: ad2984694a429edd97df32d53cbe2594a67282f1158ae3ddc0853a9b51e150de
5
5
  SHA512:
6
- metadata.gz: 492004310d7ee1b901648abb9995da987cf0f7e3525cc66d14a569a5c61004bb9ba1e71ed606e42507972b9da6d1840c6fcb14c988ed8fa41ce99031062c6d3f
7
- data.tar.gz: 0a9fa63c25ff725c2e71175f148611ef689f62730b3f7f8bb4f6ab9b4418f834f52425c98d13d5c807005f7efb633478a94ad7ba0fa3b21bdb032a501a8825a3
6
+ metadata.gz: bc3264038b2bff85ad9e5b2f2a52133d0bd0c91b250a931dd6b5d467bfd02e9e9cfeeb64f19a50f4a1915867634d4ce4a5db467ebb73130a051e5eb8e420fbee
7
+ data.tar.gz: 43e91e8bc235ee6de9147d8085113bc3511668349b1b5a708e7bf971fbfe9a7324bdc80f519da390b7712ed5bfe517488beb3754ac236d86e9a450c6570c1271
@@ -1,6 +1,12 @@
1
1
  # Changelog
2
2
 
3
- ## 0.5.21 - MAr 24 2019
3
+ ## 0.5.22 - unreleased
4
+ - Detect Crystal functions that have `handler.cr` inside `src` directory
5
+ - Exclude Crystal function handler binaries when generating a deployment package
6
+ - Move Crystal Runtime Macro to the top of the file, outside the FaaStRuby module
7
+ - Fix bug preventing `--sync` from working with any other environment.
8
+
9
+ ## 0.5.21 - Mar 24 2019
4
10
  - Require supported_runtimes on every command run.
5
11
 
6
12
  ## 0.5.20 - Mar 24 2019
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- faastruby (0.5.21)
4
+ faastruby (0.5.22)
5
5
  colorize (~> 0.8)
6
6
  faastruby-rpc (~> 0.2.6)
7
7
  listen (~> 3.1)
@@ -42,7 +42,7 @@ GEM
42
42
  ruby_dep (~> 1.2)
43
43
  mime-types (3.2.2)
44
44
  mime-types-data (~> 3.2015)
45
- mime-types-data (3.2018.0812)
45
+ mime-types-data (3.2019.0331)
46
46
  multi_json (1.13.1)
47
47
  mustermann (1.0.3)
48
48
  necromancer (0.4.0)
@@ -93,10 +93,10 @@ GEM
93
93
  rack-protection (= 2.0.5)
94
94
  sinatra (= 2.0.5)
95
95
  tilt (>= 1.3, < 3)
96
- strings (0.1.4)
97
- strings-ansi (~> 0.1.0)
98
- unicode-display_width (~> 1.4.0)
99
- unicode_utils (~> 1.4.0)
96
+ strings (0.1.5)
97
+ strings-ansi (~> 0.1)
98
+ unicode-display_width (~> 1.5)
99
+ unicode_utils (~> 1.4)
100
100
  strings-ansi (0.1.0)
101
101
  thor (0.20.3)
102
102
  tilt (2.0.9)
@@ -118,7 +118,7 @@ GEM
118
118
  unf (0.1.4)
119
119
  unf_ext
120
120
  unf_ext (0.0.7.5)
121
- unicode-display_width (1.4.1)
121
+ unicode-display_width (1.5.0)
122
122
  unicode_utils (1.4.0)
123
123
  webmock (3.4.2)
124
124
  addressable (>= 2.3.6)
@@ -4,10 +4,10 @@ module FaaStRuby
4
4
  require 'faastruby/cli/commands/function/base_command'
5
5
  require 'faastruby/cli/package'
6
6
  class Build < FunctionBaseCommand
7
- def self.build(source, output_file, function_name, quiet = false)
7
+ def self.build(source, output_file, function_name, quiet = false, exclude: [])
8
8
  # msg = "[#{function_name}] Building package..."
9
9
  # quiet ? puts(msg) : spinner = spin(msg)
10
- FaaStRuby::Package.new(source, output_file).build
10
+ FaaStRuby::Package.new(source, output_file, exclude: exclude).build
11
11
  # quiet ? puts("[#{function_name}] Package created.") : spinner.stop('Done!')
12
12
  puts "+ f #{output_file}".green unless quiet
13
13
  end
@@ -163,7 +163,8 @@ module FaaStRuby
163
163
  spinner&.success
164
164
  end
165
165
  require 'faastruby/cli/commands/function/build'
166
- FaaStRuby::Command::Function::Build.build(source, output_file, @function_name, true)
166
+ exclude = crystal_runtime? ? ['handler', 'handler.dwarf'] : []
167
+ FaaStRuby::Command::Function::Build.build(source, output_file, @function_name, true, exclude: exclude)
167
168
  @package_file.close
168
169
  output_file
169
170
  end
@@ -2,15 +2,16 @@ require 'zip'
2
2
  module FaaStRuby
3
3
  class Package
4
4
  # Initialize with the directory to zip and the location of the output archive.
5
- def initialize(input_dir, output_file)
5
+ def initialize(input_dir, output_file, exclude: [])
6
6
  @input_dir = input_dir
7
7
  @output_file = output_file
8
+ @exclude = ['.', '..', '.git', @output_file.split('/').last] + exclude
8
9
  end
9
10
 
10
11
  # Zip the input directory.
11
12
  def build
12
13
  entries = Dir.entries(@input_dir)
13
- entries.delete_if {|e| ['.', '..', '.git', @output_file.split('/').last].include?(e)}
14
+ entries.delete_if {|e| @exclude.include?(e)}
14
15
  FileUtils.rm_f(@output_file) # Make sure file doesn't exist
15
16
  ::Zip::File.open(@output_file, ::Zip::File::CREATE) do |zipfile|
16
17
  write_entries entries, '', zipfile
@@ -161,7 +161,7 @@ module FaaStRuby
161
161
  debug __method__
162
162
  puts "Sync mode enabled."
163
163
  puts "Your local environment will be synced to https://#{workspace}.tor1.faast.cloud"
164
- system("faastruby deploy")
164
+ system("faastruby deploy --env #{DEPLOY_ENVIRONMENT}")
165
165
  true
166
166
  end
167
167
 
@@ -2,10 +2,13 @@ require "base64"
2
2
  require "json"
3
3
  require "yaml"
4
4
 
5
+ macro require_handler
6
+ require {{env("HANDLER_PATH")}}
7
+ end
8
+
9
+ require_handler
10
+
5
11
  module FaaStRuby
6
- macro require_handler
7
- require {{env("HANDLER_PATH")}}
8
- end
9
12
  class Event
10
13
  JSON.mapping(
11
14
  body: String?,
@@ -68,8 +71,6 @@ module FaaStRuby
68
71
  end
69
72
  end
70
73
 
71
- FaaStRuby.require_handler
72
-
73
74
  def render(icon : String? = nil, jpeg : String? = nil, gif : String? = nil, png : String? = nil, io : Bytes? = nil, css : String? = nil, svg : String? = nil, js : String? = nil, inline : String? = nil, html : String? = nil, json : String? = nil, yaml : String? = nil, text : String? = nil, status : Int32 = 200, headers : Hash(String, String) = {} of String => String, content_type : String? = nil, binary : Bool = false)
74
75
  headers["Content-Type"] = content_type if content_type
75
76
  bin = false
@@ -8,6 +8,7 @@ module FaaStRuby
8
8
  debug "self.find_all_in(#{functions_dir.inspect})"
9
9
  Dir.glob(["**/handler.rb", "**/handler.cr"], base: functions_dir).map do |entry|
10
10
  function_absolute_folder = "#{functions_dir}/#{File.dirname(entry)}"
11
+ function_absolute_folder = File.dirname(function_absolute_folder) if File.basename(function_absolute_folder) == "src"
11
12
  next unless File.file?("#{function_absolute_folder}/faastruby.yml")
12
13
  from_yaml(function_absolute_folder)
13
14
  end.compact
@@ -1,3 +1,3 @@
1
1
  module FaaStRuby
2
- VERSION = '0.5.21'
2
+ VERSION = '0.5.22'
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.21
4
+ version: 0.5.22
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-03-24 00:00:00.000000000 Z
11
+ date: 2019-04-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client