ymdp 0.1.4 → 0.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (94) hide show
  1. data/Rakefile +1 -0
  2. data/VERSION +1 -1
  3. data/lib/ymdp/application.rb +22 -0
  4. data/lib/ymdp/application_view.rb +312 -0
  5. data/lib/ymdp/base.rb +119 -0
  6. data/lib/ymdp/commands/build.rb +0 -6
  7. data/lib/ymdp/compiler/base.rb +12 -10
  8. data/lib/ymdp/compiler/domains.rb +8 -34
  9. data/lib/ymdp/compiler/template.rb +58 -85
  10. data/lib/ymdp/configuration/config.rb +70 -28
  11. data/lib/ymdp/configuration/constants.rb +17 -3
  12. data/lib/ymdp/processor/form_post.rb +5 -1
  13. data/lib/ymdp/support/file.rb +29 -11
  14. data/lib/ymdp/tasks/keys.rake +13 -13
  15. data/lib/ymdp/tasks/ymdp.rake +4 -4
  16. data/spec/application_spec.rb +29 -0
  17. data/spec/application_view_spec.rb +5 -0
  18. data/spec/compiler_spec.rb +3 -3
  19. data/spec/compiler_template_spec.rb +26 -54
  20. data/spec/data/app/views/layouts/application.html.haml +2 -0
  21. data/spec/data/config/config.yml +1 -0
  22. data/spec/data/config/constants.rb +3 -7
  23. data/spec/data/script/destroy +2 -2
  24. data/spec/data/script/langs +1 -3
  25. data/spec/default_settings.rb +42 -0
  26. data/spec/domains_spec.rb +3 -22
  27. data/spec/spec_helper.rb +3 -0
  28. data/spec/stubs.rb +11 -0
  29. data/spec/ymdp_base_spec.rb +125 -0
  30. data/test.rb +46 -0
  31. data/ymdp.gemspec +15 -65
  32. metadata +14 -64
  33. data/lib/new_application/.base +0 -11
  34. data/lib/new_application/Gemfile +0 -13
  35. data/lib/new_application/Rakefile +0 -3
  36. data/lib/new_application/app/.gitignore +0 -1
  37. data/lib/new_application/app/assets/images/lightbox/lightbox_bg.png +0 -0
  38. data/lib/new_application/app/assets/javascripts/OpenMailIntl.js +0 -291
  39. data/lib/new_application/app/assets/javascripts/controls.js +0 -965
  40. data/lib/new_application/app/assets/javascripts/date.js +0 -104
  41. data/lib/new_application/app/assets/javascripts/dragdrop.js +0 -974
  42. data/lib/new_application/app/assets/javascripts/effects.js +0 -1123
  43. data/lib/new_application/app/assets/javascripts/lowpro.js +0 -320
  44. data/lib/new_application/app/assets/javascripts/prototype.js +0 -4874
  45. data/lib/new_application/app/assets/javascripts/scriptaculous.js +0 -68
  46. data/lib/new_application/app/assets/yrb/en-US/application_en-US.pres +0 -7
  47. data/lib/new_application/app/helpers/application_helper.rb +0 -3
  48. data/lib/new_application/app/javascripts/application.js +0 -580
  49. data/lib/new_application/app/javascripts/debug.js +0 -138
  50. data/lib/new_application/app/javascripts/flash.js +0 -96
  51. data/lib/new_application/app/javascripts/header.js +0 -13
  52. data/lib/new_application/app/javascripts/help.js +0 -76
  53. data/lib/new_application/app/javascripts/i18n.js +0 -235
  54. data/lib/new_application/app/javascripts/launcher.js +0 -159
  55. data/lib/new_application/app/javascripts/logger.js +0 -61
  56. data/lib/new_application/app/javascripts/tag_helper.js +0 -178
  57. data/lib/new_application/app/stylesheets/application.css +0 -0
  58. data/lib/new_application/app/stylesheets/ie.css +0 -0
  59. data/lib/new_application/app/stylesheets/ie6.css +0 -0
  60. data/lib/new_application/app/stylesheets/ie7.css +0 -0
  61. data/lib/new_application/app/stylesheets/ie8.css +0 -0
  62. data/lib/new_application/app/stylesheets/lightbox.css +0 -30
  63. data/lib/new_application/app/stylesheets/non_ie.css +0 -0
  64. data/lib/new_application/app/views/layouts/application.html.haml +0 -35
  65. data/lib/new_application/app/views/shared/_error.html.haml +0 -8
  66. data/lib/new_application/app/views/shared/_flash.html.haml +0 -2
  67. data/lib/new_application/app/views/shared/_javascripts.html.haml +0 -22
  68. data/lib/new_application/app/views/shared/_loading.html.haml +0 -13
  69. data/lib/new_application/app/views/shared/_stylesheets.html.haml +0 -23
  70. data/lib/new_application/config/categories.yml +0 -6
  71. data/lib/new_application/config/config.yml.example +0 -30
  72. data/lib/new_application/config/constants.rb +0 -54
  73. data/lib/new_application/config/servers.yml.example +0 -9
  74. data/lib/new_application/lib/init.rb +0 -13
  75. data/lib/new_application/lib/tasks/environment.rake +0 -4
  76. data/lib/new_application/lib/tasks/keys.rake +0 -3
  77. data/lib/new_application/lib/tasks/setup.rake +0 -13
  78. data/lib/new_application/lib/tasks/ymdp.rake +0 -4
  79. data/lib/new_application/script/build +0 -9
  80. data/lib/new_application/script/config +0 -13
  81. data/lib/new_application/script/destroy +0 -18
  82. data/lib/new_application/script/generate +0 -4
  83. data/lib/new_application/script/gitrm +0 -17
  84. data/lib/new_application/script/growl +0 -6
  85. data/lib/new_application/script/images +0 -48
  86. data/lib/new_application/script/jslint.js +0 -5072
  87. data/lib/new_application/script/langs +0 -31
  88. data/lib/new_application/script/translate +0 -5
  89. data/lib/new_application/script/ymdt +0 -1895
  90. data/lib/new_application/script/ymdt.old +0 -1890
  91. data/lib/new_application/script/yuicompressor-2.4.2.jar +0 -0
  92. data/lib/new_application/ymdp +0 -8
  93. data/lib/ymdp/processor/processor.rb +0 -132
  94. data/lib/ymdp/ymdp.rb +0 -208
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- YMDP_ROOT = "."
4
- APP_DIR = "#{YMDP_ROOT}/app"
3
+ BASE_PATH = "."
4
+ APP_DIR = "#{BASE_PATH}/app"
5
5
  ASSETS_DIR = "#{APP_DIR}/assets"
6
6
  VIEWS_DIR = "#{APP_DIR}/views"
7
7
  JAVASCRIPTS_DIR = "#{APP_DIR}/javascripts"
@@ -2,12 +2,10 @@
2
2
 
3
3
  require 'lib/init'
4
4
 
5
- YMDP_ROOT = "."
6
-
7
5
  include ApplicationView::Base
8
6
 
9
7
  def keys(lang)
10
- path = "#{YMDP_ROOT}/servers/my/assets/yrb/keys_#{lang}.json"
8
+ path = "#{BASE_PATH}/servers/my/assets/yrb/keys_#{lang}.json"
11
9
  json = ""
12
10
  if File.exists?(path)
13
11
  File.open(path, "r") do |f|
@@ -0,0 +1,42 @@
1
+
2
+ def stub_yrb_configuration
3
+ @content_variables = {
4
+ "version" => 1,
5
+ "sprint_name" => "Firefly"
6
+ }
7
+
8
+ @servers = {
9
+ "staging" => {
10
+ "server" => "staging",
11
+ "application_id" => "12345",
12
+ "assets_id" => "abcdefg_1"
13
+ },
14
+
15
+ "production" => {
16
+ "server" => "www",
17
+ "application_id" => "678910",
18
+ "assets_id" => "hijklmno_1"
19
+ }
20
+ }
21
+ @servers.stub!(:servers).and_return(@servers)
22
+
23
+ @compress = {"obfuscate"=>true, "js_assets"=>true, "css"=>true, "embedded_js"=>true}
24
+ @validate = {"html"=>{"doctype"=>"HTML 4.0 Transitional", "build"=>true, "deploy"=>true}, "js_assets"=>{"build"=>false, "deploy"=>false}, "json_assets"=>{"build"=>false, "deploy"=>false}, "embedded_js"=>{"build"=>true, "deploy"=>true}}
25
+
26
+ @base_path = "./base_path/"
27
+
28
+ YMDP::Base.configure do |config|
29
+ config.username = "malreynolds"
30
+ config.password = "firefly2591"
31
+ config.default_server = "staging"
32
+ config.growl = true
33
+ config.verbose = false
34
+ config.compress = @compress
35
+ config.validate = @validate
36
+
37
+ config.add_path(:base_path, @base_path)
38
+ config.servers = @servers
39
+
40
+ config.content_variables = @content_variables
41
+ end
42
+ end
@@ -5,32 +5,13 @@ require 'compiler/domains'
5
5
  describe "Domains" do
6
6
  before(:each) do
7
7
  stub_git_helper
8
-
9
- @servers = {
10
- "staging" => {
11
- "server" => "staging",
12
- "application_id" => "12345",
13
- "assets_id" => "abcdefg_1"
14
- },
15
-
16
- "production" => {
17
- "server" => "www",
18
- "application_id" => "678910",
19
- "assets_id" => "hijklmno_1"
20
- }
21
- }
22
- @servers.stub!(:servers).and_return(@servers)
8
+ stub_yrb_configuration
23
9
 
24
10
  @options = {
25
11
  :commit => true,
26
12
  :branch => "master",
27
13
  :message => "Commit message"
28
- }
29
- @base_path = "."
30
-
31
- YMDP::Compiler::Domains.base_path = @base_path
32
- YMDP::Compiler::Domains.servers = @servers
33
-
14
+ }
34
15
  @domains = YMDP::Compiler::Domains.new(@options)
35
16
  end
36
17
 
@@ -52,7 +33,7 @@ describe "Domains" do
52
33
  end
53
34
 
54
35
  it "should set base_path" do
55
- @domains.base_path.should == @base_path
36
+ @domains.paths[:base_path].should == @base_path
56
37
  end
57
38
 
58
39
  it "should set domains" do
@@ -11,6 +11,9 @@ require 'spec'
11
11
  require 'spec/autorun'
12
12
 
13
13
  require 'stubs'
14
+ require 'default_settings'
15
+
14
16
 
15
17
  Spec::Runner.configure do |config|
18
+
16
19
  end
@@ -1,3 +1,9 @@
1
+ def stub_io
2
+ stub_screen_io
3
+ stub_file_io
4
+ stub_file_utils
5
+ stub_yaml
6
+ end
1
7
 
2
8
  def stub_screen_io
3
9
  $stdout.stub!(:puts)
@@ -40,3 +46,8 @@ def stub_timer
40
46
  @timer.stub!(:time).and_yield
41
47
  Timer.stub!(:new).and_return(@timer)
42
48
  end
49
+
50
+ def reset_constant(constant, value)
51
+ Object.send(:remove_const, constant)
52
+ Object.const_set(constant, value)
53
+ end
@@ -0,0 +1,125 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
+
3
+ describe YMDP::Base do
4
+ describe "instantiation" do
5
+ it "should instantiate" do
6
+ @ymdp = YMDP::Base.new
7
+ @ymdp.should_not be_nil
8
+ end
9
+ end
10
+
11
+ describe "configuration" do
12
+ before(:each) do
13
+ @ymdp = YMDP::Base.new
14
+ end
15
+
16
+ it "should set username" do
17
+ YMDP::Base.configure do |config|
18
+ config.username = "mal"
19
+ end
20
+ @ymdp.username.should == "mal"
21
+ end
22
+
23
+ it "should set password" do
24
+ YMDP::Base.configure do |config|
25
+ config.password = "password"
26
+ end
27
+ @ymdp.password.should == "password"
28
+ end
29
+
30
+ it "should set default_server" do
31
+ YMDP::Base.configure do |config|
32
+ config.default_server = "staging"
33
+ end
34
+ @ymdp.default_server.should == "staging"
35
+ end
36
+
37
+ it "should set growl" do
38
+ YMDP::Base.configure do |config|
39
+ config.growl = true
40
+ end
41
+ @ymdp.growl.should be_true
42
+ end
43
+
44
+ it "should set verbose" do
45
+ YMDP::Base.configure do |config|
46
+ config.verbose = true
47
+ end
48
+ @ymdp.verbose.should be_true
49
+ end
50
+
51
+ it "should set compress" do
52
+ @compress = {
53
+ "obfuscate" => true,
54
+ "css" => true
55
+ }
56
+ YMDP::Base.configure do |config|
57
+ config.compress = @compress
58
+ end
59
+ @ymdp.compress.should == @compress
60
+ end
61
+
62
+ it "should set validate" do
63
+ @validate = {
64
+ "html" => {
65
+ "doctype" => "4.0",
66
+ "build" => true
67
+ },
68
+ "embedded_js" => {
69
+ "build" => true,
70
+ "deploy" => false
71
+ }
72
+ }
73
+ YMDP::Base.configure do |config|
74
+ config.validate = @validate
75
+ end
76
+ @ymdp.validate.should == @validate
77
+ end
78
+
79
+ describe "content variables" do
80
+ describe "add" do
81
+ it "should add a content_variable" do
82
+ YMDP::Base.configure do |config|
83
+ config.add_content_variable(:funky, "Real funky")
84
+ end
85
+ @ymdp.funky.should == "Real funky"
86
+ end
87
+ end
88
+
89
+ describe "load" do
90
+ before(:each) do
91
+ YAML.should_receive(:load_file).with(/content.yml$/).and_return({
92
+ "version" => "1.1",
93
+ "sprint_name" => "Gargantuan"
94
+ })
95
+ end
96
+
97
+ it "should load version from a file" do
98
+ YMDP::Base.configure do |config|
99
+ config.load_content_variables "content"
100
+ end
101
+ @ymdp.version.should == "1.1"
102
+ end
103
+ end
104
+
105
+ describe "set" do
106
+ before(:each) do
107
+ YMDP::Base.configure do |config|
108
+ config.content_variables = {
109
+ "version" => "1.2",
110
+ "sprint_name" => "Gorgonzola"
111
+ }
112
+ end
113
+ end
114
+
115
+ it "should set sprint name in content variables" do
116
+ @ymdp.version.should == "1.2"
117
+ end
118
+
119
+ it "should set sprint name in content variables" do
120
+ @ymdp.sprint_name.should == "Gorgonzola"
121
+ end
122
+ end
123
+ end
124
+ end
125
+ end
data/test.rb ADDED
@@ -0,0 +1,46 @@
1
+ require 'rubygems'
2
+ require './lib/ymdp/configuration/config'
3
+
4
+ class Thing
5
+ include YMDP::Configuration::Helpers
6
+
7
+ def self.configure
8
+ setter = YMDP::Configuration::Setter.new
9
+
10
+ yield setter
11
+
12
+ @@paths = setter.paths
13
+ @@servers = setter.servers
14
+
15
+ setter.content_variables.each do |key, value|
16
+ class_eval %(
17
+ class << self
18
+ attr_accessor :#{key}
19
+ end
20
+
21
+ self.#{key} = "#{value}"
22
+ )
23
+
24
+ eval %(
25
+ def #{key}
26
+ self.class.#{key}
27
+ end
28
+ )
29
+ end
30
+ end
31
+ end
32
+
33
+
34
+
35
+ Thing.configure do |config|
36
+ config.add_content_variable :hello, "what"
37
+ config.add_content_variable :yer_mom, "yeah"
38
+ end
39
+
40
+ t = Thing.new
41
+
42
+ puts Thing.hello
43
+ puts t.hello
44
+
45
+ puts Thing.yer_mom
46
+ puts t.yer_mom
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{ymdp}
8
- s.version = "0.1.4"
8
+ s.version = "0.1.6"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Jeff Coleman"]
12
- s.date = %q{2010-01-14}
12
+ s.date = %q{2010-01-16}
13
13
  s.default_executable = %q{ymdp}
14
14
  s.description = %q{Framework for developing applications in the Yahoo! Mail Development Platform.}
15
15
  s.email = %q{progressions@gmail.com}
@@ -26,68 +26,11 @@ Gem::Specification.new do |s|
26
26
  "Rakefile",
27
27
  "VERSION",
28
28
  "bin/ymdp",
29
- "lib/new_application/.base",
30
- "lib/new_application/Gemfile",
31
- "lib/new_application/Rakefile",
32
- "lib/new_application/app/.gitignore",
33
- "lib/new_application/app/assets/images/lightbox/lightbox_bg.png",
34
- "lib/new_application/app/assets/javascripts/OpenMailIntl.js",
35
- "lib/new_application/app/assets/javascripts/controls.js",
36
- "lib/new_application/app/assets/javascripts/date.js",
37
- "lib/new_application/app/assets/javascripts/dragdrop.js",
38
- "lib/new_application/app/assets/javascripts/effects.js",
39
- "lib/new_application/app/assets/javascripts/lowpro.js",
40
- "lib/new_application/app/assets/javascripts/prototype.js",
41
- "lib/new_application/app/assets/javascripts/scriptaculous.js",
42
- "lib/new_application/app/assets/yrb/en-US/application_en-US.pres",
43
- "lib/new_application/app/helpers/application_helper.rb",
44
- "lib/new_application/app/javascripts/application.js",
45
- "lib/new_application/app/javascripts/debug.js",
46
- "lib/new_application/app/javascripts/flash.js",
47
- "lib/new_application/app/javascripts/header.js",
48
- "lib/new_application/app/javascripts/help.js",
49
- "lib/new_application/app/javascripts/i18n.js",
50
- "lib/new_application/app/javascripts/launcher.js",
51
- "lib/new_application/app/javascripts/logger.js",
52
- "lib/new_application/app/javascripts/tag_helper.js",
53
- "lib/new_application/app/stylesheets/application.css",
54
- "lib/new_application/app/stylesheets/ie.css",
55
- "lib/new_application/app/stylesheets/ie6.css",
56
- "lib/new_application/app/stylesheets/ie7.css",
57
- "lib/new_application/app/stylesheets/ie8.css",
58
- "lib/new_application/app/stylesheets/lightbox.css",
59
- "lib/new_application/app/stylesheets/non_ie.css",
60
- "lib/new_application/app/views/layouts/application.html.haml",
61
- "lib/new_application/app/views/shared/_error.html.haml",
62
- "lib/new_application/app/views/shared/_flash.html.haml",
63
- "lib/new_application/app/views/shared/_javascripts.html.haml",
64
- "lib/new_application/app/views/shared/_loading.html.haml",
65
- "lib/new_application/app/views/shared/_stylesheets.html.haml",
66
- "lib/new_application/config/categories.yml",
67
- "lib/new_application/config/config.yml.example",
68
- "lib/new_application/config/constants.rb",
69
- "lib/new_application/config/servers.yml.example",
70
- "lib/new_application/lib/init.rb",
71
- "lib/new_application/lib/tasks/environment.rake",
72
- "lib/new_application/lib/tasks/keys.rake",
73
- "lib/new_application/lib/tasks/setup.rake",
74
- "lib/new_application/lib/tasks/ymdp.rake",
75
- "lib/new_application/script/build",
76
- "lib/new_application/script/config",
77
- "lib/new_application/script/destroy",
78
- "lib/new_application/script/generate",
79
- "lib/new_application/script/gitrm",
80
- "lib/new_application/script/growl",
81
- "lib/new_application/script/images",
82
- "lib/new_application/script/jslint.js",
83
- "lib/new_application/script/langs",
84
- "lib/new_application/script/translate",
85
- "lib/new_application/script/ymdt",
86
- "lib/new_application/script/ymdt.old",
87
- "lib/new_application/script/yuicompressor-2.4.2.jar",
88
- "lib/new_application/ymdp",
89
29
  "lib/ymdp.rb",
30
+ "lib/ymdp/application.rb",
31
+ "lib/ymdp/application_view.rb",
90
32
  "lib/ymdp/asset_tag_helper.rb",
33
+ "lib/ymdp/base.rb",
91
34
  "lib/ymdp/commands/build.rb",
92
35
  "lib/ymdp/commands/generate.rb",
93
36
  "lib/ymdp/compiler/base.rb",
@@ -104,7 +47,6 @@ Gem::Specification.new do |s|
104
47
  "lib/ymdp/helpers.rb",
105
48
  "lib/ymdp/processor/compressor.rb",
106
49
  "lib/ymdp/processor/form_post.rb",
107
- "lib/ymdp/processor/processor.rb",
108
50
  "lib/ymdp/processor/validator.rb",
109
51
  "lib/ymdp/processor/w3c.rb",
110
52
  "lib/ymdp/support/blank.rb",
@@ -113,7 +55,8 @@ Gem::Specification.new do |s|
113
55
  "lib/ymdp/tasks/keys.rake",
114
56
  "lib/ymdp/tasks/ymdp.rake",
115
57
  "lib/ymdp/translator/base.rb",
116
- "lib/ymdp/ymdp.rb",
58
+ "spec/application_spec.rb",
59
+ "spec/application_view_spec.rb",
117
60
  "spec/compiler_spec.rb",
118
61
  "spec/compiler_template_spec.rb",
119
62
  "spec/configuration_spec.rb",
@@ -179,12 +122,15 @@ Gem::Specification.new do |s|
179
122
  "spec/data/script/ymdt",
180
123
  "spec/data/script/ymdt.old",
181
124
  "spec/data/script/yuicompressor-2.4.2.jar",
125
+ "spec/default_settings.rb",
182
126
  "spec/domains_spec.rb",
183
127
  "spec/spec.opts",
184
128
  "spec/spec_helper.rb",
185
129
  "spec/stubs.rb",
186
130
  "spec/translator_spec.rb",
131
+ "spec/ymdp_base_spec.rb",
187
132
  "spec/ymdp_spec.rb",
133
+ "test.rb",
188
134
  "ymdp.gemspec"
189
135
  ]
190
136
  s.homepage = %q{http://github.com/progressions/ymdp}
@@ -193,16 +139,20 @@ Gem::Specification.new do |s|
193
139
  s.rubygems_version = %q{1.3.5}
194
140
  s.summary = %q{Framework for developing applications in the Yahoo! Mail Development Platform}
195
141
  s.test_files = [
196
- "spec/compiler_spec.rb",
142
+ "spec/application_spec.rb",
143
+ "spec/application_view_spec.rb",
144
+ "spec/compiler_spec.rb",
197
145
  "spec/compiler_template_spec.rb",
198
146
  "spec/configuration_spec.rb",
199
147
  "spec/data/app/helpers/application_helper.rb",
200
148
  "spec/data/config/constants.rb",
201
149
  "spec/data/lib/init.rb",
150
+ "spec/default_settings.rb",
202
151
  "spec/domains_spec.rb",
203
152
  "spec/spec_helper.rb",
204
153
  "spec/stubs.rb",
205
154
  "spec/translator_spec.rb",
155
+ "spec/ymdp_base_spec.rb",
206
156
  "spec/ymdp_spec.rb"
207
157
  ]
208
158