apple_cart 0.0.1

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 (56) hide show
  1. data/.gitignore +4 -0
  2. data/.rvmrc +1 -0
  3. data/Gemfile +4 -0
  4. data/Gemfile.lock +82 -0
  5. data/LICENSE +22 -0
  6. data/README.md +1 -0
  7. data/Rakefile +2 -0
  8. data/apple_cart.gemspec +40 -0
  9. data/bin/apple_cart +103 -0
  10. data/lib/apple_cart.rb +3 -0
  11. data/lib/apple_cart/helpers.rb +17 -0
  12. data/lib/apple_cart/version.rb +3 -0
  13. data/source/.autotest +23 -0
  14. data/source/.gitignore +36 -0
  15. data/source/.rspec +2 -0
  16. data/source/.rvmrc.erb +1 -0
  17. data/source/Capfile +5 -0
  18. data/source/Gemfile +87 -0
  19. data/source/app/helpers/body_class_helper.rb +7 -0
  20. data/source/app/views/layouts/application.html.erb.erb +14 -0
  21. data/source/app/views/pages/maintenance.html.erb.erb +37 -0
  22. data/source/app/views/shared/_flashes.html.erb +5 -0
  23. data/source/app/views/shared/_javascript.html.erb +7 -0
  24. data/source/autotest/discover.rb +2 -0
  25. data/source/config/cucumber.yml +13 -0
  26. data/source/config/database.yml.example +14 -0
  27. data/source/config/deploy.rb.erb +23 -0
  28. data/source/config/initializers/actionmailer.rb.erb +12 -0
  29. data/source/config/initializers/constants.rb +1 -0
  30. data/source/config/initializers/core_ext.rb +1 -0
  31. data/source/config/initializers/date_and_time_formats.rb +9 -0
  32. data/source/db/samplize.rb +58 -0
  33. data/source/db/seed.rb +27 -0
  34. data/source/features/step_definitions/form_steps.rb +16 -0
  35. data/source/features/step_definitions/object_creation_steps.rb +34 -0
  36. data/source/features/step_definitions/third_person_web_steps.rb +94 -0
  37. data/source/features/support/factory_girl.rb +1 -0
  38. data/source/features/support/regex.rb +3 -0
  39. data/source/features/support/seed_data.rb +6 -0
  40. data/source/lib/formats.rb +5 -0
  41. data/source/lib/recipes/kompanee-recipes.rb +2 -0
  42. data/source/lib/tasks/db.rake +38 -0
  43. data/source/lib/tasks/seed.rake +33 -0
  44. data/source/public/humans.txt +49 -0
  45. data/source/public/stylesheets/sass/fonts.scss +38 -0
  46. data/source/public/stylesheets/sass/grids.scss +14 -0
  47. data/source/public/stylesheets/sass/reset.scss +98 -0
  48. data/source/public/stylesheets/sass/template.scss +63 -0
  49. data/source/spec/factories/users.rb +12 -0
  50. data/source/spec/support/color.rb +3 -0
  51. data/source/spec/support/devise.rb +3 -0
  52. data/source/spec/support/focused.rb +6 -0
  53. data/source/spec/support/matchers/paperclip_matchers.rb +5 -0
  54. data/source/spec/support/pending.rb +5 -0
  55. data/source/template.rb +309 -0
  56. metadata +169 -0
@@ -0,0 +1,4 @@
1
+ pkg/*
2
+ *.gem
3
+ .bundle
4
+ source/Gemfile.temp
data/.rvmrc ADDED
@@ -0,0 +1 @@
1
+ rvm use ruby-1.9.2-head@apple_cart
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in apple-cart.gemspec
4
+ gemspec
@@ -0,0 +1,82 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ apple_cart (0.0.1)
5
+ bundler (~> 1.0.7)
6
+ rails (~> 3.0.3)
7
+ thor (~> 0.14.6)
8
+
9
+ GEM
10
+ remote: http://rubygems.org/
11
+ specs:
12
+ abstract (1.0.0)
13
+ actionmailer (3.0.3)
14
+ actionpack (= 3.0.3)
15
+ mail (~> 2.2.9)
16
+ actionpack (3.0.3)
17
+ activemodel (= 3.0.3)
18
+ activesupport (= 3.0.3)
19
+ builder (~> 2.1.2)
20
+ erubis (~> 2.6.6)
21
+ i18n (~> 0.4)
22
+ rack (~> 1.2.1)
23
+ rack-mount (~> 0.6.13)
24
+ rack-test (~> 0.5.6)
25
+ tzinfo (~> 0.3.23)
26
+ activemodel (3.0.3)
27
+ activesupport (= 3.0.3)
28
+ builder (~> 2.1.2)
29
+ i18n (~> 0.4)
30
+ activerecord (3.0.3)
31
+ activemodel (= 3.0.3)
32
+ activesupport (= 3.0.3)
33
+ arel (~> 2.0.2)
34
+ tzinfo (~> 0.3.23)
35
+ activeresource (3.0.3)
36
+ activemodel (= 3.0.3)
37
+ activesupport (= 3.0.3)
38
+ activesupport (3.0.3)
39
+ arel (2.0.7)
40
+ builder (2.1.2)
41
+ erubis (2.6.6)
42
+ abstract (>= 1.0.0)
43
+ i18n (0.5.0)
44
+ mail (2.2.15)
45
+ activesupport (>= 2.3.6)
46
+ i18n (>= 0.4.0)
47
+ mime-types (~> 1.16)
48
+ treetop (~> 1.4.8)
49
+ mime-types (1.16)
50
+ polyglot (0.3.1)
51
+ rack (1.2.1)
52
+ rack-mount (0.6.13)
53
+ rack (>= 1.0.0)
54
+ rack-test (0.5.7)
55
+ rack (>= 1.0)
56
+ rails (3.0.3)
57
+ actionmailer (= 3.0.3)
58
+ actionpack (= 3.0.3)
59
+ activerecord (= 3.0.3)
60
+ activeresource (= 3.0.3)
61
+ activesupport (= 3.0.3)
62
+ bundler (~> 1.0)
63
+ railties (= 3.0.3)
64
+ railties (3.0.3)
65
+ actionpack (= 3.0.3)
66
+ activesupport (= 3.0.3)
67
+ rake (>= 0.8.7)
68
+ thor (~> 0.14.4)
69
+ rake (0.8.7)
70
+ thor (0.14.6)
71
+ treetop (1.4.9)
72
+ polyglot (>= 0.3.1)
73
+ tzinfo (0.3.24)
74
+
75
+ PLATFORMS
76
+ ruby
77
+
78
+ DEPENDENCIES
79
+ apple_cart!
80
+ bundler (~> 1.0.7)
81
+ rails (~> 3.0.3)
82
+ thor (~> 0.14.6)
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ (The MIT License)
2
+
3
+ Copyright (c) 2011 The Kompanee - Jeff Felchner
4
+
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:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
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 NONINFRINGEMENT.
19
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
20
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
22
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1 @@
1
+ TODO
@@ -0,0 +1,2 @@
1
+ require 'bundler'
2
+ Bundler::GemHelper.install_tasks
@@ -0,0 +1,40 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "apple_cart/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.rubygems_version = '1.3.5'
7
+
8
+ s.name = "apple_cart"
9
+ s.rubyforge_project = "apple_cart"
10
+
11
+ s.version = AppleCart::VERSION
12
+ s.platform = Gem::Platform::RUBY
13
+
14
+ s.authors = ["thekompanee", "jfelchner"]
15
+ s.email = 'support@thekompanee.com'
16
+ s.homepage = 'http://github.com/jfelchner/apple_cart'
17
+
18
+ s.summary = "This is how The Kompanee does Rails."
19
+ s.description = <<-THEDOCTOR
20
+ The first rule of the Apple Cart is... don't upset it!
21
+ Inspired by the "Creating and Customizing Rails Generators" guide
22
+ from guides.rubyonrails.org. Created to represent The Kompanee's
23
+ most common setup.
24
+ THEDOCTOR
25
+
26
+ s.rdoc_options = ["--charset = UTF-8"]
27
+ s.extra_rdoc_files = %w[README.md LICENSE]
28
+
29
+ #= Manifest =#
30
+ s.default_executable = 'apple_cart'
31
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
32
+ s.files = `git ls-files`.split("\n")
33
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
34
+ s.require_paths = ["lib"]
35
+ #= Manifest =#
36
+
37
+ s.add_dependency('rails', '~> 3.0.3')
38
+ s.add_dependency('bundler', '~> 1.0.7')
39
+ s.add_dependency('thor', '~> 0.14.6')
40
+ end
@@ -0,0 +1,103 @@
1
+ #!/usr/bin/env ruby
2
+ require 'rubygems'
3
+ require 'thor'
4
+ require File.expand_path(File.join(__FILE__, "..", "..", "lib", "apple_cart", "helpers"))
5
+
6
+ SERVER_DEPLOYMENT_OPTIONS = ["heroku", "capistrano"]
7
+ DATABASE_OPTIONS = ["mysql", "sqlite", "postgres"]
8
+
9
+ OPTIONAL_GEMS = {
10
+ :form_generation => "simple_form",
11
+ :a12n => ["devise", "cancan"],
12
+ :validate_dates => "validates_timeliness",
13
+ :validate_truth => "validates_truthiness",
14
+ :stats => ["hoptoad_notifier", "newrelic_rpm"],
15
+ :time_freeze => "timecop",
16
+ :heroku => ["heroku", "taps"],
17
+ :capistrano => ["capistrano", "kompanee-recipes"],
18
+ :mysql => "mysql",
19
+ :sqlite => "sqlite3",
20
+ :postgres => "pg"
21
+ }
22
+
23
+ class AppleCart < Thor
24
+ include Thor::Actions
25
+
26
+ def initialize(args=[], options={}, config={})
27
+ super
28
+
29
+ source_paths << File.expand_path(File.join(File.dirname(__FILE__), "..", "source"))
30
+ @destination_stack[0] = File.expand_path(File.join(File.dirname(__FILE__), "..", "source"))
31
+ end
32
+
33
+ desc "upset APP_NAME", "I always knew you were that kind of person."
34
+ def upset(application_name)
35
+ talk "Oh man, you are just one CRAAAAZY sasquatch!!"
36
+
37
+ @application_name = application_name
38
+ execute!
39
+ end
40
+
41
+ private
42
+ def execute!
43
+ talk "Gems To Include In Project"
44
+ generate_gemfile
45
+
46
+ talk "Build the Rails Application"
47
+ create_app_template
48
+ end
49
+
50
+ def create_app_template
51
+ exec(<<-NEW_RAILS)
52
+ rails new #{@application_name} \
53
+ --template=#{template} \
54
+ --skip-gemfile \
55
+ --skip-test-unit \
56
+ --skip-git \
57
+ --skip-prototype
58
+ NEW_RAILS
59
+ end
60
+
61
+ def generate_gemfile
62
+ copy_file "Gemfile", "Gemfile.temp", :force => true, :verbose => false
63
+
64
+ desired_gems = optional_gems + deployment_gems
65
+
66
+ desired_gems.each do |desired_gem|
67
+ uncomment_lines "Gemfile.temp", desired_gem
68
+ end
69
+ end
70
+
71
+ def optional_gems
72
+ gems_needed = {
73
+ :form_generation => yes?("Are you going to need form generation?"),
74
+ :a12n => yes?("Are you going to need authentication and authorization?"),
75
+ :validate_dates => yes?("Are you going to need to validate dates or times?"),
76
+ :validate_truth => yes?("Are you going to need to validate truth or falsity?"),
77
+ :stats => yes?("Are you going to need statistics and analytics?"),
78
+ :time_freeze => yes?("Are you going to need to 'freeze' time in your tests?")
79
+ }.delete_if {|k,v| v == false}.keys
80
+
81
+ OPTIONAL_GEMS.select {|k,v| gems_needed.include? k}.values.flatten
82
+ end
83
+
84
+ def deployment_gems
85
+ staging_deploy = ask("How would you like to deploy to staging?", :limited_to => SERVER_DEPLOYMENT_OPTIONS)
86
+ production_deploy = ask("How would you like to deploy to production?", :limited_to => SERVER_DEPLOYMENT_OPTIONS)
87
+ dev_test_db = ask("Which database are you going to use for development and testing?", :limited_to => DATABASE_OPTIONS)
88
+ prod_stage_db = ask("Which database are you going to use for staging and production?", :limited_to => DATABASE_OPTIONS)
89
+
90
+ databases = [dev_test_db, prod_stage_db].uniq.map(&:to_sym)
91
+ deployment_types = [staging_deploy, production_deploy].uniq.map(&:to_sym)
92
+
93
+ gems_needed = databases + deployment_types
94
+
95
+ OPTIONAL_GEMS.select {|k,v| gems_needed.include? k}.values.flatten
96
+ end
97
+
98
+ def template
99
+ File.join(File.dirname(__FILE__), "..", "source", "template.rb")
100
+ end
101
+ end
102
+
103
+ AppleCart.start
@@ -0,0 +1,3 @@
1
+ module AppleCart
2
+ # Your code goes here...
3
+ end
@@ -0,0 +1,17 @@
1
+ def talk(message, skip_blank = false)
2
+ left_just_size = ((80 - message.length - 4) / 2).round + message.length
3
+ message = message.ljust(left_just_size).rjust(76)
4
+
5
+ puts "" unless skip_blank
6
+ puts "*" * 80
7
+ puts "**#{message}**"
8
+ puts "*" * 80
9
+ end
10
+
11
+ def copy_source_file(file, *args)
12
+ copy_file source_path_for(file), file, *args
13
+ end
14
+
15
+ def source_path_for(file)
16
+ File.join(@source_root, file)
17
+ end
@@ -0,0 +1,3 @@
1
+ module AppleCart
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,23 @@
1
+ require 'autotest/fsevent'
2
+ require 'autotest/growl'
3
+ require 'autotest/restart'
4
+ require 'autotest/timestamp'
5
+
6
+ Autotest.add_hook :initialize do |at|
7
+ at.add_exception %r{\/\.bundle}
8
+ at.add_exception %r{\/\.git}
9
+ at.add_exception %r{\.gitignore}
10
+ at.add_exception %r{\.rspec}
11
+ at.add_exception %r{\.rvmrc}
12
+ at.add_exception %r{\.trout}
13
+ at.add_exception %r{\/autotest}
14
+ at.add_exception %r{\/config}
15
+ at.add_exception %r{\/coverage}
16
+ at.add_exception %r{\/db}
17
+ at.add_exception %r{\/log}
18
+ at.add_exception %r{\/public}
19
+ at.add_exception %r{\/script}
20
+ at.add_exception %r{\/tmp}
21
+ at.add_exception %r{\/vendor}
22
+ at.add_exception %r{rerun\.txt}
23
+ end
@@ -0,0 +1,36 @@
1
+ # Always Version .keep files
2
+ !.keep
3
+
4
+ # Bundler Files
5
+ .bundle
6
+ vendor/bundler_gems
7
+
8
+ # Database Files
9
+ db/*.sqlite3
10
+ db/schema.rb
11
+
12
+ # Default Paperclip Image Location
13
+ public/system/
14
+
15
+ # OS Files
16
+ *.DS_Store
17
+
18
+ # Testing Files
19
+ coverage/*
20
+ rerun.txt
21
+
22
+ # VIM Cache Files
23
+ tags
24
+
25
+ # CSS Files Generated from SCSS
26
+ public/stylesheets/*.css
27
+
28
+ # Files used to store sensitive login/configuration data
29
+ database.yml
30
+ *.staging
31
+ *.production
32
+
33
+ # Temporary files
34
+ log/*.log
35
+ tmp/
36
+ *.swp
@@ -0,0 +1,2 @@
1
+ --format Fuubar
2
+ --colour
@@ -0,0 +1 @@
1
+ rvm use ruby-1.9.2-head@<%= app_name %>
@@ -0,0 +1,5 @@
1
+ load 'deploy' if respond_to?(:namespace) # cap2 differentiator
2
+
3
+ Dir['lib/recipes/**/*.rb'].each { |recipe| load(recipe) }
4
+
5
+ load 'config/deploy'
@@ -0,0 +1,87 @@
1
+ source 'http://rubygems.org'
2
+
3
+ # Typical Application Gems
4
+ gem 'rails', '~> 3.0' # Come on ride the train it's the choo choo train
5
+ gem 'passenger', '~> 3.0' # Web Server Interface
6
+ gem 'haml' # SCSS Conversion
7
+ # gem 'simple_form' # Form Generation
8
+
9
+ # Security
10
+ # gem 'devise' # Authentication
11
+ # gem 'cancan' # Authorization
12
+
13
+ # Validation Helpers
14
+ # gem 'validates_timeliness' # Date Validations
15
+ # gem 'validates_truthiness' # Boolean Validations
16
+
17
+ # Statistics and Analysis
18
+ # gem 'hoptoad_notifier' # Error Notifications
19
+ # gem 'newrelic_rpm' # Performance Metrics
20
+
21
+ # Application-Specific Gems
22
+
23
+ # Database Adapters
24
+ # gem 'sqlite3', :group => [:development, :test]
25
+ # gem 'mysql', :group => [:staging, :production]
26
+ # gem 'pg', :group => [:staging, :production]
27
+
28
+ group :development do
29
+ # Deployment
30
+ # gem 'heroku' # It's where all good apps go
31
+ # gem 'taps' # Allows for Heroku db:push/pull
32
+ # gem 'capistrano' # Deployment Magic
33
+ # gem 'kompanee-recipes' # Make Capistrano Magicaller
34
+ end
35
+
36
+ group :development, :test do
37
+ # Helper Gems For IRB
38
+ gem 'map_by_method' # (ie Person.map_by_name)
39
+ gem 'awesome_print' # Prettier than Pretty Print
40
+
41
+ # Allows setting breakpoints for debugging
42
+ gem 'ruby-debug', :platforms => :ruby_18
43
+ gem 'ruby-debug19', :platforms => :ruby_19
44
+
45
+ # Autotest gems
46
+ gem 'autotest', '= 4.4.5'
47
+ gem 'autotest-rails-pure'
48
+
49
+ # FSEvent and Growl are only available on Macs
50
+ if RUBY_PLATFORM =~ /darwin/
51
+ gem 'autotest-fsevent' # File change event handling
52
+ gem 'autotest-growl' # ROAR! Your Tests FAIL!
53
+ end
54
+
55
+ # RSpec
56
+ gem 'rspec' # RSpec Meta Gem
57
+ gem 'rspec-rails' # RSpec Rails Adapter
58
+
59
+ # Team RSpec
60
+ gem 'shoulda-matchers' # Thoughtbot's RSpec Matchers
61
+ # gem 'rspectacular' # The Kompanee's RSpec Matchers
62
+ # gem 'timecop' # Flux Capacitor... Fluxing
63
+ gem 'fuubar' # RSpec Progress Bar
64
+
65
+ # Cucumber
66
+ gem 'cucumber' # No Jokes Please... BDD is serious
67
+ gem 'cucumber-rails', # Cucumber Rails Adapter
68
+ :git => 'git://github.com/aslakhellesoy/cucumber-rails.git',
69
+ :ref => 'f3002faf12560dc7a7dc' # There's a fix needed for Capybara at this commit
70
+
71
+ # Team Cucumber
72
+ gem 'database_cleaner' # Empties the DB Before/After Tests
73
+ gem 'capybara' # Headless Browser Interaction
74
+ gem 'launchy' # Used for "save and open page"
75
+ gem 'fuubar-cucumber' # Cucumber Progress Bar
76
+
77
+ # Javascript
78
+ # gem 'akephalos', # Headless Javascript Testing
79
+
80
+ # Model Generation
81
+ gem 'factory_girl_rails' # Easy Object Creation
82
+ gem 'faker' # Create Fake Data for Testing
83
+
84
+ # Code Coverage Reporting
85
+ gem 'rcov', :platforms => :ruby_18
86
+ gem 'simplecov', :platforms => :ruby_19
87
+ end