ymdp 0.1.1 → 0.1.3

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.
@@ -3,7 +3,6 @@ require 'support/file'
3
3
  module YMDP
4
4
  module Compressor
5
5
  class Base
6
- extend YMDP::Config
7
6
  extend YMDP::FileSupport
8
7
 
9
8
  def self.compress(path, options={})
@@ -16,10 +15,10 @@ module YMDP
16
15
  $stdout.print " #{compressed_display_path} compressing . . . "
17
16
  compressed = ''
18
17
 
19
- if !obfuscate?
18
+ if options.delete("obfuscate")
20
19
  options["nomunge"] = ""
21
20
  end
22
- if verbose?
21
+ if options.delete("verbose")
23
22
  options["verbose"] = ""
24
23
  end
25
24
  options["charset"] = "utf-8"
@@ -64,17 +63,13 @@ module YMDP
64
63
 
65
64
  class Stylesheet < Base
66
65
  def self.compress(path)
67
- if compress_css?
68
- super(path, "type" => "css")
69
- end
66
+ super(path, "type" => "css")
70
67
  end
71
68
  end
72
69
 
73
70
  class JavaScript < Base
74
71
  def self.compress(filename)
75
- if compress_embedded_js?
76
- super(filename, "type" => "js")
77
- end
72
+ super(filename, "type" => "js")
78
73
  end
79
74
  end
80
75
  end
@@ -3,7 +3,7 @@ require 'support/file'
3
3
  module YMDP
4
4
  module Validator
5
5
  class Base
6
- extend YMDP::Config
6
+ # extend YMDP::Config
7
7
  extend YMDP::FileSupport
8
8
  end
9
9
 
@@ -35,14 +35,8 @@ module YMDP
35
35
  end
36
36
 
37
37
  class JavaScript < Base
38
- def self.validate?
39
- validate_embedded_js?
40
- end
41
-
42
38
  def self.validate(filename)
43
- if validate?
44
- validate_javascript(filename)
45
- end
39
+ validate_javascript(filename)
46
40
  end
47
41
 
48
42
  def self.use_jslint_settings?
@@ -108,10 +102,6 @@ JSLINT
108
102
  end
109
103
 
110
104
  class JSON < JavaScript
111
- def self.validate?
112
- validate_json_assets?
113
- end
114
-
115
105
  def pre_process(output)
116
106
  output
117
107
  end
@@ -0,0 +1,23 @@
1
+ require 'grit'
2
+ include Grit
3
+
4
+ class GitHelper
5
+ def get_hash(branch)
6
+ branch = get_current_branch || "master"
7
+ repo = Repo.new("#{BASE_PATH}/.")
8
+ repo.commits(branch).first.id
9
+ end
10
+
11
+ def get_current_branch
12
+ result = `git status`
13
+ if result =~ /# On branch (.*)/
14
+ return $1
15
+ end
16
+ end
17
+
18
+ def do_commit(message)
19
+ repo = Repo.new(".")
20
+ repo.add(".")
21
+ puts `git commit -am "#{message}"`
22
+ end
23
+ end
@@ -1,6 +1,6 @@
1
- require 'deploy/ymdt'
1
+ require 'ymdt'
2
2
 
3
- include YMDP::Config
3
+ # include YMDP::Config
4
4
 
5
5
  begin
6
6
  CATEGORIES = YAML.load_file("./config/categories.yml")["categories"] unless defined?(CATEGORIES)
@@ -19,7 +19,7 @@ rescue
19
19
  end
20
20
 
21
21
  def create_from_servers
22
- SERVERS.keys.each do |key|
22
+ SERVERS.each do |key, values|
23
23
  yield key.to_sym, "set_#{key}".to_sym
24
24
  end
25
25
  end
@@ -68,10 +68,10 @@ set_application_variables(@application)
68
68
 
69
69
  @sync = ENV["sync"]
70
70
 
71
- @validate_html = (ENV["validate_html"] || CONFIG["validate_html"].to_s) != "false"
72
- @validate_js_assets = (ENV["validate_js_assets"] || CONFIG["validate_js_assets"].to_s) != "false"
73
- @validate_json_assets = (ENV["validate_json_assets"] || CONFIG["validate_json_assets"].to_s) != "false"
74
- @validate_embedded_js = (ENV["validate_embedded_js"] || CONFIG["validate_embedded_js_deploy"].to_s) != "false"
71
+ # @validate_html = (ENV["validate_html"] || CONFIG["validate_html"].to_s) != "false"
72
+ # @validate_js_assets = (ENV["validate_js_assets"] || CONFIG["validate_js_assets"].to_s) != "false"
73
+ # @validate_json_assets = (ENV["validate_json_assets"] || CONFIG["validate_json_assets"].to_s) != "false"
74
+ # @validate_embedded_js = (ENV["validate_embedded_js"] || CONFIG["validate_embedded_js_deploy"].to_s) != "false"
75
75
 
76
76
  create_from_servers do |key, set_task|
77
77
  task set_task do
@@ -475,7 +475,7 @@ end
475
475
  # END OF RAKE TASKS
476
476
 
477
477
  def time(message="")
478
- Timer.new(:title => "YMDP", :growl => growl?).time(message) do
478
+ Timer.new(:title => "YMDP", :growl => CONFIG.growl?).time(message) do
479
479
  yield
480
480
  end
481
481
  end
@@ -504,10 +504,10 @@ end
504
504
  def deploy(application, path)
505
505
  puts "\nDeploying #{application}: #{path}"
506
506
 
507
- Rake::Task["validate:html"].invoke if validate_html?
508
- Rake::Task["validate:embedded_js"].invoke if validate_embedded_js?
509
- Rake::Task["validate:#{application}:javascripts"].invoke if validate_js_assets?
510
- Rake::Task["validate:#{application}:json"].invoke if validate_json_assets?
507
+ Rake::Task["validate:html"].invoke if CONFIG.validate_html?
508
+ Rake::Task["validate:embedded_js"].invoke if CONFIG.validate_embedded_js?
509
+ Rake::Task["validate:#{application}:javascripts"].invoke if CONFIG.validate_js_assets?
510
+ Rake::Task["validate:#{application}:json"].invoke if CONFIG.validate_json_assets?
511
511
 
512
512
  ymdt.put(:application => application, :path => path)
513
513
  end
@@ -515,10 +515,10 @@ end
515
515
  def deploy_path(application, path)
516
516
  puts "\nDeploying #{application}: #{path}"
517
517
 
518
- Rake::Task["validate:html"].invoke if validate_html?
519
- Rake::Task["validate:embedded_js"].invoke if validate_embedded_js?
520
- Rake::Task["validate:#{application}:javascripts"].invoke if validate_js_assets?
521
- Rake::Task["validate:#{application}:json"].invoke if validate_json_assets?
518
+ Rake::Task["validate:html"].invoke if CONFIG.validate_html?
519
+ Rake::Task["validate:embedded_js"].invoke if CONFIG.validate_embedded_js?
520
+ Rake::Task["validate:#{application}:javascripts"].invoke if CONFIG.validate_js_assets?
521
+ Rake::Task["validate:#{application}:json"].invoke if CONFIG.validate_json_assets?
522
522
 
523
523
  dir = "./servers/#{application}"
524
524
 
@@ -1,7 +1,7 @@
1
1
  require 'rubygems'
2
2
  require 'rtranslate'
3
3
  require 'timer'
4
- require 'compiler/template_compiler'
4
+ require 'compiler/template'
5
5
 
6
6
  module YMDP
7
7
  module Yaml
data/lib/ymdp/ymdp.rb CHANGED
@@ -1,7 +1,5 @@
1
- require 'config'
2
1
  require 'processor/compressor'
3
2
  require 'processor/validator'
4
- require 'support/file'
5
3
 
6
4
  class Application
7
5
  def self.current_view?(view)
@@ -19,7 +17,7 @@ end
19
17
 
20
18
  module YMDP
21
19
  module Base
22
- include YMDP::Config
20
+ # include YMDP::Config
23
21
  include YMDP::FileSupport
24
22
  include YMDP::Compressor
25
23
 
@@ -119,7 +117,7 @@ module YMDP
119
117
  output = ''
120
118
  if File.exists?(path)
121
119
  tmp_filename = save_processed_template(path)
122
- if compress_css?
120
+ if CONFIG.compress_css?
123
121
  output = YMDP::Compressor::Stylesheet.compress(tmp_filename)
124
122
  else
125
123
  File.open(path) do |f|
data/lib/ymdp.rb CHANGED
@@ -7,6 +7,7 @@ $LOAD_PATH.unshift dir unless $LOAD_PATH.include?(dir)
7
7
  # load application
8
8
  #
9
9
 
10
+ require 'rubygems'
10
11
  require 'erb'
11
12
  require 'set'
12
13
 
@@ -17,8 +18,8 @@ Dir["#{dir}/*.rb"].each do |path|
17
18
  require File.expand_path(path)
18
19
  end
19
20
 
20
- # load support
21
- #
22
- Dir["#{dir}/support/*.rb"].each do |path|
23
- require File.expand_path(path)
21
+ ["support", "configuration"].each do |directory|
22
+ Dir["#{dir}/#{directory}/*.rb"].each do |path|
23
+ require File.expand_path(path)
24
+ end
24
25
  end
@@ -0,0 +1,39 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
+
3
+ describe "Configuration" do
4
+ describe "Config" do
5
+ before(:each) do
6
+ @config_yml = {
7
+ "config" => {
8
+ "username" => "captmal",
9
+ "password" => "iluvinara",
10
+ "growl" => true
11
+ }
12
+ }
13
+ YAML.stub!(:load_file).and_return(@config_yml)
14
+ @config = YMDP::Configuration::Config.new
15
+ end
16
+
17
+ it "should return username" do
18
+ @config.username.should == @config_yml["config"]["username"]
19
+ end
20
+
21
+ it "should return password" do
22
+ @config.password.should == @config_yml["config"]["password"]
23
+ end
24
+
25
+ it "should return growl" do
26
+ @config.growl?.should == @config_yml["config"]["growl"]
27
+ end
28
+
29
+ describe "[]" do
30
+ it "should return username" do
31
+ @config["username"].should == @config_yml["config"]["username"]
32
+ end
33
+
34
+ it "should return password" do
35
+ @config["password"].should == @config_yml["config"]["password"]
36
+ end
37
+ end
38
+ end
39
+ end
@@ -2,6 +2,7 @@ config:
2
2
  username: user
3
3
  password: password
4
4
  default_server: staging
5
+ host: myserver.com
5
6
  production_server: my
6
7
  doctype: HTML 4.0 Transitional
7
8
  growl: false
@@ -40,13 +40,15 @@ servers = "#{YMDP_ROOT}/config/servers.yml"
40
40
  config = "#{YMDP_ROOT}/config/config.yml"
41
41
 
42
42
  if File.exists?(servers)
43
- SERVERS = YAML.load_file("#{YMDP_ROOT}/config/servers.yml") unless defined?(SERVERS)
43
+ # SERVERS = YAML.load_file("#{YMDP_ROOT}/config/servers.yml") unless defined?(SERVERS)
44
+ SERVERS = YMDP::Configuration::Servers.new
44
45
  else
45
46
  file_not_found(servers)
46
47
  end
47
48
 
48
49
  if File.exists?(config)
49
- CONFIG = YAML.load_file("#{YMDP_ROOT}/config/config.yml")["config"] unless defined?(CONFIG)
50
+ # CONFIG = YAML.load_file("#{YMDP_ROOT}/config/config.yml")["config"] unless defined?(CONFIG)
51
+ CONFIG = YMDP::Configuration::Config.new
50
52
  else
51
53
  file_not_found(config)
52
54
  end
data/spec/spec_helper.rb CHANGED
@@ -1,11 +1,14 @@
1
1
  $LOAD_PATH.unshift(File.dirname(__FILE__))
2
2
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
3
+
4
+ BASE_PATH = File.dirname(__FILE__) + "/data"
5
+ CONFIG_PATH = "#{BASE_PATH}/config"
6
+ SERVERS_PATH = "#{BASE_PATH}/servers"
7
+ TMP_PATH = "#{BASE_PATH}/tmp"
8
+
3
9
  require 'ymdp'
4
10
  require 'spec'
5
11
  require 'spec/autorun'
6
12
 
7
13
  Spec::Runner.configure do |config|
8
- BASE_PATH = "./"
9
- SERVERS_PATH = "#{BASE_PATH}/servers"
10
- TMP_PATH = "#{BASE_PATH}/tmp"
11
14
  end
@@ -3,7 +3,4 @@ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
3
3
  require 'translator/base'
4
4
 
5
5
  describe "Translator" do
6
- it "should set base_path" do
7
- BASE_PATH.should == "./"
8
- end
9
6
  end
data/ymdp.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{ymdp}
8
- s.version = "0.1.1"
8
+ s.version = "0.1.3"
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-13}
12
+ s.date = %q{2010-01-14}
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}
@@ -89,9 +89,10 @@ Gem::Specification.new do |s|
89
89
  "lib/ymdp.rb",
90
90
  "lib/ymdp/asset_tag_helper.rb",
91
91
  "lib/ymdp/commands/generate.rb",
92
- "lib/ymdp/compiler/template_compiler.rb",
93
- "lib/ymdp/config.rb",
94
- "lib/ymdp/deploy/ymdt.rb",
92
+ "lib/ymdp/compiler/compiler.rb",
93
+ "lib/ymdp/compiler/template.rb",
94
+ "lib/ymdp/configuration/config.rb",
95
+ "lib/ymdp/configuration/constants.rb",
95
96
  "lib/ymdp/generator/base.rb",
96
97
  "lib/ymdp/generator/templates/javascript.js",
97
98
  "lib/ymdp/generator/templates/stylesheet.css",
@@ -105,13 +106,14 @@ Gem::Specification.new do |s|
105
106
  "lib/ymdp/support/blank.rb",
106
107
  "lib/ymdp/support/file.rb",
107
108
  "lib/ymdp/support/form_post.rb",
108
- "lib/ymdp/support/string_masker.rb",
109
+ "lib/ymdp/support/git_helper.rb",
109
110
  "lib/ymdp/support/w3c.rb",
110
111
  "lib/ymdp/tag_helper.rb",
111
112
  "lib/ymdp/tasks/keys.rake",
112
113
  "lib/ymdp/tasks/ymdp.rake",
113
114
  "lib/ymdp/translator/base.rb",
114
115
  "lib/ymdp/ymdp.rb",
116
+ "spec/configuration_spec.rb",
115
117
  "spec/data/Rakefile",
116
118
  "spec/data/VERSION",
117
119
  "spec/data/app/.gitignore",
@@ -178,7 +180,6 @@ Gem::Specification.new do |s|
178
180
  "spec/spec_helper.rb",
179
181
  "spec/translator_spec.rb",
180
182
  "spec/ymdp_spec.rb",
181
- "spec/ymdt_spec.rb",
182
183
  "ymdp.gemspec"
183
184
  ]
184
185
  s.homepage = %q{http://github.com/progressions/ymdp}
@@ -187,13 +188,13 @@ Gem::Specification.new do |s|
187
188
  s.rubygems_version = %q{1.3.5}
188
189
  s.summary = %q{Framework for developing applications in the Yahoo! Mail Development Platform}
189
190
  s.test_files = [
190
- "spec/data/app/helpers/application_helper.rb",
191
+ "spec/configuration_spec.rb",
192
+ "spec/data/app/helpers/application_helper.rb",
191
193
  "spec/data/config/constants.rb",
192
194
  "spec/data/lib/init.rb",
193
195
  "spec/spec_helper.rb",
194
196
  "spec/translator_spec.rb",
195
- "spec/ymdp_spec.rb",
196
- "spec/ymdt_spec.rb"
197
+ "spec/ymdp_spec.rb"
197
198
  ]
198
199
 
199
200
  if s.respond_to? :specification_version then
@@ -211,6 +212,7 @@ Gem::Specification.new do |s|
211
212
  s.add_development_dependency(%q<progressions-g>, [">= 0"])
212
213
  s.add_development_dependency(%q<bundler>, [">= 0"])
213
214
  s.add_development_dependency(%q<timer>, [">= 0"])
215
+ s.add_development_dependency(%q<serenity>, [">= 0"])
214
216
  else
215
217
  s.add_dependency(%q<haml>, [">= 0"])
216
218
  s.add_dependency(%q<json>, [">= 0"])
@@ -222,6 +224,7 @@ Gem::Specification.new do |s|
222
224
  s.add_dependency(%q<progressions-g>, [">= 0"])
223
225
  s.add_dependency(%q<bundler>, [">= 0"])
224
226
  s.add_dependency(%q<timer>, [">= 0"])
227
+ s.add_dependency(%q<serenity>, [">= 0"])
225
228
  end
226
229
  else
227
230
  s.add_dependency(%q<haml>, [">= 0"])
@@ -234,6 +237,7 @@ Gem::Specification.new do |s|
234
237
  s.add_dependency(%q<progressions-g>, [">= 0"])
235
238
  s.add_dependency(%q<bundler>, [">= 0"])
236
239
  s.add_dependency(%q<timer>, [">= 0"])
240
+ s.add_dependency(%q<serenity>, [">= 0"])
237
241
  end
238
242
  end
239
243
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ymdp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeff Coleman
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-01-13 00:00:00 -06:00
12
+ date: 2010-01-14 00:00:00 -06:00
13
13
  default_executable: ymdp
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -112,6 +112,16 @@ dependencies:
112
112
  - !ruby/object:Gem::Version
113
113
  version: "0"
114
114
  version:
115
+ - !ruby/object:Gem::Dependency
116
+ name: serenity
117
+ type: :development
118
+ version_requirement:
119
+ version_requirements: !ruby/object:Gem::Requirement
120
+ requirements:
121
+ - - ">="
122
+ - !ruby/object:Gem::Version
123
+ version: "0"
124
+ version:
115
125
  description: Framework for developing applications in the Yahoo! Mail Development Platform.
116
126
  email: progressions@gmail.com
117
127
  executables:
@@ -192,9 +202,10 @@ files:
192
202
  - lib/ymdp.rb
193
203
  - lib/ymdp/asset_tag_helper.rb
194
204
  - lib/ymdp/commands/generate.rb
195
- - lib/ymdp/compiler/template_compiler.rb
196
- - lib/ymdp/config.rb
197
- - lib/ymdp/deploy/ymdt.rb
205
+ - lib/ymdp/compiler/compiler.rb
206
+ - lib/ymdp/compiler/template.rb
207
+ - lib/ymdp/configuration/config.rb
208
+ - lib/ymdp/configuration/constants.rb
198
209
  - lib/ymdp/generator/base.rb
199
210
  - lib/ymdp/generator/templates/javascript.js
200
211
  - lib/ymdp/generator/templates/stylesheet.css
@@ -208,13 +219,14 @@ files:
208
219
  - lib/ymdp/support/blank.rb
209
220
  - lib/ymdp/support/file.rb
210
221
  - lib/ymdp/support/form_post.rb
211
- - lib/ymdp/support/string_masker.rb
222
+ - lib/ymdp/support/git_helper.rb
212
223
  - lib/ymdp/support/w3c.rb
213
224
  - lib/ymdp/tag_helper.rb
214
225
  - lib/ymdp/tasks/keys.rake
215
226
  - lib/ymdp/tasks/ymdp.rake
216
227
  - lib/ymdp/translator/base.rb
217
228
  - lib/ymdp/ymdp.rb
229
+ - spec/configuration_spec.rb
218
230
  - spec/data/Rakefile
219
231
  - spec/data/VERSION
220
232
  - spec/data/app/.gitignore
@@ -281,7 +293,6 @@ files:
281
293
  - spec/spec_helper.rb
282
294
  - spec/translator_spec.rb
283
295
  - spec/ymdp_spec.rb
284
- - spec/ymdt_spec.rb
285
296
  - ymdp.gemspec
286
297
  has_rdoc: true
287
298
  homepage: http://github.com/progressions/ymdp
@@ -312,10 +323,10 @@ signing_key:
312
323
  specification_version: 3
313
324
  summary: Framework for developing applications in the Yahoo! Mail Development Platform
314
325
  test_files:
326
+ - spec/configuration_spec.rb
315
327
  - spec/data/app/helpers/application_helper.rb
316
328
  - spec/data/config/constants.rb
317
329
  - spec/data/lib/init.rb
318
330
  - spec/spec_helper.rb
319
331
  - spec/translator_spec.rb
320
332
  - spec/ymdp_spec.rb
321
- - spec/ymdt_spec.rb