fuzion 0.0.1pre

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ OTZhOTIxNjExNzRmNjQzNGE1YTJmNGEzMDBiMzRlM2UxY2I1MGNiZQ==
5
+ data.tar.gz: !binary |-
6
+ OGU1ODU5MThlZGQzMzMyYjljZTI1ODViZGZmYmJhZTRiMGEzNGFiZg==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ MDJhMDk2MDY3MmQ0MjQ4OTUzZTQ0NGIyMGMyZGVmYzUxYjJhOGRiYzFmOGY3
10
+ ZWEyMzNjODllNDQ4ZmRhMzc3NjdjYWFjZTVkZGYzZWYzOTY4NzY4YzQ2MGIz
11
+ MTVkYzc3NWU0N2NjNTk4N2JkMTZjNjAxZWUwMmVmNWYxMDI3YTA=
12
+ data.tar.gz: !binary |-
13
+ NTk1MTE2ZDc4YTQ3ODAyNmQ3MTdlNDYyYzMyNGRjYWFmYWRiMmZmN2Q3YTUx
14
+ NjNhNTY3OWRiMzM3NjE1ZGM0OGM1NjA3OTE4ZjAwYzMzYzI2OTc0ZGJkZjlh
15
+ MzAxZmExMTVkMmM5Mjc2ZTJjYTE0MGVmYTM4NTNmOTRmY2NiZTU=
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in fuzion.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 TODO: Write your name
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,29 @@
1
+ # Fuzion
2
+
3
+ The Fuzion gem was created as a working part of the Fuzion Collaborative Text Editor. Fuzion allows a user to specify a file or directory on which to listen. When the text within the target file or directory changes, the Fuzion gem records the changes and sends them to the Fuzion web app. Other collaborators can view and edit the text in real time at http://www.fuzion-app.com http://www.fuzion-text.com.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'fuzion'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install fuzion
18
+
19
+ ## Usage
20
+ TODO: Write usage instructions here
21
+
22
+ ## Contributing
23
+
24
+ 1. Fork it
25
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
26
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
27
+ 4. Push to the branch (`git push origin my-new-feature`)
28
+ 5. Create new Pull Request
29
+
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
data/bin/fuzion ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env ruby
2
+ require 'SecureRandom'
3
+
4
+ require File.expand_path(File.join('..', 'lib', 'fuzion'), File.dirname(__FILE__))
5
+
6
+ unless ARGV.empty?
7
+ this=KickOff.new()
8
+ end
data/f.rb ADDED
@@ -0,0 +1,22 @@
1
+ #keep in order to allow for getting around annoying ass gem update things
2
+
3
+ # require 'SecureRandom'
4
+
5
+ # require_relative '../lib/fuzion.rb'
6
+
7
+ # unless ARGV.empty?
8
+ # if ARGV[0][0] == '/'
9
+ # file_name_to_watch = ARGV[0][1..-1]
10
+ # else
11
+ # file_name_to_watch = ARGV[0] #comeback to this
12
+ # end
13
+ # session_url_key = SecureRandom::urlsafe_base64(1)
14
+ # puts 'http://fuzion-app.herokuapp.com/classrooms/' + session_url_key
15
+ # dir_to_watch=Dir.pwd
16
+ # file_to_watch=file_name_to_watch
17
+ # puts "WATCHING " + dir_to_watch + file_to_watch
18
+ # Fuzion.thing(dir_to_watch, file_to_watch, session_url_key)
19
+ # else
20
+ # print "Please pass a filename."
21
+ # end
22
+
data/fuzion.gemspec ADDED
@@ -0,0 +1,32 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'fuzion/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "fuzion"
8
+ spec.version = Fuzion::VERSION
9
+ spec.authors = ["David Stavis, Ben Myhre, Drew West, Aaron Wertman, James Hulley"]
10
+ spec.email = ["drewfwest@gmail.com"]
11
+ spec.description = %q{Run the fuzion command line executable to start a live coding session that can be watched by anyone who has the url printed to the command line.}
12
+ spec.summary = %q{Allows teachers to stream copies of their code to many students, live.}
13
+ spec.homepage = ""
14
+ spec.license = "MIT"
15
+
16
+ #/*****************Dependencies*********************
17
+ spec.add_development_dependency('rspec')
18
+ #spec.add_development_dependency('listen')
19
+ spec.add_runtime_dependency('listen')
20
+ spec.add_runtime_dependency('json')
21
+ spec.add_runtime_dependency('httparty')
22
+
23
+ #*****************Dependencies*********************/
24
+
25
+ spec.files = `git ls-files`.split($/)
26
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
27
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
28
+ spec.require_paths = ["lib"]
29
+
30
+ spec.add_development_dependency "bundler", "~> 1.3"
31
+ spec.add_development_dependency "rake"
32
+ end
@@ -0,0 +1,17 @@
1
+ require 'json'
2
+
3
+ class FileParser
4
+ def initialize(path)
5
+ @path=path
6
+ end
7
+
8
+ def read_file()
9
+ return File.read("#{@path}")
10
+ end
11
+
12
+ def make_JSON(file_text, file_to_watch, session_url="")
13
+ j_hash={"classroom_code"=> session_url, "file_name"=> file_to_watch, "file_content"=> file_text}
14
+ return j_hash.to_json
15
+ end
16
+
17
+ end
@@ -0,0 +1,21 @@
1
+ require "httparty"
2
+ require "json"
3
+
4
+ class FBSender
5
+ include HTTParty
6
+
7
+ def initialize(classroom_code)
8
+ @classroom_code = classroom_code
9
+ end
10
+
11
+ def self.send_post(file_name, file_content)
12
+ post "whadddup?"
13
+ HTTParty.post("https://radiant-fire-3325.firebaseio.com/classrooms.json", :body => {"classroom_id" => "akt", "content" => "def method test ruby gem"}.to_json, :options => { :headers => { "Content-Type" => "application/json"}})
14
+ end
15
+
16
+ end
17
+
18
+ # file_name = "dumb.txt"
19
+ # file_content = "David in the classroom. 5th graders don't know bout my presence!"
20
+
21
+ # HTTParty.post("https://radiant-fire-3325.firebaseio.com/classrooms.json", :body => {"classroom_id" => "akt", "content" => "def method test ruby gem"}.to_json, :options => { :headers => { "Content-Type" => "application/json"}})
@@ -0,0 +1,29 @@
1
+ require_relative 'fileparser.rb'
2
+ require_relative 'firebasesender'
3
+
4
+
5
+
6
+ class Listener
7
+
8
+ def self.start(dir_to_watch, file_to_watch, session_url_key, file)
9
+
10
+
11
+ listener = Listen.to(dir_to_watch, only: /#{file_to_watch}/) do |modified, added, removed|
12
+ file = FileParser.new("#{dir_to_watch}/#{file_to_watch}")
13
+ file_contents = file.read_file
14
+ completed_json = file.make_JSON(file_contents,file_to_watch, session_url_key)
15
+ p "updating"
16
+ HTTParty.post("https://radiant-fire-3325.firebaseio.com/classrooms.json", :body => completed_json, :options => { :headers => { "Content-Type" => "application/json"}})
17
+ end
18
+
19
+ puts "Listening for file changes."
20
+ puts "Please don't close the tab or kill the process unless you want to stop the Fuzion session..."
21
+ listener.start
22
+ sleep
23
+ end
24
+
25
+ end
26
+
27
+
28
+
29
+
@@ -0,0 +1,3 @@
1
+ module Fuzion
2
+ VERSION = "0.0.1pre"
3
+ end
data/lib/fuzion.rb ADDED
@@ -0,0 +1,43 @@
1
+ require 'listen'
2
+ require 'rubygems'
3
+
4
+ require 'fuzion/listener'
5
+ require 'fuzion/firebasesender'
6
+
7
+ class KickOff
8
+ attr_accessor :fb_session
9
+
10
+ def initialize()
11
+ file_name_to_watch = get_file_name
12
+ dir_to_watch = Dir.pwd
13
+ session_url_key = generate_classroom_code
14
+ print_teacher_message(file_name_to_watch, dir_to_watch, session_url_key)
15
+ # @fb_session=FBSender.new(session_url_key)
16
+ file = FileParser.new("#{dir_to_watch}/#{file_name_to_watch}")
17
+ # gobbledy_gook = fb_session.post(file_name_to_watch, file )
18
+ Listener.start(dir_to_watch, file_name_to_watch, session_url_key, file)
19
+ end
20
+
21
+ private
22
+
23
+ def get_file_name
24
+ if ARGV[0][0] == '/'
25
+ return ARGV[0][1..-1]
26
+ elsif ARGV !=nil
27
+ return ARGV[0]
28
+ else
29
+ puts "please enter a file name"
30
+ exit
31
+ end
32
+ e nd
33
+
34
+ def generate_classroom_code
35
+ SecureRandom::urlsafe_base64(1)
36
+ end
37
+
38
+ def print_teacher_message(file_name_to_watch, dir_to_watch, session_url_key)
39
+ puts 'http://fuzion-app.herokuapp.com/classrooms/' + session_url_key
40
+ puts "WATCHING " + dir_to_watch + "/" + file_name_to_watch
41
+ end
42
+ end
43
+
@@ -0,0 +1,5 @@
1
+ require 'spec_helper'
2
+
3
+ describe Listener do
4
+ pending "write it"
5
+ end
@@ -0,0 +1,9 @@
1
+ require 'bundler/setup'
2
+ Bundler.setup
3
+
4
+ require 'fuzion'
5
+
6
+
7
+ RSpec.configure do |config|
8
+
9
+ end
metadata ADDED
@@ -0,0 +1,147 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fuzion
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1pre
5
+ platform: ruby
6
+ authors:
7
+ - David Stavis, Ben Myhre, Drew West, Aaron Wertman, James Hulley
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-05-24 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rspec
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ! '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ! '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: listen
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ! '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ! '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: json
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ! '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: httparty
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ! '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: bundler
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ~>
74
+ - !ruby/object:Gem::Version
75
+ version: '1.3'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ~>
81
+ - !ruby/object:Gem::Version
82
+ version: '1.3'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rake
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ! '>='
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ! '>='
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ description: Run the fuzion command line executable to start a live coding session
98
+ that can be watched by anyone who has the url printed to the command line.
99
+ email:
100
+ - drewfwest@gmail.com
101
+ executables:
102
+ - fuzion
103
+ extensions: []
104
+ extra_rdoc_files: []
105
+ files:
106
+ - .gitignore
107
+ - Gemfile
108
+ - LICENSE.txt
109
+ - README.md
110
+ - Rakefile
111
+ - bin/fuzion
112
+ - f.rb
113
+ - fuzion.gemspec
114
+ - lib/fuzion.rb
115
+ - lib/fuzion/fileparser.rb
116
+ - lib/fuzion/firebasesender.rb
117
+ - lib/fuzion/listener.rb
118
+ - lib/fuzion/version.rb
119
+ - spec/listener_spec.rb
120
+ - spec/spec_helper.rb
121
+ homepage: ''
122
+ licenses:
123
+ - MIT
124
+ metadata: {}
125
+ post_install_message:
126
+ rdoc_options: []
127
+ require_paths:
128
+ - lib
129
+ required_ruby_version: !ruby/object:Gem::Requirement
130
+ requirements:
131
+ - - ! '>='
132
+ - !ruby/object:Gem::Version
133
+ version: '0'
134
+ required_rubygems_version: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ! '>'
137
+ - !ruby/object:Gem::Version
138
+ version: 1.3.1
139
+ requirements: []
140
+ rubyforge_project:
141
+ rubygems_version: 2.1.5
142
+ signing_key:
143
+ specification_version: 4
144
+ summary: Allows teachers to stream copies of their code to many students, live.
145
+ test_files:
146
+ - spec/listener_spec.rb
147
+ - spec/spec_helper.rb