dup_spree_cmd 1.3.0.rc1

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 (31) hide show
  1. data/LICENSE +26 -0
  2. data/README.md +63 -0
  3. data/Rakefile +6 -0
  4. data/bin/spree +2 -0
  5. data/bin/spree_cmd +3 -0
  6. data/lib/spree_cmd/extension.rb +65 -0
  7. data/lib/spree_cmd/installer.rb +192 -0
  8. data/lib/spree_cmd/templates/extension/Gemfile +6 -0
  9. data/lib/spree_cmd/templates/extension/LICENSE +26 -0
  10. data/lib/spree_cmd/templates/extension/README.md +21 -0
  11. data/lib/spree_cmd/templates/extension/Rakefile +15 -0
  12. data/lib/spree_cmd/templates/extension/Versionfile +11 -0
  13. data/lib/spree_cmd/templates/extension/app/assets/javascripts/admin/%file_name%.js +1 -0
  14. data/lib/spree_cmd/templates/extension/app/assets/javascripts/store/%file_name%.js +1 -0
  15. data/lib/spree_cmd/templates/extension/app/assets/stylesheets/admin/%file_name%.css +3 -0
  16. data/lib/spree_cmd/templates/extension/app/assets/stylesheets/store/%file_name%.css +3 -0
  17. data/lib/spree_cmd/templates/extension/config/locales/en.yml +5 -0
  18. data/lib/spree_cmd/templates/extension/config/routes.rb +3 -0
  19. data/lib/spree_cmd/templates/extension/extension.gemspec +28 -0
  20. data/lib/spree_cmd/templates/extension/gitignore +14 -0
  21. data/lib/spree_cmd/templates/extension/lib/%file_name%/engine.rb.tt +22 -0
  22. data/lib/spree_cmd/templates/extension/lib/%file_name%.rb.tt +2 -0
  23. data/lib/spree_cmd/templates/extension/lib/generators/%file_name%/install/install_generator.rb.tt +29 -0
  24. data/lib/spree_cmd/templates/extension/rspec +1 -0
  25. data/lib/spree_cmd/templates/extension/script/rails.tt +7 -0
  26. data/lib/spree_cmd/templates/extension/spec/spec_helper.rb.tt +46 -0
  27. data/lib/spree_cmd/version.rb +12 -0
  28. data/lib/spree_cmd.rb +16 -0
  29. data/spec/spec_helper.rb +12 -0
  30. data/spree_cmd.gemspec +26 -0
  31. metadata +111 -0
data/LICENSE ADDED
@@ -0,0 +1,26 @@
1
+ Copyright (c) 2007-2012, Spree Commerce, Inc. and other contributors
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,63 @@
1
+ Spree Installer
2
+ ===============
3
+
4
+ **Until the release of Spree 1.0 you must use the --edge option**
5
+
6
+ Command line utility to create new Spree store applications
7
+ and extensions
8
+
9
+ See the main spree project: https://github.com/spree/spree
10
+
11
+ Installation
12
+ ------------
13
+
14
+ ```ruby
15
+ gem install spree_cmd
16
+ ```
17
+ This will make the command line utility 'spree' available.
18
+
19
+ You can add Spree to an existing rails application
20
+
21
+ ```ruby
22
+ rails new my_app
23
+ spree install my_app
24
+ ```
25
+
26
+ Extensions
27
+ ----------
28
+
29
+ To build a new Spree Extension, you can run
30
+ ```ruby
31
+ spree extension my_extension
32
+ ```
33
+ Examples
34
+ --------
35
+
36
+ If you want to accept all the defaults pass --auto_accept
37
+
38
+ spree install my_store --edge --auto_accept
39
+
40
+ to use a local clone of Spree, pass the --path option
41
+
42
+ spree install my_store --path=../spree
43
+
44
+
45
+ options
46
+ -------
47
+
48
+ * --auto_accept - answer yes to all questions
49
+ * --edge - to use the edge version of Spree
50
+ * --path=../spree - to use a local version of spree
51
+ * --git=git@github.com:cmar/spree.git
52
+ * --branch=my_changes or --ref=23423423423423 or --tag=my_tag
53
+
54
+ Older Versions of Spree
55
+ -----------------------
56
+
57
+ Versions of the Spree gem before 1.0 included a spree binary. If you
58
+ have one of these installed in your gemset, then you can alternatively
59
+ use the command line utility "spree_cmd". For example "spree_cmd install
60
+ my_app".
61
+
62
+
63
+
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+
3
+ desc 'alias for :build to work with other spree gems'
4
+ task :gem => :build do
5
+
6
+ end
data/bin/spree ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env ruby
2
+ require 'spree_cmd'
data/bin/spree_cmd ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'spree_cmd'
@@ -0,0 +1,65 @@
1
+ module SpreeCmd
2
+
3
+ class Extension < Thor::Group
4
+ include Thor::Actions
5
+
6
+ desc "builds a spree extension"
7
+ argument :file_name, :type => :string, :desc => 'rails app_path', :default => '.'
8
+
9
+ source_root File.expand_path('../templates/extension', __FILE__)
10
+
11
+ def generate
12
+ use_prefix 'spree_'
13
+
14
+ empty_directory file_name
15
+
16
+ directory 'app', "#{file_name}/app"
17
+ directory 'lib', "#{file_name}/lib"
18
+ directory 'script', "#{file_name}/script"
19
+
20
+ template 'extension.gemspec', "#{file_name}/#{file_name}.gemspec"
21
+ template 'Gemfile', "#{file_name}/Gemfile"
22
+ template 'gitignore', "#{file_name}/.gitignore"
23
+ template 'LICENSE', "#{file_name}/LICENSE"
24
+ template 'Rakefile', "#{file_name}/Rakefile"
25
+ template 'README.md', "#{file_name}/README.md"
26
+ template 'config/routes.rb', "#{file_name}/config/routes.rb"
27
+ template 'config/locales/en.yml', "#{file_name}/config/locales/en.yml"
28
+ template 'rspec', "#{file_name}/.rspec"
29
+ template 'spec/spec_helper.rb.tt', "#{file_name}/spec/spec_helper.rb"
30
+ template 'Versionfile', "#{file_name}/Versionfile"
31
+ end
32
+
33
+ def final_banner
34
+ say %Q{
35
+ #{'*' * 80}
36
+
37
+ Your extension has been generated with a gemspec dependency on Spree #{spree_version}.
38
+
39
+ Please update the Versionfile to designate compatibility with different versions of Spree.
40
+ See http://spreecommerce.com/documentation/extensions.html#versionfile
41
+
42
+ Consider listing your extension in the official extension registry http://spreecommerce.com/extensions"
43
+
44
+ #{'*' * 80}
45
+ }
46
+ end
47
+
48
+ no_tasks do
49
+ def class_name
50
+ Thor::Util.camel_case file_name
51
+ end
52
+
53
+ def spree_version
54
+ '1.3.0.rc1'
55
+ end
56
+
57
+ def use_prefix(prefix)
58
+ unless file_name =~ /^#{prefix}/
59
+ @file_name = prefix + Thor::Util.snake_case(file_name)
60
+ end
61
+ end
62
+ end
63
+
64
+ end
65
+ end
@@ -0,0 +1,192 @@
1
+ require 'rbconfig'
2
+ require 'active_support/core_ext/string'
3
+
4
+ module SpreeCmd
5
+
6
+ class Installer < Thor::Group
7
+ include Thor::Actions
8
+
9
+ desc 'Creates a new rails project with a spree store'
10
+ argument :app_path, :type => :string, :desc => 'rails app_path', :default => '.'
11
+
12
+ class_option :auto_accept, :type => :boolean, :aliases => '-A',
13
+ :desc => 'Answer yes to all prompts'
14
+
15
+ class_option :skip_install_data, :type => :boolean, :default => false,
16
+ :desc => 'Skip running migrations and loading seed and sample data'
17
+
18
+ class_option :version, :type => :string, :desc => 'Spree Version to use'
19
+
20
+ class_option :edge, :type => :boolean
21
+
22
+ class_option :path, :type => :string, :desc => 'Spree gem path'
23
+ class_option :git, :type => :string, :desc => 'Spree gem git url'
24
+ class_option :ref, :type => :string, :desc => 'Spree gem git ref'
25
+ class_option :branch, :type => :string, :desc => 'Spree gem git branch'
26
+ class_option :tag, :type => :string, :desc => 'Spree gem git tag'
27
+
28
+ def verify_rails
29
+ unless rails_project?
30
+ say "#{@app_path} is not a rails project."
31
+ exit 1
32
+ end
33
+ end
34
+
35
+ def verify_image_magick
36
+ unless image_magick_installed?
37
+ say "Image magick must be installed."
38
+ exit 1
39
+ end
40
+ end
41
+
42
+ def prepare_options
43
+ @spree_gem_options = {}
44
+
45
+ if options[:edge]
46
+ @spree_gem_options[:git] = 'git://github.com/spree/spree.git'
47
+ elsif options[:path]
48
+ @spree_gem_options[:path] = options[:path]
49
+ elsif options[:git]
50
+ @spree_gem_options[:git] = options[:git]
51
+ @spree_gem_options[:ref] = options[:ref] if options[:ref]
52
+ @spree_gem_options[:branch] = options[:branch] if options[:branch]
53
+ @spree_gem_options[:tag] = options[:tag] if options[:tag]
54
+ elsif options[:version]
55
+ @spree_gem_options[:version] = options[:version]
56
+ else
57
+ version = Gem.loaded_specs['spree_cmd'].version
58
+ @spree_gem_options[:version] = version.to_s
59
+ end
60
+ end
61
+
62
+ def ask_questions
63
+ @install_default_gateways = ask_with_default('Would you like to install the default gateways? (Recommended)')
64
+ @install_default_auth = ask_with_default('Would you like to install the default authentication system?')
65
+
66
+ if @install_default_auth
67
+ @user_class = "Spree::User"
68
+ else
69
+ @user_class = ask("What is the name of the class representing users within your application? [User]")
70
+ if @user_class.blank?
71
+ @user_class = "User"
72
+ end
73
+ end
74
+
75
+ if options[:skip_install_data]
76
+ @run_migrations = false
77
+ @load_seed_data = false
78
+ @load_sample_data = false
79
+ else
80
+ @run_migrations = ask_with_default('Would you like to run the migrations?')
81
+ if @run_migrations
82
+ @load_seed_data = ask_with_default('Would you like to load the seed data?')
83
+ @load_sample_data = ask_with_default('Would you like to load the sample data?')
84
+ else
85
+ @load_seed_data = false
86
+ @load_sample_data = false
87
+ end
88
+ end
89
+ end
90
+
91
+ def add_gems
92
+ inside @app_path do
93
+
94
+ gem :spree, @spree_gem_options
95
+
96
+ if @install_default_gateways
97
+ gem :spree_gateway, :github => "spree/spree_gateway"
98
+ end
99
+
100
+ if @install_default_auth
101
+ gem :spree_auth_devise, :github => "spree/spree_auth_devise", :branch => "edge"
102
+ end
103
+
104
+ run 'bundle install', :capture => true
105
+ end
106
+ end
107
+
108
+ def initialize_spree
109
+ spree_options = []
110
+ spree_options << "--migrate=#{@run_migrations}"
111
+ spree_options << "--seed=#{@load_seed_data}"
112
+ spree_options << "--sample=#{@load_sample_data}"
113
+ spree_options << "--user_class=#{@user_class}"
114
+ spree_options << "--auto_accept" if options[:auto_accept]
115
+
116
+ inside @app_path do
117
+ run "rails generate spree:install #{spree_options.join(' ')}", :verbose => false
118
+ end
119
+ end
120
+
121
+ private
122
+
123
+ def gem(name, gem_options={})
124
+ say_status :gemfile, name
125
+ parts = ["'#{name}'"]
126
+ parts << ["'#{gem_options.delete(:version)}'"] if gem_options[:version]
127
+ gem_options.each { |key, value| parts << ":#{key} => '#{value}'" }
128
+ append_file 'Gemfile', "gem #{parts.join(', ')}\n", :verbose => false
129
+ end
130
+
131
+ def ask_with_default(message, default = 'yes')
132
+ return true if options[:auto_accept]
133
+
134
+ valid = false
135
+ until valid
136
+ response = ask "#{message} (yes/no) [#{default}]"
137
+ response = default if response.empty?
138
+ valid = (response =~ /\Ay(?:es)?|no?\Z/i)
139
+ end
140
+ response.downcase[0] == ?y
141
+ end
142
+
143
+ def ask_string(message, default, valid_regex = /\w/)
144
+ return default if options[:auto_accept]
145
+ valid = false
146
+ until valid
147
+ response = ask "#{message} [#{default}]"
148
+ response = default if response.empty?
149
+ valid = (valid_regex === response)
150
+ end
151
+ response
152
+ end
153
+
154
+ def create_rails_app
155
+ say :create, @app_path
156
+
157
+ rails_cmd = "rails new #{@app_path} --skip-bundle"
158
+ rails_cmd << " -m #{options[:template]}" if options[:template]
159
+ rails_cmd << " -d #{options[:database]}" if options[:database]
160
+ run(rails_cmd)
161
+ end
162
+
163
+ def rails_project?
164
+ File.exists? File.join(@app_path, 'script', 'rails')
165
+ end
166
+
167
+ def linux?
168
+ /linux/i === RbConfig::CONFIG['host_os']
169
+ end
170
+
171
+ def mac?
172
+ /darwin/i === RbConfig::CONFIG['host_os']
173
+ end
174
+
175
+ def windows?
176
+ %r{msdos|mswin|djgpp|mingw} === RbConfig::CONFIG['host_os']
177
+ end
178
+
179
+ def image_magick_installed?
180
+ cmd = 'identify -version'
181
+ if RUBY_PLATFORM =~ /mingw|mswin/ #windows
182
+ cmd += " >nul"
183
+ else
184
+ cmd += " >/dev/null"
185
+ end
186
+ # true if command executed succesfully
187
+ # false for non zero exit status
188
+ # nil if command execution fails
189
+ system(cmd)
190
+ end
191
+ end
192
+ end
@@ -0,0 +1,6 @@
1
+ source 'http://rubygems.org'
2
+
3
+ # Provides basic authentication functionality for testing parts of your engine
4
+ gem 'spree_auth_devise', :git => "git://github.com/spree/spree_auth_devise"
5
+
6
+ gemspec
@@ -0,0 +1,26 @@
1
+ Copyright (c) <%= Time.now.year %> [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.
@@ -0,0 +1,21 @@
1
+ <%= class_name %>
2
+ <%= "=" * class_name.size %>
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) <%= Time.now.year %> [name of extension creator], released under the New BSD License
@@ -0,0 +1,15 @@
1
+ require 'bundler'
2
+ Bundler::GemHelper.install_tasks
3
+
4
+ require 'rspec/core/rake_task'
5
+ require 'spree/core/testing_support/common_rake'
6
+
7
+ RSpec::Core::RakeTask.new
8
+
9
+ task :default => [:spec]
10
+
11
+ desc 'Generates a dummy app for testing'
12
+ task :test_app do
13
+ ENV['LIB_NAME'] = '<%=file_name%>'
14
+ Rake::Task['common:test_app'].invoke
15
+ end
@@ -0,0 +1,11 @@
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.2.x' => { :branch => 'master' }
7
+ # '1.1.x' => { :branch => '1-1-stable' }
8
+ # '1.0.x' => { :branch => '1-0-stable' }
9
+ # '0.70.x' => { :branch => '0-70-stable' }
10
+ # '0.40.x' => { :tag => 'v1.0.0', :version => '1.0.0' }
11
+
@@ -0,0 +1 @@
1
+ //= require admin/spree_core
@@ -0,0 +1 @@
1
+ //= require store/spree_core
@@ -0,0 +1,3 @@
1
+ /*
2
+ *= require admin/spree_core
3
+ */
@@ -0,0 +1,3 @@
1
+ /*
2
+ *= require store/spree_core
3
+ */
@@ -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"
@@ -0,0 +1,3 @@
1
+ Spree::Core::Engine.routes.draw do
2
+ # Add your extension routes here
3
+ end
@@ -0,0 +1,28 @@
1
+ # encoding: UTF-8
2
+ Gem::Specification.new do |s|
3
+ s.platform = Gem::Platform::RUBY
4
+ s.name = '<%= file_name %>'
5
+ s.version = '<%= spree_version %>'
6
+ s.summary = 'TODO: Add gem summary here'
7
+ s.description = 'TODO: Add (optional) gem description here'
8
+ s.required_ruby_version = '>= 1.8.7'
9
+
10
+ # s.author = 'You'
11
+ # s.email = 'you@example.com'
12
+ # s.homepage = 'http://www.spreecommerce.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', '~> <%= spree_version %>'
20
+
21
+ s.add_development_dependency 'capybara', '~> 1.1.2'
22
+ s.add_development_dependency 'coffee-rails'
23
+ s.add_development_dependency 'factory_girl', '~> 2.6.4'
24
+ s.add_development_dependency 'ffaker'
25
+ s.add_development_dependency 'rspec-rails', '~> 2.9'
26
+ s.add_development_dependency 'sass-rails'
27
+ s.add_development_dependency 'sqlite3'
28
+ end
@@ -0,0 +1,14 @@
1
+ \#*
2
+ *~
3
+ .#*
4
+ .DS_Store
5
+ .idea
6
+ .project
7
+ .sass-cache
8
+ coverage
9
+ Gemfile.lock
10
+ tmp
11
+ nbproject
12
+ pkg
13
+ *.swp
14
+ spec/dummy
@@ -0,0 +1,22 @@
1
+ module <%= class_name %>
2
+ class Engine < Rails::Engine
3
+ require 'spree/core'
4
+ isolate_namespace Spree
5
+ engine_name '<%= file_name %>'
6
+
7
+ config.autoload_paths += %W(#{config.root}/lib)
8
+
9
+ # use rspec for tests
10
+ config.generators do |g|
11
+ g.test_framework :rspec
12
+ end
13
+
14
+ def self.activate
15
+ Dir.glob(File.join(File.dirname(__FILE__), '../../app/**/*_decorator*.rb')) do |c|
16
+ Rails.configuration.cache_classes ? require(c) : load(c)
17
+ end
18
+ end
19
+
20
+ config.to_prepare &method(:activate).to_proc
21
+ end
22
+ end
@@ -0,0 +1,2 @@
1
+ require 'spree_core'
2
+ require '<%=file_name%>/engine'
@@ -0,0 +1,29 @@
1
+ module <%= class_name %>
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/<%= file_name %>\n"
7
+ append_file 'app/assets/javascripts/admin/all.js', "//= require admin/<%= file_name %>\n"
8
+ end
9
+
10
+ def add_stylesheets
11
+ inject_into_file 'app/assets/stylesheets/store/all.css', " *= require store/<%= file_name %>\n", :before => /\*\//, :verbose => true
12
+ inject_into_file 'app/assets/stylesheets/admin/all.css', " *= require admin/<%= file_name %>\n", :before => /\*\//, :verbose => true
13
+ end
14
+
15
+ def add_migrations
16
+ run 'bundle exec rake railties:install:migrations FROM=<%= file_name %>'
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 'Skipping rake db:migrate, don\'t forget to run it!'
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1 @@
1
+ --colour
@@ -0,0 +1,7 @@
1
+ # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
2
+
3
+ ENGINE_ROOT = File.expand_path('../..', __FILE__)
4
+ ENGINE_PATH = File.expand_path('../../lib/<%= file_name -%>/engine', __FILE__)
5
+
6
+ require 'rails/all'
7
+ require 'rails/engine/commands'
@@ -0,0 +1,46 @@
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
+ require 'ffaker'
8
+
9
+ # Requires supporting ruby files with custom matchers and macros, etc,
10
+ # in spec/support/ and its subdirectories.
11
+ Dir[File.join(File.dirname(__FILE__), 'support/**/*.rb')].each { |f| require f }
12
+
13
+ # Requires factories defined in spree_core
14
+ require 'spree/core/testing_support/factories'
15
+ require 'spree/core/testing_support/controller_requests'
16
+ require 'spree/core/testing_support/authorization_helpers'
17
+ require 'spree/core/url_helpers'
18
+
19
+ RSpec.configure do |config|
20
+ config.include FactoryGirl::Syntax::Methods
21
+
22
+ # == URL Helpers
23
+ #
24
+ # Allows access to Spree's routes in specs:
25
+ #
26
+ # visit spree.admin_path
27
+ # current_path.should eql(spree.products_path)
28
+ config.include Spree::Core::UrlHelpers
29
+
30
+ # == Mock Framework
31
+ #
32
+ # If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
33
+ #
34
+ # config.mock_with :mocha
35
+ # config.mock_with :flexmock
36
+ # config.mock_with :rr
37
+ config.mock_with :rspec
38
+
39
+ # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
40
+ config.fixture_path = "#{::Rails.root}/spec/fixtures"
41
+
42
+ # If you're not using ActiveRecord, or you'd prefer not to run each of your
43
+ # examples within a transaction, remove the following line or assign false
44
+ # instead of true.
45
+ config.use_transactional_fixtures = true
46
+ end
@@ -0,0 +1,12 @@
1
+ module SpreeCmd
2
+ class Version < Thor::Group
3
+ include Thor::Actions
4
+
5
+ desc 'display spree_cmd version'
6
+
7
+ def cmd_version
8
+ puts Gem.loaded_specs['spree_cmd'].version
9
+ end
10
+
11
+ end
12
+ end
data/lib/spree_cmd.rb ADDED
@@ -0,0 +1,16 @@
1
+ require 'thor'
2
+ require 'thor/group'
3
+
4
+ case ARGV.first
5
+ when 'version', '-v', '--version'
6
+ puts "outputting version"
7
+ puts Gem.loaded_specs['spree_cmd'].version
8
+ when 'extension'
9
+ ARGV.shift
10
+ require 'spree_cmd/extension'
11
+ SpreeCmd::Extension.start
12
+ else
13
+ ARGV.shift
14
+ require 'spree_cmd/installer'
15
+ SpreeCmd::Installer.start
16
+ end
@@ -0,0 +1,12 @@
1
+ # This file is copied to ~/spec when you run 'ruby script/generate rspec'
2
+ # from the project root directory.
3
+ ENV["RAILS_ENV"] ||= 'test'
4
+
5
+ RSpec.configure do |config|
6
+ config.mock_with :rspec
7
+
8
+ config.fixture_path = "#{::Rails.root}/spec/fixtures"
9
+
10
+ config.use_transactional_fixtures = false
11
+
12
+ end
data/spree_cmd.gemspec ADDED
@@ -0,0 +1,26 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ version = File.read(File.expand_path("../../SPREE_VERSION", __FILE__)).strip
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "dup_spree_cmd"
7
+ s.version = version
8
+ s.authors = ["Chris Mar"]
9
+ s.email = ["chris@spreecommerce.com"]
10
+ s.homepage = "http://spreecommerce.com"
11
+ s.license = %q{BSD-3}
12
+ s.summary = %q{Spree Commerce command line utility}
13
+ s.description = %q{tools to create new Spree stores and extensions}
14
+
15
+ s.rubyforge_project = "spree_cmd"
16
+
17
+ s.files = `git ls-files`.split("\n")
18
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
19
+ s.bindir = 'bin'
20
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
21
+ s.require_paths = ["lib"]
22
+
23
+ s.add_development_dependency 'rspec'
24
+ # Temporary hack until https://github.com/wycats/thor/issues/234 is fixed
25
+ s.add_dependency 'thor', '>= 0.14.6'
26
+ end
metadata ADDED
@@ -0,0 +1,111 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: dup_spree_cmd
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.3.0.rc1
5
+ prerelease: 6
6
+ platform: ruby
7
+ authors:
8
+ - Chris Mar
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-12-09 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rspec
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: thor
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: 0.14.6
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: 0.14.6
46
+ description: tools to create new Spree stores and extensions
47
+ email:
48
+ - chris@spreecommerce.com
49
+ executables:
50
+ - spree
51
+ - spree_cmd
52
+ extensions: []
53
+ extra_rdoc_files: []
54
+ files:
55
+ - LICENSE
56
+ - README.md
57
+ - Rakefile
58
+ - bin/spree
59
+ - bin/spree_cmd
60
+ - lib/spree_cmd.rb
61
+ - lib/spree_cmd/extension.rb
62
+ - lib/spree_cmd/installer.rb
63
+ - lib/spree_cmd/templates/extension/Gemfile
64
+ - lib/spree_cmd/templates/extension/LICENSE
65
+ - lib/spree_cmd/templates/extension/README.md
66
+ - lib/spree_cmd/templates/extension/Rakefile
67
+ - lib/spree_cmd/templates/extension/Versionfile
68
+ - lib/spree_cmd/templates/extension/app/assets/javascripts/admin/%file_name%.js
69
+ - lib/spree_cmd/templates/extension/app/assets/javascripts/store/%file_name%.js
70
+ - lib/spree_cmd/templates/extension/app/assets/stylesheets/admin/%file_name%.css
71
+ - lib/spree_cmd/templates/extension/app/assets/stylesheets/store/%file_name%.css
72
+ - lib/spree_cmd/templates/extension/config/locales/en.yml
73
+ - lib/spree_cmd/templates/extension/config/routes.rb
74
+ - lib/spree_cmd/templates/extension/extension.gemspec
75
+ - lib/spree_cmd/templates/extension/gitignore
76
+ - lib/spree_cmd/templates/extension/lib/%file_name%.rb.tt
77
+ - lib/spree_cmd/templates/extension/lib/%file_name%/engine.rb.tt
78
+ - lib/spree_cmd/templates/extension/lib/generators/%file_name%/install/install_generator.rb.tt
79
+ - lib/spree_cmd/templates/extension/rspec
80
+ - lib/spree_cmd/templates/extension/script/rails.tt
81
+ - lib/spree_cmd/templates/extension/spec/spec_helper.rb.tt
82
+ - lib/spree_cmd/version.rb
83
+ - spec/spec_helper.rb
84
+ - spree_cmd.gemspec
85
+ homepage: http://spreecommerce.com
86
+ licenses:
87
+ - BSD-3
88
+ post_install_message:
89
+ rdoc_options: []
90
+ require_paths:
91
+ - lib
92
+ required_ruby_version: !ruby/object:Gem::Requirement
93
+ none: false
94
+ requirements:
95
+ - - ! '>='
96
+ - !ruby/object:Gem::Version
97
+ version: '0'
98
+ required_rubygems_version: !ruby/object:Gem::Requirement
99
+ none: false
100
+ requirements:
101
+ - - ! '>'
102
+ - !ruby/object:Gem::Version
103
+ version: 1.3.1
104
+ requirements: []
105
+ rubyforge_project: spree_cmd
106
+ rubygems_version: 1.8.24
107
+ signing_key:
108
+ specification_version: 3
109
+ summary: Spree Commerce command line utility
110
+ test_files:
111
+ - spec/spec_helper.rb