icebreaker 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,6 @@
1
+ pkg/*
2
+ *.gem
3
+ .bundle
4
+ tmp
5
+ .idea
6
+ .DS_Store
data/.rvmrc ADDED
@@ -0,0 +1,5 @@
1
+ rvm --create 1.9.2@icebreaker
2
+
3
+ if [[ -s icebreaker.gems ]] ; then
4
+ rvm gemset import icebreaker.gems
5
+ fi
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source :gemcutter
2
+
3
+ # Specify your gem's dependencies in icebreaker.gemspec
4
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,79 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ icebreaker (0.0.1)
5
+ rails
6
+ thor
7
+
8
+ GEM
9
+ remote: http://rubygems.org/
10
+ specs:
11
+ abstract (1.0.0)
12
+ actionmailer (3.0.4)
13
+ actionpack (= 3.0.4)
14
+ mail (~> 2.2.15)
15
+ actionpack (3.0.4)
16
+ activemodel (= 3.0.4)
17
+ activesupport (= 3.0.4)
18
+ builder (~> 2.1.2)
19
+ erubis (~> 2.6.6)
20
+ i18n (~> 0.4)
21
+ rack (~> 1.2.1)
22
+ rack-mount (~> 0.6.13)
23
+ rack-test (~> 0.5.7)
24
+ tzinfo (~> 0.3.23)
25
+ activemodel (3.0.4)
26
+ activesupport (= 3.0.4)
27
+ builder (~> 2.1.2)
28
+ i18n (~> 0.4)
29
+ activerecord (3.0.4)
30
+ activemodel (= 3.0.4)
31
+ activesupport (= 3.0.4)
32
+ arel (~> 2.0.2)
33
+ tzinfo (~> 0.3.23)
34
+ activeresource (3.0.4)
35
+ activemodel (= 3.0.4)
36
+ activesupport (= 3.0.4)
37
+ activesupport (3.0.4)
38
+ arel (2.0.8)
39
+ builder (2.1.2)
40
+ erubis (2.6.6)
41
+ abstract (>= 1.0.0)
42
+ i18n (0.5.0)
43
+ mail (2.2.15)
44
+ activesupport (>= 2.3.6)
45
+ i18n (>= 0.4.0)
46
+ mime-types (~> 1.16)
47
+ treetop (~> 1.4.8)
48
+ mime-types (1.16)
49
+ polyglot (0.3.1)
50
+ rack (1.2.1)
51
+ rack-mount (0.6.13)
52
+ rack (>= 1.0.0)
53
+ rack-test (0.5.7)
54
+ rack (>= 1.0)
55
+ rails (3.0.4)
56
+ actionmailer (= 3.0.4)
57
+ actionpack (= 3.0.4)
58
+ activerecord (= 3.0.4)
59
+ activeresource (= 3.0.4)
60
+ activesupport (= 3.0.4)
61
+ bundler (~> 1.0)
62
+ railties (= 3.0.4)
63
+ railties (3.0.4)
64
+ actionpack (= 3.0.4)
65
+ activesupport (= 3.0.4)
66
+ rake (>= 0.8.7)
67
+ thor (~> 0.14.4)
68
+ rake (0.8.7)
69
+ thor (0.14.6)
70
+ treetop (1.4.9)
71
+ polyglot (>= 0.3.1)
72
+ tzinfo (0.3.24)
73
+
74
+ PLATFORMS
75
+ ruby
76
+
77
+ DEPENDENCIES
78
+ bundler
79
+ icebreaker!
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License
2
+
3
+ Copyright (c) 2010 Quick Left
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,44 @@
1
+ IceBreaker
2
+ ===========
3
+ Generate a Rails 3 app with the Mongoid ORM (or OM) and RSpec for BDD testing.
4
+
5
+
6
+ ### What you get
7
+
8
+ IceBreaker provides a base Rails 3 application with the Mongoid ORM (or OM) and RSpec for BDD testing.
9
+
10
+ ### Quick Start
11
+
12
+ gem install icebreaker
13
+
14
+ break new my_app
15
+
16
+
17
+ ### Options
18
+
19
+ None at the moment
20
+
21
+
22
+ ### Testing generated app
23
+
24
+ cd myapp/
25
+ rspec spec/
26
+
27
+
28
+ ### Issues
29
+
30
+ Please report issues to the [IceBreaker issue tracker](http://github.com/markdillon/icebreaker/issues/).
31
+
32
+
33
+ ### Development
34
+
35
+ bundle install
36
+
37
+
38
+ ### Patches/Pull Requests
39
+
40
+ * Fork it.
41
+ * Add tests for it.
42
+ * Make your changes.
43
+ * Commit.
44
+ * Send a pull request.
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require 'bundler'
2
+ Bundler::GemHelper.install_tasks
data/bin/ice ADDED
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ $:.unshift(File.dirname(__FILE__) + '/../lib') unless $:.include?(File.dirname(__FILE__) + '/../lib')
3
+ require 'icebreaker/cli'
4
+ IceBreaker::CLI.start
@@ -0,0 +1,25 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path("../lib/icebreaker/version", __FILE__)
3
+
4
+ Gem::Specification.new do |s|
5
+ s.name = "icebreaker"
6
+ s.version = IceBreaker::VERSION
7
+ s.platform = Gem::Platform::RUBY
8
+ s.authors = ["Mark Dillon"]
9
+ s.email = ["mdillon@gmail.com"]
10
+ s.homepage = "http://github.com/markdillon/icebreaker"
11
+ s.summary = "icebreaker-#{s.version}"
12
+ s.description = "Generate a Rails 3 app with the Mongoid ORM (or OM) and RSpec for BDD testing."
13
+
14
+ s.required_rubygems_version = "~> 1.3.6"
15
+ s.rubyforge_project = "icebreaker"
16
+
17
+ s.add_dependency "thor"
18
+ # s.add_dependency "mail" # Hack to get around "mail requires i18n (~> 0.4.1, runtime)" error
19
+ s.add_dependency "rails"
20
+ s.add_development_dependency "bundler"
21
+
22
+ s.files = `git ls-files`.split("\n")
23
+ s.executables = `git ls-files`.split("\n").map{|f| f =~ /^bin\/(.*)/ ? $1 : nil}.compact
24
+ s.require_path = 'lib'
25
+ end
@@ -0,0 +1,34 @@
1
+ require 'thor'
2
+ require 'thor/actions'
3
+ require 'active_support/secure_random'
4
+
5
+ module IceBreaker
6
+ class CLI < Thor
7
+ include Thor::Actions
8
+
9
+ desc "new [app]", "Create a new Rails 3 application"
10
+ long_desc <<-D
11
+ IceBreaker will ask you a few questions to determine what features you
12
+ would like to generate. Based on your answers it will setup a new Rails 3 application.
13
+ D
14
+
15
+ def new(project)
16
+ command = "rails new #{project} --skip-active-record --skip-test-unit --skip-prototype --template=#{template} "
17
+ puts "Creating new Rails 3 project with: #{command}"
18
+ exec(command)
19
+ end
20
+
21
+ desc "version", "Prints IceBreaker's version information"
22
+ def version
23
+ say "IceBreaker version #{IceBreaker::VERSION}"
24
+ end
25
+ map %w(-v --version) => :version
26
+
27
+ private
28
+
29
+ def template
30
+ File.expand_path(File.dirname(__FILE__) + "/../../templates/bootstrap.rb")
31
+ end
32
+
33
+ end
34
+ end
@@ -0,0 +1,3 @@
1
+ module IceBreaker
2
+ VERSION = "0.0.1"
3
+ end
data/lib/icebreaker.rb ADDED
@@ -0,0 +1,7 @@
1
+ $:.unshift(File.dirname(__FILE__) + '/../lib') unless $:.include?(File.dirname(__FILE__) + '/../lib')
2
+ require 'icebreaker/version'
3
+ require 'icebreaker/cli'
4
+
5
+ module IceBreaker
6
+
7
+ end
@@ -0,0 +1,73 @@
1
+ require "net/http"
2
+ require "net/https"
3
+ require "uri"
4
+ require 'rbconfig'
5
+
6
+ def get_remote_https_file(source, destination)
7
+ uri = URI.parse(source)
8
+ http = Net::HTTP.new(uri.host, uri.port)
9
+ http.use_ssl = true
10
+ http.verify_mode = OpenSSL::SSL::VERIFY_NONE
11
+ request = Net::HTTP::Get.new(uri.request_uri)
12
+ response = http.request(request)
13
+ path = File.join(destination_root, destination)
14
+ File.open(path, "w") { |file| file.write(response.body) }
15
+ end
16
+
17
+ # Check for a gemset and warn if none
18
+ gemset = `rvm gemset name`.chomp
19
+ unless gemset == 'icebreaker'
20
+ say "It is recommend that you use a separate RVM gemset called 'icebreaker' when creating a Rails project with IceBreaker. This will keep your system gems clean."
21
+ say "You can create it by running this command: rvm use 1.9.2@icebreaker --create"
22
+ if yes?("Would you like to exit now and create a separate RVM gemset for icebreaker?")
23
+ exit 0
24
+ end
25
+ end
26
+
27
+ say "Building Application with IceBreaker..."
28
+
29
+ append_file '.gitignore' do <<-RUBY
30
+ .DS_Store
31
+ config/database.yml
32
+ public/system/**/**/**/*
33
+ .rspec
34
+ .sass-cache
35
+ DIFF*
36
+ RUBY
37
+ end
38
+
39
+ git :init
40
+
41
+ # Apply Gemfile
42
+ apply File.expand_path("../gemfile.rb", __FILE__)
43
+
44
+ # Apply Mongoid
45
+ apply File.expand_path("../mongoid.rb", __FILE__)
46
+
47
+ # # Apply Test Suite
48
+ apply File.expand_path("../test_suite.rb", __FILE__)
49
+
50
+ # # Remove RSpec stuff we are not gonna use right away
51
+ apply File.expand_path("../rspec_clean.rb", __FILE__)
52
+
53
+ # Apply rails clean up
54
+ apply File.expand_path("../rails_clean.rb", __FILE__)
55
+
56
+ # # Apply RVM settings
57
+ apply File.expand_path("../rvm.rb", __FILE__)
58
+
59
+ git :add => "."
60
+ git :commit => "-am 'Initial Commit'"
61
+
62
+ say <<-D
63
+
64
+ ########################################################################
65
+
66
+ IceBreaker just added like 6 hours to your life.
67
+
68
+ Next run...
69
+ rake spec
70
+ rails s
71
+
72
+ ########################################################################
73
+ D
@@ -0,0 +1,33 @@
1
+ run 'rm Gemfile'
2
+ create_file 'Gemfile', "source 'http://rubygems.org'\n"
3
+
4
+ # Rails
5
+ gem "rails", "3.0.4"
6
+
7
+ # MongoID
8
+ gem "mongoid", "2.0.0.rc.7"
9
+ gem 'bson', '1.2.1'
10
+ gem 'bson_ext', '1.2.1'
11
+
12
+ # HTML, CSS and JavaScript
13
+ gem "will_paginate", "3.0.pre2"
14
+
15
+ # Development dependencies
16
+ gem 'html5-boilerplate'
17
+ gem 'rspec-rails', '2.5.0', :group => [:development]
18
+
19
+ # Development and test support
20
+ gem 'factory_girl_rails', :group => [:development, :test]
21
+ gem 'faker', :group => [:development, :test]
22
+
23
+ # Test dependencies
24
+ gem 'rspec', '2.5.0', :group => [:test]
25
+ gem 'webrat', '0.7.1', :group => [:test]
26
+
27
+ # Utilities
28
+ gem 'awesome_print', :group => [:development]
29
+ gem 'heroku', :group => :development
30
+
31
+
32
+ # Install bundled gems
33
+ run 'bundle install'
File without changes
@@ -0,0 +1,5 @@
1
+ #----------------------------------------------------------------------------
2
+ # Set up Mongoid
3
+ #----------------------------------------------------------------------------
4
+ say "creating 'config/mongoid.yml' Mongoid configuration file..."
5
+ run 'rails generate mongoid:config'
@@ -0,0 +1,5 @@
1
+ # Clean up default Rails generated stuff
2
+ run 'rm public/index.html'
3
+ run 'rm public/images/rails.png'
4
+ run 'rm README'
5
+ run 'touch README.markdown'
@@ -0,0 +1,3 @@
1
+ # By default don't use views or helpers in specs
2
+ run 'rm -rf spec/views'
3
+ run 'rm -rf spec/helpers'
data/templates/rvm.rb ADDED
@@ -0,0 +1,12 @@
1
+ # Sandbox with RVM
2
+ create_file '.rvmrc' do
3
+ <<-RUBY
4
+ #!/usr/bin/env bash
5
+
6
+ rvm --create 1.9.2@#{app_name}
7
+
8
+ if [[ -s #{app_name}.gems ]] ; then
9
+ rvm gemset import #{app_name}.gems
10
+ fi
11
+ RUBY
12
+ end
@@ -0,0 +1,91 @@
1
+ run 'rails generate rspec:install'
2
+
3
+ # MongoID Teardown
4
+ gsub_file 'spec/spec_helper.rb', /config\.fixture_path/, '# config.fixture_path'
5
+ gsub_file 'spec/spec_helper.rb', /config\.use_transactional_fixtures/, '# config.use_transactional_fixtures'
6
+ gsub_file 'spec/spec_helper.rb', /end/ do
7
+ <<-RUBY
8
+ config.before :each do
9
+ Mongoid.master.collections.select {|c| c.name !~ /system/ }.each(&:drop)
10
+ end
11
+ end
12
+ RUBY
13
+ end
14
+
15
+ # cucumber_install = 'rails generate cucumber:install --capybara --rspec'
16
+ # cucumber_install = "#{cucumber_install} --skip-database" if ENV['MOLOGUE_MONGOID']
17
+ # run cucumber_install
18
+ #
19
+ # if ENV['MOLOGUE_MONGOID']
20
+ # append_file 'features/support/env.rb' do
21
+ # <<-RUBY
22
+ #
23
+ # # Clean MongoDB between tests
24
+ # require 'database_cleaner'
25
+ # DatabaseCleaner.strategy = :truncation
26
+ # Before do
27
+ # DatabaseCleaner.clean
28
+ # end
29
+ #
30
+ # RUBY
31
+ # end
32
+ # end
33
+ #
34
+ # run 'rails generate pickle --email'
35
+ #
36
+ # test_framework = "g.test_framework :rspec"
37
+ # test_framework = "#{test_framework}, :fixture => false" if ENV['MOLOGUE_MONGOID']
38
+ # inject_into_file 'config/application.rb', :after => "# Configure the default encoding used in templates for Ruby 1.9.\n" do
39
+ # <<-RUBY
40
+ # config.generators do |g|
41
+ # #{test_framework}
42
+ # end
43
+ # RUBY
44
+ # end
45
+ #
46
+ # inject_into_file 'features/support/env.rb', :after => "ENV[\"RAILS_ENV\"] ||= \"test\"\n" do
47
+ # <<-RUBY
48
+ # $VERBOSE = nil
49
+ # RUBY
50
+ # end
51
+ #
52
+ # gsub_file 'features/support/env.rb',/require 'cucumber\/rails\/capybara_javascript_emulation'/,'#require \'cucumber/rails/capybara_javascript_emulation\''
53
+ #
54
+ # run 'mkdir spec/factories'
55
+ #
56
+ # create_file 'features/step_definitions/web_steps_extended.rb' do
57
+ # <<-'FILE'
58
+ # When /^I confirm a js popup on the next step$/ do
59
+ # page.evaluate_script("window.alert = function(msg) { return true; }")
60
+ # page.evaluate_script("window.confirm = function(msg) { return true; }")
61
+ # end
62
+ #
63
+ # When /^I perform the following actions:$/ do |table|
64
+ # table.hashes.each do |row|
65
+ # case row['Action']
66
+ # when 'Fill in'
67
+ # Given "I fill in \"#{row['Field']}\" with \"#{row['Value']}\""
68
+ # when 'Check'
69
+ # if row['Value'] =~ /true/
70
+ # Given "I check \"#{row['Field']}\""
71
+ # else
72
+ # Given "I uncheck \"#{row['Field']}\""
73
+ # end
74
+ # when 'Choose'
75
+ # Given "I choose \"#{row['Field']}\""
76
+ # end
77
+ # end
78
+ # end
79
+ # FILE
80
+ # end
81
+ #
82
+ # create_file 'features/step_definitions/factory_steps.rb' do
83
+ # <<-'FILE'
84
+ # Given /^the following (.+) records?$/ do |factory, table|
85
+ # table.hashes.each do |hash|
86
+ # hash.each{|k,v| hash[k] = nil if v == "nil" } # FIXME: hack to make resend_email_verification.feature work
87
+ # Factory(factory, hash)
88
+ # end
89
+ # end
90
+ # FILE
91
+ # end
metadata ADDED
@@ -0,0 +1,124 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: icebreaker
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 0
8
+ - 1
9
+ version: 0.0.1
10
+ platform: ruby
11
+ authors:
12
+ - Mark Dillon
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2011-02-11 00:00:00 -08:00
18
+ default_executable:
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: thor
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
25
+ requirements:
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ segments:
29
+ - 0
30
+ version: "0"
31
+ type: :runtime
32
+ version_requirements: *id001
33
+ - !ruby/object:Gem::Dependency
34
+ name: rails
35
+ prerelease: false
36
+ requirement: &id002 !ruby/object:Gem::Requirement
37
+ none: false
38
+ requirements:
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ segments:
42
+ - 0
43
+ version: "0"
44
+ type: :runtime
45
+ version_requirements: *id002
46
+ - !ruby/object:Gem::Dependency
47
+ name: bundler
48
+ prerelease: false
49
+ requirement: &id003 !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ segments:
55
+ - 0
56
+ version: "0"
57
+ type: :development
58
+ version_requirements: *id003
59
+ description: Generate a Rails 3 app with the Mongoid ORM (or OM) and RSpec for BDD testing.
60
+ email:
61
+ - mdillon@gmail.com
62
+ executables:
63
+ - ice
64
+ extensions: []
65
+
66
+ extra_rdoc_files: []
67
+
68
+ files:
69
+ - .gitignore
70
+ - .rvmrc
71
+ - Gemfile
72
+ - Gemfile.lock
73
+ - LICENSE
74
+ - README.md
75
+ - Rakefile
76
+ - bin/ice
77
+ - icebreaker.gemspec
78
+ - lib/icebreaker.rb
79
+ - lib/icebreaker/cli.rb
80
+ - lib/icebreaker/version.rb
81
+ - templates/bootstrap.rb
82
+ - templates/gemfile.rb
83
+ - templates/html5_boilerplate.rb
84
+ - templates/mongoid.rb
85
+ - templates/rails_clean.rb
86
+ - templates/rspec_clean.rb
87
+ - templates/rvm.rb
88
+ - templates/test_suite.rb
89
+ has_rdoc: true
90
+ homepage: http://github.com/markdillon/icebreaker
91
+ licenses: []
92
+
93
+ post_install_message:
94
+ rdoc_options: []
95
+
96
+ require_paths:
97
+ - lib
98
+ required_ruby_version: !ruby/object:Gem::Requirement
99
+ none: false
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ segments:
104
+ - 0
105
+ version: "0"
106
+ required_rubygems_version: !ruby/object:Gem::Requirement
107
+ none: false
108
+ requirements:
109
+ - - ~>
110
+ - !ruby/object:Gem::Version
111
+ segments:
112
+ - 1
113
+ - 3
114
+ - 6
115
+ version: 1.3.6
116
+ requirements: []
117
+
118
+ rubyforge_project: icebreaker
119
+ rubygems_version: 1.3.7
120
+ signing_key:
121
+ specification_version: 3
122
+ summary: icebreaker-0.0.1
123
+ test_files: []
124
+