juice 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +4 -0
- data/Manifest.txt +14 -0
- data/PostInstall.txt +7 -0
- data/README.rdoc +48 -0
- data/Rakefile +20 -0
- data/bin/juice +78 -0
- data/lib/JSquish.rb +17 -0
- data/lib/juice.rb +6 -0
- data/script/console +10 -0
- data/script/console.cmd +1 -0
- data/script/destroy +14 -0
- data/script/destroy.cmd +1 -0
- data/script/generate +14 -0
- data/script/generate.cmd +1 -0
- metadata +81 -0
data/History.txt
ADDED
data/Manifest.txt
ADDED
data/PostInstall.txt
ADDED
data/README.rdoc
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
= juice
|
2
|
+
|
3
|
+
* http://github.com/#{github_username}/#{project_name}
|
4
|
+
|
5
|
+
== DESCRIPTION:
|
6
|
+
|
7
|
+
FIX (describe your package)
|
8
|
+
|
9
|
+
== FEATURES/PROBLEMS:
|
10
|
+
|
11
|
+
* FIX (list of features or problems)
|
12
|
+
|
13
|
+
== SYNOPSIS:
|
14
|
+
|
15
|
+
FIX (code sample of usage)
|
16
|
+
|
17
|
+
== REQUIREMENTS:
|
18
|
+
|
19
|
+
* FIX (list of requirements)
|
20
|
+
|
21
|
+
== INSTALL:
|
22
|
+
|
23
|
+
* FIX (sudo gem install, anything else)
|
24
|
+
|
25
|
+
== LICENSE:
|
26
|
+
|
27
|
+
(The MIT License)
|
28
|
+
|
29
|
+
Copyright (c) 2010 FIXME full name
|
30
|
+
|
31
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
32
|
+
a copy of this software and associated documentation files (the
|
33
|
+
'Software'), to deal in the Software without restriction, including
|
34
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
35
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
36
|
+
permit persons to whom the Software is furnished to do so, subject to
|
37
|
+
the following conditions:
|
38
|
+
|
39
|
+
The above copyright notice and this permission notice shall be
|
40
|
+
included in all copies or substantial portions of the Software.
|
41
|
+
|
42
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
43
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
44
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
45
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
46
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
47
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
48
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
gem 'hoe', '>= 2.1.0'
|
3
|
+
require 'hoe'
|
4
|
+
require 'fileutils'
|
5
|
+
require './lib/juice'
|
6
|
+
|
7
|
+
Hoe.plugin :newgem
|
8
|
+
# Hoe.plugin :website
|
9
|
+
# Hoe.plugin :cucumberfeatures
|
10
|
+
|
11
|
+
# Generate all the Rake tasks
|
12
|
+
# Run 'rake -T' to see list of generated tasks (from gem root directory)
|
13
|
+
$hoe = Hoe.spec 'juice' do
|
14
|
+
self.developer 'Justin Baker', 'justin@fluttrhq.com'
|
15
|
+
self.rubyforge_name = self.name # TODO this is default value
|
16
|
+
end
|
17
|
+
|
18
|
+
require 'newgem/tasks'
|
19
|
+
Dir['tasks/**/*.rake'].each { |t| load t }
|
20
|
+
|
data/bin/juice
ADDED
@@ -0,0 +1,78 @@
|
|
1
|
+
#! /usr/bin/env ruby
|
2
|
+
require 'webrick'
|
3
|
+
require 'JSquish.rb'
|
4
|
+
include WEBrick
|
5
|
+
class File
|
6
|
+
def self.readt_s(filename)
|
7
|
+
data = ''
|
8
|
+
f = File.open(filename, "r")
|
9
|
+
f.each_line do |line|
|
10
|
+
data += line
|
11
|
+
end
|
12
|
+
data
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
module Juice
|
17
|
+
class Base
|
18
|
+
version = "0.0.2 "
|
19
|
+
|
20
|
+
def initialize
|
21
|
+
params = ARGV
|
22
|
+
if params[0] == 'server'
|
23
|
+
Juice::Base.server()
|
24
|
+
elsif params[0] == 'build'
|
25
|
+
Juice::Base.build()
|
26
|
+
else
|
27
|
+
puts 'No method given'
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def self.build
|
32
|
+
save_file = ARGV[1].nil? ? 'production.js' : ARGV[1]
|
33
|
+
if File.exists?(save_file)
|
34
|
+
puts "#{save_file} already exists!"
|
35
|
+
else
|
36
|
+
app = ''
|
37
|
+
files = Dir.glob("Framework/Juice.js")
|
38
|
+
Dir.glob("Framework/Juice.*.js").each do |me|
|
39
|
+
files.push(me)
|
40
|
+
end
|
41
|
+
Dir.glob("*.js").each do |me|
|
42
|
+
files.push(me)
|
43
|
+
end
|
44
|
+
files.each do |file|
|
45
|
+
puts "Adding #{file}"
|
46
|
+
if file == "Framework/Juice.js"
|
47
|
+
js = File.readt_s(file)
|
48
|
+
else
|
49
|
+
js = "Juice.appDidLoad(function(){#{File.readt_s(file)}});"
|
50
|
+
end
|
51
|
+
app = app +js
|
52
|
+
end
|
53
|
+
app = JSquish.parse(app)
|
54
|
+
puts "Saving to #{save_file}"
|
55
|
+
File.open(save_file, 'w') {|f| f.write(app) }
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
def self.server
|
60
|
+
port = ARGV[1].nil? ? 80 : ARGV[1]
|
61
|
+
puts "Starting webrick on #{Dir.getwd} \n "
|
62
|
+
Juice::Base.start_webrick(port,:DocumentRoot => Dir.getwd)
|
63
|
+
end
|
64
|
+
|
65
|
+
def self.start_webrick(port = 8080 ,config = {})
|
66
|
+
# always listen on port 8080
|
67
|
+
config.update(:Port => port)
|
68
|
+
server = HTTPServer.new(config)
|
69
|
+
yield server if block_given?
|
70
|
+
['INT', 'TERM'].each do |signal|
|
71
|
+
trap(signal) {server.shutdown}
|
72
|
+
end
|
73
|
+
server.start
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
Juice::Base.new
|
data/lib/JSquish.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
class JSquish
|
2
|
+
def self.parse(str)
|
3
|
+
s_comment_reg = /[\/]{2}.*/
|
4
|
+
str = str.gsub(s_comment_reg,' ')
|
5
|
+
|
6
|
+
#Remove all extra space
|
7
|
+
remove_regexes = [/\s+/]
|
8
|
+
remove_regexes.each do |reg|
|
9
|
+
str = str.gsub(reg,' ')
|
10
|
+
end
|
11
|
+
|
12
|
+
#comment_reg = /(\/*).+(\*\/)/
|
13
|
+
#str = str.gsub(comment_reg,' ')
|
14
|
+
# Return the string
|
15
|
+
str
|
16
|
+
end
|
17
|
+
end
|
data/lib/juice.rb
ADDED
data/script/console
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# File: script/console
|
3
|
+
irb = RUBY_PLATFORM =~ /(:?mswin|mingw)/ ? 'irb.bat' : 'irb'
|
4
|
+
|
5
|
+
libs = " -r irb/completion"
|
6
|
+
# Perhaps use a console_lib to store any extra methods I may want available in the cosole
|
7
|
+
# libs << " -r #{File.dirname(__FILE__) + '/../lib/console_lib/console_logger.rb'}"
|
8
|
+
libs << " -r #{File.dirname(__FILE__) + '/../lib/juice.rb'}"
|
9
|
+
puts "Loading juice gem"
|
10
|
+
exec "#{irb} #{libs} --simple-prompt"
|
data/script/console.cmd
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
@ruby script/console %*
|
data/script/destroy
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'rubigen'
|
6
|
+
rescue LoadError
|
7
|
+
require 'rubygems'
|
8
|
+
require 'rubigen'
|
9
|
+
end
|
10
|
+
require 'rubigen/scripts/destroy'
|
11
|
+
|
12
|
+
ARGV.shift if ['--help', '-h'].include?(ARGV[0])
|
13
|
+
RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
|
14
|
+
RubiGen::Scripts::Destroy.new.run(ARGV)
|
data/script/destroy.cmd
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
@ruby script/destroy %*
|
data/script/generate
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'rubigen'
|
6
|
+
rescue LoadError
|
7
|
+
require 'rubygems'
|
8
|
+
require 'rubigen'
|
9
|
+
end
|
10
|
+
require 'rubigen/scripts/generate'
|
11
|
+
|
12
|
+
ARGV.shift if ['--help', '-h'].include?(ARGV[0])
|
13
|
+
RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
|
14
|
+
RubiGen::Scripts::Generate.new.run(ARGV)
|
data/script/generate.cmd
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
@ruby script/generate %*
|
metadata
ADDED
@@ -0,0 +1,81 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: juice
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Justin Baker
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2010-01-06 00:00:00 -05:00
|
13
|
+
default_executable:
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: hoe
|
17
|
+
type: :development
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 2.3.2
|
24
|
+
version:
|
25
|
+
description: FIX (describe your package)
|
26
|
+
email:
|
27
|
+
- justin@fluttrhq.com
|
28
|
+
executables:
|
29
|
+
- juice
|
30
|
+
extensions: []
|
31
|
+
|
32
|
+
extra_rdoc_files:
|
33
|
+
- History.txt
|
34
|
+
- Manifest.txt
|
35
|
+
- PostInstall.txt
|
36
|
+
files:
|
37
|
+
- History.txt
|
38
|
+
- Manifest.txt
|
39
|
+
- PostInstall.txt
|
40
|
+
- README.rdoc
|
41
|
+
- Rakefile
|
42
|
+
- bin/juice
|
43
|
+
- lib/juice.rb
|
44
|
+
- lib/JSquish.rb
|
45
|
+
- script/console
|
46
|
+
- script/console.cmd
|
47
|
+
- script/destroy
|
48
|
+
- script/destroy.cmd
|
49
|
+
- script/generate
|
50
|
+
- script/generate.cmd
|
51
|
+
has_rdoc: true
|
52
|
+
homepage: http://github.com/#{github_username}/#{project_name}
|
53
|
+
licenses: []
|
54
|
+
|
55
|
+
post_install_message:
|
56
|
+
rdoc_options:
|
57
|
+
- --main
|
58
|
+
- README.rdoc
|
59
|
+
require_paths:
|
60
|
+
- lib
|
61
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
62
|
+
requirements:
|
63
|
+
- - ">="
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: "0"
|
66
|
+
version:
|
67
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
68
|
+
requirements:
|
69
|
+
- - ">="
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: "0"
|
72
|
+
version:
|
73
|
+
requirements: []
|
74
|
+
|
75
|
+
rubyforge_project: juice
|
76
|
+
rubygems_version: 1.3.5
|
77
|
+
signing_key:
|
78
|
+
specification_version: 3
|
79
|
+
summary: FIX (describe your package)
|
80
|
+
test_files: []
|
81
|
+
|