siterest 0.1.0.pre1

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 (49) hide show
  1. data/Gemfile +9 -0
  2. data/Gemfile.lock +38 -0
  3. data/Rakefile +23 -0
  4. data/VERSION +1 -0
  5. data/bin/siterest +10 -0
  6. data/config.ru +6 -0
  7. data/lib/encoded_attachment/.gitignore +7 -0
  8. data/lib/encoded_attachment/Gemfile +11 -0
  9. data/lib/encoded_attachment/LICENSE +20 -0
  10. data/lib/encoded_attachment/README.md +107 -0
  11. data/lib/encoded_attachment/Rakefile +41 -0
  12. data/lib/encoded_attachment/encoded_attachment.gemspec +23 -0
  13. data/lib/encoded_attachment/lib/activerecord/base.rb +63 -0
  14. data/lib/encoded_attachment/lib/activeresource/base.rb +121 -0
  15. data/lib/encoded_attachment/lib/activeresource/connection.rb +7 -0
  16. data/lib/encoded_attachment/lib/encoded_attachment/version.rb +3 -0
  17. data/lib/encoded_attachment/lib/encoded_attachment.rb +47 -0
  18. data/lib/encoded_attachment/test/active_record_test.rb +136 -0
  19. data/lib/encoded_attachment/test/active_resource_test.rb +276 -0
  20. data/lib/encoded_attachment/test/avatars/.gitignore +0 -0
  21. data/lib/encoded_attachment/test/config/database.yml +19 -0
  22. data/lib/encoded_attachment/test/config/schema.rb +17 -0
  23. data/lib/encoded_attachment/test/fixtures/kitten.jpg +0 -0
  24. data/lib/encoded_attachment/test/fixtures/tapir.jpg +0 -0
  25. data/lib/encoded_attachment/test/test_helper.rb +73 -0
  26. data/lib/siterest/asset.rb +27 -0
  27. data/lib/siterest/client.rb +149 -0
  28. data/lib/siterest/command.rb +105 -0
  29. data/lib/siterest/server.rb +58 -0
  30. data/lib/siterest/site.rb +6 -0
  31. data/lib/siterest/template/filters/core_filters.rb +57 -0
  32. data/lib/siterest/template/filters/datetime_filters.rb +8 -0
  33. data/lib/siterest/template/filters/url_filters.rb +82 -0
  34. data/lib/siterest/template/objects/article.rb +35 -0
  35. data/lib/siterest/template/objects/page.rb +71 -0
  36. data/lib/siterest/template/objects/site.rb +51 -0
  37. data/lib/siterest/template.rb +6 -0
  38. data/lib/siterest/user.rb +6 -0
  39. data/lib/siterest.rb +56 -0
  40. data/lib/upfile.rb +51 -0
  41. data/readme.md +86 -0
  42. data/site/data/articles/2008-04-24-my-first-blog-post.md +12 -0
  43. data/site/data/pages/about-us/something.md +0 -0
  44. data/site/data/pages/about-us.md +12 -0
  45. data/site/data/pages/contact.md +12 -0
  46. data/site/data/pages/home.md +14 -0
  47. data/site/data/site.yaml +2 -0
  48. data/siterest.gemspec +101 -0
  49. metadata +203 -0
data/lib/upfile.rb ADDED
@@ -0,0 +1,51 @@
1
+ # The Upfile module is a convenience module for adding uploaded-file-type methods
2
+ # to the +File+ class. Useful for testing.
3
+ # user.avatar = File.new("test/test_avatar.jpg")
4
+ module Upfile
5
+
6
+ # Infer the MIME-type of the file from the extension.
7
+ def content_type
8
+ type = (self.path.match(/\.(\w+)$/)[1] rescue "octet-stream").downcase
9
+ case type
10
+ when %r"jp(e|g|eg)" then "image/jpeg"
11
+ when %r"tiff?" then "image/tiff"
12
+ when %r"png", "gif", "bmp" then "image/#{type}"
13
+ when "txt" then "text/plain"
14
+ when %r"html?" then "text/html"
15
+ when "js" then "application/js"
16
+ when "csv", "xml", "css" then "text/#{type}"
17
+ else
18
+ # On BSDs, `file` doesn't give a result code of 1 if the file doesn't exist.
19
+ content_type = (Paperclip.run("file", "--mime-type :file", :file => self.path).split(':').last.strip rescue "application/x-#{type}")
20
+ content_type = "application/x-#{type}" if content_type.match(/\(.*?\)/)
21
+ content_type
22
+ end
23
+ end
24
+
25
+ # Returns the file's normal name.
26
+ def original_filename
27
+ File.basename(self.path)
28
+ end
29
+
30
+ # Returns the size of the file.
31
+ def size
32
+ File.size(self)
33
+ end
34
+ end
35
+
36
+
37
+ if defined? StringIO
38
+ class StringIO
39
+ attr_accessor :original_filename, :content_type
40
+ def original_filename
41
+ @original_filename ||= "stringio.txt"
42
+ end
43
+ def content_type
44
+ @content_type ||= "text/plain"
45
+ end
46
+ end
47
+ end
48
+
49
+ class File #:nodoc:
50
+ include Upfile
51
+ end
data/readme.md ADDED
@@ -0,0 +1,86 @@
1
+ SiteRest client - building website is now happier
2
+
3
+ - Local server
4
+ - siterest command with various options to communicate to the server
5
+
6
+
7
+
8
+ API Token
9
+
10
+ API URL
11
+
12
+ Access core resources
13
+ http://api.siterest.com/
14
+
15
+ Access site resources
16
+
17
+ http://api.siterest.com/sites/{subdomain}/templates
18
+
19
+
20
+ Commands
21
+ ===
22
+
23
+ setup
24
+ ---
25
+
26
+ > siterest setup
27
+
28
+ Enter your SiteRest credenticals
29
+ Email: [subjective@gmail.com]
30
+ Password: [*******]
31
+
32
+ then credential and config are saved to following config file
33
+
34
+ ~/.siterest.yml
35
+ current : taylorluk
36
+ email : [subjective@gmail.com]
37
+
38
+ design:pull [name]
39
+ ----------------
40
+
41
+ first time
42
+
43
+ git clone git@siterest.com:sitename
44
+
45
+ pull latest content from the website
46
+
47
+ git reset --hard
48
+ git pull git@siterest.com:sitename
49
+
50
+ conflict:
51
+
52
+ overwrite local copy of file if it is already on remote server.
53
+
54
+ design:push [name]
55
+ ------------------
56
+
57
+ push all local changes to remote server
58
+
59
+ git add .
60
+ git commit -m "Site update [messages]"
61
+
62
+ git push git@siterest.com:sitename
63
+
64
+
65
+
66
+ Low priority features
67
+ ==================
68
+
69
+
70
+ create
71
+ ------------------
72
+
73
+ > siterest create
74
+ We are going to create new website for you.
75
+
76
+ Title: My new we website
77
+ Subdomain: something
78
+
79
+ git-config username, email
80
+
81
+
82
+ backup
83
+ ---
84
+
85
+ import
86
+ ---
@@ -0,0 +1,12 @@
1
+ ---
2
+ title: This is my first blog post about this issue
3
+ excerpt: What every happens already happened, why are you so mad at yourself.
4
+ tags: [something, else]
5
+ ---
6
+
7
+ Hello world
8
+ ----
9
+
10
+ What every you do and don't panic
11
+
12
+
File without changes
@@ -0,0 +1,12 @@
1
+ ---
2
+ title: About us
3
+ tags: [one, two]
4
+ ---
5
+
6
+ We are idealian
7
+ ---
8
+
9
+ Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
10
+
11
+ Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
12
+
@@ -0,0 +1,12 @@
1
+ ---
2
+ title: Contact us
3
+ ---
4
+
5
+ contact us
6
+ ---
7
+
8
+ Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
9
+
10
+ Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
11
+
12
+ email
@@ -0,0 +1,14 @@
1
+ ---
2
+ title: Welcome to my website
3
+ tags: one, two
4
+ ---
5
+
6
+ Welcome
7
+ ---
8
+
9
+ Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
10
+
11
+ Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
12
+
13
+ Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
14
+
@@ -0,0 +1,2 @@
1
+ title: Example site
2
+ host: www.example.com
data/siterest.gemspec ADDED
@@ -0,0 +1,101 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{siterest}
8
+ s.version = "0.1.0.pre1"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Taylor luk"]
12
+ s.date = %q{2010-08-06}
13
+ s.default_executable = %q{siterest}
14
+ s.description = %q{Simple content service}
15
+ s.email = %q{taylor.luk@idealian.net}
16
+ s.executables = ["siterest"]
17
+ s.files = [
18
+ "Gemfile",
19
+ "Gemfile.lock",
20
+ "Rakefile",
21
+ "VERSION",
22
+ "bin/siterest",
23
+ "config.ru",
24
+ "lib/encoded_attachment/.gitignore",
25
+ "lib/encoded_attachment/Gemfile",
26
+ "lib/encoded_attachment/LICENSE",
27
+ "lib/encoded_attachment/README.md",
28
+ "lib/encoded_attachment/Rakefile",
29
+ "lib/encoded_attachment/encoded_attachment.gemspec",
30
+ "lib/encoded_attachment/lib/activerecord/base.rb",
31
+ "lib/encoded_attachment/lib/activeresource/base.rb",
32
+ "lib/encoded_attachment/lib/activeresource/connection.rb",
33
+ "lib/encoded_attachment/lib/encoded_attachment.rb",
34
+ "lib/encoded_attachment/lib/encoded_attachment/version.rb",
35
+ "lib/encoded_attachment/test/active_record_test.rb",
36
+ "lib/encoded_attachment/test/active_resource_test.rb",
37
+ "lib/encoded_attachment/test/avatars/.gitignore",
38
+ "lib/encoded_attachment/test/config/database.yml",
39
+ "lib/encoded_attachment/test/config/schema.rb",
40
+ "lib/encoded_attachment/test/fixtures/kitten.jpg",
41
+ "lib/encoded_attachment/test/fixtures/tapir.jpg",
42
+ "lib/encoded_attachment/test/test_helper.rb",
43
+ "lib/siterest.rb",
44
+ "lib/siterest/asset.rb",
45
+ "lib/siterest/client.rb",
46
+ "lib/siterest/command.rb",
47
+ "lib/siterest/server.rb",
48
+ "lib/siterest/site.rb",
49
+ "lib/siterest/template.rb",
50
+ "lib/siterest/template/filters/core_filters.rb",
51
+ "lib/siterest/template/filters/datetime_filters.rb",
52
+ "lib/siterest/template/filters/url_filters.rb",
53
+ "lib/siterest/template/objects/article.rb",
54
+ "lib/siterest/template/objects/page.rb",
55
+ "lib/siterest/template/objects/site.rb",
56
+ "lib/siterest/user.rb",
57
+ "lib/upfile.rb",
58
+ "readme.md",
59
+ "site/data/articles/2008-04-24-my-first-blog-post.md",
60
+ "site/data/pages/about-us.md",
61
+ "site/data/pages/about-us/something.md",
62
+ "site/data/pages/contact.md",
63
+ "site/data/pages/home.md",
64
+ "site/data/site.yaml",
65
+ "siterest.gemspec"
66
+ ]
67
+ s.homepage = %q{http://www.siterest.com}
68
+ s.rdoc_options = ["--charset=UTF-8"]
69
+ s.require_paths = ["lib"]
70
+ s.rubygems_version = %q{1.3.7}
71
+ s.summary = %q{Siterest client}
72
+
73
+ if s.respond_to? :specification_version then
74
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
75
+ s.specification_version = 3
76
+
77
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
78
+ s.add_runtime_dependency(%q<h2o>, [">= 0"])
79
+ s.add_runtime_dependency(%q<activeresource>, ["~> 3.0.0.beta4"])
80
+ s.add_runtime_dependency(%q<launchy>, [">= 0"])
81
+ s.add_runtime_dependency(%q<sinatra>, [">= 0"])
82
+ s.add_runtime_dependency(%q<rest-client>, [">= 0"])
83
+ s.add_runtime_dependency(%q<rdiscount>, [">= 0"])
84
+ else
85
+ s.add_dependency(%q<h2o>, [">= 0"])
86
+ s.add_dependency(%q<activeresource>, ["~> 3.0.0.beta4"])
87
+ s.add_dependency(%q<launchy>, [">= 0"])
88
+ s.add_dependency(%q<sinatra>, [">= 0"])
89
+ s.add_dependency(%q<rest-client>, [">= 0"])
90
+ s.add_dependency(%q<rdiscount>, [">= 0"])
91
+ end
92
+ else
93
+ s.add_dependency(%q<h2o>, [">= 0"])
94
+ s.add_dependency(%q<activeresource>, ["~> 3.0.0.beta4"])
95
+ s.add_dependency(%q<launchy>, [">= 0"])
96
+ s.add_dependency(%q<sinatra>, [">= 0"])
97
+ s.add_dependency(%q<rest-client>, [">= 0"])
98
+ s.add_dependency(%q<rdiscount>, [">= 0"])
99
+ end
100
+ end
101
+
metadata ADDED
@@ -0,0 +1,203 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: siterest
3
+ version: !ruby/object:Gem::Version
4
+ hash: -1876988184
5
+ prerelease: true
6
+ segments:
7
+ - 0
8
+ - 1
9
+ - 0
10
+ - pre1
11
+ version: 0.1.0.pre1
12
+ platform: ruby
13
+ authors:
14
+ - Taylor luk
15
+ autorequire:
16
+ bindir: bin
17
+ cert_chain: []
18
+
19
+ date: 2010-08-06 00:00:00 +10:00
20
+ default_executable: siterest
21
+ dependencies:
22
+ - !ruby/object:Gem::Dependency
23
+ name: h2o
24
+ prerelease: false
25
+ requirement: &id001 !ruby/object:Gem::Requirement
26
+ none: false
27
+ requirements:
28
+ - - ">="
29
+ - !ruby/object:Gem::Version
30
+ hash: 3
31
+ segments:
32
+ - 0
33
+ version: "0"
34
+ type: :runtime
35
+ version_requirements: *id001
36
+ - !ruby/object:Gem::Dependency
37
+ name: activeresource
38
+ prerelease: false
39
+ requirement: &id002 !ruby/object:Gem::Requirement
40
+ none: false
41
+ requirements:
42
+ - - ~>
43
+ - !ruby/object:Gem::Version
44
+ hash: -1848230024
45
+ segments:
46
+ - 3
47
+ - 0
48
+ - 0
49
+ - beta4
50
+ version: 3.0.0.beta4
51
+ type: :runtime
52
+ version_requirements: *id002
53
+ - !ruby/object:Gem::Dependency
54
+ name: launchy
55
+ prerelease: false
56
+ requirement: &id003 !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ hash: 3
62
+ segments:
63
+ - 0
64
+ version: "0"
65
+ type: :runtime
66
+ version_requirements: *id003
67
+ - !ruby/object:Gem::Dependency
68
+ name: sinatra
69
+ prerelease: false
70
+ requirement: &id004 !ruby/object:Gem::Requirement
71
+ none: false
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ hash: 3
76
+ segments:
77
+ - 0
78
+ version: "0"
79
+ type: :runtime
80
+ version_requirements: *id004
81
+ - !ruby/object:Gem::Dependency
82
+ name: rest-client
83
+ prerelease: false
84
+ requirement: &id005 !ruby/object:Gem::Requirement
85
+ none: false
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ hash: 3
90
+ segments:
91
+ - 0
92
+ version: "0"
93
+ type: :runtime
94
+ version_requirements: *id005
95
+ - !ruby/object:Gem::Dependency
96
+ name: rdiscount
97
+ prerelease: false
98
+ requirement: &id006 !ruby/object:Gem::Requirement
99
+ none: false
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ hash: 3
104
+ segments:
105
+ - 0
106
+ version: "0"
107
+ type: :runtime
108
+ version_requirements: *id006
109
+ description: Simple content service
110
+ email: taylor.luk@idealian.net
111
+ executables:
112
+ - siterest
113
+ extensions: []
114
+
115
+ extra_rdoc_files: []
116
+
117
+ files:
118
+ - Gemfile
119
+ - Gemfile.lock
120
+ - Rakefile
121
+ - VERSION
122
+ - bin/siterest
123
+ - config.ru
124
+ - lib/encoded_attachment/.gitignore
125
+ - lib/encoded_attachment/Gemfile
126
+ - lib/encoded_attachment/LICENSE
127
+ - lib/encoded_attachment/README.md
128
+ - lib/encoded_attachment/Rakefile
129
+ - lib/encoded_attachment/encoded_attachment.gemspec
130
+ - lib/encoded_attachment/lib/activerecord/base.rb
131
+ - lib/encoded_attachment/lib/activeresource/base.rb
132
+ - lib/encoded_attachment/lib/activeresource/connection.rb
133
+ - lib/encoded_attachment/lib/encoded_attachment.rb
134
+ - lib/encoded_attachment/lib/encoded_attachment/version.rb
135
+ - lib/encoded_attachment/test/active_record_test.rb
136
+ - lib/encoded_attachment/test/active_resource_test.rb
137
+ - lib/encoded_attachment/test/avatars/.gitignore
138
+ - lib/encoded_attachment/test/config/database.yml
139
+ - lib/encoded_attachment/test/config/schema.rb
140
+ - lib/encoded_attachment/test/fixtures/kitten.jpg
141
+ - lib/encoded_attachment/test/fixtures/tapir.jpg
142
+ - lib/encoded_attachment/test/test_helper.rb
143
+ - lib/siterest.rb
144
+ - lib/siterest/asset.rb
145
+ - lib/siterest/client.rb
146
+ - lib/siterest/command.rb
147
+ - lib/siterest/server.rb
148
+ - lib/siterest/site.rb
149
+ - lib/siterest/template.rb
150
+ - lib/siterest/template/filters/core_filters.rb
151
+ - lib/siterest/template/filters/datetime_filters.rb
152
+ - lib/siterest/template/filters/url_filters.rb
153
+ - lib/siterest/template/objects/article.rb
154
+ - lib/siterest/template/objects/page.rb
155
+ - lib/siterest/template/objects/site.rb
156
+ - lib/siterest/user.rb
157
+ - lib/upfile.rb
158
+ - readme.md
159
+ - site/data/articles/2008-04-24-my-first-blog-post.md
160
+ - site/data/pages/about-us.md
161
+ - site/data/pages/about-us/something.md
162
+ - site/data/pages/contact.md
163
+ - site/data/pages/home.md
164
+ - site/data/site.yaml
165
+ - siterest.gemspec
166
+ has_rdoc: true
167
+ homepage: http://www.siterest.com
168
+ licenses: []
169
+
170
+ post_install_message:
171
+ rdoc_options:
172
+ - --charset=UTF-8
173
+ require_paths:
174
+ - lib
175
+ required_ruby_version: !ruby/object:Gem::Requirement
176
+ none: false
177
+ requirements:
178
+ - - ">="
179
+ - !ruby/object:Gem::Version
180
+ hash: 3
181
+ segments:
182
+ - 0
183
+ version: "0"
184
+ required_rubygems_version: !ruby/object:Gem::Requirement
185
+ none: false
186
+ requirements:
187
+ - - ">"
188
+ - !ruby/object:Gem::Version
189
+ hash: 25
190
+ segments:
191
+ - 1
192
+ - 3
193
+ - 1
194
+ version: 1.3.1
195
+ requirements: []
196
+
197
+ rubyforge_project:
198
+ rubygems_version: 1.3.7
199
+ signing_key:
200
+ specification_version: 3
201
+ summary: Siterest client
202
+ test_files: []
203
+