ymdp 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +1 -1
- data/Rakefile +13 -19
- data/VERSION +1 -1
- data/lib/new_application/Gemfile +1 -0
- data/lib/ymdp/compiler/template_compiler.rb +19 -3
- data/lib/ymdp/config.rb +4 -0
- data/lib/ymdp/deploy/ymdt.rb +118 -0
- data/lib/ymdp/support/string_masker.rb +17 -0
- data/lib/ymdp/tasks/ymdp.rake +13 -61
- data/lib/ymdp/translator/base.rb +6 -3
- data/lib/ymdp.rb +3 -0
- data/spec/data/Rakefile +3 -0
- data/spec/data/VERSION +1 -0
- data/spec/data/app/.gitignore +1 -0
- data/spec/data/app/assets/images/lightbox/lightbox_bg.png +0 -0
- data/spec/data/app/assets/javascripts/OpenMailIntl.js +291 -0
- data/spec/data/app/assets/javascripts/controls.js +965 -0
- data/spec/data/app/assets/javascripts/date.js +104 -0
- data/spec/data/app/assets/javascripts/dragdrop.js +974 -0
- data/spec/data/app/assets/javascripts/effects.js +1123 -0
- data/spec/data/app/assets/javascripts/lowpro.js +320 -0
- data/spec/data/app/assets/javascripts/prototype.js +4874 -0
- data/spec/data/app/assets/javascripts/scriptaculous.js +68 -0
- data/spec/data/app/assets/yrb/en-US/application_en-US.pres +7 -0
- data/spec/data/app/helpers/application_helper.rb +3 -0
- data/spec/data/app/javascripts/application.js +580 -0
- data/spec/data/app/javascripts/debug.js +138 -0
- data/spec/data/app/javascripts/flash.js +96 -0
- data/spec/data/app/javascripts/header.js +13 -0
- data/spec/data/app/javascripts/help.js +76 -0
- data/spec/data/app/javascripts/i18n.js +235 -0
- data/spec/data/app/javascripts/launcher.js +159 -0
- data/spec/data/app/javascripts/logger.js +61 -0
- data/spec/data/app/javascripts/tag_helper.js +178 -0
- data/spec/data/app/stylesheets/application.css +0 -0
- data/spec/data/app/stylesheets/ie.css +0 -0
- data/spec/data/app/stylesheets/ie6.css +0 -0
- data/spec/data/app/stylesheets/ie7.css +0 -0
- data/spec/data/app/stylesheets/ie8.css +0 -0
- data/spec/data/app/stylesheets/lightbox.css +30 -0
- data/spec/data/app/stylesheets/non_ie.css +0 -0
- data/spec/data/app/views/layouts/application.html.haml +35 -0
- data/spec/data/app/views/page.html.haml +1 -0
- data/spec/data/app/views/shared/_error.html.haml +8 -0
- data/spec/data/app/views/shared/_flash.html.haml +2 -0
- data/spec/data/app/views/shared/_javascripts.html.haml +22 -0
- data/spec/data/app/views/shared/_loading.html.haml +13 -0
- data/spec/data/app/views/shared/_stylesheets.html.haml +23 -0
- data/spec/data/config/categories.yml +6 -0
- data/spec/data/config/config.yml +28 -0
- data/spec/data/config/config.yml.example +30 -0
- data/spec/data/config/constants.rb +54 -0
- data/spec/data/config/content.yml +2 -0
- data/spec/data/config/servers.yml +9 -0
- data/spec/data/config/servers.yml.example +9 -0
- data/spec/data/lib/init.rb +13 -0
- data/spec/data/lib/tasks/environment.rake +4 -0
- data/spec/data/lib/tasks/keys.rake +3 -0
- data/spec/data/lib/tasks/setup.rake +13 -0
- data/spec/data/lib/tasks/ymdp.rake +4 -0
- data/spec/data/script/build +9 -0
- data/spec/data/script/config +13 -0
- data/spec/data/script/destroy +18 -0
- data/spec/data/script/generate +4 -0
- data/spec/data/script/gitrm +17 -0
- data/spec/data/script/growl +6 -0
- data/spec/data/script/images +48 -0
- data/spec/data/script/jslint.js +5072 -0
- data/spec/data/script/langs +31 -0
- data/spec/data/script/translate +5 -0
- data/spec/data/script/ymdt +1895 -0
- data/spec/data/script/ymdt.old +1890 -0
- data/spec/data/script/yuicompressor-2.4.2.jar +0 -0
- data/spec/spec.opts +1 -0
- data/spec/spec_helper.rb +11 -0
- data/spec/translator_spec.rb +9 -0
- data/spec/ymdp_spec.rb +5 -0
- data/spec/ymdt_spec.rb +149 -0
- data/ymdp.gemspec +78 -6
- metadata +78 -6
- data/test/helper.rb +0 -10
- data/test/test_ymdp.rb +0 -4
data/LICENSE
CHANGED
data/Rakefile
CHANGED
@@ -27,36 +27,30 @@ rescue LoadError
|
|
27
27
|
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
|
28
28
|
end
|
29
29
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
30
|
+
|
31
|
+
require 'spec/rake/spectask'
|
32
|
+
Spec::Rake::SpecTask.new(:spec) do |spec|
|
33
|
+
spec.libs << 'lib' << 'spec'
|
34
|
+
spec.spec_files = FileList['spec/**/*_spec.rb']
|
35
|
+
spec.spec_opts = ['-c']
|
35
36
|
end
|
36
37
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
test.pattern = 'test/**/test_*.rb'
|
42
|
-
test.verbose = true
|
43
|
-
end
|
44
|
-
rescue LoadError
|
45
|
-
task :rcov do
|
46
|
-
abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
|
47
|
-
end
|
38
|
+
Spec::Rake::SpecTask.new(:rcov) do |spec|
|
39
|
+
spec.libs << 'lib' << 'spec'
|
40
|
+
spec.pattern = 'spec/**/*_spec.rb'
|
41
|
+
spec.rcov = true
|
48
42
|
end
|
49
43
|
|
50
|
-
task :
|
44
|
+
task :spec => :check_dependencies
|
51
45
|
|
52
|
-
task :default => :
|
46
|
+
task :default => :spec
|
53
47
|
|
54
48
|
require 'rake/rdoctask'
|
55
49
|
Rake::RDocTask.new do |rdoc|
|
56
50
|
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
57
51
|
|
58
52
|
rdoc.rdoc_dir = 'rdoc'
|
59
|
-
rdoc.title = "
|
53
|
+
rdoc.title = "translator #{version}"
|
60
54
|
rdoc.rdoc_files.include('README*')
|
61
55
|
rdoc.rdoc_files.include('lib/**/*.rb')
|
62
56
|
end
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.1
|
data/lib/new_application/Gemfile
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'grit'
|
2
|
+
|
1
3
|
include Grit
|
2
4
|
|
3
5
|
include YMDP::Config
|
@@ -33,11 +35,20 @@ module TemplateBuilder
|
|
33
35
|
@hash = git_hash
|
34
36
|
@message = message
|
35
37
|
@subdir = subdir
|
36
|
-
|
37
|
-
|
38
|
+
|
39
|
+
set_content_variables
|
40
|
+
|
38
41
|
@view = base_filename(@file.split("/").last)
|
39
42
|
Application.current_view = @view
|
40
43
|
end
|
44
|
+
|
45
|
+
def set_content_variables
|
46
|
+
content = YAML.load_file("#{BASE_PATH}/config/content.yml")
|
47
|
+
content.each do |key, value|
|
48
|
+
attribute = "@#{key}"
|
49
|
+
instance_variable_set(attribute, value) unless instance_variable_defined?(attribute)
|
50
|
+
end
|
51
|
+
end
|
41
52
|
|
42
53
|
def build
|
43
54
|
unless @file =~ /#{YMDP_ROOT}\/app\/views\/_/
|
@@ -108,7 +119,12 @@ end
|
|
108
119
|
class YMDPTemplate
|
109
120
|
include ActionView::Helpers::TagHelper
|
110
121
|
include TemplateBuilder
|
111
|
-
|
122
|
+
|
123
|
+
begin
|
124
|
+
include ApplicationHelper
|
125
|
+
rescue NameError
|
126
|
+
end
|
127
|
+
|
112
128
|
include YMDP::Base
|
113
129
|
include YMDP::AssetTagHelper
|
114
130
|
include YMDP::FormTagHelper
|
data/lib/ymdp/config.rb
CHANGED
@@ -0,0 +1,118 @@
|
|
1
|
+
module YMDT
|
2
|
+
class System
|
3
|
+
def self.execute(command, params={})
|
4
|
+
if params[:return]
|
5
|
+
`#{command}`
|
6
|
+
else
|
7
|
+
system command
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
class Base
|
13
|
+
attr_accessor :username, :password, :script_path
|
14
|
+
|
15
|
+
def initialize(params={})
|
16
|
+
@username = params[:username]
|
17
|
+
@password = params[:password]
|
18
|
+
unless @username
|
19
|
+
raise ArgumentError.new("username required")
|
20
|
+
end
|
21
|
+
unless @password
|
22
|
+
raise ArgumentError.new("password required")
|
23
|
+
end
|
24
|
+
@script_path = params[:script_path] || "./script/ymdt"
|
25
|
+
end
|
26
|
+
|
27
|
+
def put(params={})
|
28
|
+
invoke(:put, params)
|
29
|
+
end
|
30
|
+
|
31
|
+
def get(params={})
|
32
|
+
invoke(:get, params)
|
33
|
+
end
|
34
|
+
|
35
|
+
def create(params={})
|
36
|
+
raise ArgumentError.new("application_id required") unless params[:application_id]
|
37
|
+
invoke(:get, params)
|
38
|
+
end
|
39
|
+
|
40
|
+
def ls(params={})
|
41
|
+
invoke(:ls, {:return => true}.merge(params))
|
42
|
+
end
|
43
|
+
|
44
|
+
def upgrade(params={})
|
45
|
+
invoke(:upgrade, params)
|
46
|
+
end
|
47
|
+
|
48
|
+
# prepares the commands to correctly reference the application and path
|
49
|
+
#
|
50
|
+
def invoke(command, params={})
|
51
|
+
command_string = compile_command(command, params)
|
52
|
+
output_command(command_string)
|
53
|
+
execute(command_string, params)
|
54
|
+
end
|
55
|
+
|
56
|
+
private
|
57
|
+
|
58
|
+
def output_command(command_string)
|
59
|
+
$stdout.puts
|
60
|
+
$stdout.puts StringMasker.new(command_string, :username => username, :password => password).to_s
|
61
|
+
end
|
62
|
+
|
63
|
+
def compile_command(command, params)
|
64
|
+
full_path = nil
|
65
|
+
|
66
|
+
# construct relative path to the application's location in the servers directory
|
67
|
+
#
|
68
|
+
if params[:application]
|
69
|
+
full_path = "#{SERVERS_PATH}/" << params[:application]
|
70
|
+
full_path = full_path << "/" << params[:path] if params[:path]
|
71
|
+
end
|
72
|
+
|
73
|
+
# construct command line
|
74
|
+
#
|
75
|
+
options = []
|
76
|
+
|
77
|
+
# execute script
|
78
|
+
#
|
79
|
+
options << script_path
|
80
|
+
|
81
|
+
# command (:put, :get, etc)
|
82
|
+
#
|
83
|
+
options << command
|
84
|
+
|
85
|
+
# path
|
86
|
+
#
|
87
|
+
options << "\"#{full_path}\"" if full_path
|
88
|
+
|
89
|
+
# optional sync flag MUST BE PLACED HERE
|
90
|
+
#
|
91
|
+
options << "-s" if params[:sync]
|
92
|
+
|
93
|
+
# optional application ID flag
|
94
|
+
#
|
95
|
+
options << "-a#{params[:application_id]}" if params[:application_id]
|
96
|
+
|
97
|
+
# username and password
|
98
|
+
|
99
|
+
options << "-u#{username}"
|
100
|
+
options << "-p#{password}"
|
101
|
+
|
102
|
+
options.join(" ")
|
103
|
+
end
|
104
|
+
|
105
|
+
# execute the command, or not, and return the results, or not
|
106
|
+
#
|
107
|
+
def execute(command, params={})
|
108
|
+
unless params[:dry_run]
|
109
|
+
if params[:return]
|
110
|
+
System.execute(command, :return => true)
|
111
|
+
else
|
112
|
+
$stdout.puts
|
113
|
+
System.execute(command)
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|
117
|
+
end
|
118
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
class StringMasker
|
2
|
+
attr_accessor :string, :params, :output_string
|
3
|
+
|
4
|
+
def initialize(string, params)
|
5
|
+
output_string = string.dup
|
6
|
+
|
7
|
+
params.each do |key, value|
|
8
|
+
output_string.gsub!(value, "[#{key}]")
|
9
|
+
end
|
10
|
+
|
11
|
+
@output_string = output_string
|
12
|
+
end
|
13
|
+
|
14
|
+
def to_s
|
15
|
+
output_string
|
16
|
+
end
|
17
|
+
end
|
data/lib/ymdp/tasks/ymdp.rake
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'deploy/ymdt'
|
2
|
+
|
1
3
|
include YMDP::Config
|
2
4
|
|
3
5
|
begin
|
@@ -157,12 +159,6 @@ DOCS
|
|
157
159
|
puts docs
|
158
160
|
end
|
159
161
|
|
160
|
-
def time(message="")
|
161
|
-
Timer.new(:title => "YMDP").time(message) do
|
162
|
-
yield
|
163
|
-
end
|
164
|
-
end
|
165
|
-
|
166
162
|
desc "Deploys application to YMDP servers"
|
167
163
|
task :deploy do
|
168
164
|
time("Deployed #{@application}: #{@path}") do
|
@@ -478,46 +474,17 @@ end
|
|
478
474
|
|
479
475
|
# END OF RAKE TASKS
|
480
476
|
|
481
|
-
def
|
482
|
-
|
483
|
-
|
484
|
-
|
485
|
-
command = []
|
486
|
-
command << command_string
|
487
|
-
command << "\"#{path}\""
|
488
|
-
command << "-s" if @sync
|
489
|
-
|
490
|
-
ymdt_command(command, return_results)
|
477
|
+
def time(message="")
|
478
|
+
Timer.new(:title => "YMDP", :growl => growl?).time(message) do
|
479
|
+
yield
|
480
|
+
end
|
491
481
|
end
|
492
482
|
|
493
|
-
def
|
494
|
-
|
495
|
-
# command << "php"
|
496
|
-
command << "./script/ymdt"
|
497
|
-
|
498
|
-
command << commands
|
499
|
-
|
500
|
-
command << "-u#{@username}"
|
501
|
-
command << "-p#{@password}"
|
502
|
-
command_string = command.join(" ")
|
503
|
-
|
504
|
-
display_string = command_string.dup
|
505
|
-
display_string.gsub!(@username, "[username]")
|
506
|
-
display_string.gsub!(@password, "[password]")
|
507
|
-
|
508
|
-
puts
|
509
|
-
puts display_string
|
510
|
-
|
511
|
-
unless @dry_run
|
512
|
-
if return_results
|
513
|
-
`#{command_string}`
|
514
|
-
else
|
515
|
-
puts
|
516
|
-
system command_string
|
517
|
-
end
|
518
|
-
end
|
483
|
+
def ymdt
|
484
|
+
@ymdt ||= YMDT::Base.new(:username => @username, :password => @password)
|
519
485
|
end
|
520
486
|
|
487
|
+
|
521
488
|
def validated_embedded_js(path)
|
522
489
|
# jslint only accepts files, later we can hack it to accept stdin pipes
|
523
490
|
doc = open(path) { |f|
|
@@ -542,7 +509,7 @@ def deploy(application, path)
|
|
542
509
|
Rake::Task["validate:#{application}:javascripts"].invoke if validate_js_assets?
|
543
510
|
Rake::Task["validate:#{application}:json"].invoke if validate_json_assets?
|
544
511
|
|
545
|
-
|
512
|
+
ymdt.put(:application => application, :path => path)
|
546
513
|
end
|
547
514
|
|
548
515
|
def deploy_path(application, path)
|
@@ -568,7 +535,7 @@ def deploy_path(application, path)
|
|
568
535
|
|
569
536
|
if file =~ Regexp.new(path)
|
570
537
|
puts file
|
571
|
-
|
538
|
+
ymdt.put(:application => application, :path => new_path)
|
572
539
|
end
|
573
540
|
end
|
574
541
|
end
|
@@ -587,7 +554,7 @@ def deploy_yrb(application, path, options={})
|
|
587
554
|
end
|
588
555
|
|
589
556
|
def list(application, path)
|
590
|
-
|
557
|
+
ymdt.ls(:application => application, :path => path, :return_results => true)
|
591
558
|
end
|
592
559
|
|
593
560
|
def check_asset_ids(application, path)
|
@@ -687,22 +654,7 @@ def create_directory_from_application(application, path="")
|
|
687
654
|
time("Done creating #{application}: #{path}") do
|
688
655
|
puts "Creating #{application}: #{path}"
|
689
656
|
application_id = SERVERS[application]["application_id"]
|
690
|
-
|
691
|
-
dir = "./servers/#{application}"
|
692
|
-
|
693
|
-
if path == ""
|
694
|
-
path = dir
|
695
|
-
else
|
696
|
-
path = "./" << path
|
697
|
-
end
|
698
|
-
|
699
|
-
command = []
|
700
|
-
|
701
|
-
command << "get"
|
702
|
-
command << path
|
703
|
-
command << "-a#{application_id}"
|
704
|
-
|
705
|
-
ymdt_command(command)
|
657
|
+
ymdt.get(:application => application, :path => path, :application_id => application_id)
|
706
658
|
end
|
707
659
|
end
|
708
660
|
|
data/lib/ymdp/translator/base.rb
CHANGED
@@ -91,9 +91,6 @@ module YMDP
|
|
91
91
|
# Finds English language translation keys which have not been translated
|
92
92
|
# and translates them through Google Translate.
|
93
93
|
#
|
94
|
-
# Usage:
|
95
|
-
# YMDP::Translator::Base.new().translate
|
96
|
-
#
|
97
94
|
class Base
|
98
95
|
include YMDP::FileSupport
|
99
96
|
extend YMDP::FileSupport
|
@@ -303,6 +300,9 @@ module YMDP
|
|
303
300
|
end
|
304
301
|
end
|
305
302
|
|
303
|
+
# Usage:
|
304
|
+
# YMDP::Translator::Yaml.new().translate
|
305
|
+
#
|
306
306
|
class Yaml < Base
|
307
307
|
include YMDP::Yaml::Support
|
308
308
|
extend YMDP::Yaml::Support
|
@@ -340,6 +340,9 @@ module YMDP
|
|
340
340
|
end
|
341
341
|
end
|
342
342
|
|
343
|
+
# Usage:
|
344
|
+
# YMDP::Translator::YRB.new().translate
|
345
|
+
#
|
343
346
|
class YRB < Base
|
344
347
|
include YMDP::YRB::Support
|
345
348
|
extend YMDP::YRB::Support
|
data/lib/ymdp.rb
CHANGED
data/spec/data/Rakefile
ADDED
data/spec/data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
6.0.0 Felucia
|
@@ -0,0 +1 @@
|
|
1
|
+
assets.zip
|
Binary file
|