spontaneous 0.2.0.alpha3 → 0.2.0.alpha4

Sign up to get free protection for your applications and to get access to all the features.
@@ -77,7 +77,7 @@ module Spontaneous
77
77
  prepare :browse
78
78
  require 'launchy'
79
79
  boot!
80
- ::Launchy::Browser.run("http://localhost:#{Site.config.port}/@spontaneous")
80
+ ::Launchy.open("http://localhost:#{Site.config.port}/@spontaneous")
81
81
  end
82
82
 
83
83
 
@@ -150,7 +150,7 @@ module Spontaneous
150
150
  prepare :browse
151
151
  require 'launchy'
152
152
  boot!
153
- ::Launchy::Browser.run("http://localhost:#{::Site.config.port}/@spontaneous")
153
+ ::Launchy.open("http://localhost:#{::Site.config.port}/@spontaneous")
154
154
  end
155
155
  end
156
156
  end
@@ -3,7 +3,6 @@
3
3
  require 'oj'
4
4
 
5
5
  Oj.default_options = {
6
- symbol_keys: true,
7
6
  mode: :compat
8
7
  } if defined?(Oj)
9
8
 
@@ -11,7 +10,7 @@ module Spontaneous
11
10
  module JSON
12
11
  module OjParser
13
12
  def parse(json_string)
14
- ::Oj.load(json_string)
13
+ ::Oj.load(json_string, symbol_keys: true)
15
14
  rescue
16
15
  nil
17
16
  end
@@ -12,6 +12,6 @@ require 'sequel/plugins/serialization'
12
12
  Sequel::Plugins::Serialization.register_format(
13
13
  :ojson,
14
14
  lambda { |v| Oj.dump(v) },
15
- lambda { |v| Oj.load(v) }
15
+ lambda { |v| Oj.load(v, symbol_keys: true) }
16
16
  )
17
17
 
@@ -4,7 +4,6 @@
4
4
 
5
5
  ## thanks again to the stirling work of the Padrino guys & gals.
6
6
  require 'rack'
7
- require 'launchy'
8
7
 
9
8
  module Spontaneous
10
9
 
@@ -41,7 +40,6 @@ module Spontaneous
41
40
  end
42
41
  trap(:INT, &term)
43
42
  trap(:TERM, &term)
44
- # ::Launchy::Browser.run("http://localhost:#{port}/@spontaneous") if Spontaneous.mode == :back
45
43
  end
46
44
  rescue RuntimeError => e
47
45
  if e.message =~ /no acceptor/
@@ -5,6 +5,9 @@ require 'tempfile'
5
5
 
6
6
  module Spontaneous::Storage
7
7
  class Cloud < Backend
8
+ # Thanks thoughtbot (via paperclip)
9
+ # http://rdoc.info/github/thoughtbot/paperclip/Paperclip/Storage/Fog
10
+ AWS_BUCKET_SUBDOMAIN_RESTRICTON_REGEX = /^(?:[a-z]|\d(?!\d{0,2}(?:\.\d{1,3}){3}$))(?:[a-z0-9]|\.(?![\.\-])|\-(?![\.])){1,61}[a-z0-9]$/
8
11
  # bucket_name = "media.kitmonsters.com"
9
12
  # connection = Fog::Storage.new({
10
13
  # :provider=>"AWS",
@@ -97,7 +100,23 @@ module Spontaneous::Storage
97
100
  if @public_host
98
101
  "#{@public_host}/#{join_path(path)}"
99
102
  else
100
- bucket.files.new(:key => join_path(path)).public_url
103
+ if @config[:provider] == "AWS"
104
+ public_url_aws(path)
105
+ else
106
+ bucket.files.new(:key => join_path(path)).public_url
107
+ end
108
+ end
109
+ end
110
+
111
+ # AWS Redirects to the bucketname.s3.amazonaws.com style of public URL
112
+ # if you use the s3.amazonaws.com/bucketname/ style so to avoid a lot of
113
+ # slow redirects when loading a page's media we use the fastest available
114
+ # version
115
+ def public_url_aws(path)
116
+ if bucket_name =~ AWS_BUCKET_SUBDOMAIN_RESTRICTON_REGEX
117
+ "https://#{bucket_name}.s3.amazonaws.com/#{join_path(path)}"
118
+ else
119
+ "https://s3.amazonaws.com/#{bucket_name}/#{join_path(path)}"
101
120
  end
102
121
  end
103
122
 
@@ -1,6 +1,6 @@
1
1
  # encoding: UTF-8
2
2
 
3
3
  module Spontaneous
4
- VERSION = "0.2.0.alpha3"
4
+ VERSION = "0.2.0.alpha4"
5
5
  GEM = false
6
6
  end
data/spontaneous.gemspec CHANGED
@@ -14,7 +14,7 @@ Gem::Specification.new do |s|
14
14
  ## If your rubyforge_project name is different, then edit it and comment out
15
15
  ## the sub! line in the Rakefile
16
16
  s.name = 'spontaneous'
17
- s.version = '0.2.0.alpha3'
17
+ s.version = '0.2.0.alpha4'
18
18
  s.date = '2012-10-15'
19
19
  s.rubyforge_project = 'spontaneous'
20
20
 
@@ -54,10 +54,10 @@ Gem::Specification.new do |s|
54
54
  s.add_dependency('coffee-script', ["~> 2.2.0"])
55
55
  s.add_dependency('cutaneous', ["~> 0.1.3"])
56
56
  s.add_dependency('erubis', ["~> 2.6"])
57
- s.add_dependency('fog', ["~> 1.1.1"])
57
+ s.add_dependency('fog', ["~> 1.6.0"])
58
58
  s.add_dependency('foreman', ["~> 0.22.0"])
59
- s.add_dependency('kramdown', ["~> 0.13.3"])
60
- s.add_dependency('launchy', ["~> 0.4.0"])
59
+ s.add_dependency('kramdown', ["~> 0.14.0"])
60
+ s.add_dependency('launchy', ["~> 2.1.2"])
61
61
  s.add_dependency('mini_magick', ["~> 3.3"])
62
62
  s.add_dependency('nokogiri', ["~> 1.5.0"])
63
63
  s.add_dependency('public_suffix', ["~> 1.0"])
@@ -71,19 +71,19 @@ Gem::Specification.new do |s|
71
71
  s.add_dependency('simultaneous', ["~> 0.4.1"])
72
72
  s.add_dependency('sinatra', ["= 1.3.2"])
73
73
  s.add_dependency('sinatra-contrib', ["~> 1.3.1"])
74
- s.add_dependency('sprockets', ["~> 2.4.3"])
74
+ s.add_dependency('sprockets', ["~> 2.7.0"])
75
75
  s.add_dependency('stringex', ["= 1.3"])
76
76
  s.add_dependency('therubyracer', ['~> 0.9.10'])
77
77
  s.add_dependency('thin', ["~> 1.2"])
78
78
  s.add_dependency('thor', ["~> 0.14.6"])
79
- s.add_dependency('uglifier', ["~> 1.2.4"])
79
+ s.add_dependency('uglifier', ["~> 1.3.0"])
80
80
  s.add_dependency('oj', ["~> 1.4"])
81
81
 
82
82
  ## List your development dependencies here. Development dependencies are
83
83
  ## those that are only needed during development
84
84
  s.add_development_dependency('minitest', ["~> 2.1.0"])
85
85
  s.add_development_dependency('mysql2', ["~> 0.3.11"])
86
- s.add_development_dependency('pg', ["~> 0.13.2"])
86
+ s.add_development_dependency('pg', ["~> 0.14.1"])
87
87
  s.add_development_dependency('jeweler', ["~> 1.5"])
88
88
  s.add_development_dependency('jnunemaker-matchy', ["~> 0.4"])
89
89
  s.add_development_dependency('shoulda', ["~> 2.11.3"])
@@ -42,9 +42,9 @@ class AssetBundler < MiniTest::Spec
42
42
  compiled_js_path = Dir["#{@site.root}/public/@spontaneous/assets/spontaneous*.js"].first
43
43
  js = File.read(compiled_js_path)
44
44
  # hard to test because we don't know exactly what the uglifier is going to do
45
- js.should =~ /var a;a="yes"/
46
- js.should =~ /var a;a="#{Date.today.day}"/
47
- js.should =~ /var a;a="subdir\/#{Date.today.day}"/
45
+ js.should =~ /var (\w);\1="yes"/
46
+ js.should =~ /var (\w);\1="#{Date.today.day}"/
47
+ js.should =~ /var (\w);\1="subdir\/#{Date.today.day}"/
48
48
  end
49
49
 
50
50
  should "compile CSS into any destination directory" do
@@ -118,7 +118,7 @@ class AssetBundler < MiniTest::Spec
118
118
  end
119
119
  end
120
120
 
121
- context "Production mode editing app xxxx" do
121
+ context "Production mode editing app" do
122
122
  setup do
123
123
  @compiler = Spontaneous::Asset::AppCompiler.new(fixture_dir, @site.root)
124
124
  @compiler.compile
@@ -108,18 +108,7 @@ class AssetTest < MiniTest::Spec
108
108
  context "CoffeeScript assets" do
109
109
  should "be compiled & compressed in live environment" do
110
110
  files = [@fixture_root / "public1/js/m.js", @fixture_root / "public2/js/n.js"]
111
- Shine.expects(:compress_string).with((<<-COMPILED), :js, {}).once.returns("var A;\nvar B;\n")
112
- (function() {
113
- var square;
114
-
115
- square = function(x) {
116
- return x * x;
117
- };
118
-
119
- if (typeof elvis !== "undefined" && elvis !== null) alert("I knew it!");
120
-
121
- }).call(this);
122
- COMPILED
111
+ Shine.expects(:compress_string).with(regexp_matches(/square = function/), :js, {}).once.returns("var A;\nvar B;\n")
123
112
  context = new_context
124
113
  result = context.scripts("/js/m", "/js/n")
125
114
  result.should =~ /src="\/rev\/5dde6b3e04ce364ef23f51048006e5dd7e6f62ad\.js"/
@@ -129,20 +118,7 @@ class AssetTest < MiniTest::Spec
129
118
  end
130
119
 
131
120
  should "be correctly compiled when mixed with plain js" do
132
- Shine.expects(:compress_string).with((<<-COMPILED), :js, {}).once.returns("var A;\nvar B;\n")
133
- var A;
134
- (function() {
135
- var square;
136
-
137
- square = function(x) {
138
- return x * x;
139
- };
140
-
141
- if (typeof elvis !== "undefined" && elvis !== null) alert("I knew it!");
142
-
143
- }).call(this);
144
- var B;
145
- COMPILED
121
+ Shine.expects(:compress_string).with(regexp_matches(/square = function/), :js, {}).once.returns("var A;\nvar B;\n")
146
122
  context = new_context
147
123
  result = context.scripts("/js/a", "/js/m", "/js/n", "/js/b")
148
124
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spontaneous
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0.alpha3
4
+ version: 0.2.0.alpha4
5
5
  prerelease: 6
6
6
  platform: ruby
7
7
  authors:
@@ -114,7 +114,7 @@ dependencies:
114
114
  requirements:
115
115
  - - ~>
116
116
  - !ruby/object:Gem::Version
117
- version: 1.1.1
117
+ version: 1.6.0
118
118
  type: :runtime
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
@@ -122,7 +122,7 @@ dependencies:
122
122
  requirements:
123
123
  - - ~>
124
124
  - !ruby/object:Gem::Version
125
- version: 1.1.1
125
+ version: 1.6.0
126
126
  - !ruby/object:Gem::Dependency
127
127
  name: foreman
128
128
  requirement: !ruby/object:Gem::Requirement
@@ -146,7 +146,7 @@ dependencies:
146
146
  requirements:
147
147
  - - ~>
148
148
  - !ruby/object:Gem::Version
149
- version: 0.13.3
149
+ version: 0.14.0
150
150
  type: :runtime
151
151
  prerelease: false
152
152
  version_requirements: !ruby/object:Gem::Requirement
@@ -154,7 +154,7 @@ dependencies:
154
154
  requirements:
155
155
  - - ~>
156
156
  - !ruby/object:Gem::Version
157
- version: 0.13.3
157
+ version: 0.14.0
158
158
  - !ruby/object:Gem::Dependency
159
159
  name: launchy
160
160
  requirement: !ruby/object:Gem::Requirement
@@ -162,7 +162,7 @@ dependencies:
162
162
  requirements:
163
163
  - - ~>
164
164
  - !ruby/object:Gem::Version
165
- version: 0.4.0
165
+ version: 2.1.2
166
166
  type: :runtime
167
167
  prerelease: false
168
168
  version_requirements: !ruby/object:Gem::Requirement
@@ -170,7 +170,7 @@ dependencies:
170
170
  requirements:
171
171
  - - ~>
172
172
  - !ruby/object:Gem::Version
173
- version: 0.4.0
173
+ version: 2.1.2
174
174
  - !ruby/object:Gem::Dependency
175
175
  name: mini_magick
176
176
  requirement: !ruby/object:Gem::Requirement
@@ -386,7 +386,7 @@ dependencies:
386
386
  requirements:
387
387
  - - ~>
388
388
  - !ruby/object:Gem::Version
389
- version: 2.4.3
389
+ version: 2.7.0
390
390
  type: :runtime
391
391
  prerelease: false
392
392
  version_requirements: !ruby/object:Gem::Requirement
@@ -394,7 +394,7 @@ dependencies:
394
394
  requirements:
395
395
  - - ~>
396
396
  - !ruby/object:Gem::Version
397
- version: 2.4.3
397
+ version: 2.7.0
398
398
  - !ruby/object:Gem::Dependency
399
399
  name: stringex
400
400
  requirement: !ruby/object:Gem::Requirement
@@ -466,7 +466,7 @@ dependencies:
466
466
  requirements:
467
467
  - - ~>
468
468
  - !ruby/object:Gem::Version
469
- version: 1.2.4
469
+ version: 1.3.0
470
470
  type: :runtime
471
471
  prerelease: false
472
472
  version_requirements: !ruby/object:Gem::Requirement
@@ -474,7 +474,7 @@ dependencies:
474
474
  requirements:
475
475
  - - ~>
476
476
  - !ruby/object:Gem::Version
477
- version: 1.2.4
477
+ version: 1.3.0
478
478
  - !ruby/object:Gem::Dependency
479
479
  name: oj
480
480
  requirement: !ruby/object:Gem::Requirement
@@ -530,7 +530,7 @@ dependencies:
530
530
  requirements:
531
531
  - - ~>
532
532
  - !ruby/object:Gem::Version
533
- version: 0.13.2
533
+ version: 0.14.1
534
534
  type: :development
535
535
  prerelease: false
536
536
  version_requirements: !ruby/object:Gem::Requirement
@@ -538,7 +538,7 @@ dependencies:
538
538
  requirements:
539
539
  - - ~>
540
540
  - !ruby/object:Gem::Version
541
- version: 0.13.2
541
+ version: 0.14.1
542
542
  - !ruby/object:Gem::Dependency
543
543
  name: jeweler
544
544
  requirement: !ruby/object:Gem::Requirement