Skip to content

Commit

Permalink
Update to Spree 2.0.
Browse files Browse the repository at this point in the history
  • Loading branch information
stefansenk committed Oct 4, 2013
1 parent 1ed9954 commit 31e41f5
Show file tree
Hide file tree
Showing 12 changed files with 83 additions and 44 deletions.
8 changes: 4 additions & 4 deletions Gemfile
@@ -1,12 +1,12 @@
source 'http://rubygems.org'
source 'https://rubygems.org'

group :assets do
gem 'therubyracer'
end

gem 'spree_auth_devise', :github => "spree/spree_auth_devise", :branch => "1-3-stable"
gem 'spree_auth_devise', github: 'spree/spree_auth_devise', branch: '2-0-stable'

gem 'spree_related_products', :github => 'spree/spree_related_products', :branch => "1-3-stable"
gem 'spree_static_content', :github => 'spree/spree_static_content', :branch => '1-3-stable'
gem 'spree_related_products', github: 'spree/spree_related_products', branch: '2-0-stable'
gem 'spree_static_content', github: 'spree/spree_static_content', branch: '2-0-stable'

gemspec
32 changes: 18 additions & 14 deletions README.md
@@ -1,7 +1,7 @@
Spree Admin Bar
===============

[![Build Status](https://travis-ci.org/stefansenk/spree_admin_bar.png?branch=1-3-stable)](https://travis-ci.org/stefansenk/spree_admin_bar)
[![Build Status](https://travis-ci.org/stefansenk/spree_admin_bar.png?branch=2-0-stable)](https://travis-ci.org/stefansenk/spree_admin_bar)

Adds an admin bar to a [Spree](http://github.com/spree/spree) E-Commerce platform shop font-end, allowing an admin user to quickly navigate to the relevant sections within the site admin pages.

Expand All @@ -27,27 +27,31 @@ Installation

Add to your Gemfile:

gem 'spree_admin_bar', github: 'stefansenk/spree_admin_bar'
```ruby
gem 'spree_admin_bar', github: 'stefansenk/spree_admin_bar'
```

Bundle your dependencies and run the installation generator:

Run:
```shell
bundle
bundle exec rails g spree_admin_bar:install
```

$ bundle install
$ rake railties:install:migrations
$ rake db:migrate


Include spree_admin_bar.css from your CSS file:

*= require store/spree_admin_bar
If required, include spree_admin_bar.css from your CSS file:

```
*= require store/spree_admin_bar
```

Testing
-------

$ bundle
$ bundle exec rake test_app
$ bundle exec rspec spec
```shell
bundle
bundle exec rake test_app
bundle exec rspec spec
```


Copyright (c) 2013 Stefan Senk, released under the New BSD License
4 changes: 2 additions & 2 deletions Rakefile
Expand Up @@ -2,7 +2,7 @@ require 'bundler'
Bundler::GemHelper.install_tasks

require 'rspec/core/rake_task'
require 'spree/core/testing_support/common_rake'
require 'spree/testing_support/extension_rake'

RSpec::Core::RakeTask.new

Expand All @@ -11,5 +11,5 @@ task :default => [:spec]
desc 'Generates a dummy app for testing'
task :test_app do
ENV['LIB_NAME'] = 'spree_admin_bar'
Rake::Task['common:test_app'].invoke
Rake::Task['extension:test_app'].invoke
end
1 change: 1 addition & 0 deletions Versionfile
Expand Up @@ -2,6 +2,7 @@
# Please see http://spreecommerce.com/documentation/extensions.html#versionfile for details

#'2.0.x' => { :branch => 'master' }
'2.0.x' => { :branch => '2-0-stable' }
'1.3.x' => { :branch => '1-3-stable' }

# Examples
Expand Down
2 changes: 1 addition & 1 deletion app/assets/javascripts/admin/spree_admin_bar.js
@@ -1 +1 @@
//= require admin/spree_core
//= require admin/spree_backend
2 changes: 1 addition & 1 deletion app/assets/javascripts/store/spree_admin_bar.js
@@ -1 +1 @@
//= require store/spree_core
//= require store/spree_frontend
4 changes: 2 additions & 2 deletions app/assets/stylesheets/admin/spree_admin_bar.css
@@ -1,3 +1,3 @@
/*
*= require admin/spree_core
*/
*= require admin/spree_backend
*/
2 changes: 1 addition & 1 deletion app/assets/stylesheets/store/spree_admin_bar.css.scss
@@ -1,5 +1,5 @@
/*
*= require store/spree_core
*= require store/spree_frontend
*/

#admin_bar {
Expand Down
14 changes: 8 additions & 6 deletions lib/generators/spree_admin_bar/install/install_generator.rb
Expand Up @@ -2,6 +2,8 @@ module SpreeAdminBar
module Generators
class InstallGenerator < Rails::Generators::Base

class_option :auto_run_migrations, :type => :boolean, :default => false

def add_javascripts
append_file 'app/assets/javascripts/store/all.js', "//= require store/spree_admin_bar\n"
append_file 'app/assets/javascripts/admin/all.js', "//= require admin/spree_admin_bar\n"
Expand All @@ -17,12 +19,12 @@ def add_migrations
end

def run_migrations
res = ask 'Would you like to run the migrations now? [Y/n]'
if res == '' || res.downcase == 'y'
run 'bundle exec rake db:migrate'
else
puts 'Skipping rake db:migrate, don\'t forget to run it!'
end
run_migrations = options[:auto_run_migrations] || ['', 'y', 'Y'].include?(ask 'Would you like to run the migrations now? [Y/n]')
if run_migrations
run 'bundle exec rake db:migrate'
else
puts 'Skipping rake db:migrate, don\'t forget to run it!'
end
end
end
end
Expand Down
6 changes: 6 additions & 0 deletions lib/spree_admin_bar/factories.rb
@@ -0,0 +1,6 @@
FactoryGirl.define do
# Define your Spree extensions Factories within this file to enable applications, and other extensions to use and override them.
#
# Example adding this to your spec_helper will load these Factories for use:
# require 'spree_admin_bar/factories'
end
41 changes: 32 additions & 9 deletions spec/spec_helper.rb
Expand Up @@ -4,17 +4,21 @@
require File.expand_path('../dummy/config/environment.rb', __FILE__)

require 'rspec/rails'
require 'database_cleaner'
require 'ffaker'

# Requires supporting ruby files with custom matchers and macros, etc,
# in spec/support/ and its subdirectories.
Dir[File.join(File.dirname(__FILE__), 'support/**/*.rb')].each { |f| require f }

# Requires factories defined in spree_core
require 'spree/core/testing_support/factories'
require 'spree/core/testing_support/controller_requests'
require 'spree/core/testing_support/authorization_helpers'
require 'spree/core/url_helpers'
require 'spree/testing_support/factories'
require 'spree/testing_support/controller_requests'
require 'spree/testing_support/authorization_helpers'
require 'spree/testing_support/url_helpers'

# Requires factories defined in lib/spree_admin_bar/factories.rb
require 'spree_admin_bar/factories'

RSpec.configure do |config|
config.include FactoryGirl::Syntax::Methods
Expand All @@ -25,7 +29,7 @@
#
# visit spree.admin_path
# current_path.should eql(spree.products_path)
config.include Spree::Core::UrlHelpers
config.include Spree::TestingSupport::UrlHelpers

# == Mock Framework
#
Expand All @@ -40,8 +44,27 @@
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
config.fixture_path = "#{::Rails.root}/spec/fixtures"

# If you're not using ActiveRecord, or you'd prefer not to run each of your
# examples within a transaction, remove the following line or assign false
# instead of true.
config.use_transactional_fixtures = true
# Capybara javascript drivers require transactional fixtures set to false, and we use DatabaseCleaner
# to cleanup after each test instead. Without transactional fixtures set to false the records created
# to setup a test will be unavailable to the browser, which runs under a seperate server instance.
config.use_transactional_fixtures = false

# Ensure Suite is set to use transactions for speed.
config.before :suite do
DatabaseCleaner.strategy = :transaction
DatabaseCleaner.clean_with :truncation
end

# Before each spec check if it is a Javascript test and switch between using database transactions or not where necessary.
config.before :each do
DatabaseCleaner.strategy = example.metadata[:js] ? :truncation : :transaction
DatabaseCleaner.start
end

# After each spec clean the database.
config.after :each do
DatabaseCleaner.clean
end

config.fail_fast = ENV['FAIL_FAST'] || false
end
11 changes: 7 additions & 4 deletions spree_admin_bar.gemspec
Expand Up @@ -2,10 +2,10 @@
Gem::Specification.new do |s|
s.platform = Gem::Platform::RUBY
s.name = 'spree_admin_bar'
s.version = '1.3.3'
s.version = '2.0.0'
s.summary = 'Adds an admin bar to a Spree shop font-end.'
s.description = 'Adds an admin bar to a Spree shop font-end to allow an admin user to quickly navigate to the relevant section in the admin pages.'
s.required_ruby_version = '>= 1.8.7'
s.required_ruby_version = '>= 1.9.3'

s.author = 'Stefan Senk'
# s.email = 'you@example.com'
Expand All @@ -16,14 +16,17 @@ Gem::Specification.new do |s|
s.require_path = 'lib'
s.requirements << 'none'

s.add_dependency 'spree_core', '~> 1.3.0'
s.add_dependency 'spree_core', '~> 2.0.0'

s.add_development_dependency 'capybara', '~> 2.0'
s.add_development_dependency 'capybara', '~> 2.1'
s.add_development_dependency 'coffee-rails'
s.add_development_dependency 'database_cleaner', '~> 1.0.0'
s.add_development_dependency 'factory_girl', '~> 4.2'
s.add_development_dependency 'ffaker'
s.add_development_dependency 'rspec-rails', '~> 2.13'
s.add_development_dependency 'sass-rails'
s.add_development_dependency 'selenium-webdriver'
s.add_development_dependency 'simplecov'
s.add_development_dependency 'sqlite3'
s.add_development_dependency 'launchy'
end

0 comments on commit 31e41f5

Please sign in to comment.