siterest 0.1.0.pre4 → 0.1.0.pre5

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.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0.pre4
1
+ 0.1.0.pre5
@@ -3,7 +3,7 @@ require 'mime/types'
3
3
  require 'stringio'
4
4
  require 'upfile'
5
5
  require 'encoded_attachment/lib/encoded_attachment'
6
-
6
+ require 'cgi'
7
7
 
8
8
  module Siterest
9
9
  class Asset < ActiveResource::Base
@@ -13,7 +13,7 @@ module Siterest
13
13
  has_encoded_attachment :data
14
14
 
15
15
  def url
16
- "http://assets.siterest.com/#{self.path}"
16
+ "http://assets.siterest.com/#{CGI::escape(self.path)}"
17
17
  end
18
18
 
19
19
  def binary?
@@ -29,8 +29,7 @@ module Siterest
29
29
 
30
30
  def pull_assets(site)
31
31
  reset_path(
32
- [assets_path + 'images', assets_path + 'javascripts', assets_path + 'stylesheets']
33
- )
32
+ [assets_path + 'images', assets_path + 'javascripts', assets_path + 'stylesheets', assets_path + 'assets'] )
34
33
 
35
34
  results = []
36
35
  page = 1
@@ -85,46 +84,20 @@ module Siterest
85
84
  require 'siterest/asset'
86
85
 
87
86
  Dir.glob("assets/*/*").each do |filename|
88
- file = open(filename)
89
- # puts file
90
- #
91
- # io = StringIO.new(open(file).read)
92
- # io.original_filename = File.basename(file)
93
- #
87
+
94
88
  existing = Asset.first(:params => {
95
89
  :subdomain => site, :search => {:data_file_name_eq => File.basename(filename)}
96
90
  })
97
91
 
98
92
  if existing
99
- existing.data = file
93
+ existing.data = open(filename)
100
94
  existing.save
101
95
  else
102
- Asset.create(:data => file, :subdomain => site, :layout => true)
96
+ Asset.create(:data => open(filename), :subdomain => site, :layout => true)
103
97
  end
104
98
 
105
99
  puts "#{existing ? 'Updated' : 'Created'} #{filename}"
106
100
  end
107
- #
108
- # asset = Asset.new(:subdomain => site)
109
- # new_path = asset.send(:new_element_path).to_s
110
- # collection_path = asset.send(:collection_path).to_s
111
- #
112
- # puts Siterest.url.to_s
113
- #
114
- #
115
- # resource = RestClient::Resource.new(Siterest.url.gsub('//', "//#{Siterest.token}:x@"))
116
- #
117
- # resource[collection_path].post :content_type => 'application/xml', :asset => {:data => open('assets/images/bg.png'), :layout => true}
118
-
119
- # RestClient.post 'http://localhost:3000/foo', fields_hash.merge(:file => File.new('/path/to/file'))
120
-
121
- #
122
- # Dir.glob("site/assets/*/*").each do |file|
123
- # Asset.create(
124
- # :data => open(file)
125
- # :subdomain => site
126
- # )
127
- # end
128
101
  end
129
102
 
130
103
  def request_path
data/siterest.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{siterest}
8
- s.version = "0.1.0.pre4"
8
+ s.version = "0.1.0.pre5"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Taylor luk"]
12
- s.date = %q{2010-08-06}
12
+ s.date = %q{2010-08-09}
13
13
  s.default_executable = %q{siterest}
14
14
  s.description = %q{Simple content service}
15
15
  s.email = %q{taylor.luk@idealian.net}
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: siterest
3
3
  version: !ruby/object:Gem::Version
4
- hash: -1876988169
4
+ hash: -1876988172
5
5
  prerelease: true
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
9
  - 0
10
- - pre4
11
- version: 0.1.0.pre4
10
+ - pre5
11
+ version: 0.1.0.pre5
12
12
  platform: ruby
13
13
  authors:
14
14
  - Taylor luk
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2010-08-06 00:00:00 +10:00
19
+ date: 2010-08-09 00:00:00 +10:00
20
20
  default_executable: siterest
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency