nutella_framework 0.4.11 → 0.4.12

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
  SHA1:
3
- metadata.gz: 9172faccd58a12b7b71e6b98b23bdabae149cba2
4
- data.tar.gz: 41ddccdf48c2216534ca3ac1fc6b8a8e69c6217b
3
+ metadata.gz: 296f21e2152a67070cc1899d903e32efdd743532
4
+ data.tar.gz: d8b399f0b70ffd1b676ad8b680c42c4723ec85c1
5
5
  SHA512:
6
- metadata.gz: 8b6091ed6ab787a2dedcf3ea31c124dcda6ba528d2d23a9e2a1f42b18ae28d3bf54ae309a64ea64a8442a6bdf1d21980292aa080a50759ebab27b1d16fac36f0
7
- data.tar.gz: 49da081ac45ecd83adb657cc5f7abe35ed99a75a9a35bdc6cd7fa5e12e1c7d2dd5d1e95bdf4f740a74196aa772a1a55992c9c6d58f36e2a17344651fe9822016
6
+ metadata.gz: d979a40f5d0fe6a0875bc9153158cfb7f5c586f6f909a64aac0f6597dcaed8b939660f58d45fa1fe7cda90e314967d01681cf16e0811aae1c1e5ce48b932dd2e
7
+ data.tar.gz: 48fef042ac069df2debd3e990025cd9ace9ce071f9e251a6cd4da4f9a83ef24cb92b29fba9b7166efd490ae345604443ec3d5e7489a76572b4de47c7b4e9b00b
data/Gemfile CHANGED
@@ -4,6 +4,7 @@ gem 'semantic', '~> 1.4'
4
4
  gem 'logging', '~> 1.8'
5
5
  gem 'git', '~> 1.2'
6
6
  gem 'sinatra', '~>1.4'
7
+ gem 'sinatra-cross_origin', '~> 0.3.2'
7
8
  gem 'thin', '~>1.6'
8
9
  gem 'nokogiri', '~>1.6'
9
10
  gem 'slop', '~>4.0'
data/README.md CHANGED
@@ -38,5 +38,6 @@ If you already have an application you want to tinker with (like [RoomQuake](htt
38
38
  If you want to create your own application, hold on tight, a tutorial is coming soon.
39
39
 
40
40
 
41
- # Contributing
42
- Check out our [contributing wiki page](https://github.com/nutella-framework/nutella_framework/wiki/Contributing)! Thanks!
41
+ # Building (for contributors)
42
+ Clone the repo, `bundle install` to take care of the dependencies and then `rake` to run all the tests. If you want to build and install the gem just `rake install`. If you want a list of available build tasks, simply type `rake -T`.
43
+
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.11
1
+ 0.4.12
@@ -0,0 +1,67 @@
1
+ require 'sinatra'
2
+ require 'sinatra/cross_origin'
3
+ require 'fileutils'
4
+
5
+ require_relative '../../lib/config/runlist'
6
+ require_relative '../../lib/config/config'
7
+ require_relative '../../nutella_lib/framework_core'
8
+
9
+
10
+ # Set Sinatra to run in production mode
11
+ set :environment, :production
12
+
13
+ # Set Sinatra's port to nutella's main_interface_port
14
+ pt = Nutella.config['main_interface_port'] + 2
15
+ set :port, pt
16
+
17
+ # Enable Sinatra to process CORS requests
18
+ set :allow_origin, :any
19
+ set :allow_methods, [:get, :post, :options]
20
+
21
+ configure do
22
+ enable :cross_origin
23
+ end
24
+
25
+
26
+
27
+ # Set data folder
28
+ data_folder = "#{ENV['HOME']}/.nutella/data/binary-files-manager"
29
+
30
+ # If data folder doesn't exist, create it
31
+ unless Dir.exists? data_folder
32
+ FileUtils::mkdir_p data_folder
33
+ end
34
+
35
+
36
+
37
+ # Serve all files in the data folder
38
+ get "/:filename" do |fn|
39
+ send_file "#{data_folder}/#{fn}"
40
+ end
41
+
42
+
43
+ # Handle file upload
44
+ post "/upload" do
45
+ file_name = params[:filename]
46
+ file_path = "#{data_folder}/#{file_name}"
47
+
48
+ # If the file already exists, just reply with the file url
49
+ return {url: url(file_path)}.to_json if File.exist? file_path
50
+
51
+ # Otherwise, write the file and reply with URL
52
+ File.open(file_path, 'w') do |f|
53
+ f.write(params['file'][:tempfile].read)
54
+ end
55
+ {url: url(file_name)}.to_json
56
+ end
57
+
58
+
59
+ # Tests if a particular file exists
60
+ get "/test/:filename" do |fn|
61
+ if File.exist? "#{data_folder}/#{fn}"
62
+ {url: url("/#{fn}")}.to_json
63
+ else
64
+ {error: 404}.to_json
65
+ end
66
+ end
67
+
@@ -0,0 +1,5 @@
1
+ #!/bin/sh
2
+
3
+ BASEDIR=$(dirname $0)
4
+ ruby $BASEDIR/bin_files_mngr.rb > /dev/null 2>&1 &
5
+ echo $! > $BASEDIR/.pid
@@ -2,5 +2,6 @@
2
2
  "logging_bot",
3
3
  "runs_list_bot",
4
4
  "main_interface",
5
- "beacon-cloud-bot"
5
+ "beacon-cloud-bot",
6
+ "binary-files-manager"
6
7
  ]
@@ -153,7 +153,7 @@ module Nutella
153
153
 
154
154
  # Returns true if the app has no bots
155
155
  def app_has_no_bots( app_id )
156
- Dir.entries("#{app_path(app_id)}/bots").select{|entry| File.directory?(entry) && !(entry =='.' || entry == '..') }.empty?
156
+ Dir.entries("#{app_path(app_id)}/bots").select{|entry| File.directory?(File.join("#{app_path(app_id)}/bots",entry)) && !(entry =='.' || entry == '..') }.empty?
157
157
  end
158
158
 
159
159
  end
@@ -2,16 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: nutella_framework 0.4.11 ruby lib
5
+ # stub: nutella_framework 0.4.12 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "nutella_framework"
9
- s.version = "0.4.11"
9
+ s.version = "0.4.12"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib"]
13
13
  s.authors = ["Alessandro Gnoli"]
14
- s.date = "2015-04-22"
14
+ s.date = "2015-04-26"
15
15
  s.description = "utella is a framework to create and run RoomApps"
16
16
  s.email = "tebemis@gmail.com"
17
17
  s.executables = ["nutella"]
@@ -93,6 +93,8 @@ Gem::Specification.new do |s|
93
93
  "framework_components/beacon-cloud-interface/js/react/beacon-table.js",
94
94
  "framework_components/beacon-cloud-interface/js/react/beacon.js",
95
95
  "framework_components/beacon-cloud-interface/nutella.json",
96
+ "framework_components/binary-files-manager/bin_files_mngr.rb",
97
+ "framework_components/binary-files-manager/startup",
96
98
  "framework_components/logging_bot/logging_bot.rb",
97
99
  "framework_components/logging_bot/startup",
98
100
  "framework_components/logging_bot/utils.rb",
@@ -158,6 +160,7 @@ Gem::Specification.new do |s|
158
160
  s.add_runtime_dependency(%q<logging>, ["~> 1.8"])
159
161
  s.add_runtime_dependency(%q<git>, ["~> 1.2"])
160
162
  s.add_runtime_dependency(%q<sinatra>, ["~> 1.4"])
163
+ s.add_runtime_dependency(%q<sinatra-cross_origin>, ["~> 0.3.2"])
161
164
  s.add_runtime_dependency(%q<thin>, ["~> 1.6"])
162
165
  s.add_runtime_dependency(%q<nokogiri>, ["~> 1.6"])
163
166
  s.add_runtime_dependency(%q<slop>, ["~> 4.0"])
@@ -173,6 +176,7 @@ Gem::Specification.new do |s|
173
176
  s.add_dependency(%q<logging>, ["~> 1.8"])
174
177
  s.add_dependency(%q<git>, ["~> 1.2"])
175
178
  s.add_dependency(%q<sinatra>, ["~> 1.4"])
179
+ s.add_dependency(%q<sinatra-cross_origin>, ["~> 0.3.2"])
176
180
  s.add_dependency(%q<thin>, ["~> 1.6"])
177
181
  s.add_dependency(%q<nokogiri>, ["~> 1.6"])
178
182
  s.add_dependency(%q<slop>, ["~> 4.0"])
@@ -189,6 +193,7 @@ Gem::Specification.new do |s|
189
193
  s.add_dependency(%q<logging>, ["~> 1.8"])
190
194
  s.add_dependency(%q<git>, ["~> 1.2"])
191
195
  s.add_dependency(%q<sinatra>, ["~> 1.4"])
196
+ s.add_dependency(%q<sinatra-cross_origin>, ["~> 0.3.2"])
192
197
  s.add_dependency(%q<thin>, ["~> 1.6"])
193
198
  s.add_dependency(%q<nokogiri>, ["~> 1.6"])
194
199
  s.add_dependency(%q<slop>, ["~> 4.0"])
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nutella_framework
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.11
4
+ version: 0.4.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alessandro Gnoli
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-22 00:00:00.000000000 Z
11
+ date: 2015-04-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: semantic
@@ -66,6 +66,20 @@ dependencies:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '1.4'
69
+ - !ruby/object:Gem::Dependency
70
+ name: sinatra-cross_origin
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: 0.3.2
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: 0.3.2
69
83
  - !ruby/object:Gem::Dependency
70
84
  name: thin
71
85
  requirement: !ruby/object:Gem::Requirement
@@ -294,6 +308,8 @@ files:
294
308
  - framework_components/beacon-cloud-interface/js/react/beacon-table.js
295
309
  - framework_components/beacon-cloud-interface/js/react/beacon.js
296
310
  - framework_components/beacon-cloud-interface/nutella.json
311
+ - framework_components/binary-files-manager/bin_files_mngr.rb
312
+ - framework_components/binary-files-manager/startup
297
313
  - framework_components/logging_bot/logging_bot.rb
298
314
  - framework_components/logging_bot/startup
299
315
  - framework_components/logging_bot/utils.rb