alchemy_spree 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 301fe68273f680a0824558febf122a0dbc9af5d7
4
- data.tar.gz: 3852285bdf2a9973c9ab163eee3152d5b447dce0
3
+ metadata.gz: 953d2bd54c42ee048850217613a981122584dfc8
4
+ data.tar.gz: a5e80e786905bf2798eb05b204e0bc07ea78ffac
5
5
  SHA512:
6
- metadata.gz: 2f650b88632215540b284184e17f02358ddfd9b599ecfb142222c623e94519422e5bd004f299b7a55ac42a4f1b8525a4fac957df81407e2fed09f0f6b9eb1960
7
- data.tar.gz: 4d326c6ede1c990b529868f33f2bb9451840c441134d61f7153b99331f42b4f06a67ea1b43f7a508bb43530b872299f5bb131ac5cc783ceb850db7b4386db118
6
+ metadata.gz: c2e878aa1e0ea152da467326b319d7f8de8d7dab31b1fbdbf32936a90dd6ddf7653e16a81890e421fde2ebcd68dbd83dc4f4f4b83a11c0696109d4a63f1d9bec
7
+ data.tar.gz: 3fe19a7605050fa4ac334a256fc7306506e9660784121b80ace70b419368cd6ea5053a507a39989cc2dd3dcc1fdc10dda48ba17c3f744ea655ad5aff83e9f040
data/Gemfile CHANGED
@@ -2,9 +2,3 @@ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in alchemy_spree.gemspec
4
4
  gemspec
5
-
6
- group :developmemt, :test do
7
- gem "spree", github: 'tvdeyen/spree', branch: 'alchemy'
8
- gem 'money', '~> 5.1'
9
- gem 'sqlite3'
10
- end
data/LICENSE CHANGED
@@ -1,22 +1,24 @@
1
- Copyright (c) 2012 magic labs*
1
+ Copyright (c) 2012-14, magic labs*
2
+ All rights reserved.
2
3
 
3
- MIT License
4
+ Redistribution and use in source and binary forms, with or without modification,
5
+ are permitted provided that the following conditions are met:
4
6
 
5
- Permission is hereby granted, free of charge, to any person obtaining
6
- a copy of this software and associated documentation files (the
7
- "Software"), to deal in the Software without restriction, including
8
- without limitation the rights to use, copy, modify, merge, publish,
9
- distribute, sublicense, and/or sell copies of the Software, and to
10
- permit persons to whom the Software is furnished to do so, subject to
11
- the following conditions:
7
+ * Redistributions of source code must retain the above copyright notice,
8
+ this list of conditions and the following disclaimer.
12
9
 
13
- The above copyright notice and this permission notice shall be
14
- included in all copies or substantial portions of the Software.
10
+ * Redistributions in binary form must reproduce the above copyright notice,
11
+ this list of conditions and the following disclaimer in the documentation and/or
12
+ other materials provided with the distribution.
15
13
 
16
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
14
+ * Neither the name of magic labs* nor the names of its contributors may be used to
15
+ endorse or promote products derived from this software without specific prior written permission.
16
+
17
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
18
+ IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
19
+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
20
+ BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
22
+ OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
23
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
24
+ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
data/README.md CHANGED
@@ -10,64 +10,110 @@ This gem is a [Alchemy CMS](https://github.com/magiclabs/alchemy_cms) and [Spree
10
10
  2. It gives you new Essences for Alchemy called EssenceSpreeProduct and EssenceSpreeTaxon that you can use to place a Spree product and Taxon on your pages.
11
11
  3. Shares admin session between Alchemy and Spree.
12
12
 
13
+ ### Compatibility
14
+
15
+ ## Spree
16
+
17
+ This version runs with Spreecommerce 2.1 and above.
18
+
19
+ ## Alchemy
20
+
21
+ This version runs with Alchemy 3.0
22
+
13
23
  ## Installation
14
24
 
15
25
  Add this line to your application's Gemfile:
16
26
 
17
- gem 'alchemy_spree'
27
+ ```ruby
28
+ gem 'alchemy_spree', github: 'magiclabs/alchemy_spree', branch: 'master'
29
+ ```
18
30
 
19
31
  And then execute:
20
32
 
21
- $ bundle
22
-
23
- Or install it yourself as:
24
-
25
- $ gem install alchemy_spree
33
+ ```sh
34
+ $ bundle
35
+ ```
26
36
 
27
37
  Install the migrations:
28
38
 
29
- $ rake alchemy_spree:install:migrations
39
+ ```sh
40
+ $ rake alchemy_spree:install:migrations
41
+ ```
30
42
 
31
43
  Migrate the database:
32
44
 
33
- $ rake db:migrate
45
+ ```sh
46
+ $ rake db:migrate
47
+ ```
48
+
49
+ ### Authentication system installation
50
+
51
+ Since Alchemy 3.0 has dropped the authentication from its core, you will need to choose one authentication system. The easiest choice is to use the [alchemy-devise gem](https://github.com/magiclabs/alchemy-devise).
52
+
53
+ To install alchemy-devise:
54
+
55
+ ```ruby
56
+ # Gemfile
57
+ gem 'alchemy-devise', '~> 2.0'
58
+ ```
59
+
60
+ And then execute:
61
+
62
+ ```sh
63
+ $ bundle
64
+ ```
65
+
66
+ Finally, you'll need to instruct Spree accordingly:
67
+
68
+ ```ruby
69
+ # config/initializers/spree.rb
70
+ Spree.user_class = "Alchemy::User"
71
+ ```
34
72
 
35
73
  ## Usage
36
74
 
37
75
  ### Create a new Element for Alchemy
38
76
 
39
- # config/alchemy/elements.yml
40
- - name: product
41
- contents:
42
- - name: spree_product
43
- type: EssenceSpreeProduct
77
+ ```yaml
78
+ # config/alchemy/elements.yml
79
+ - name: product
80
+ contents:
81
+ - name: spree_product
82
+ type: EssenceSpreeProduct
44
83
 
45
- - name: product_category
46
- contents:
47
- - name: spree_taxon
48
- type: EssenceSpreeTaxon
84
+ - name: product_category
85
+ contents:
86
+ - name: spree_taxon
87
+ type: EssenceSpreeTaxon
88
+ ```
49
89
 
50
90
  ### Generate the views
51
91
 
52
- $ rails g alchemy:elements --skip
92
+ ```sh
93
+ $ rails g alchemy:elements --skip
94
+ ```
53
95
 
54
96
  ### Place this element on a page layout
55
97
 
56
- # config/alchemy/page_layouts.yml
57
- - name: product
58
- elements: [product]
59
- - name: products
60
- elements: [product_category]
98
+ ```yaml
99
+ # config/alchemy/page_layouts.yml
100
+ - name: product
101
+ elements: [product]
102
+ - name: products
103
+ elements: [product_category]
104
+ ```
61
105
 
62
106
  ### You can haz Spree product and taxons!
63
107
 
64
- # app/views/alchemy/elements/_product_view.html.erb
65
- <%= element.ingredient('spree_product') %>
108
+ ```erb
109
+ # app/views/alchemy/elements/_product_view.html.erb
110
+ <%= element.ingredient('spree_product') %>
66
111
 
67
- # app/views/alchemy/elements/_product_category_view.html.erb
68
- <%= element.ingredient('spree_taxon') %>
112
+ # app/views/alchemy/elements/_product_category_view.html.erb
113
+ <%= element.ingredient('spree_taxon') %>
114
+ ```
69
115
 
70
- Alchemy <3 Spree!
116
+ Alchemy :heart: Spree!
71
117
 
72
118
  ## Contributing
73
119
 
@@ -1,3 +1,5 @@
1
- '1.0.x' => {:branch => 'master'}
2
- '1.1.x' => {:branch => 'master'}
3
- '1.2.x' => {:branch => 'master'}
1
+ "2.4.x" => { :branch => "master" }
2
+ "2.3.x" => { :branch => "master" }
3
+ "2.2.x" => { :branch => "0.3-stable" }
4
+ "2.1.x" => { :branch => "0.3-stable" }
5
+ "2.0.x" => { :branch => "0.2-stable" }
@@ -6,8 +6,8 @@ Gem::Specification.new do |gem|
6
6
  gem.email = ["tvd@magiclabs.de"]
7
7
  gem.description = %q{A Alchemy CMS and Spree connector}
8
8
  gem.summary = %q{The World's Most Flexible E-Commerce Platform meets The World's Most Flexible Content Management System!}
9
- gem.homepage = "https://github.com/magiclabs/alchemy_spree"
10
-
9
+ gem.homepage = "https://github.com/AlchemyCMS/alchemy_spree"
10
+ gem.license = 'BSD New'
11
11
  gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
12
12
  gem.files = `git ls-files`.split("\n")
13
13
  gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
@@ -15,6 +15,6 @@ Gem::Specification.new do |gem|
15
15
  gem.require_paths = ["lib"]
16
16
  gem.version = Alchemy::Spree::VERSION
17
17
 
18
- gem.add_dependency('alchemy_cms', ['~> 2.7.0'])
19
- gem.add_dependency('spree', ['~> 2.0.0'])
18
+ gem.add_dependency('alchemy_cms', ['~> 3.0.0'])
19
+ gem.add_dependency('spree', ['>= 2.1', '< 2.3'])
20
20
  end
@@ -1,5 +1,6 @@
1
1
  class Alchemy::Admin::SpreeController < Alchemy::Admin::BaseController
2
2
  def index
3
+ authorize! :index, :alchemy_admin_spree
3
4
  render
4
5
  end
5
6
  end
@@ -1,14 +1,12 @@
1
1
  module Alchemy
2
2
  class EssenceSpreeProduct < ActiveRecord::Base
3
- belongs_to :product, class_name: "Spree::Product", foreign_key: 'spree_product_id', readonly: true
3
+ belongs_to :product, class_name: "Spree::Product", foreign_key: 'spree_product_id'
4
4
 
5
5
  acts_as_essence(
6
6
  ingredient_column: 'spree_product_id',
7
7
  preview_text_method: 'name'
8
8
  )
9
9
 
10
- attr_accessible :spree_product_id
11
-
12
10
  def ingredient
13
11
  product
14
12
  end
@@ -1,14 +1,12 @@
1
1
  module Alchemy
2
2
  class EssenceSpreeTaxon < ActiveRecord::Base
3
- belongs_to :taxon, class_name: "Spree::Taxon", foreign_key: 'taxon_id', readonly: true
3
+ belongs_to :taxon, class_name: "Spree::Taxon", foreign_key: 'taxon_id'
4
4
 
5
5
  acts_as_essence(
6
6
  ingredient_column: 'taxon_id',
7
7
  preview_text_method: 'name'
8
8
  )
9
9
 
10
- attr_accessible :taxon_id
11
-
12
10
  def ingredient
13
11
  taxon
14
12
  end
@@ -5,6 +5,6 @@ Alchemy::Modules.register_module({
5
5
  controller: 'alchemy/admin/spree',
6
6
  action: 'index',
7
7
  name: 'Spree',
8
- image: '/assets/alchemy_spree/alchemy_module_icon.png'
8
+ image: 'alchemy_spree/alchemy_module_icon.png'
9
9
  }
10
10
  })
@@ -1,3 +1,3 @@
1
- Alchemy::Engine.routes.prepend do
1
+ Alchemy::Engine.routes.draw do
2
2
  get '/admin/spree' => 'admin/spree#index', :as => :spree_admin
3
3
  end
@@ -0,0 +1,14 @@
1
+ module Alchemy
2
+ module Spree
3
+ class Ability
4
+ include CanCan::Ability
5
+
6
+ def initialize(user)
7
+ if user && user.is_admin?
8
+ can :index, :alchemy_admin_spree
9
+ end
10
+ end
11
+
12
+ end
13
+ end
14
+ end
@@ -1,4 +1,6 @@
1
+ require 'alchemy/spree/ability'
1
2
  require 'alchemy/spree/alchemy_language_store'
3
+ require 'spree'
2
4
 
3
5
  module Alchemy
4
6
  module Spree
@@ -14,7 +16,7 @@ module Alchemy
14
16
  Dir.glob(File.join(File.dirname(__FILE__), "../../../app/**/*_decorator*.rb")) do |c|
15
17
  Rails.configuration.cache_classes ? require(c) : load(c)
16
18
  end
17
- Alchemy::Auth::Engine.get_instance.load(File.join(File.dirname(__FILE__), '../..', 'config/authorization_rules.rb'))
19
+ Alchemy.register_ability(Alchemy::Spree::Ability)
18
20
  end
19
21
 
20
22
  config.to_prepare &method(:activate).to_proc
@@ -1,5 +1,5 @@
1
1
  module Alchemy
2
2
  module Spree
3
- VERSION = "0.2.0"
3
+ VERSION = "0.3.0"
4
4
  end
5
5
  end
@@ -26,3 +26,4 @@ module Spree
26
26
  end
27
27
 
28
28
  ApplicationController.send :include, Spree::AuthenticationHelpers
29
+ Spree::Api::BaseController.send :include, Spree::AuthenticationHelpers
metadata CHANGED
@@ -1,43 +1,49 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: alchemy_spree
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thomas von Deyen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-11-07 00:00:00.000000000 Z
11
+ date: 2015-01-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: alchemy_cms
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 2.7.0
19
+ version: 3.0.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 2.7.0
26
+ version: 3.0.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: spree
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: 2.0.0
33
+ version: '2.1'
34
+ - - "<"
35
+ - !ruby/object:Gem::Version
36
+ version: '2.3'
34
37
  type: :runtime
35
38
  prerelease: false
36
39
  version_requirements: !ruby/object:Gem::Requirement
37
40
  requirements:
38
- - - ~>
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: '2.1'
44
+ - - "<"
39
45
  - !ruby/object:Gem::Version
40
- version: 2.0.0
46
+ version: '2.3'
41
47
  description: A Alchemy CMS and Spree connector
42
48
  email:
43
49
  - tvd@magiclabs.de
@@ -45,7 +51,7 @@ executables: []
45
51
  extensions: []
46
52
  extra_rdoc_files: []
47
53
  files:
48
- - .gitignore
54
+ - ".gitignore"
49
55
  - Gemfile
50
56
  - LICENSE
51
57
  - README.md
@@ -64,12 +70,12 @@ files:
64
70
  - app/views/alchemy/essences/_essence_spree_product_view.html.erb
65
71
  - app/views/alchemy/essences/_essence_spree_taxon_editor.html.erb
66
72
  - app/views/alchemy/essences/_essence_spree_taxon_view.html.erb
67
- - config/authorization_rules.rb
68
73
  - config/initializers/alchemy.rb
69
74
  - config/routes.rb
70
75
  - db/migrate/20120229160509_create_alchemy_essence_spree_products.rb
71
76
  - db/migrate/20131029215548_add_spree_fields_to_custom_user_table.rb
72
77
  - db/migrate/20131030140218_create_alchemy_essence_spree_taxons.rb
78
+ - lib/alchemy/spree/ability.rb
73
79
  - lib/alchemy/spree/alchemy_language_store.rb
74
80
  - lib/alchemy/spree/engine.rb
75
81
  - lib/alchemy/spree/version.rb
@@ -110,8 +116,9 @@ files:
110
116
  - test/dummy/script/rails
111
117
  - test/integration/navigation_test.rb
112
118
  - test/test_helper.rb
113
- homepage: https://github.com/magiclabs/alchemy_spree
114
- licenses: []
119
+ homepage: https://github.com/AlchemyCMS/alchemy_spree
120
+ licenses:
121
+ - BSD New
115
122
  metadata: {}
116
123
  post_install_message:
117
124
  rdoc_options: []
@@ -119,17 +126,17 @@ require_paths:
119
126
  - lib
120
127
  required_ruby_version: !ruby/object:Gem::Requirement
121
128
  requirements:
122
- - - '>='
129
+ - - ">="
123
130
  - !ruby/object:Gem::Version
124
131
  version: '0'
125
132
  required_rubygems_version: !ruby/object:Gem::Requirement
126
133
  requirements:
127
- - - '>='
134
+ - - ">="
128
135
  - !ruby/object:Gem::Version
129
136
  version: '0'
130
137
  requirements: []
131
138
  rubyforge_project:
132
- rubygems_version: 2.1.10
139
+ rubygems_version: 2.4.3
133
140
  signing_key:
134
141
  specification_version: 4
135
142
  summary: The World's Most Flexible E-Commerce Platform meets The World's Most Flexible
@@ -1,5 +0,0 @@
1
- authorization do
2
- role :admin do
3
- has_permission_on :alchemy_admin_spree, :to => [:index]
4
- end
5
- end