alchemy_spree 0.3.0 → 1.0.0.beta

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: 953d2bd54c42ee048850217613a981122584dfc8
4
- data.tar.gz: a5e80e786905bf2798eb05b204e0bc07ea78ffac
3
+ metadata.gz: c85623e15a5d44f28558ce70f514589423e5418c
4
+ data.tar.gz: faeeec7cef1249a91eaa03bfba29f35f7c577198
5
5
  SHA512:
6
- metadata.gz: c2e878aa1e0ea152da467326b319d7f8de8d7dab31b1fbdbf32936a90dd6ddf7653e16a81890e421fde2ebcd68dbd83dc4f4f4b83a11c0696109d4a63f1d9bec
7
- data.tar.gz: 3fe19a7605050fa4ac334a256fc7306506e9660784121b80ace70b419368cd6ea5053a507a39989cc2dd3dcc1fdc10dda48ba17c3f744ea655ad5aff83e9f040
6
+ metadata.gz: 300e1ba2611427bf96a7a697485d2d7a5fd9cd65821a48ba2102b8ef81c391d37dc0b36ef0e34ea2e9f182ae6df071346379dc6b0d11212e1e4c243a152e852f
7
+ data.tar.gz: e49b7e103f6341e765ca5e2e6c82b460815968c098744a017a662c98f768f15845282af4d84a5d43f8cf91c2a90b8fedc0067d5a2ca630ccf3589567e536c95b
data/README.md CHANGED
@@ -18,7 +18,7 @@ This version runs with Spreecommerce 2.1 and above.
18
18
 
19
19
  ## Alchemy
20
20
 
21
- This version runs with Alchemy 3.0
21
+ This version runs with Alchemy 3.0 and above.
22
22
 
23
23
  ## Installation
24
24
 
@@ -28,48 +28,126 @@ Add this line to your application's Gemfile:
28
28
  gem 'alchemy_spree', github: 'magiclabs/alchemy_spree', branch: 'master'
29
29
  ```
30
30
 
31
- And then execute:
31
+ Install the gem with:
32
32
 
33
- ```sh
34
- $ bundle
33
+ ```shell
34
+ $ bundle install
35
35
  ```
36
36
 
37
- Install the migrations:
37
+ ### Authentication system installation
38
38
 
39
- ```sh
40
- $ rake alchemy_spree:install:migrations
41
- ```
39
+ Both Alchemy 3.0 and Spree come without an authentication system in place. You will need to choose an authentication system yourself. There are 3 available options. Whichever you choose, you need to instruct Spree & Alchemy about your choice of authentication system.
42
40
 
43
- Migrate the database:
41
+ Here are the steps for each option:
44
42
 
45
- ```sh
46
- $ rake db:migrate
43
+ #### 1. Option: Use [Spree Auth Devise](https://github.com/spree/spree_auth_devise)
44
+
45
+ **Recommended for:**
46
+ - An existing Spree installation (`gem 'spree_auth_devise'` should already be in your Gemfile).
47
+ - You are just adding Alchemy
48
+
49
+ To use Spree Auth Devise, instruct Alchemy to use the `Spree::User` class:
50
+
51
+ ```ruby
52
+ # config/initializers/alchemy.rb
53
+
54
+ # Tell Alchemy to use the Spree::User class
55
+ Alchemy.user_class_name = 'Spree::User'
56
+ Alchemy.current_user_method = :spree_current_user
57
+
58
+ # Load the Spree.user_class decorator for Alchemy roles
59
+ require 'alchemy/spree/spree_user_decorator'
60
+
61
+ # Include the Spree controller helpers to render the
62
+ # alchemy pages within the default Spree layout
63
+ Alchemy::BaseHelper.send :include, Spree::BaseHelper
64
+ Alchemy::BaseController.send :include, Spree::Core::ControllerHelpers::Common
65
+ Alchemy::BaseController.send :include, Spree::Core::ControllerHelpers::Store
47
66
  ```
48
67
 
49
- ### Authentication system installation
68
+ #### 2. Option: Use [Alchemy Devise](https://github.com/magiclabs/alchemy-devise)
50
69
 
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).
70
+ **Recommended for:**
71
+ - An existing Alchemy installation
72
+ - You don't have an authentication system and don't want to role an authentication system on your own.
52
73
 
53
- To install alchemy-devise:
74
+ Add `alchemy-devise` to your `Gemfile`
54
75
 
55
76
  ```ruby
56
77
  # Gemfile
57
78
  gem 'alchemy-devise', '~> 2.0'
58
79
  ```
59
80
 
60
- And then execute:
81
+ and install it:
61
82
 
62
- ```sh
63
- $ bundle
83
+ ```shell
84
+ $ bundle install
85
+ $ bundle exec rails g alchemy:devise:install
86
+ ```
87
+
88
+ Run the Spree installer:
89
+
90
+ *NOTE*: Skip this if you already have a running Spree installation.
91
+
92
+ ```shell
93
+ $ bundle exec rails g spree:install
64
94
  ```
65
95
 
66
- Finally, you'll need to instruct Spree accordingly:
96
+ Then run the spree custom user generator:
97
+
98
+ ```shell
99
+ $ bundle exec rails g spree:custom_user Alchemy::User
100
+ ```
101
+
102
+ Now you'll need to instruct Spree to use the Alchemy User class:
67
103
 
68
104
  ```ruby
69
105
  # config/initializers/spree.rb
106
+ ...
70
107
  Spree.user_class = "Alchemy::User"
108
+ require 'alchemy/spree/alchemy_user_decorator'
109
+ ...
71
110
  ```
72
111
 
112
+ and tell Spree about Alchemy's path helpers:
113
+
114
+ ```ruby
115
+ # lib/spree/authentication_helpers.rb
116
+ ...
117
+ def spree_login_path
118
+ alchemy.login_path
119
+ end
120
+
121
+ def spree_signup_path
122
+ alchemy.signup_path
123
+ end
124
+
125
+ def spree_logout_path
126
+ alchemy.logout_path
127
+ end
128
+ ...
129
+ ```
130
+
131
+ #### 3. Option: Build their own authentication
132
+
133
+ Please follow the [spree custom authentication](https://guides.spreecommerce.com/developer/authentication.html) and the [Alchemy custom authentication](http://guides.alchemy-cms.com/edge/custom_authentication.html) guides in order to integrate your custom user with Spree and Alchemy.
134
+
135
+ #### In either case
136
+
137
+ Install the migrations
138
+
139
+ ```shell
140
+ $ bundle exec rake alchemy_spree:install:migrations
141
+ ```
142
+
143
+ Run the installer of Alchemy
144
+
145
+ ```shell
146
+ $ bundle exec rake alchemy:install
147
+ ```
148
+
149
+ and follow the on screen instructions.
150
+
73
151
  ## Usage
74
152
 
75
153
  ### Create a new Element for Alchemy
@@ -6,7 +6,7 @@ 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/AlchemyCMS/alchemy_spree"
9
+ gem.homepage = "https://github.com/magiclabs/alchemy_spree"
10
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")
@@ -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', ['~> 3.0.0'])
19
- gem.add_dependency('spree', ['>= 2.1', '< 2.3'])
18
+ gem.add_dependency('alchemy_cms', ['>= 3.1.0.rc1', '< 3.2'])
19
+ gem.add_dependency('spree', ['>= 2.3', '< 3.0'])
20
20
  end
@@ -4,11 +4,10 @@ module Alchemy
4
4
  include CanCan::Ability
5
5
 
6
6
  def initialize(user)
7
- if user && user.is_admin?
7
+ if user && user.alchemy_roles.include?('admin')
8
8
  can :index, :alchemy_admin_spree
9
9
  end
10
10
  end
11
-
12
11
  end
13
12
  end
14
13
  end
@@ -7,5 +7,4 @@ Alchemy::User.class_eval do
7
7
  ::Spree::Role.where('1 = 0') # aka. empty relation
8
8
  end
9
9
  end
10
-
11
10
  end
@@ -7,11 +7,6 @@ module Alchemy
7
7
  class Engine < ::Rails::Engine
8
8
  engine_name 'alchemy_spree'
9
9
 
10
- initializer 'spree.user_class', after: 'alchemy.include_authentication_helpers' do
11
- ::Spree.user_class = "Alchemy::User"
12
- require File.join(File.dirname(__FILE__), '../../spree/authentication_helpers')
13
- end
14
-
15
10
  def self.activate
16
11
  Dir.glob(File.join(File.dirname(__FILE__), "../../../app/**/*_decorator*.rb")) do |c|
17
12
  Rails.configuration.cache_classes ? require(c) : load(c)
@@ -0,0 +1,10 @@
1
+ Spree::User.class_eval do
2
+
3
+ def alchemy_roles
4
+ if has_spree_role?(:admin)
5
+ %w(admin)
6
+ else
7
+ []
8
+ end
9
+ end
10
+ end
@@ -1,5 +1,5 @@
1
1
  module Alchemy
2
2
  module Spree
3
- VERSION = "0.3.0"
3
+ VERSION = "1.0.0.beta"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: alchemy_spree
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 1.0.0.beta
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thomas von Deyen
@@ -14,36 +14,42 @@ dependencies:
14
14
  name: alchemy_cms
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 3.1.0.rc1
20
+ - - "<"
18
21
  - !ruby/object:Gem::Version
19
- version: 3.0.0
22
+ version: '3.2'
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
24
- - - "~>"
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ version: 3.1.0.rc1
30
+ - - "<"
25
31
  - !ruby/object:Gem::Version
26
- version: 3.0.0
32
+ version: '3.2'
27
33
  - !ruby/object:Gem::Dependency
28
34
  name: spree
29
35
  requirement: !ruby/object:Gem::Requirement
30
36
  requirements:
31
37
  - - ">="
32
38
  - !ruby/object:Gem::Version
33
- version: '2.1'
39
+ version: '2.3'
34
40
  - - "<"
35
41
  - !ruby/object:Gem::Version
36
- version: '2.3'
42
+ version: '3.0'
37
43
  type: :runtime
38
44
  prerelease: false
39
45
  version_requirements: !ruby/object:Gem::Requirement
40
46
  requirements:
41
47
  - - ">="
42
48
  - !ruby/object:Gem::Version
43
- version: '2.1'
49
+ version: '2.3'
44
50
  - - "<"
45
51
  - !ruby/object:Gem::Version
46
- version: '2.3'
52
+ version: '3.0'
47
53
  description: A Alchemy CMS and Spree connector
48
54
  email:
49
55
  - tvd@magiclabs.de
@@ -64,7 +70,6 @@ files:
64
70
  - app/controllers/spree/user_sessions_controller_decorator.rb
65
71
  - app/models/alchemy/essence_spree_product.rb
66
72
  - app/models/alchemy/essence_spree_taxon.rb
67
- - app/models/alchemy/user_decorator.rb
68
73
  - app/views/alchemy/admin/spree/index.html.erb
69
74
  - app/views/alchemy/essences/_essence_spree_product_editor.html.erb
70
75
  - app/views/alchemy/essences/_essence_spree_product_view.html.erb
@@ -73,14 +78,14 @@ files:
73
78
  - config/initializers/alchemy.rb
74
79
  - config/routes.rb
75
80
  - db/migrate/20120229160509_create_alchemy_essence_spree_products.rb
76
- - db/migrate/20131029215548_add_spree_fields_to_custom_user_table.rb
77
81
  - db/migrate/20131030140218_create_alchemy_essence_spree_taxons.rb
78
82
  - lib/alchemy/spree/ability.rb
79
83
  - lib/alchemy/spree/alchemy_language_store.rb
84
+ - lib/alchemy/spree/alchemy_user_decorator.rb
80
85
  - lib/alchemy/spree/engine.rb
86
+ - lib/alchemy/spree/spree_user_decorator.rb
81
87
  - lib/alchemy/spree/version.rb
82
88
  - lib/alchemy_spree.rb
83
- - lib/spree/authentication_helpers.rb
84
89
  - script/rails
85
90
  - test/alchemy_spree_test.rb
86
91
  - test/dummy/Rakefile
@@ -116,7 +121,7 @@ files:
116
121
  - test/dummy/script/rails
117
122
  - test/integration/navigation_test.rb
118
123
  - test/test_helper.rb
119
- homepage: https://github.com/AlchemyCMS/alchemy_spree
124
+ homepage: https://github.com/magiclabs/alchemy_spree
120
125
  licenses:
121
126
  - BSD New
122
127
  metadata: {}
@@ -131,9 +136,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
131
136
  version: '0'
132
137
  required_rubygems_version: !ruby/object:Gem::Requirement
133
138
  requirements:
134
- - - ">="
139
+ - - ">"
135
140
  - !ruby/object:Gem::Version
136
- version: '0'
141
+ version: 1.3.1
137
142
  requirements: []
138
143
  rubyforge_project:
139
144
  rubygems_version: 2.4.3
@@ -1,7 +0,0 @@
1
- class AddSpreeFieldsToCustomUserTable < ActiveRecord::Migration
2
- def up
3
- add_column "alchemy_users", :spree_api_key, :string, :limit => 48
4
- add_column "alchemy_users", :ship_address_id, :integer
5
- add_column "alchemy_users", :bill_address_id, :integer
6
- end
7
- end
@@ -1,29 +0,0 @@
1
- module Spree
2
- module AuthenticationHelpers
3
- def self.included(receiver)
4
- receiver.send :helper_method, :spree_login_path
5
- receiver.send :helper_method, :spree_signup_path
6
- receiver.send :helper_method, :spree_logout_path
7
- receiver.send :helper_method, :spree_current_user
8
- end
9
-
10
- def spree_current_user
11
- current_user
12
- end
13
-
14
- def spree_login_path
15
- alchemy.login_path
16
- end
17
-
18
- def spree_signup_path
19
- alchemy.signup_path
20
- end
21
-
22
- def spree_logout_path
23
- alchemy.logout_path
24
- end
25
- end
26
- end
27
-
28
- ApplicationController.send :include, Spree::AuthenticationHelpers
29
- Spree::Api::BaseController.send :include, Spree::AuthenticationHelpers