Remove solidus_cmd
This only existed to provide `spree new` for creating new applications. I believe it is less confusing to have the install generator be the only method of installation.
This commit is contained in:
parent
f2ed7697f5
commit
1d77c8053b
26
cmd/LICENSE
26
cmd/LICENSE
@ -1,26 +0,0 @@
|
|||||||
Copyright (c) 2007-2014, Spree Commerce, Inc. and other contributors
|
|
||||||
All rights reserved.
|
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without modification,
|
|
||||||
are permitted provided that the following conditions are met:
|
|
||||||
|
|
||||||
* Redistributions of source code must retain the above copyright notice,
|
|
||||||
this list of conditions and the following disclaimer.
|
|
||||||
* Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
this list of conditions and the following disclaimer in the documentation
|
|
||||||
and/or other materials provided with the distribution.
|
|
||||||
* Neither the name Spree nor the names of its contributors may be used to
|
|
||||||
endorse or promote products derived from this software without specific
|
|
||||||
prior written permission.
|
|
||||||
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
||||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
|
||||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
|
||||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
|
||||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
|
||||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
|
||||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
||||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
||||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@ -1,65 +0,0 @@
|
|||||||
Spree Installer
|
|
||||||
===============
|
|
||||||
|
|
||||||
**Until the release of Spree 1.0 you must use the --edge option**
|
|
||||||
|
|
||||||
Command line utility to create new Spree store applications
|
|
||||||
and extensions
|
|
||||||
|
|
||||||
See the main spree project: https://github.com/spree/spree
|
|
||||||
|
|
||||||
Installation
|
|
||||||
------------
|
|
||||||
|
|
||||||
```ruby
|
|
||||||
gem install spree_cmd
|
|
||||||
```
|
|
||||||
This will make the command line utility 'spree' available.
|
|
||||||
|
|
||||||
You can add Spree to an existing rails application
|
|
||||||
|
|
||||||
```ruby
|
|
||||||
rails new my_app
|
|
||||||
spree install my_app
|
|
||||||
```
|
|
||||||
|
|
||||||
Extensions
|
|
||||||
----------
|
|
||||||
|
|
||||||
To build a new Spree Extension, you can run
|
|
||||||
```ruby
|
|
||||||
spree extension my_extension
|
|
||||||
```
|
|
||||||
Examples
|
|
||||||
--------
|
|
||||||
|
|
||||||
If you want to accept all the defaults pass --auto_accept
|
|
||||||
|
|
||||||
spree install my_store --edge --auto_accept
|
|
||||||
|
|
||||||
to use a local clone of Spree, pass the --path option
|
|
||||||
|
|
||||||
spree install my_store --path=../spree
|
|
||||||
|
|
||||||
|
|
||||||
Options
|
|
||||||
-------
|
|
||||||
|
|
||||||
* `--auto_accept` to answer yes to all questions
|
|
||||||
* `--edge` to use the edge version of Spree
|
|
||||||
* `--path=../spree` to use a local version of spree
|
|
||||||
* `--branch=n-n-stable` to use git branch
|
|
||||||
* `--git=git@github.com:cmar/spree.git` to use git version of spree
|
|
||||||
* `--ref=23423423423423` to use git reference
|
|
||||||
* `--tag=my_tag` to use git tag
|
|
||||||
|
|
||||||
Older Versions of Spree
|
|
||||||
-----------------------
|
|
||||||
|
|
||||||
Versions of the Spree gem before 1.0 included a spree binary. If you
|
|
||||||
have one of these installed in your gemset, then you can alternatively
|
|
||||||
use the command line utility "spree_cmd". For example "spree_cmd install
|
|
||||||
my_app".
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,6 +0,0 @@
|
|||||||
require "bundler/gem_tasks"
|
|
||||||
|
|
||||||
desc 'alias for :build to work with other spree gems'
|
|
||||||
task :gem => :build do
|
|
||||||
|
|
||||||
end
|
|
@ -1,2 +0,0 @@
|
|||||||
#!/usr/bin/env ruby
|
|
||||||
require 'spree_cmd'
|
|
@ -1,2 +0,0 @@
|
|||||||
#!/usr/bin/env ruby
|
|
||||||
require 'spree_cmd'
|
|
@ -1 +0,0 @@
|
|||||||
require 'spree_cmd'
|
|
@ -1,15 +0,0 @@
|
|||||||
require 'thor'
|
|
||||||
require 'thor/group'
|
|
||||||
|
|
||||||
case ARGV.first
|
|
||||||
when 'version', '-v', '--version'
|
|
||||||
puts Gem.loaded_specs['spree_cmd'].version
|
|
||||||
when 'extension'
|
|
||||||
ARGV.shift
|
|
||||||
require 'spree_cmd/extension'
|
|
||||||
SpreeCmd::Extension.start
|
|
||||||
else
|
|
||||||
ARGV.shift
|
|
||||||
require 'spree_cmd/installer'
|
|
||||||
SpreeCmd::Installer.start
|
|
||||||
end
|
|
@ -1,64 +0,0 @@
|
|||||||
module SpreeCmd
|
|
||||||
|
|
||||||
class Extension < Thor::Group
|
|
||||||
include Thor::Actions
|
|
||||||
|
|
||||||
desc "builds a spree extension"
|
|
||||||
argument :file_name, :type => :string, :desc => 'rails app_path', :default => '.'
|
|
||||||
|
|
||||||
source_root File.expand_path('../templates/extension', __FILE__)
|
|
||||||
|
|
||||||
def generate
|
|
||||||
use_prefix 'spree_'
|
|
||||||
|
|
||||||
empty_directory file_name
|
|
||||||
|
|
||||||
directory 'app', "#{file_name}/app"
|
|
||||||
directory 'lib', "#{file_name}/lib"
|
|
||||||
directory 'bin', "#{file_name}/bin"
|
|
||||||
|
|
||||||
template 'extension.gemspec', "#{file_name}/#{file_name}.gemspec"
|
|
||||||
template 'Gemfile', "#{file_name}/Gemfile"
|
|
||||||
template 'gitignore', "#{file_name}/.gitignore"
|
|
||||||
template 'LICENSE', "#{file_name}/LICENSE"
|
|
||||||
template 'Rakefile', "#{file_name}/Rakefile"
|
|
||||||
template 'README.md', "#{file_name}/README.md"
|
|
||||||
template 'config/routes.rb', "#{file_name}/config/routes.rb"
|
|
||||||
template 'config/locales/en.yml', "#{file_name}/config/locales/en.yml"
|
|
||||||
template 'rspec', "#{file_name}/.rspec"
|
|
||||||
template 'spec/spec_helper.rb.tt', "#{file_name}/spec/spec_helper.rb"
|
|
||||||
end
|
|
||||||
|
|
||||||
def final_banner
|
|
||||||
say %Q{
|
|
||||||
#{'*' * 80}
|
|
||||||
|
|
||||||
Your extension has been generated with a gemspec dependency on Spree #{spree_version}.
|
|
||||||
|
|
||||||
Please update the Versionfile to designate compatibility with different versions of Spree.
|
|
||||||
See http://spreecommerce.com/documentation/extensions.html#versionfile
|
|
||||||
|
|
||||||
Consider listing your extension in the official extension registry http://spreecommerce.com/extensions
|
|
||||||
|
|
||||||
#{'*' * 80}
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
no_tasks do
|
|
||||||
def class_name
|
|
||||||
Thor::Util.camel_case file_name
|
|
||||||
end
|
|
||||||
|
|
||||||
def spree_version
|
|
||||||
'2.4.6.beta'
|
|
||||||
end
|
|
||||||
|
|
||||||
def use_prefix(prefix)
|
|
||||||
unless file_name =~ /^#{prefix}/
|
|
||||||
@file_name = prefix + Thor::Util.snake_case(file_name)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
end
|
|
@ -1,197 +0,0 @@
|
|||||||
require 'rbconfig'
|
|
||||||
require 'active_support/core_ext/string'
|
|
||||||
|
|
||||||
module SpreeCmd
|
|
||||||
|
|
||||||
class Installer < Thor::Group
|
|
||||||
include Thor::Actions
|
|
||||||
|
|
||||||
desc 'Creates a new rails project with a spree store'
|
|
||||||
argument :app_path, :type => :string, :desc => 'rails app_path', :default => '.'
|
|
||||||
|
|
||||||
class_option :auto_accept, :type => :boolean, :aliases => '-A',
|
|
||||||
:desc => 'Answer yes to all prompts'
|
|
||||||
|
|
||||||
class_option :skip_install_data, :type => :boolean, :default => false,
|
|
||||||
:desc => 'Skip running migrations and loading seed and sample data'
|
|
||||||
|
|
||||||
class_option :version, :type => :string, :desc => 'Spree Version to use'
|
|
||||||
|
|
||||||
class_option :edge, :type => :boolean
|
|
||||||
|
|
||||||
class_option :path, :type => :string, :desc => 'Spree gem path'
|
|
||||||
class_option :git, :type => :string, :desc => 'Spree gem git url'
|
|
||||||
class_option :ref, :type => :string, :desc => 'Spree gem git ref'
|
|
||||||
class_option :branch, :type => :string, :desc => 'Spree gem git branch'
|
|
||||||
class_option :tag, :type => :string, :desc => 'Spree gem git tag'
|
|
||||||
|
|
||||||
def verify_rails
|
|
||||||
unless rails_project?
|
|
||||||
say "#{@app_path} is not a rails project."
|
|
||||||
exit 1
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def verify_image_magick
|
|
||||||
unless image_magick_installed?
|
|
||||||
say "Image magick must be installed."
|
|
||||||
exit 1
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def prepare_options
|
|
||||||
@spree_gem_options = {}
|
|
||||||
|
|
||||||
if options[:edge] || options[:branch]
|
|
||||||
@spree_gem_options[:git] = 'https://github.com/spree/spree.git'
|
|
||||||
elsif options[:path]
|
|
||||||
@spree_gem_options[:path] = options[:path]
|
|
||||||
elsif options[:git]
|
|
||||||
@spree_gem_options[:git] = options[:git]
|
|
||||||
@spree_gem_options[:ref] = options[:ref] if options[:ref]
|
|
||||||
@spree_gem_options[:tag] = options[:tag] if options[:tag]
|
|
||||||
elsif options[:version]
|
|
||||||
@spree_gem_options[:version] = options[:version]
|
|
||||||
else
|
|
||||||
version = Gem.loaded_specs['spree_cmd'].version
|
|
||||||
@spree_gem_options[:version] = version.to_s
|
|
||||||
end
|
|
||||||
|
|
||||||
@spree_gem_options[:branch] = options[:branch] if options[:branch]
|
|
||||||
end
|
|
||||||
|
|
||||||
def ask_questions
|
|
||||||
@install_default_gateways = ask_with_default('Would you like to install the default gateways? (Recommended)')
|
|
||||||
@install_default_auth = ask_with_default('Would you like to install the default authentication system?')
|
|
||||||
|
|
||||||
if @install_default_auth
|
|
||||||
@user_class = "Spree::User"
|
|
||||||
else
|
|
||||||
@user_class = ask("What is the name of the class representing users within your application? [User]")
|
|
||||||
if @user_class.blank?
|
|
||||||
@user_class = "User"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
if options[:skip_install_data]
|
|
||||||
@run_migrations = false
|
|
||||||
@load_seed_data = false
|
|
||||||
@load_sample_data = false
|
|
||||||
else
|
|
||||||
@run_migrations = ask_with_default('Would you like to run the migrations?')
|
|
||||||
if @run_migrations
|
|
||||||
@load_seed_data = ask_with_default('Would you like to load the seed data?')
|
|
||||||
@load_sample_data = ask_with_default('Would you like to load the sample data?')
|
|
||||||
else
|
|
||||||
@load_seed_data = false
|
|
||||||
@load_sample_data = false
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def add_gems
|
|
||||||
inside @app_path do
|
|
||||||
|
|
||||||
gem :spree, @spree_gem_options
|
|
||||||
|
|
||||||
if @install_default_gateways && @spree_gem_options[:branch]
|
|
||||||
gem :spree_gateway, github: 'spree/spree_gateway', branch: @spree_gem_options[:branch]
|
|
||||||
elsif @install_default_gateways
|
|
||||||
gem :spree_gateway, github: 'spree/spree_gateway', branch: '2-4-stable'
|
|
||||||
end
|
|
||||||
|
|
||||||
if @install_default_auth && @spree_gem_options[:branch]
|
|
||||||
gem :spree_auth_devise, github: 'spree/spree_auth_devise', branch: @spree_gem_options[:branch]
|
|
||||||
elsif @install_default_auth
|
|
||||||
gem :spree_auth_devise, github: 'spree/spree_auth_devise', branch: '2-4-stable'
|
|
||||||
end
|
|
||||||
|
|
||||||
run 'bundle install', :capture => true
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def initialize_spree
|
|
||||||
spree_options = []
|
|
||||||
spree_options << "--migrate=#{@run_migrations}"
|
|
||||||
spree_options << "--seed=#{@load_seed_data}"
|
|
||||||
spree_options << "--sample=#{@load_sample_data}"
|
|
||||||
spree_options << "--user_class=#{@user_class}"
|
|
||||||
spree_options << "--auto_accept" if options[:auto_accept]
|
|
||||||
|
|
||||||
inside @app_path do
|
|
||||||
run "rails generate spree:install #{spree_options.join(' ')}", :verbose => false
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
private
|
|
||||||
|
|
||||||
def gem(name, gem_options={})
|
|
||||||
say_status :gemfile, name
|
|
||||||
parts = ["'#{name}'"]
|
|
||||||
parts << ["'#{gem_options.delete(:version)}'"] if gem_options[:version]
|
|
||||||
gem_options.each { |key, value| parts << "#{key}: '#{value}'" }
|
|
||||||
append_file 'Gemfile', "\ngem #{parts.join(', ')}", :verbose => false
|
|
||||||
end
|
|
||||||
|
|
||||||
def ask_with_default(message, default = 'yes')
|
|
||||||
return true if options[:auto_accept]
|
|
||||||
|
|
||||||
valid = false
|
|
||||||
until valid
|
|
||||||
response = ask "#{message} (yes/no) [#{default}]"
|
|
||||||
response = default if response.empty?
|
|
||||||
valid = (response =~ /\Ay(?:es)?|no?\Z/i)
|
|
||||||
end
|
|
||||||
response.downcase[0] == ?y
|
|
||||||
end
|
|
||||||
|
|
||||||
def ask_string(message, default, valid_regex = /\w/)
|
|
||||||
return default if options[:auto_accept]
|
|
||||||
valid = false
|
|
||||||
until valid
|
|
||||||
response = ask "#{message} [#{default}]"
|
|
||||||
response = default if response.empty?
|
|
||||||
valid = (valid_regex === response)
|
|
||||||
end
|
|
||||||
response
|
|
||||||
end
|
|
||||||
|
|
||||||
def create_rails_app
|
|
||||||
say :create, @app_path
|
|
||||||
|
|
||||||
rails_cmd = "rails new #{@app_path} --skip-bundle"
|
|
||||||
rails_cmd << " -m #{options[:template]}" if options[:template]
|
|
||||||
rails_cmd << " -d #{options[:database]}" if options[:database]
|
|
||||||
run(rails_cmd)
|
|
||||||
end
|
|
||||||
|
|
||||||
def rails_project?
|
|
||||||
File.exists? File.join(@app_path, 'bin', 'rails')
|
|
||||||
end
|
|
||||||
|
|
||||||
def linux?
|
|
||||||
/linux/i === RbConfig::CONFIG['host_os']
|
|
||||||
end
|
|
||||||
|
|
||||||
def mac?
|
|
||||||
/darwin/i === RbConfig::CONFIG['host_os']
|
|
||||||
end
|
|
||||||
|
|
||||||
def windows?
|
|
||||||
%r{msdos|mswin|djgpp|mingw} === RbConfig::CONFIG['host_os']
|
|
||||||
end
|
|
||||||
|
|
||||||
def image_magick_installed?
|
|
||||||
cmd = 'identify -version'
|
|
||||||
if RUBY_PLATFORM =~ /mingw|mswin/ #windows
|
|
||||||
cmd += " >nul"
|
|
||||||
else
|
|
||||||
cmd += " >/dev/null"
|
|
||||||
end
|
|
||||||
# true if command executed succesfully
|
|
||||||
# false for non zero exit status
|
|
||||||
# nil if command execution fails
|
|
||||||
system(cmd)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
@ -1,57 +0,0 @@
|
|||||||
# How to contribute
|
|
||||||
|
|
||||||
Third-party patches are essential to any great open source project. We want
|
|
||||||
to keep it as easy as possible to contribute changes that get things working
|
|
||||||
in your environment. There are a few guidelines that we need contributors to
|
|
||||||
follow so that we can have a chance of keeping on top of things.
|
|
||||||
|
|
||||||
## Getting Started
|
|
||||||
|
|
||||||
* Make sure you have a [GitHub account](https://github.com/signup/free)
|
|
||||||
* Submit a ticket for your issue, assuming one does not already exist.
|
|
||||||
* Clearly describe the issue including steps to reproduce when it is a bug.
|
|
||||||
* Make sure you fill in the earliest version that you know has the issue.
|
|
||||||
* Fork the repository on GitHub
|
|
||||||
|
|
||||||
## Making Changes
|
|
||||||
|
|
||||||
* Create a topic branch from where you want to base your work.
|
|
||||||
* This is usually the master branch.
|
|
||||||
* Only target release branches if you are certain your fix must be on that
|
|
||||||
branch.
|
|
||||||
* To quickly create a topic branch based on master; `git branch
|
|
||||||
fix/master/my_contribution master` then checkout the new branch with `git
|
|
||||||
checkout fix/master/my_contribution`. Please avoid working directly on the
|
|
||||||
`master` branch.
|
|
||||||
* Make commits of logical units.
|
|
||||||
* Check for unnecessary whitespace with `git diff --check` before committing.
|
|
||||||
* Make sure your commit messages are in the proper format.
|
|
||||||
|
|
||||||
````
|
|
||||||
(#99999) Make the example in CONTRIBUTING imperative and concrete
|
|
||||||
|
|
||||||
Without this patch applied the example commit message in the CONTRIBUTING
|
|
||||||
document is not a concrete example. This is a problem because the
|
|
||||||
contributor is left to imagine what the commit message should look like
|
|
||||||
based on a description rather than an example. This patch fixes the
|
|
||||||
problem by making the example concrete and imperative.
|
|
||||||
|
|
||||||
The first line is a real life imperative statement with a ticket number
|
|
||||||
from our issue tracker. The body describes the behavior without the patch,
|
|
||||||
why this is a problem, and how the patch fixes the problem when applied.
|
|
||||||
````
|
|
||||||
|
|
||||||
* Make sure you have added the necessary tests for your changes.
|
|
||||||
* Run _all_ the tests to assure nothing else was accidentally broken.
|
|
||||||
|
|
||||||
## Submitting Changes
|
|
||||||
|
|
||||||
* Push your changes to a topic branch in your fork of the repository.
|
|
||||||
* Submit a pull request to the extensions repository.
|
|
||||||
* Update any Github issues to mark that you have submitted code and are ready for it to be reviewed.
|
|
||||||
* Include a link to the pull request in the ticket
|
|
||||||
|
|
||||||
# Additional Resources
|
|
||||||
|
|
||||||
* [General GitHub documentation](http://help.github.com/)
|
|
||||||
* [GitHub pull request documentation](http://help.github.com/send-pull-requests/)
|
|
@ -1,7 +0,0 @@
|
|||||||
source 'https://rubygems.org'
|
|
||||||
|
|
||||||
gem 'spree', github: 'spree/spree', branch: '2-4-stable'
|
|
||||||
# Provides basic authentication functionality for testing parts of your engine
|
|
||||||
gem 'spree_auth_devise', github: 'spree/spree_auth_devise', branch: '2-4-stable'
|
|
||||||
|
|
||||||
gemspec
|
|
@ -1,26 +0,0 @@
|
|||||||
Copyright (c) <%= Time.now.year %> [name of plugin creator]
|
|
||||||
All rights reserved.
|
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without modification,
|
|
||||||
are permitted provided that the following conditions are met:
|
|
||||||
|
|
||||||
* Redistributions of source code must retain the above copyright notice,
|
|
||||||
this list of conditions and the following disclaimer.
|
|
||||||
* Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
this list of conditions and the following disclaimer in the documentation
|
|
||||||
and/or other materials provided with the distribution.
|
|
||||||
* Neither the name Spree nor the names of its contributors may be used to
|
|
||||||
endorse or promote products derived from this software without specific
|
|
||||||
prior written permission.
|
|
||||||
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
||||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
|
||||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
|
||||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
|
||||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
|
||||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
|
||||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
||||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
||||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@ -1,39 +0,0 @@
|
|||||||
<%= class_name %>
|
|
||||||
<%= "=" * class_name.size %>
|
|
||||||
|
|
||||||
Introduction goes here.
|
|
||||||
|
|
||||||
Installation
|
|
||||||
------------
|
|
||||||
|
|
||||||
Add <%= file_name %> to your Gemfile:
|
|
||||||
|
|
||||||
```ruby
|
|
||||||
gem '<%= file_name %>'
|
|
||||||
```
|
|
||||||
|
|
||||||
Bundle your dependencies and run the installation generator:
|
|
||||||
|
|
||||||
```shell
|
|
||||||
bundle
|
|
||||||
bundle exec rails g <%= file_name %>:install
|
|
||||||
```
|
|
||||||
|
|
||||||
Testing
|
|
||||||
-------
|
|
||||||
|
|
||||||
First bundle your dependencies, then run `rake`. `rake` will default to building the dummy app if it does not exist, then it will run specs. The dummy app can be regenerated by using `rake test_app`.
|
|
||||||
|
|
||||||
```shell
|
|
||||||
bundle
|
|
||||||
bundle exec rake
|
|
||||||
```
|
|
||||||
|
|
||||||
When testing your applications integration with this extension you may use it's factories.
|
|
||||||
Simply add this require statement to your spec_helper:
|
|
||||||
|
|
||||||
```ruby
|
|
||||||
require '<%= file_name %>/factories'
|
|
||||||
```
|
|
||||||
|
|
||||||
Copyright (c) <%= Time.now.year %> [name of extension creator], released under the New BSD License
|
|
@ -1,21 +0,0 @@
|
|||||||
require 'bundler'
|
|
||||||
Bundler::GemHelper.install_tasks
|
|
||||||
|
|
||||||
require 'rspec/core/rake_task'
|
|
||||||
require 'spree/testing_support/extension_rake'
|
|
||||||
|
|
||||||
RSpec::Core::RakeTask.new
|
|
||||||
|
|
||||||
task :default do
|
|
||||||
if Dir["spec/dummy"].empty?
|
|
||||||
Rake::Task[:test_app].invoke
|
|
||||||
Dir.chdir("../../")
|
|
||||||
end
|
|
||||||
Rake::Task[:spec].invoke
|
|
||||||
end
|
|
||||||
|
|
||||||
desc 'Generates a dummy app for testing'
|
|
||||||
task :test_app do
|
|
||||||
ENV['LIB_NAME'] = '<%=file_name%>'
|
|
||||||
Rake::Task['extension:test_app'].invoke
|
|
||||||
end
|
|
@ -1,2 +0,0 @@
|
|||||||
// Placeholder manifest file.
|
|
||||||
// the installer will append this file to the app vendored assets here: vendor/assets/javascripts/spree/backend/all.js'
|
|
@ -1,2 +0,0 @@
|
|||||||
// Placeholder manifest file.
|
|
||||||
// the installer will append this file to the app vendored assets here: vendor/assets/javascripts/spree/frontend/all.js'
|
|
@ -1,4 +0,0 @@
|
|||||||
/*
|
|
||||||
Placeholder manifest file.
|
|
||||||
the installer will append this file to the app vendored assets here: 'vendor/assets/stylesheets/spree/backend/all.css'
|
|
||||||
*/
|
|
@ -1,4 +0,0 @@
|
|||||||
/*
|
|
||||||
Placeholder manifest file.
|
|
||||||
the installer will append this file to the app vendored assets here: 'vendor/assets/stylesheets/spree/frontend/all.css'
|
|
||||||
*/
|
|
@ -1,7 +0,0 @@
|
|||||||
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
|
|
||||||
|
|
||||||
ENGINE_ROOT = File.expand_path('../..', __FILE__)
|
|
||||||
ENGINE_PATH = File.expand_path('../../lib/<%= file_name -%>/engine', __FILE__)
|
|
||||||
|
|
||||||
require 'rails/all'
|
|
||||||
require 'rails/engine/commands'
|
|
@ -1,5 +0,0 @@
|
|||||||
# Sample localization file for English. Add more files in this directory for other locales.
|
|
||||||
# See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
|
|
||||||
|
|
||||||
en:
|
|
||||||
hello: "Hello world"
|
|
@ -1,3 +0,0 @@
|
|||||||
Spree::Core::Engine.routes.draw do
|
|
||||||
# Add your extension routes here
|
|
||||||
end
|
|
@ -1,31 +0,0 @@
|
|||||||
# encoding: UTF-8
|
|
||||||
Gem::Specification.new do |s|
|
|
||||||
s.platform = Gem::Platform::RUBY
|
|
||||||
s.name = '<%= file_name %>'
|
|
||||||
s.version = '<%= spree_version %>'
|
|
||||||
s.summary = 'TODO: Add gem summary here'
|
|
||||||
s.description = 'TODO: Add (optional) gem description here'
|
|
||||||
s.required_ruby_version = '>= 2.1.0'
|
|
||||||
|
|
||||||
# s.author = 'You'
|
|
||||||
# s.email = 'you@example.com'
|
|
||||||
# s.homepage = 'http://www.spreecommerce.com'
|
|
||||||
|
|
||||||
#s.files = `git ls-files`.split("\n")
|
|
||||||
#s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
|
||||||
s.require_path = 'lib'
|
|
||||||
s.requirements << 'none'
|
|
||||||
|
|
||||||
s.add_dependency 'spree_core', '~> <%= spree_version %>'
|
|
||||||
|
|
||||||
s.add_development_dependency 'capybara', '~> 2.4'
|
|
||||||
s.add_development_dependency 'coffee-rails'
|
|
||||||
s.add_development_dependency 'database_cleaner'
|
|
||||||
s.add_development_dependency 'factory_girl', '~> 4.5'
|
|
||||||
s.add_development_dependency 'ffaker'
|
|
||||||
s.add_development_dependency 'rspec-rails', '~> 3.1'
|
|
||||||
s.add_development_dependency 'sass-rails', '~> 4.0.2'
|
|
||||||
s.add_development_dependency 'selenium-webdriver'
|
|
||||||
s.add_development_dependency 'simplecov'
|
|
||||||
s.add_development_dependency 'sqlite3'
|
|
||||||
end
|
|
@ -1,15 +0,0 @@
|
|||||||
*.gem
|
|
||||||
\#*
|
|
||||||
*~
|
|
||||||
.#*
|
|
||||||
.DS_Store
|
|
||||||
.idea
|
|
||||||
.project
|
|
||||||
.sass-cache
|
|
||||||
coverage
|
|
||||||
Gemfile.lock
|
|
||||||
tmp
|
|
||||||
nbproject
|
|
||||||
pkg
|
|
||||||
*.swp
|
|
||||||
spec/dummy
|
|
@ -1,2 +0,0 @@
|
|||||||
require 'spree_core'
|
|
||||||
require '<%=file_name%>/engine'
|
|
@ -1,20 +0,0 @@
|
|||||||
module <%= class_name %>
|
|
||||||
class Engine < Rails::Engine
|
|
||||||
require 'spree/core'
|
|
||||||
isolate_namespace Spree
|
|
||||||
engine_name '<%= file_name %>'
|
|
||||||
|
|
||||||
# use rspec for tests
|
|
||||||
config.generators do |g|
|
|
||||||
g.test_framework :rspec
|
|
||||||
end
|
|
||||||
|
|
||||||
def self.activate
|
|
||||||
Dir.glob(File.join(File.dirname(__FILE__), '../../app/**/*_decorator*.rb')) do |c|
|
|
||||||
Rails.configuration.cache_classes ? require(c) : load(c)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
config.to_prepare &method(:activate).to_proc
|
|
||||||
end
|
|
||||||
end
|
|
@ -1,6 +0,0 @@
|
|||||||
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 '<%= file_name %>/factories'
|
|
||||||
end
|
|
@ -1,31 +0,0 @@
|
|||||||
module <%= class_name %>
|
|
||||||
module Generators
|
|
||||||
class InstallGenerator < Rails::Generators::Base
|
|
||||||
|
|
||||||
class_option :auto_run_migrations, :type => :boolean, :default => false
|
|
||||||
|
|
||||||
def add_javascripts
|
|
||||||
append_file 'vendor/assets/javascripts/spree/frontend/all.js', "//= require spree/frontend/<%= file_name %>\n"
|
|
||||||
append_file 'vendor/assets/javascripts/spree/backend/all.js', "//= require spree/backend/<%= file_name %>\n"
|
|
||||||
end
|
|
||||||
|
|
||||||
def add_stylesheets
|
|
||||||
inject_into_file 'vendor/assets/stylesheets/spree/frontend/all.css', " *= require spree/frontend/<%= file_name %>\n", :before => /\*\//, :verbose => true
|
|
||||||
inject_into_file 'vendor/assets/stylesheets/spree/backend/all.css', " *= require spree/backend/<%= file_name %>\n", :before => /\*\//, :verbose => true
|
|
||||||
end
|
|
||||||
|
|
||||||
def add_migrations
|
|
||||||
run 'bundle exec rake railties:install:migrations FROM=<%= file_name %>'
|
|
||||||
end
|
|
||||||
|
|
||||||
def run_migrations
|
|
||||||
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
|
|
||||||
end
|
|
@ -1 +0,0 @@
|
|||||||
--color
|
|
@ -1,87 +0,0 @@
|
|||||||
# Run Coverage report
|
|
||||||
require 'simplecov'
|
|
||||||
SimpleCov.start do
|
|
||||||
add_filter 'spec/dummy'
|
|
||||||
add_group 'Controllers', 'app/controllers'
|
|
||||||
add_group 'Helpers', 'app/helpers'
|
|
||||||
add_group 'Mailers', 'app/mailers'
|
|
||||||
add_group 'Models', 'app/models'
|
|
||||||
add_group 'Views', 'app/views'
|
|
||||||
add_group 'Libraries', 'lib'
|
|
||||||
end
|
|
||||||
|
|
||||||
# Configure Rails Environment
|
|
||||||
ENV['RAILS_ENV'] = 'test'
|
|
||||||
|
|
||||||
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 and other useful helpers defined in spree_core.
|
|
||||||
require 'spree/testing_support/authorization_helpers'
|
|
||||||
require 'spree/testing_support/capybara_ext'
|
|
||||||
require 'spree/testing_support/controller_requests'
|
|
||||||
require 'spree/testing_support/factories'
|
|
||||||
require 'spree/testing_support/url_helpers'
|
|
||||||
|
|
||||||
# Requires factories defined in lib/<%= file_name %>/factories.rb
|
|
||||||
require '<%= file_name %>/factories'
|
|
||||||
|
|
||||||
RSpec.configure do |config|
|
|
||||||
config.include FactoryGirl::Syntax::Methods
|
|
||||||
|
|
||||||
# Infer an example group's spec type from the file location.
|
|
||||||
config.infer_spec_type_from_file_location!
|
|
||||||
|
|
||||||
# == URL Helpers
|
|
||||||
#
|
|
||||||
# Allows access to Spree's routes in specs:
|
|
||||||
#
|
|
||||||
# visit spree.admin_path
|
|
||||||
# current_path.should eql(spree.products_path)
|
|
||||||
config.include Spree::TestingSupport::UrlHelpers
|
|
||||||
|
|
||||||
# == Mock Framework
|
|
||||||
#
|
|
||||||
# If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
|
|
||||||
#
|
|
||||||
# config.mock_with :mocha
|
|
||||||
# config.mock_with :flexmock
|
|
||||||
# config.mock_with :rr
|
|
||||||
config.mock_with :rspec
|
|
||||||
config.color = true
|
|
||||||
|
|
||||||
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
|
|
||||||
config.fixture_path = "#{::Rails.root}/spec/fixtures"
|
|
||||||
|
|
||||||
# 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 separate 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 = RSpec.current_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
|
|
||||||
config.order = "random"
|
|
||||||
end
|
|
@ -1,12 +0,0 @@
|
|||||||
module SpreeCmd
|
|
||||||
class Version < Thor::Group
|
|
||||||
include Thor::Actions
|
|
||||||
|
|
||||||
desc 'display spree_cmd version'
|
|
||||||
|
|
||||||
def cmd_version
|
|
||||||
puts Gem.loaded_specs['spree_cmd'].version
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
end
|
|
@ -1,24 +0,0 @@
|
|||||||
# -*- encoding: utf-8 -*-
|
|
||||||
$:.push File.expand_path("../lib", __FILE__)
|
|
||||||
version = File.read(File.expand_path("../../SOLIDUS_VERSION", __FILE__)).strip
|
|
||||||
|
|
||||||
Gem::Specification.new do |s|
|
|
||||||
s.name = "solidus_cmd"
|
|
||||||
s.version = version
|
|
||||||
s.authors = 'Solidus Team'
|
|
||||||
s.email = 'contact@solidus.io'
|
|
||||||
s.homepage = "http://solidus.io"
|
|
||||||
s.license = %q{BSD-3}
|
|
||||||
s.summary = %q{Spree Commerce command line utility}
|
|
||||||
s.description = %q{tools to create new Spree stores and extensions}
|
|
||||||
|
|
||||||
s.files = `git ls-files`.split("\n")
|
|
||||||
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
|
||||||
s.bindir = 'bin'
|
|
||||||
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
|
||||||
s.require_paths = ["lib"]
|
|
||||||
|
|
||||||
s.add_development_dependency 'rspec'
|
|
||||||
# Temporary hack until https://github.com/wycats/thor/issues/234 is fixed
|
|
||||||
s.add_dependency 'thor', '~> 0.14'
|
|
||||||
end
|
|
@ -1,27 +0,0 @@
|
|||||||
if ENV["COVERAGE"]
|
|
||||||
# Run Coverage report
|
|
||||||
require 'simplecov'
|
|
||||||
SimpleCov.start do
|
|
||||||
add_group 'Controllers', 'app/controllers'
|
|
||||||
add_group 'Helpers', 'app/helpers'
|
|
||||||
add_group 'Mailers', 'app/mailers'
|
|
||||||
add_group 'Models', 'app/models'
|
|
||||||
add_group 'Views', 'app/views'
|
|
||||||
add_group 'Libraries', 'lib'
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
# This file is copied to ~/spec when you run 'ruby script/generate rspec'
|
|
||||||
# from the project root directory.
|
|
||||||
ENV["RAILS_ENV"] ||= 'test'
|
|
||||||
|
|
||||||
RSpec.configure do |config|
|
|
||||||
config.color = true
|
|
||||||
config.mock_with :rspec
|
|
||||||
|
|
||||||
config.fixture_path = "#{::Rails.root}/spec/fixtures"
|
|
||||||
|
|
||||||
config.use_transactional_fixtures = false
|
|
||||||
|
|
||||||
config.fail_fast = ENV['FAIL_FAST'] || false
|
|
||||||
end
|
|
@ -24,5 +24,4 @@ Gem::Specification.new do |s|
|
|||||||
s.add_dependency 'solidus_backend', version
|
s.add_dependency 'solidus_backend', version
|
||||||
s.add_dependency 'solidus_frontend', version
|
s.add_dependency 'solidus_frontend', version
|
||||||
s.add_dependency 'solidus_sample', version
|
s.add_dependency 'solidus_sample', version
|
||||||
s.add_dependency 'solidus_cmd', version
|
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user