spree_news 0.0.2 → 0.0.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.
Files changed (38) hide show
  1. data/.gitignore +12 -0
  2. data/.rspec +1 -0
  3. data/Gemfile +13 -0
  4. data/Gemfile.lock +172 -0
  5. data/LICENSE +26 -0
  6. data/README.md +21 -0
  7. data/Rakefile +29 -0
  8. data/Versionfile +10 -0
  9. data/app/assets/javascripts/admin/spree_news.js +2 -0
  10. data/app/assets/javascripts/jquery.vticker-min.js +6 -0
  11. data/app/assets/javascripts/posts.js.coffee +3 -0
  12. data/app/assets/javascripts/store/spree_news.js +2 -0
  13. data/app/assets/stylesheets/admin/spree_news.css +3 -0
  14. data/app/assets/stylesheets/posts.css.scss +23 -0
  15. data/app/assets/stylesheets/store/spree_news.css +4 -0
  16. data/app/controllers/spree/admin/posts_controller.rb +50 -0
  17. data/app/models/spree/post.rb +6 -0
  18. data/app/overrides/spree_news_overrides.rb +11 -0
  19. data/app/views/shared/_news.html.haml +24 -0
  20. data/app/views/spree/admin/posts/_form.html.haml +13 -0
  21. data/app/views/spree/admin/posts/edit.html.haml +6 -0
  22. data/app/views/spree/admin/posts/index.html.haml +18 -0
  23. data/app/views/spree/admin/posts/new.html.haml +6 -0
  24. data/app/views/spree/admin/posts/show.html.haml +11 -0
  25. data/config/locales/en.yml +5 -0
  26. data/config/routes.rb +6 -0
  27. data/db/migrate/20120312183513_create_posts.rb +11 -0
  28. data/lib/generators/spree_news/install/install_generator.rb +29 -0
  29. data/lib/spree_news/engine.rb +20 -0
  30. data/lib/spree_news.rb +2 -0
  31. data/script/rails +9 -0
  32. data/spec/spec_helper.rb +32 -0
  33. data/spree_news.gemspec +22 -0
  34. data/test/fixtures/posts.yml +11 -0
  35. data/test/functional/posts_controller_test.rb +7 -0
  36. data/test/unit/helpers/posts_helper_test.rb +4 -0
  37. data/test/unit/post_test.rb +7 -0
  38. metadata +39 -2
data/.gitignore ADDED
@@ -0,0 +1,12 @@
1
+ \#*
2
+ *~
3
+ .#*
4
+ .DS_Store
5
+ .idea
6
+ .project
7
+ tmp
8
+ nbproject
9
+ *.swp
10
+ spec/dummy
11
+
12
+ public/
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --colour
data/Gemfile ADDED
@@ -0,0 +1,13 @@
1
+ source 'http://rubygems.org'
2
+
3
+ group :test do
4
+ gem 'ffaker'
5
+ end
6
+
7
+ if RUBY_VERSION < "1.9"
8
+ gem "ruby-debug"
9
+ else
10
+ gem "ruby-debug19"
11
+ end
12
+
13
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,172 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ spree_news (0.0.1)
5
+ haml
6
+ spree_core (~> 1.0.0)
7
+
8
+ GEM
9
+ remote: http://rubygems.org/
10
+ specs:
11
+ actionmailer (3.1.3)
12
+ actionpack (= 3.1.3)
13
+ mail (~> 2.3.0)
14
+ actionpack (3.1.3)
15
+ activemodel (= 3.1.3)
16
+ activesupport (= 3.1.3)
17
+ builder (~> 3.0.0)
18
+ erubis (~> 2.7.0)
19
+ i18n (~> 0.6)
20
+ rack (~> 1.3.5)
21
+ rack-cache (~> 1.1)
22
+ rack-mount (~> 0.8.2)
23
+ rack-test (~> 0.6.1)
24
+ sprockets (~> 2.0.3)
25
+ active_utils (1.0.3)
26
+ activesupport (>= 2.3.11)
27
+ i18n
28
+ activemerchant (1.20.1)
29
+ active_utils (>= 1.0.1)
30
+ activesupport (>= 2.3.11)
31
+ braintree (>= 2.0.0)
32
+ builder (>= 2.0.0)
33
+ i18n
34
+ json (>= 1.5.1)
35
+ money (<= 3.7.1)
36
+ activemodel (3.1.3)
37
+ activesupport (= 3.1.3)
38
+ builder (~> 3.0.0)
39
+ i18n (~> 0.6)
40
+ activerecord (3.1.3)
41
+ activemodel (= 3.1.3)
42
+ activesupport (= 3.1.3)
43
+ arel (~> 2.2.1)
44
+ tzinfo (~> 0.3.29)
45
+ activeresource (3.1.3)
46
+ activemodel (= 3.1.3)
47
+ activesupport (= 3.1.3)
48
+ activesupport (3.1.3)
49
+ multi_json (~> 1.0)
50
+ acts_as_list (0.1.4)
51
+ archive-tar-minitar (0.5.2)
52
+ arel (2.2.3)
53
+ braintree (2.14.0)
54
+ builder (>= 2.0.0)
55
+ builder (3.0.0)
56
+ cocaine (0.2.1)
57
+ columnize (0.3.6)
58
+ deface (0.8.0)
59
+ nokogiri (~> 1.5.0)
60
+ rails (>= 3.0.9)
61
+ erubis (2.7.0)
62
+ ffaker (1.12.1)
63
+ haml (3.1.4)
64
+ highline (1.6.8)
65
+ hike (1.2.1)
66
+ i18n (0.6.0)
67
+ jquery-rails (1.0.19)
68
+ railties (~> 3.0)
69
+ thor (~> 0.14)
70
+ json (1.6.5)
71
+ kaminari (0.13.0)
72
+ actionpack (>= 3.0.0)
73
+ activesupport (>= 3.0.0)
74
+ railties (>= 3.0.0)
75
+ linecache19 (0.5.12)
76
+ ruby_core_source (>= 0.1.4)
77
+ mail (2.3.3)
78
+ i18n (>= 0.4.0)
79
+ mime-types (~> 1.16)
80
+ treetop (~> 1.4.8)
81
+ meta_search (1.1.1)
82
+ actionpack (~> 3.1.0)
83
+ activerecord (~> 3.1.0)
84
+ activesupport (~> 3.1.0)
85
+ polyamorous (~> 0.5.0)
86
+ mime-types (1.17.2)
87
+ money (3.7.1)
88
+ i18n (~> 0.4)
89
+ multi_json (1.1.0)
90
+ nested_set (1.6.8)
91
+ activerecord (>= 3.0.0)
92
+ railties (>= 3.0.0)
93
+ nokogiri (1.5.2)
94
+ paperclip (2.5.0)
95
+ activerecord (>= 2.3.0)
96
+ activesupport (>= 2.3.2)
97
+ cocaine (>= 0.0.2)
98
+ mime-types
99
+ polyamorous (0.5.0)
100
+ activerecord (~> 3.0)
101
+ polyglot (0.3.3)
102
+ rack (1.3.6)
103
+ rack-cache (1.2)
104
+ rack (>= 0.4)
105
+ rack-mount (0.8.3)
106
+ rack (>= 1.0.0)
107
+ rack-ssl (1.3.2)
108
+ rack
109
+ rack-test (0.6.1)
110
+ rack (>= 1.0)
111
+ rails (3.1.3)
112
+ actionmailer (= 3.1.3)
113
+ actionpack (= 3.1.3)
114
+ activerecord (= 3.1.3)
115
+ activeresource (= 3.1.3)
116
+ activesupport (= 3.1.3)
117
+ bundler (~> 1.0)
118
+ railties (= 3.1.3)
119
+ railties (3.1.3)
120
+ actionpack (= 3.1.3)
121
+ activesupport (= 3.1.3)
122
+ rack-ssl (~> 1.3.2)
123
+ rake (>= 0.8.7)
124
+ rdoc (~> 3.4)
125
+ thor (~> 0.14.6)
126
+ rake (0.9.2.2)
127
+ rdoc (3.12)
128
+ json (~> 1.4)
129
+ ruby-debug-base19 (0.11.25)
130
+ columnize (>= 0.3.1)
131
+ linecache19 (>= 0.5.11)
132
+ ruby_core_source (>= 0.1.4)
133
+ ruby-debug19 (0.11.6)
134
+ columnize (>= 0.3.1)
135
+ linecache19 (>= 0.5.11)
136
+ ruby-debug-base19 (>= 0.11.19)
137
+ ruby_core_source (0.1.5)
138
+ archive-tar-minitar (>= 0.5.2)
139
+ spree_core (1.0.2)
140
+ activemerchant (= 1.20.1)
141
+ acts_as_list (= 0.1.4)
142
+ deface (>= 0.7.2)
143
+ ffaker (~> 1.12.0)
144
+ highline (= 1.6.8)
145
+ jquery-rails (>= 1.0.18, <= 1.0.19)
146
+ kaminari (>= 0.13.0)
147
+ meta_search (= 1.1.1)
148
+ nested_set (= 1.6.8)
149
+ paperclip (= 2.5.0)
150
+ rails (>= 3.1.1, <= 3.1.4)
151
+ state_machine (= 1.1.1)
152
+ stringex (~> 1.3.0)
153
+ sprockets (2.0.3)
154
+ hike (~> 1.2)
155
+ rack (~> 1.0)
156
+ tilt (~> 1.1, != 1.3.0)
157
+ state_machine (1.1.1)
158
+ stringex (1.3.2)
159
+ thor (0.14.6)
160
+ tilt (1.3.3)
161
+ treetop (1.4.10)
162
+ polyglot
163
+ polyglot (>= 0.3.1)
164
+ tzinfo (0.3.32)
165
+
166
+ PLATFORMS
167
+ ruby
168
+
169
+ DEPENDENCIES
170
+ ffaker
171
+ ruby-debug19
172
+ spree_news!
data/LICENSE ADDED
@@ -0,0 +1,26 @@
1
+ Copyright (c) 2012 [name of plugin creator]
2
+ All rights reserved.
3
+
4
+ Redistribution and use in source and binary forms, with or without modification,
5
+ are permitted provided that the following conditions are met:
6
+
7
+ * Redistributions of source code must retain the above copyright notice,
8
+ this list of conditions and the following disclaimer.
9
+ * Redistributions in binary form must reproduce the above copyright notice,
10
+ this list of conditions and the following disclaimer in the documentation
11
+ and/or other materials provided with the distribution.
12
+ * Neither the name Spree nor the names of its contributors may be used to
13
+ endorse or promote products derived from this software without specific
14
+ prior written permission.
15
+
16
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
20
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
21
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
22
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
23
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
24
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
25
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
data/README.md ADDED
@@ -0,0 +1,21 @@
1
+ SpreeNews
2
+ =========
3
+
4
+ Introduction goes here.
5
+
6
+
7
+ Example
8
+ =======
9
+
10
+ Example goes here.
11
+
12
+ Testing
13
+ -------
14
+
15
+ Be sure to bundle your dependencies and then create a dummy test app for the specs to run against.
16
+
17
+ $ bundle
18
+ $ bundle exec rake test_app
19
+ $ bundle exec rspec spec
20
+
21
+ Copyright (c) 2012 [name of extension creator], released under the New BSD License
data/Rakefile ADDED
@@ -0,0 +1,29 @@
1
+ require 'rake'
2
+ require 'rake/testtask'
3
+ require 'rake/packagetask'
4
+ require 'rubygems/package_task'
5
+ require 'rspec/core/rake_task'
6
+ require 'spree/core/testing_support/common_rake'
7
+
8
+ RSpec::Core::RakeTask.new
9
+
10
+ task :default => [:spec]
11
+
12
+ spec = eval(File.read('spree_news.gemspec'))
13
+
14
+ Gem::PackageTask.new(spec) do |p|
15
+ p.gem_spec = spec
16
+ end
17
+
18
+ desc "Release to gemcutter"
19
+ task :release => :package do
20
+ require 'rake/gemcutter'
21
+ Rake::Gemcutter::Tasks.new(spec).define
22
+ Rake::Task['gem:push'].invoke
23
+ end
24
+
25
+ desc "Generates a dummy app for testing"
26
+ task :test_app do
27
+ ENV['LIB_NAME'] = 'spree_news'
28
+ Rake::Task['common:test_app'].invoke
29
+ end
data/Versionfile ADDED
@@ -0,0 +1,10 @@
1
+ # This file is used to designate compatibilty with different versions of Spree
2
+ # Please see http://spreecommerce.com/documentation/extensions.html#versionfile for details
3
+
4
+ # Examples
5
+ #
6
+ "1.0.x" => { :version => "1.0", :tag => "v1.0" }
7
+ # "0.70.x" => { :branch => "master"}
8
+ # "0.60.x" => { :branch => "0-60-stable" }
9
+ # "0.40.x" => { :tag => "v1.0.0", :version => "1.0.0" }
10
+
@@ -0,0 +1,2 @@
1
+ //= require admin/spree_core
2
+ //= require ckeditor/ckeditor
@@ -0,0 +1,6 @@
1
+ /*
2
+ * vertical news ticker
3
+ * Tadas Juozapaitis ( kasp3rito@gmail.com )
4
+ * http://plugins.jquery.com/project/vTicker
5
+ */
6
+ (function(a){a.fn.vTicker=function(b){var c={speed:700,pause:4000,showItems:3,animation:"",mousePause:true,isPaused:false,direction:"up",height:0};var b=a.extend(c,b);moveUp=function(g,d,e){if(e.isPaused){return}var f=g.children("ul");var h=f.children("li:first").clone(true);if(e.height>0){d=f.children("li:first").height()}f.animate({top:"-="+d+"px"},e.speed,function(){a(this).children("li:first").remove();a(this).css("top","0px")});if(e.animation=="fade"){f.children("li:first").fadeOut(e.speed);if(e.height==0){f.children("li:eq("+e.showItems+")").hide().fadeIn(e.speed)}}h.appendTo(f)};moveDown=function(g,d,e){if(e.isPaused){return}var f=g.children("ul");var h=f.children("li:last").clone(true);if(e.height>0){d=f.children("li:first").height()}f.css("top","-"+d+"px").prepend(h);f.animate({top:0},e.speed,function(){a(this).children("li:last").remove()});if(e.animation=="fade"){if(e.height==0){f.children("li:eq("+e.showItems+")").fadeOut(e.speed)}f.children("li:first").hide().fadeIn(e.speed)}};return this.each(function(){var f=a(this);var e=0;f.css({overflow:"hidden",position:"relative"}).children("ul").css({position:"absolute",margin:0,padding:0}).children("li").css({margin:0,padding:0});if(b.height==0){f.children("ul").children("li").each(function(){if(a(this).height()>e){e=a(this).height()}});f.children("ul").children("li").each(function(){a(this).height(e)});f.height(e*b.showItems)}else{f.height(b.height)}var d=setInterval(function(){if(b.direction=="up"){moveUp(f,e,b)}else{moveDown(f,e,b)}},b.pause);if(b.mousePause){f.bind("mouseenter",function(){b.isPaused=true}).bind("mouseleave",function(){b.isPaused=false})}})}})(jQuery);
@@ -0,0 +1,3 @@
1
+ # Place all the behaviors and hooks related to the matching controller here.
2
+ # All this logic will automatically be available in application.js.
3
+ # You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
@@ -0,0 +1,2 @@
1
+ //= require store/spree_core
2
+ //= require jquery.vticker-min.js
@@ -0,0 +1,3 @@
1
+ /*
2
+ *= require admin/spree_core
3
+ */
@@ -0,0 +1,23 @@
1
+ // Place all the styles related to the spree_posts controller here.
2
+ // They will automatically be included in application.css.
3
+ // You can use Sass (SCSS) here: http://sass-lang.com/
4
+
5
+ .news-ticker {
6
+ background: #D3D5BA;
7
+ width: 290px;
8
+ float: right;
9
+ margin: 10px 8px 10px 10px;
10
+ padding: 10px 10px 10px 10px;
11
+ }
12
+
13
+ #news-container {
14
+ border: 1px solid #333333;
15
+ }
16
+
17
+ #news-container ul li div {
18
+ border: 1px solid #aaaaaa;
19
+ height: 75px;
20
+ width: 280px;
21
+ background: #EEE7DF;
22
+ padding: 5px 5px 5px 5px;
23
+ }
@@ -0,0 +1,4 @@
1
+ /*
2
+ *= require store/spree_core
3
+ *= require posts
4
+ */
@@ -0,0 +1,50 @@
1
+ class Spree::Admin::PostsController < Spree::Admin::ResourceController
2
+
3
+ def index
4
+ @posts = Spree::Post.all
5
+ end
6
+
7
+ def show
8
+ @post = Spree::Post.find(params[:id])
9
+ end
10
+
11
+ def new
12
+ @post = Spree::Post.new
13
+ end
14
+
15
+ def create
16
+ @post = Spree::Post.new(params[:post])
17
+ if @post.save
18
+ flash[:notice] = "Post saved successfully"
19
+ redirect_to admin_posts_path
20
+ else
21
+ flash[:alert] = "There was an error saving your post"
22
+ redirect_to :back
23
+ end
24
+ end
25
+
26
+ def edit
27
+ @post = Spree::Post.find(params[:id])
28
+ end
29
+
30
+ def update
31
+ @post = Spree::Post.find(params[:id])
32
+ if @post.update_attributes(params[:post])
33
+ flash[:notice] = "Post saved successfully"
34
+ redirect_to admin_posts_path
35
+ else
36
+ flash[:alert] = "There was an error saving your post"
37
+ redirect_to :back
38
+ end
39
+ end
40
+
41
+ def destroy
42
+ @post = Spree::Post.find(params[:id])
43
+ if @post.destroy
44
+ redirect_to admin_posts_path
45
+ else
46
+ redirect_to :back
47
+ end
48
+ end
49
+
50
+ end
@@ -0,0 +1,6 @@
1
+ class Spree::Post < ActiveRecord::Base
2
+ validates_presence_of :description
3
+ validates_length_of :description, :maximum => 150
4
+
5
+ scope :published, lambda { where(:published => true) }
6
+ end
@@ -0,0 +1,11 @@
1
+ Deface::Override.new(:virtual_path => "spree/layouts/admin",
2
+ :name => "news_admin_tab",
3
+ :insert_bottom => "[data-hook='admin_tabs']",
4
+ :text => "<%= tab(:posts) %>",
5
+ :disabled => false)
6
+
7
+ Deface::Override.new(:virtual_path => "spree/home/index",
8
+ :name => "index_news_partial",
9
+ :insert_after => "[data-hook='homepage_products']",
10
+ :partial => "shared/news",
11
+ :disabled => false)
@@ -0,0 +1,24 @@
1
+ - if Spree::Post.all.any?
2
+ .news-ticker
3
+ %center
4
+ %u
5
+ %h3 Latest News
6
+ %p
7
+ #news-container
8
+ %ul
9
+ - Spree::Post.published.each do |post|
10
+ %li
11
+ %div
12
+ %h6= post.created_at.strftime("%B %d, %Y")
13
+ =h truncate(post.description, :length => 150)
14
+
15
+ :javascript
16
+ $(function(){
17
+ $('#news-container').vTicker({
18
+ speed: 1000,
19
+ pause: 4000,
20
+ animation: 'fade',
21
+ mousePause: true,
22
+ showItems: 3
23
+ });
24
+ });
@@ -0,0 +1,13 @@
1
+ %p
2
+ = f.label :title, t(:title)
3
+ %p
4
+ = f.text_field :title
5
+ %p
6
+ = f.label :description, t(:description)
7
+ %p
8
+ = f.text_area :description
9
+ %p
10
+ = f.label :published, t(:published)
11
+ %p
12
+ = f.check_box :published
13
+
@@ -0,0 +1,6 @@
1
+ = render :partial => 'spree/admin/shared/configuration_menu'
2
+ %h1= "Editing Post"
3
+
4
+ = form_for [:admin, @post] do |f|
5
+ = render :partial => 'form', :locals => {:f => f}
6
+ = render :partial => 'spree/admin/shared/edit_resource_links'
@@ -0,0 +1,18 @@
1
+ = render :partial => 'spree/admin/shared/configuration_menu'
2
+ %h1 Posts
3
+ .new-post= button_link_to 'New Post', new_object_url, :icon => 'add', :id => 'admin_new_post_link'
4
+
5
+ %table.index#listing_posts
6
+ %thead
7
+ %th Name
8
+ %th Text
9
+ %th
10
+ %th
11
+ %tbody
12
+ - @posts.each do |post|
13
+ %tr
14
+ %td=link_to post.title, object_url(post)
15
+ %td= post.description.html_safe
16
+ %td= link_to_edit post
17
+ %td= link_to_delete post
18
+
@@ -0,0 +1,6 @@
1
+ = render :partial => 'spree/admin/shared/configuration_menu'
2
+ %h1= "New Post"
3
+
4
+ = form_for [:admin, @post] do |f|
5
+ = render :partial => 'form', :locals => {:f => f}
6
+ = render :partial => 'spree/admin/shared/edit_resource_links'
@@ -0,0 +1,11 @@
1
+ %h1= "Showing News Post: #{@post.title}"
2
+ %p
3
+
4
+ %h4= "Title: #{@post.title}"
5
+ %h4= t(:description)
6
+ = @post.description
7
+
8
+ %p
9
+ = link_to_edit @slide, :class => 'edit_slide'
10
+ = t(:or)
11
+ = link_to t(:back), collection_url
@@ -0,0 +1,5 @@
1
+ # Sample localization file for English. Add more files in this directory for other locales.
2
+ # See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
3
+
4
+ en:
5
+ hello: "Hello world"
data/config/routes.rb ADDED
@@ -0,0 +1,6 @@
1
+ Spree::Core::Engine.routes.draw do
2
+ # Add your extension routes here
3
+ namespace :admin do
4
+ resources :posts
5
+ end
6
+ end
@@ -0,0 +1,11 @@
1
+ class CreatePosts < ActiveRecord::Migration
2
+ def change
3
+ create_table :spree_posts do |t|
4
+ t.string :title
5
+ t.string :description
6
+ t.boolean :published
7
+
8
+ t.timestamps
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,29 @@
1
+ module SpreeNews
2
+ module Generators
3
+ class InstallGenerator < Rails::Generators::Base
4
+
5
+ def add_javascripts
6
+ append_file "app/assets/javascripts/store/all.js", "//= require store/spree_news\n"
7
+ append_file "app/assets/javascripts/admin/all.js", "//= require admin/spree_news\n"
8
+ end
9
+
10
+ def add_stylesheets
11
+ inject_into_file "app/assets/stylesheets/store/all.css", " *= require store/spree_news\n", :before => /\*\//, :verbose => true
12
+ inject_into_file "app/assets/stylesheets/admin/all.css", " *= require admin/spree_news\n", :before => /\*\//, :verbose => true
13
+ end
14
+
15
+ def add_migrations
16
+ run 'bundle exec rake railties:install:migrations FROM=spree_news'
17
+ end
18
+
19
+ def run_migrations
20
+ res = ask "Would you like to run the migrations now? [Y/n]"
21
+ if res == "" || res.downcase == "y"
22
+ run 'bundle exec rake db:migrate'
23
+ else
24
+ puts "Skiping rake db:migrate, don't forget to run it!"
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,20 @@
1
+ module SpreeNews
2
+ class Engine < Rails::Engine
3
+ engine_name 'spree_news'
4
+
5
+ config.autoload_paths += %W(#{config.root}/lib)
6
+
7
+ # use rspec for tests
8
+ config.generators do |g|
9
+ g.test_framework :rspec
10
+ end
11
+
12
+ def self.activate
13
+ Dir.glob(File.join(File.dirname(__FILE__), "../../app/**/*_decorator*.rb")) do |c|
14
+ Rails.configuration.cache_classes ? require(c) : load(c)
15
+ end
16
+ end
17
+
18
+ config.to_prepare &method(:activate).to_proc
19
+ end
20
+ end
data/lib/spree_news.rb ADDED
@@ -0,0 +1,2 @@
1
+ require 'spree_core'
2
+ require 'spree_news/engine'
data/script/rails ADDED
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env ruby
2
+ # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
3
+
4
+ ENGINE_ROOT = File.expand_path('../..', __FILE__)
5
+ ENGINE_PATH = File.expand_path('../../lib/spree_news/engine', __FILE__)
6
+
7
+ require 'rails/all'
8
+ require 'rails/engine/commands'
9
+
@@ -0,0 +1,32 @@
1
+ # Configure Rails Environment
2
+ ENV["RAILS_ENV"] = "test"
3
+
4
+ require File.expand_path("../dummy/config/environment.rb", __FILE__)
5
+
6
+ require 'rspec/rails'
7
+
8
+ # Requires supporting ruby files with custom matchers and macros, etc,
9
+ # in spec/support/ and its subdirectories.
10
+ Dir[File.join(File.dirname(__FILE__), "support/**/*.rb")].each {|f| require f }
11
+
12
+ # Requires factories defined in spree_core
13
+ require 'spree/core/testing_support/factories'
14
+
15
+ RSpec.configure do |config|
16
+ # == Mock Framework
17
+ #
18
+ # If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
19
+ #
20
+ # config.mock_with :mocha
21
+ # config.mock_with :flexmock
22
+ # config.mock_with :rr
23
+ config.mock_with :rspec
24
+
25
+ # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
26
+ config.fixture_path = "#{::Rails.root}/spec/fixtures"
27
+
28
+ # If you're not using ActiveRecord, or you'd prefer not to run each of your
29
+ # examples within a transaction, remove the following line or assign false
30
+ # instead of true.
31
+ config.use_transactional_fixtures = true
32
+ end
@@ -0,0 +1,22 @@
1
+ # encoding: UTF-8
2
+ Gem::Specification.new do |s|
3
+ s.platform = Gem::Platform::RUBY
4
+ s.name = 'spree_news'
5
+ s.version = '0.0.3'
6
+ s.summary = 'Adds a Javascript enabled scrolling news feed ticker wherever you call it'
7
+ s.description = s.summary
8
+ s.required_ruby_version = '>= 1.9.2'
9
+
10
+ s.author = 'JD Warren'
11
+ s.email = 'jd@isotope11.com'
12
+ s.homepage = 'http://www.isotope11.com'
13
+
14
+ s.files = `git ls-files`.split("\n")
15
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
16
+ s.require_path = 'lib'
17
+ s.requirements << 'none'
18
+
19
+ s.add_dependency 'spree_core', '~> 1.0.0'
20
+ s.add_dependency 'haml'
21
+
22
+ end
@@ -0,0 +1,11 @@
1
+ # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
2
+
3
+ # This model initially had no columns defined. If you add columns to the
4
+ # model remove the '{}' from the fixture names and add the columns immediately
5
+ # below each fixture, per the syntax in the comments below
6
+ #
7
+ one: {}
8
+ # column: value
9
+ #
10
+ two: {}
11
+ # column: value
@@ -0,0 +1,7 @@
1
+ require 'test_helper'
2
+
3
+ class PostsControllerTest < ActionController::TestCase
4
+ # test "the truth" do
5
+ # assert true
6
+ # end
7
+ end
@@ -0,0 +1,4 @@
1
+ require 'test_helper'
2
+
3
+ class PostsHelperTest < ActionView::TestCase
4
+ end
@@ -0,0 +1,7 @@
1
+ require 'test_helper'
2
+
3
+ class PostTest < ActiveSupport::TestCase
4
+ # test "the truth" do
5
+ # assert true
6
+ # end
7
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spree_news
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -49,7 +49,44 @@ email: jd@isotope11.com
49
49
  executables: []
50
50
  extensions: []
51
51
  extra_rdoc_files: []
52
- files: []
52
+ files:
53
+ - .gitignore
54
+ - .rspec
55
+ - Gemfile
56
+ - Gemfile.lock
57
+ - LICENSE
58
+ - README.md
59
+ - Rakefile
60
+ - Versionfile
61
+ - app/assets/javascripts/admin/spree_news.js
62
+ - app/assets/javascripts/jquery.vticker-min.js
63
+ - app/assets/javascripts/posts.js.coffee
64
+ - app/assets/javascripts/store/spree_news.js
65
+ - app/assets/stylesheets/admin/spree_news.css
66
+ - app/assets/stylesheets/posts.css.scss
67
+ - app/assets/stylesheets/store/spree_news.css
68
+ - app/controllers/spree/admin/posts_controller.rb
69
+ - app/models/spree/post.rb
70
+ - app/overrides/spree_news_overrides.rb
71
+ - app/views/shared/_news.html.haml
72
+ - app/views/spree/admin/posts/_form.html.haml
73
+ - app/views/spree/admin/posts/edit.html.haml
74
+ - app/views/spree/admin/posts/index.html.haml
75
+ - app/views/spree/admin/posts/new.html.haml
76
+ - app/views/spree/admin/posts/show.html.haml
77
+ - config/locales/en.yml
78
+ - config/routes.rb
79
+ - db/migrate/20120312183513_create_posts.rb
80
+ - lib/generators/spree_news/install/install_generator.rb
81
+ - lib/spree_news.rb
82
+ - lib/spree_news/engine.rb
83
+ - script/rails
84
+ - spec/spec_helper.rb
85
+ - spree_news.gemspec
86
+ - test/fixtures/posts.yml
87
+ - test/functional/posts_controller_test.rb
88
+ - test/unit/helpers/posts_helper_test.rb
89
+ - test/unit/post_test.rb
53
90
  homepage: http://www.isotope11.com
54
91
  licenses: []
55
92
  post_install_message: