social_cheesecake 0.0.4 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -0
- data/Rakefile +111 -0
- data/app/assets/javascripts/kinetic.js +448 -407
- data/app/assets/javascripts/social_cheesecake.js +1 -2
- data/app/assets/javascripts/socialcheesecake/_header.js +28 -0
- data/app/assets/javascripts/socialcheesecake/actor.js +104 -41
- data/app/assets/javascripts/socialcheesecake/cheesecake.js +26 -31
- data/app/assets/javascripts/socialcheesecake/grid.js +53 -12
- data/app/assets/javascripts/socialcheesecake/sector.js +108 -93
- data/app/assets/javascripts/socialcheesecake/text.js +39 -36
- data/lib/generators/social_cheesecake/install_generator.rb +10 -0
- data/lib/social_cheesecake/version.rb +1 -1
- data/social_cheesecake.gemspec +1 -0
- data/test/dummy/.gitignore +15 -0
- data/test/dummy/Gemfile +34 -0
- data/test/dummy/README +261 -0
- data/test/dummy/Rakefile +7 -0
- data/test/dummy/app/assets/images/beatriz.png +0 -0
- data/test/dummy/app/assets/images/rails.png +0 -0
- data/test/dummy/app/assets/images/youngAlberto.png +0 -0
- data/test/dummy/app/assets/javascripts/application.js +10 -0
- data/test/dummy/app/assets/stylesheets/application.css +7 -0
- data/test/dummy/app/controllers/application_controller.rb +3 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/mailers/.gitkeep +0 -0
- data/test/dummy/app/models/.gitkeep +0 -0
- data/test/dummy/app/views/layouts/application.html.erb +14 -0
- data/test/dummy/config/application.rb +48 -0
- data/test/dummy/config/boot.rb +6 -0
- data/test/dummy/config/database.yml +25 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +30 -0
- data/test/dummy/config/environments/production.rb +60 -0
- data/test/dummy/config/environments/test.rb +39 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/inflections.rb +10 -0
- data/test/dummy/config/initializers/mime_types.rb +5 -0
- data/test/dummy/config/initializers/secret_token.rb +7 -0
- data/test/dummy/config/initializers/session_store.rb +8 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/en.yml +5 -0
- data/test/dummy/config/routes.rb +58 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/db/seeds.rb +7 -0
- data/test/dummy/doc/README_FOR_APP +2 -0
- data/test/dummy/lib/assets/.gitkeep +0 -0
- data/test/dummy/lib/tasks/.gitkeep +0 -0
- data/test/dummy/log/.gitkeep +0 -0
- data/test/dummy/public/404.html +26 -0
- data/test/dummy/public/422.html +26 -0
- data/test/dummy/public/500.html +26 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/public/index.html +133 -0
- data/test/dummy/public/robots.txt +5 -0
- data/test/dummy/script/rails +6 -0
- data/test/dummy/test/fixtures/.gitkeep +0 -0
- data/test/dummy/test/functional/.gitkeep +0 -0
- data/test/dummy/test/integration/.gitkeep +0 -0
- data/test/dummy/test/performance/browsing_test.rb +12 -0
- data/test/dummy/test/test_helper.rb +13 -0
- data/test/dummy/test/unit/.gitkeep +0 -0
- data/test/dummy/vendor/assets/stylesheets/.gitkeep +0 -0
- data/test/dummy/vendor/plugins/.gitkeep +0 -0
- metadata +114 -29
- data/app/assets/javascripts/socialCheesecake.js +0 -161
data/.gitignore
CHANGED
data/Rakefile
CHANGED
@@ -1 +1,112 @@
|
|
1
1
|
require "bundler/gem_tasks"
|
2
|
+
require "rails"
|
3
|
+
|
4
|
+
# configure these defaults based on Your needs :
|
5
|
+
JS_FILES_DIR = 'app/assets/javascripts/socialcheesecake' # the javascripts base directory
|
6
|
+
|
7
|
+
COMPILER_JAR_PATH = "lib/java/build/compiler.jar" # adjust the jar path !
|
8
|
+
# only required if running under JRuby - will compile multiple files
|
9
|
+
# faster as it does not need to run system `java -jar ...` commands.
|
10
|
+
#COMPILER_MAIN_CLASS = "com.google.javascript.jscomp.CommandLineRunner"
|
11
|
+
COMPILER_DOWNLOAD_URI = 'http://closure-compiler.googlecode.com/files/compiler-latest.zip'
|
12
|
+
|
13
|
+
#
|
14
|
+
# a javascript compile rake task (uses google's closure compiler).
|
15
|
+
#
|
16
|
+
# @see http://code.google.com/closure/compiler/
|
17
|
+
#
|
18
|
+
namespace :cheesecake do
|
19
|
+
|
20
|
+
task :compile do
|
21
|
+
js_files = Dir[ File.join(JS_FILES_DIR, "**/*.js") ].sort
|
22
|
+
puts "matched #{js_files.size} .js file(s)"
|
23
|
+
compile_js(js_files)
|
24
|
+
end
|
25
|
+
|
26
|
+
desc "downloads (and extracts) the latest closure compiler.jar into COMPILER_JAR_PATH path (#{COMPILER_JAR_PATH})"
|
27
|
+
task :download_jar do
|
28
|
+
require 'uri'; require 'net/http'; require 'tempfile'
|
29
|
+
uri = URI.parse(COMPILER_DOWNLOAD_URI)
|
30
|
+
puts "downloading compiler jar from: #{COMPILER_DOWNLOAD_URI}"
|
31
|
+
response = Net::HTTP.start(uri.host, uri.port) do |http|
|
32
|
+
http.get(uri.path)
|
33
|
+
end
|
34
|
+
case response
|
35
|
+
when Net::HTTPSuccess
|
36
|
+
file_data, content_type = response.body, response.content_type
|
37
|
+
raise "no data returned from #{uri}" if file_data.nil? || file_data.size == 0
|
38
|
+
else
|
39
|
+
raise "download from #{uri} failed with response: #{response}"
|
40
|
+
end
|
41
|
+
filename = uri.path.split('/')[-1]
|
42
|
+
Tempfile.open(filename) do |tmpfile|
|
43
|
+
tmpfile << file_data
|
44
|
+
filename = tmpfile.path
|
45
|
+
end
|
46
|
+
if content_type =~ /application\/(x-)?zip/
|
47
|
+
# compiler-latest.zip with 3 entries :
|
48
|
+
# - compiler.jar
|
49
|
+
# - COPYING
|
50
|
+
# - README
|
51
|
+
extract_path = File.dirname(compiler_jar_path)
|
52
|
+
unless File.exist?(extract_path)
|
53
|
+
FileUtils.mkdir_p(extract_path)
|
54
|
+
end
|
55
|
+
# -u update files, create if necessary :
|
56
|
+
system "unzip -u #{filename} -d #{extract_path}"
|
57
|
+
else
|
58
|
+
raise "unexpected content-type: #{content_type}"
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
#========================================================================
|
63
|
+
|
64
|
+
def compile_js(files)
|
65
|
+
unless File.exist?(compiler_jar_path)
|
66
|
+
Rake::Task["javascript:download_jar"].invoke
|
67
|
+
end
|
68
|
+
unless File.exist?(compiler_jar_path)
|
69
|
+
puts "#{compiler_jar_path} not found !"
|
70
|
+
raise "try to run `rake javascript:download_jar` manually to download the compiler jar"
|
71
|
+
end
|
72
|
+
|
73
|
+
files = [ files ] unless files.is_a?(Array)
|
74
|
+
|
75
|
+
compiler_options = {}
|
76
|
+
compiler_options['--js'] = files.join(' ')
|
77
|
+
compiler_options['--compilation_level'] = 'SIMPLE_OPTIMIZATIONS'
|
78
|
+
compiler_options['--js_output_file'] = "../socialCheesecake.min.js"
|
79
|
+
#compiler_options['--warning_level'] = 'QUIET'
|
80
|
+
compiler_options2 = {}
|
81
|
+
compiler_options2['--js'] = files.join(' ')
|
82
|
+
compiler_options2['--compilation_level'] = 'WHITESPACE_ONLY'
|
83
|
+
compiler_options2['--formatting'] = 'PRETTY_PRINT'
|
84
|
+
compiler_options2['--js_output_file'] = "../socialCheesecake.js"
|
85
|
+
#compiler_options2['--warning_level'] = 'QUIET'
|
86
|
+
|
87
|
+
files.each do |file|
|
88
|
+
puts " > #{file}"
|
89
|
+
end
|
90
|
+
|
91
|
+
puts ""
|
92
|
+
puts "compiling ..."
|
93
|
+
puts "----------------------------------------------------"
|
94
|
+
|
95
|
+
# NOTE: JRuby "version" disabled as the closure java code does a System.exit !
|
96
|
+
#if defined?(JRUBY_VERSION) # JRuby style - will be much faster :
|
97
|
+
# require 'java'; require compiler_jar_path
|
98
|
+
# instance_eval "#{COMPILER_MAIN_CLASS}.main( #{compiler_options.to_a.flatten.inspect} )"
|
99
|
+
#else
|
100
|
+
system "java -jar #{compiler_jar_path} #{compiler_options.to_a.join(' ')}"
|
101
|
+
system "java -jar #{compiler_jar_path} #{compiler_options2.to_a.join(' ')}"
|
102
|
+
#end
|
103
|
+
puts "----------------------------------------------------"
|
104
|
+
puts "compiled #{files.size} javascript file(s) into socialCheesecake.js and socialCheesecake.min.js"
|
105
|
+
puts ""
|
106
|
+
end
|
107
|
+
|
108
|
+
def compiler_jar_path
|
109
|
+
ENV['COMPILER_JAR_PATH'].presence || COMPILER_JAR_PATH
|
110
|
+
end
|
111
|
+
|
112
|
+
end
|