faastruby 0.5.5 → 0.5.6

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8a491f4abb96d8fa8365469a5cd1adec928ba2c775e05dedafbcce10924ef889
4
- data.tar.gz: e20f906502710fb4b7bb5803a47e4844d183e254305766e8f5fff94341b5ef63
3
+ metadata.gz: f6c5b8269b49257d206406eb93f408d375f9c6ebdfe50f0fac40ee62a2fd8db3
4
+ data.tar.gz: b289988fe2d42f3c49062fb19810c664cf4655a3296c6d5726390bad3c77d67b
5
5
  SHA512:
6
- metadata.gz: 77f0c2999f8648cad2055da5a36917ece93849b7e243d5d0c512bde0406b2fffeb4a121686b5a420b4a4ed9ed49e3d10af3ada202bda8d2d9528fa3df675b8db
7
- data.tar.gz: 22f7921d21da2357857f2b4e66bd0cc0c0334e0c2f610e8c4538abf629874889121e99efc835867a2645a709dce0611784a23568f8f3181ee88e20858698a969
6
+ metadata.gz: c34f895e38b4a72493e252ff84c6f3129a217fe36a7f68fb26775f06da8b129aa85cb262c1896410aae857720667cb35a3a83cae333077e94489e9d55698ff40
7
+ data.tar.gz: 4c80da8ed9e3a45bd319d6ad726ebd8ab1f1dd7fb99f25db70adb58806544bbe5336046df3d1b48da8980238abc3a840431e904329d8f855d5b8fe412f9c2deb
data/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.5.6 - Mar 10 2019
4
+ - Fix bug preventing require libraries. Thanks to
5
+ - Support for static files with space in their names
6
+ - Cleanup comments code
7
+ - Limit the size of static files to 5MB
8
+ - Check if the number of runners is an integer
9
+
3
10
  ## 0.5.5 - Mar 9 2019
4
11
  - Use a class method inside FaaStRuby::Response to handle invalid response messages.
5
12
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- faastruby (0.5.4)
4
+ faastruby (0.5.5)
5
5
  colorize (~> 0.8)
6
6
  faastruby-rpc (~> 0.2)
7
7
  listen (~> 3.1)
@@ -3,6 +3,7 @@ module FaaStRuby
3
3
  module Workspace
4
4
  require 'tmpdir'
5
5
  require 'tempfile'
6
+ require 'uri'
6
7
  # require 'faastruby/cli/commands/workspace/base_command'
7
8
  require 'faastruby/cli/package'
8
9
  require 'faastruby/cli/new_credentials'
@@ -20,8 +21,9 @@ module FaaStRuby
20
21
  end
21
22
 
22
23
  def run
23
- destination_url = "#{FaaStRuby.workspace_host_for(@workspace_name)}/#{@relative_path}"
24
- spinner = say("[#{@source_file}] Copying file to '#{destination_url}'...", quiet: true)
24
+ FaaStRuby::CLI.error("You can't upload static files larger than 5MB. If you need to upload large files, please reach out to us on Slack at https://faastruby.io/slack") if source_file_too_big?
25
+ destination_url = URI.escape("#{FaaStRuby.workspace_host_for(@workspace_name)}/#{@relative_path}")
26
+ # spinner = say("[#{@source_file}] Copying file to '#{destination_url}'...", quiet: true)
25
27
  workspace = FaaStRuby::Workspace.new(name: @workspace_name)
26
28
  package = build_package
27
29
  workspace.upload_file(package, relative_path: @relative_path)
@@ -34,12 +36,14 @@ module FaaStRuby
34
36
  @package_file.unlink
35
37
  end
36
38
 
39
+ def source_file_too_big?
40
+ File.size(@source_file) > 5242880 # That's 5MB
41
+ end
37
42
 
38
43
  def build_package
39
44
  FileUtils.cp @source_file, @tmpdir
40
45
  output_file = @package_file.path
41
46
  FaaStRuby::Package.new(@tmpdir, output_file).build
42
- # FaaStRuby::Command::Function::Build.build(@source_file, output_file, @function_name, true)
43
47
  @package_file.close
44
48
  output_file
45
49
  end
@@ -77,30 +81,6 @@ module FaaStRuby
77
81
  FaaStRuby::CLI.error("You can only 'cp' files, not directories.") unless File.file?(@source_file)
78
82
  true
79
83
  end
80
-
81
- # def missing_args
82
- # FaaStRuby::CLI.error(["'#{@workspace_name}' is not a valid workspace name.".red, usage], color: nil) if @workspace_name =~ /^-.*/
83
- # @missing_args << "Missing argument: WORKSPACE_NAME".red unless @workspace_name
84
- # @missing_args << "Missing argument: -s SOURCE_FILE" unless @options['source']
85
- # @missing_args << "Missing argument: -d DESTINATION_PATH" unless @options['destination']
86
- # @missing_args << usage if @missing_args.any?
87
- # @missing_args
88
- # end
89
-
90
- # def parse_options(require_options: {})
91
- # @options = {}
92
- # while @args.any?
93
- # option = @args.shift
94
- # case option
95
- # when '-s', '--source'
96
- # @options['source'] = @args.shift
97
- # when '-d', '--destination'
98
- # @options['destination'] = @args.shift.gsub(/(^\/|\/$|\.\.|;|'|"|&|\\)/, '')
99
- # else
100
- # FaaStRuby::CLI.error("Unknown argument: #{option}")
101
- # end
102
- # end
103
- # end
104
84
  end
105
85
  end
106
86
  end
@@ -51,6 +51,7 @@ module FaaStRuby
51
51
  case option
52
52
  when '--runners'
53
53
  @options['runners_max'] = @args.shift
54
+ FaaStRuby::CLI.error("The argument '--runners' takes an integer") if @options['runners_max'].nil? || !@options['runners_max'].to_i.is_a?(Integer)
54
55
  else
55
56
  FaaStRuby::CLI.error("Unknown argument: #{option}")
56
57
  end
@@ -4,7 +4,7 @@ module FaaStRuby
4
4
  include Local::Logger
5
5
 
6
6
  def self.full_sync
7
- cmd = "faastruby deploy-to #{Local.workspace} -f #{Local.public_dir}"
7
+ cmd = "faastruby deploy-to '#{Local.workspace}' -f '#{Local.public_dir}'"
8
8
  output, status = Open3.capture2e(cmd)
9
9
  String.disable_colorization = true
10
10
  if status.exitstatus == 0
@@ -27,7 +27,7 @@ module FaaStRuby
27
27
 
28
28
  def deploy
29
29
  path = "public/#{@relative_path}"
30
- cmd = "faastruby cp #{path} #{Local.workspace}:/#{@relative_path}"
30
+ cmd = "faastruby cp '#{path}' '#{Local.workspace}:/#{@relative_path}'"
31
31
  puts "Running: #{cmd}"
32
32
  output, status = Open3.capture2e(cmd)
33
33
  String.disable_colorization = true
@@ -42,7 +42,7 @@ module FaaStRuby
42
42
 
43
43
  def remove_from_workspace
44
44
  path = "public/#{@relative_path}"
45
- cmd = "faastruby rm #{Local.workspace}:/#{@relative_path}"
45
+ cmd = "faastruby rm '#{Local.workspace}:/#{@relative_path}'"
46
46
  puts "Running: #{cmd}"
47
47
  output, status = Open3.capture2e(cmd)
48
48
  String.disable_colorization = true
@@ -19,11 +19,18 @@ module FaaStRuby
19
19
 
20
20
  def load_function(path)
21
21
  eval %(
22
- Module.new do
23
- def self.require(path)
24
- return load("\#{path}.rb") if File.file?("\#{path}.rb")
25
- Kernel.require path
22
+ module Kernel
23
+ # make an alias of the original require
24
+ alias_method :original_require, :require
25
+
26
+ # rewrite require
27
+ def require name
28
+ return load("\#{name}.rb") if File.file?("\#{name}.rb")
29
+ original_require name
26
30
  end
31
+ end
32
+
33
+ Module.new do
27
34
  #{File.read(path)}
28
35
  end
29
36
  )
@@ -1,3 +1,3 @@
1
1
  module FaaStRuby
2
- VERSION = '0.5.5'
2
+ VERSION = '0.5.6'
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.5
4
+ version: 0.5.6
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-09 00:00:00.000000000 Z
11
+ date: 2019-03-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client