TextBox 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: d3e37baae0c3b72c894ff03d089e1b55f4cf93bf
4
+ data.tar.gz: 4656737b1f4bbff5c031e63e872f8c722ce9b1cb
5
+ SHA512:
6
+ metadata.gz: e9aefcf0e01b58ddc40ca0236ae1ce39e0468f9a0767ef047077d4ccda4fa3b55567216e28127f7b222d3b54496b758fadcdb19057252a918ada247ebecda184
7
+ data.tar.gz: 084f979fd61195667223615357db2e7265d68b16c35a1a9dfdb5ffd38ba87ec44adf43c3869229afb4c661f0a5d3869d132276cb99c7243f58ff387a0a16b1e1
@@ -0,0 +1,32 @@
1
+ #!/usr/bin/env ruby
2
+
3
+
4
+ #like a switch in Java, ARGV is the 1st command line augment ex. ruby TextBox.rb {ARGV[0]}
5
+ case ARGV[0]
6
+ when 'setup'
7
+ puts 'Welcome to the TextBox server!'
8
+ puts '=============================='
9
+ puts 'Please choose a password...'
10
+ #Gets password from command line, and sets it to an Eviormental Password
11
+ File.write('text_box_password', "#{STDIN.gets}")
12
+ puts 'Now set some text!'
13
+ File.write('text_box', "#{STDIN.gets}")
14
+ puts 'Ok, awesome! You are done! Run TextBox.rb run'
15
+ when 'run'
16
+ begin
17
+ require 'TextBoxServer.rb'
18
+ rescue LoadError => e
19
+ require 'rubygems'
20
+ path = File.expand_path '../../lib', __FILE__
21
+ $:.unshift(path) if File.directory?(path) && !$:.include?(path)
22
+ require 'TextBoxServer.rb'
23
+ end
24
+ else
25
+ puts 'This is the TextBox server.'
26
+ puts 'It was written by Ben from bensites.com'
27
+ puts ' Options:'
28
+ puts '============================'
29
+ puts 'run: Runs the server'
30
+ puts 'setup: Sets things up'
31
+ puts 'help: Displays this message'
32
+ end
File without changes
@@ -0,0 +1,26 @@
1
+ #Sinatra is like rails, but without almost everything
2
+ require 'sinatra'
3
+
4
+ class Server < Sinatra::Base
5
+ puts 'Starting text box server!'
6
+
7
+ #get '/' is like rails routes.rb, basically saying whenever you go to the homepage of the api.
8
+ get '/' do
9
+ File.read('text_box')
10
+ end
11
+
12
+ #put '/' is like get '/', but it is a bit different, and accepts a body (learn the difference between put and get here: http://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Request_methods)
13
+ put '/' + File.read('text_box_password') do
14
+ #Does things (you don't have to understand it - I'm not exactly sure either :P)
15
+ request.body.rewind
16
+
17
+ #Sets what is in the text box
18
+ File.write('text_box', request.body.read)
19
+ end
20
+
21
+ end
22
+
23
+ # Run the app!
24
+ #
25
+ puts "TextBox server is running!"
26
+ Server.run!
metadata ADDED
@@ -0,0 +1,91 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: TextBox
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.2
5
+ platform: ruby
6
+ authors:
7
+ - Ben
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-05-10 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.7'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.7'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: sinatra
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
+ description:
56
+ email:
57
+ - ben@bensites.com
58
+ executables:
59
+ - textboxserver
60
+ - textboxserversetup
61
+ extensions: []
62
+ extra_rdoc_files: []
63
+ files:
64
+ - bin/textboxserver
65
+ - bin/textboxserversetup
66
+ - lib/TextBoxServer.rb
67
+ homepage: http://bensites.com
68
+ licenses:
69
+ - MIT
70
+ metadata: {}
71
+ post_install_message:
72
+ rdoc_options: []
73
+ require_paths:
74
+ - lib
75
+ required_ruby_version: !ruby/object:Gem::Requirement
76
+ requirements:
77
+ - - ">="
78
+ - !ruby/object:Gem::Version
79
+ version: '0'
80
+ required_rubygems_version: !ruby/object:Gem::Requirement
81
+ requirements:
82
+ - - ">="
83
+ - !ruby/object:Gem::Version
84
+ version: '0'
85
+ requirements: []
86
+ rubyforge_project:
87
+ rubygems_version: 2.4.3
88
+ signing_key:
89
+ specification_version: 4
90
+ summary: Quickly run an API to set and change a text file
91
+ test_files: []