cafepress_wrapper 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -1,3 +1,35 @@
1
- = CafepressWrapper
1
+ # Copyright 2010-2011 Benjamin Lee Smith <benjamin.lee.smith@gmail.com>
2
+ #
3
+ # This file is part of CafePress Wrapper.
4
+ # CafePress Wrapper is free software: you can redistribute it and/or modify
5
+ # it under the terms of the GNU General Public License as published by
6
+ # the Free Software Foundation, either version 3 of the License, or
7
+ # (at your option) any later version.
8
+ #
9
+ # CafePress Wrapper is distributed in the hope that it will be useful,
10
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ # GNU General Public License for more details.
13
+ #
14
+ # You should have received a copy of the GNU General Public License
15
+ # along with CafePress Wrapper. If not, see <http://www.gnu.org/licenses/>.
2
16
 
3
- This project rocks and uses MIT-LICENSE.
17
+ == INTRODUCTION ==
18
+
19
+ WORK IN PROGRESS!
20
+
21
+ CafePress Wrapper was built to create a portal for multiple CafePress basic stores.
22
+ The intent is to create a fully fledged site where all product browsing and searching
23
+ is done on the wrapper site, while selecting specific sizes/colors/etc, shopping
24
+ cart functionality, and checkout is all done normally on cafepress.com
25
+
26
+ CafePress Wrapper is a Rails plugin distributed as a gem. Currently, there is a lot
27
+ of code which is specific to rockclimbingshirts.com. I am in the process of removing
28
+ this code and replacing it with generic stuff.
29
+
30
+ Runs great on Heroku.
31
+
32
+ == TODO ==
33
+
34
+ * Write setup howto
35
+ * Remove rockclimbingshirts.com specific stuff and create generic pages
@@ -21,10 +21,7 @@
21
21
  <div id="contact">
22
22
  <h1>Contact</h1>
23
23
  <p>
24
- You can email me at <%= link_to('benjamin.lee.smith@gmail.com', 'mailto:benjamin.lee.smith@gmail.com') %>
25
- or just look for my ugly mug at the crag...
26
- </p>
27
- <p>
28
- <a href="http://www.flickr.com/photos/benjaminsmith/4839622122/" title="Lover's Leap by benjamin.smith, on Flickr"><img src="http://farm5.static.flickr.com/4091/4839622122_a2b5cc5a97.jpg" width="375" height="500" alt="Lover's Leap" /></a>
24
+ Create content for this page by creating the file app/views/content/about.html.erb
25
+ and adding the content there.
29
26
  </p>
30
27
  </div>
@@ -0,0 +1,9 @@
1
+ <div class="menu">
2
+ <ul>
3
+ <li class="first"><%= link_to 'Home', root_url %></li>
4
+ <li><%= link_to 'Photos', Rails.configuration.cpw_photos_url, :target => '_photos' %></li>
5
+ <li><%= link_to 'About', content_about_path %></li>
6
+ <li><%= link_to 'Contact', content_contact_path %></li>
7
+ <li><%= link_to 'RSS', '/feed.rss' %></li>
8
+ </ul>
9
+ </div>
@@ -18,38 +18,30 @@
18
18
  %>
19
19
  <html>
20
20
  <head>
21
- <title>Rock Climbing Shirts - <%= yield :title %></title>
22
- <%= stylesheet_link_tag :all %>
21
+ <title><%= Rails.configuration.cpw_name %> - <%= yield :title %></title>
22
+ <%= stylesheet_link_tag 'cafepress_wrapper', 'application' %>
23
23
  <%= javascript_include_tag :defaults %>
24
24
  <%= javascript_include_tag 'cafepress_wrapper' %>
25
25
  <%= csrf_meta_tag %>
26
- <meta name="description" content="Hilarious, sweet, and all around kickass shirts for every type of rock climber." />
27
- <link rel="alternate" type="application/rss+xml" title="Rock Climbing Shirts - <%= yield :title %>" href="/feed.rss" />
28
- <script type="text/javascript">
29
-
30
- var _gaq = _gaq || [];
31
- _gaq.push(['_setAccount', '<%= ::CAFEPRESS_CONFIG['google_analytics'] %>']);
32
- _gaq.push(['_trackPageview']);
33
-
34
- (function() {
35
- var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
36
- ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
37
- var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
38
- })();
39
-
40
- </script>
26
+ <meta name="description" content="<%= Rails.configuration.cpw_description %>" />
27
+ <link rel="alternate" type="application/rss+xml" title="<%= Rails.configuration.cpw_name %> - <%= yield :title %>" href="/feed.rss" />
28
+ <% if Rails.configuration.cpw_google_analytics %>
29
+ <script type="text/javascript">
30
+ var _gaq = _gaq || [];
31
+ _gaq.push(['_setAccount', '<%= Rails.configuration.cpw_google_analytics %>']);
32
+ _gaq.push(['_trackPageview']);
33
+
34
+ (function() {
35
+ var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
36
+ ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
37
+ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
38
+ })();
39
+ </script>
40
+ <% end %>
41
41
  </head>
42
42
  <body>
43
43
  <div id="header">
44
- <div class="menu">
45
- <ul>
46
- <li class="first"><%= link_to 'Home', root_url %></li>
47
- <li><%= link_to 'Photos', 'http://www.flickr.com/photos/benjaminsmith/tags/tshirt/show/', :target => '_flickr' %></li>
48
- <li><%= link_to 'About', content_about_path %></li>
49
- <li><%= link_to 'Contact', content_contact_path %></li>
50
- <li><%= link_to 'RSS', '/feed.rss' %></li>
51
- </ul>
52
- </div>
44
+ <%= render :partial => 'layouts/menu'%>
53
45
  </div>
54
46
  <div id="content">
55
47
  <div id="cart">
@@ -61,15 +53,7 @@
61
53
  <%= yield %>
62
54
  </div>
63
55
  <div id="footer">
64
- <div class="menu">
65
- <ul>
66
- <li><%= link_to 'Home', root_url %></li>
67
- <li><%= link_to 'Photos', 'http://www.flickr.com/photos/benjaminsmith/tags/tshirt/show/', :target => '_flickr' %></li>
68
- <li><%= link_to 'About', content_about_path %></li>
69
- <li><%= link_to 'Contact', content_contact_path %></li>
70
- <li><%= link_to 'RSS', '/feed.rss' %></li>
71
- </ul>
72
- </div>
56
+ <%= render :partial => 'layouts/menu'%>
73
57
  </div>
74
58
  </body>
75
59
  </html>
@@ -1,8 +1,8 @@
1
1
  xml.instruct! :xml, :version => "1.0"
2
2
  xml.rss :version => "2.0", 'xmlns:content' => 'http://purl.org/rss/1.0/modules/content/' do
3
3
  xml.channel do
4
- xml.title "Rockclimbingshirts.com - funny, awesome, and badass climbing shirts"
5
- xml.description "Hilarious, sweet, and all around kickass shirts for every type of rock climber."
4
+ xml.title "#{Rails.configuration.cpw_name} - #{Rails.configuration.cpw_title}"
5
+ xml.description Rails.configuration.cpw_description
6
6
  xml.link root_url
7
7
 
8
8
  for store in @stores
@@ -12,11 +12,11 @@ xml.rss :version => "2.0", 'xmlns:content' => 'http://purl.org/rss/1.0/modules/c
12
12
  if store.cafepress_back_design_url
13
13
  xml.tag! 'content:encoded' do
14
14
  xml.cdata! %{
15
- <a href="http://cafepress.com/#{store.cafepress_store_id}">
15
+ <a href="#{store_url(store)}">
16
16
  <img src="#{store.cafepress_design_url}"/>
17
17
  </a>
18
18
  <br/>
19
- <a href="http://cafepress.com/#{store.cafepress_store_id}">
19
+ <a href="#{store_url(store)}">
20
20
  <img src=#{store.cafepress_back_design_url}/>
21
21
  </a>
22
22
  <br/>
@@ -26,7 +26,7 @@ xml.rss :version => "2.0", 'xmlns:content' => 'http://purl.org/rss/1.0/modules/c
26
26
  else
27
27
  xml.tag! 'content:encoded' do
28
28
  xml.cdata! %{
29
- <a href="http://cafepress.com/#{store.cafepress_store_id}">
29
+ <a href="#{store_url(store)}">
30
30
  <img src="#{store.cafepress_design_url}"/>
31
31
  </a>
32
32
  <br/>
@@ -35,7 +35,7 @@ xml.rss :version => "2.0", 'xmlns:content' => 'http://purl.org/rss/1.0/modules/c
35
35
  end
36
36
  end
37
37
  xml.pubDate store.created_at
38
- xml.link "http://cafepress.com/#{store.cafepress_store_id}"
38
+ xml.link store_url(store)
39
39
  xml.guid store.cafepress_store_id
40
40
  end
41
41
  end
@@ -16,7 +16,7 @@
16
16
  # along with CafePress Wrapper. If not, see <http://www.gnu.org/licenses/>.
17
17
  %>
18
18
 
19
- <% content_for :title, 'funny, awesome, and badass climbing shirts' %>
19
+ <% content_for :title, Rails.configuration.cpw_title %>
20
20
  <script type="text/javascript">
21
21
  document.observe("dom:loaded", function() {
22
22
  setTimeout('CPW.cycle_images();', CPW.cycle_speed);
@@ -0,0 +1,20 @@
1
+ development:
2
+ name: CPW-name (change in config/cafepress_wrapper.yml:name)
3
+ title: CPW-title (change in config/cafepress_wrapper.yml:title)
4
+ description: CPW-description (change in config/cafepress_wrapper.yml:description)
5
+ photos_url: CPW-photos_url (change in config/cafepres_wrapper.yml:photos_url)
6
+ google_analytics:
7
+
8
+ test:
9
+ name: CPW-name (change in config/cafepress_wrapper.yml:name)
10
+ title: CPW-title (change in config/cafepress_wrapper.yml:title)
11
+ description: CPW-description (change in config/cafepress_wrapper.yml:description)
12
+ photos_url: CPW-photos_url (change in config/cafepres_wrapper.yml:photos_url)
13
+ google_analytics:
14
+
15
+ production:
16
+ name: CPW-name (change in config/cafepress_wrapper.yml:name)
17
+ title: CPW-title (change in config/cafepress_wrapper.yml:title)
18
+ description: CPW-description (change in config/cafepress_wrapper.yml:description)
19
+ photos_url: CPW-photos_url (change in config/cafepres_wrapper.yml:photos_url)
20
+ google_analytics:
@@ -0,0 +1,69 @@
1
+ # Copyright 2010 Benjamin Lee Smith <benjamin.lee.smith@gmail.com>
2
+ #
3
+ # This file is part of CafePress Wrapper.
4
+ # CafePress Wrapper is free software: you can redistribute it and/or modify
5
+ # it under the terms of the GNU General Public License as published by
6
+ # the Free Software Foundation, either version 3 of the License, or
7
+ # (at your option) any later version.
8
+ #
9
+ # CafePress Wrapper is distributed in the hope that it will be useful,
10
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ # GNU General Public License for more details.
13
+ #
14
+ # You should have received a copy of the GNU General Public License
15
+ # along with CafePress Wrapper. If not, see <http://www.gnu.org/licenses/>.
16
+
17
+ begin
18
+ yaml_config = YAML.load_file("#{::Rails.root.to_s}/config/cafepress_wrapper.yml")[::Rails.env]
19
+ Rails.configuration.cpw_name = yaml_config['name']
20
+ Rails.configuration.cpw_title = yaml_config['title']
21
+ Rails.configuration.cpw_description = yaml_config['description']
22
+ Rails.configuration.cpw_photos_url = yaml_config['photos_url']
23
+ Rails.configuration.cpw_google_analytics = yaml_config['google_analytics']
24
+ rescue
25
+ Rails.configuration.cpw_name = yaml_config['cpw_name']
26
+ Rails.configuration.cpw_title = yaml_config['cpw_title']
27
+ Rails.configuration.cpw_description = yaml_config['cpw_description']
28
+ Rails.configuration.cpw_photos_url = yaml_config['cpw_photos_url']
29
+ Rails.configuration.cpw_google_analytics = yaml_config['cpw_google_analytics']
30
+ end
31
+
32
+ require 'rails/generators'
33
+
34
+ class InstallGenerator < Rails::Generators::Base
35
+ def copy_config_file
36
+ source = File.join(File.dirname(__FILE__), '..', '..', 'config')
37
+ destination = File.join(Rails.root, 'config', 'cafepress_wrapper.yml')
38
+
39
+ InstallGenerator.source_root(source)
40
+
41
+ copy_file 'cafepress_wrapper.yml', destination
42
+ end
43
+
44
+ def copy_images
45
+ source = File.join(File.dirname(__FILE__), '..', '..', 'public', 'images')
46
+ destination = File.join(Rails.root, 'public', 'images')
47
+ copy_files(source, destination)
48
+ end
49
+
50
+ def copy_javascripts
51
+ source = File.join(File.dirname(__FILE__), '..', '..', 'public', 'javascripts')
52
+ destination = File.join(Rails.root, 'public', 'javascripts')
53
+ copy_files(source, destination)
54
+ end
55
+
56
+ def copy_stylesheets
57
+ source = File.join(File.dirname(__FILE__), '..', '..', 'public', 'stylesheets')
58
+ destination = File.join(Rails.root, 'public', 'stylesheets')
59
+ copy_files(source, destination)
60
+ end
61
+
62
+ private
63
+ def copy_files(source, destination)
64
+ InstallGenerator.source_root(source)
65
+ (Dir.entries(source) - ['.', '..']).each do |f|
66
+ copy_file f, File.join(destination, f)
67
+ end
68
+ end
69
+ end
@@ -1,21 +1,8 @@
1
1
  require 'cafepress_api'
2
2
 
3
- # %w{ models controllers }.each do |dir|
4
- # path = File.join(File.dirname(__FILE__), 'app', dir)
5
- # $LOAD_PATH << path
6
- # ActiveSupport::Dependencies.autoload_paths << path
7
- # ActiveSupport::Dependencies.autoload_once_paths.delete(path)
8
- # end
9
-
10
3
  module CafepressWrapper
11
4
  class Engine < Rails::Engine
12
- # Dir[File.join(File.dirname(__FILE__),'../app/models/*.rb')].each {|f| config.autoload_paths += f }
13
- # Dir[File.join(File.dirname(__FILE__),'../app/controllers/*.rb')].each {|f| config.autoload_paths += f }
14
5
  config.autoload_paths << File.join(File.dirname(__FILE__),'../app/models/')
15
6
  config.autoload_paths << File.join(File.dirname(__FILE__),'../app/controllers/')
16
-
17
- rake_tasks do
18
- load File.join(File.dirname(__FILE__), 'tasks/cafepress_wrapper.rake')
19
- end
20
7
  end
21
8
  end
@@ -20,23 +20,18 @@ namespace :cafepress_wrapper do
20
20
  end
21
21
 
22
22
  namespace :install do
23
- def copy_files(source, destination)
24
- FileUtils.cp_r((Dir.entries(source) - ['.', '..']).collect{|s| "#{source}/#{s}"}, destination)
23
+ desc 'Copy static assets (images, javascript and stylesheets), into public directory'
24
+ task :assets => :environment do
25
+ Rails::Generators::Base.invoke 'install:copy_images'
26
+ Rails::Generators::Base.invoke 'install:copy_javascripts'
27
+ Rails::Generators::Base.invoke 'install:copy_stylesheets'
28
+ Rails::Generators::Base.start
25
29
  end
26
30
 
27
- desc 'Copy static assets (images, javascript and stylesheets), into public direction'
28
- task :assets => :environment do
29
- source = File.join(File.dirname(__FILE__), '..', '..', 'public', 'images')
30
- destination = File.join(Rails.root, 'public', 'images')
31
- copy_files(source, destination)
32
-
33
- source = File.join(File.dirname(__FILE__), '..', '..', 'public', 'javascripts')
34
- destination = File.join(Rails.root, 'public', 'javascripts')
35
- copy_files(source, destination)
36
-
37
- source = File.join(File.dirname(__FILE__), '..', '..', 'public', 'stylesheets')
38
- destination = File.join(Rails.root, 'public', 'stylesheets')
39
- copy_files(source, destination)
31
+ desc 'Copy config file (config/cafepress_wrapper.yml) into config directory'
32
+ task :config => :environment do
33
+ Rails::Generators::Base.invoke 'install:copy_config_file'
34
+ Rails::Generators::Base.start
40
35
  end
41
36
  end
42
37
  end
Binary file
Binary file
@@ -88,7 +88,7 @@ body {
88
88
  margin: 0px;
89
89
  padding: 0px;
90
90
  /*background-color: #DBAE5E !important;*/
91
- background-image: url(/images/fabric_bg.png);
91
+ background-color: #F5F5F5;
92
92
  text-align: center;
93
93
  }
94
94
 
@@ -98,9 +98,9 @@ div#header {
98
98
  margin: 0pt auto;
99
99
  background-image: url(/images/header_bg.png);
100
100
  height: 150px;
101
- border-bottom: 2px solid #96602D;
102
- border-left: 2px solid #96602D;
103
- border-right: 2px solid #96602D;
101
+ border-bottom: 2px solid #DEDEDE;
102
+ border-left: 2px solid #DEDEDE;
103
+ border-right: 2px solid #DEDEDE;
104
104
  margin-bottom: 10px;
105
105
  position: relative;
106
106
  }
@@ -139,17 +139,17 @@ div#header div.menu ul li.first {
139
139
  }
140
140
 
141
141
  div#content {
142
- background-color: #4D5453;
142
+ background-color: #919191;
143
143
  width: 900px;
144
144
  text-align: center;
145
145
  margin: 0pt auto;
146
- border: 2px solid #96602D;
146
+ border: 2px solid #DEDEDE;
147
147
  padding-bottom: 20px;
148
148
  margin-bottom: 20px;
149
149
  }
150
150
 
151
151
  div#content div#cart {
152
- background-color: #96602D;
152
+ background-color: #676767;
153
153
  margin-bottom: 20px;
154
154
  padding: 4px;
155
155
  position: relative;
@@ -167,7 +167,7 @@ div#content div#cart a, div#content div#cart a:visited {
167
167
  }
168
168
 
169
169
  div#content div#cart a:hover {
170
- background-color: #96602D;
170
+ background-color: #676767;
171
171
  }
172
172
 
173
173
  div#content div#cart a div.text {
@@ -205,7 +205,6 @@ div#footer div.menu {
205
205
  }
206
206
 
207
207
  div#footer div.menu a {
208
- color: #f0f0f0;
209
208
  text-decoration: none;
210
209
  font-size: 18px;
211
210
  }
@@ -252,7 +251,6 @@ div#footer div.menu ul li {
252
251
  text-align: center;
253
252
  display: table-cell;
254
253
  vertical-align: middle;
255
- color: transparent;
256
254
  }
257
255
 
258
256
  #stores .store .front-image {
@@ -286,7 +284,7 @@ div.clear {
286
284
  }
287
285
 
288
286
  #products a:hover {
289
- border: 2px solid #DBAE5E;
287
+ border: 2px solid #000000;
290
288
  background-color: inherit;
291
289
  }
292
290
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cafepress_wrapper
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 2
10
- version: 0.0.2
9
+ - 3
10
+ version: 0.0.3
11
11
  platform: ruby
12
12
  authors: []
13
13
 
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-05-15 00:00:00 -07:00
18
+ date: 2011-05-17 00:00:00 -06:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -54,6 +54,7 @@ files:
54
54
  - app/models/user_token.rb
55
55
  - app/views/content/about.html.erb
56
56
  - app/views/content/contact.html.erb
57
+ - app/views/layouts/_menu.html.erb
57
58
  - app/views/layouts/cafepress_wrapper.html.erb
58
59
  - app/views/products/show.rjs
59
60
  - app/views/sitemap/index.xml.erb
@@ -84,7 +85,8 @@ files:
84
85
  - lib/db/migrate/20110308010304_add_title_to_stores.rb
85
86
  - lib/db/migrate/20110308050955_add_price_to_products.rb
86
87
  - lib/tasks/cafepress_wrapper.rake
87
- - config/initializers/cafepress.rb
88
+ - config/cafepress_wrapper.yml
89
+ - config/initializers/cafepress_wrapper.rb
88
90
  - config/routes.rb
89
91
  - public/images/ajax-loader.gif
90
92
  - public/images/back_bg.png
@@ -1,23 +0,0 @@
1
- # Copyright 2010 Benjamin Lee Smith <benjamin.lee.smith@gmail.com>
2
- #
3
- # This file is part of CafePress Wrapper.
4
- # CafePress Wrapper is free software: you can redistribute it and/or modify
5
- # it under the terms of the GNU General Public License as published by
6
- # the Free Software Foundation, either version 3 of the License, or
7
- # (at your option) any later version.
8
- #
9
- # CafePress Wrapper is distributed in the hope that it will be useful,
10
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
- # GNU General Public License for more details.
13
- #
14
- # You should have received a copy of the GNU General Public License
15
- # along with CafePress Wrapper. If not, see <http://www.gnu.org/licenses/>.
16
-
17
- begin
18
- ::CAFEPRESS_CONFIG = YAML.load_file("#{::Rails.root.to_s}/config/cafepress.yml")[::Rails.env]
19
- rescue
20
- ::CAFEPRESS_CONFIG = {
21
- 'google_analytics' => ENV['cp_google_analytics']
22
- }
23
- end