da-suspenders 1.2.0 → 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## 1.2.1 (2012-02-03)
2
+ * Add --with-mongoid option to create an app with Mongoid instead of ActiveRecord/MySQL.
3
+ * Use bleeding edge versions of compass and compass-rails to make it work with Rails 3.2.
4
+ * Update gem dependency to Rails 3.2.1.
5
+
1
6
  ## 1.2.0 (2012-02-03)
2
7
  * Updated to use Rails 3.2.1
3
8
  * Removed ie6 and ie7 stylesheets.
data/Rakefile CHANGED
@@ -19,11 +19,12 @@ namespace :test do
19
19
  end
20
20
 
21
21
  namespace :test_project do
22
- desc 'Suspend a new project. Pass REPO=... to change the Suspenders repo (defaults to dir with Rakefile).'
22
+ desc 'Suspend a new project. Pass WITH_MONGOID=1 to use mongoid. Pass REPO=... to change the Suspenders repo (defaults to dir with Rakefile).'
23
23
  task :generate do
24
24
  FileUtils.rm_rf(TEST_PROJECT)
25
25
  repo = (ENV['REPO'] || "file://#{Dir.pwd}").to_s
26
- sh 'ruby', 'bin/da-suspenders', 'create', TEST_PROJECT, repo
26
+ with_mongoid = ENV["WITH_MONGOID"] ? "--with-mongoid" : ""
27
+ sh 'ruby', 'bin/da-suspenders', 'create', TEST_PROJECT, with_mongoid, repo
27
28
  end
28
29
 
29
30
  desc 'Remove a suspended project'
data/bin/da-suspenders CHANGED
@@ -6,13 +6,13 @@ require File.expand_path(File.dirname(__FILE__) + "/../lib/errors")
6
6
  include DaSuspenders::Errors
7
7
 
8
8
  def usage
9
- "Usage: #{File.basename(__FILE__)} create new_project_name"
9
+ "Usage: #{File.basename(__FILE__)} create new_project_name [--with-mongoid]"
10
10
  end
11
11
 
12
12
  case ARGV[0]
13
13
  when 'create', '--create'
14
14
  begin
15
- DaSuspenders::Create.run!(ARGV[1], ARGV[2])
15
+ DaSuspenders::Create.run!(ARGV[1], ARGV[2], ARGV[3])
16
16
  rescue DaSuspenders::InvalidInput => e
17
17
  error_with_message(e.message)
18
18
  end
@@ -12,7 +12,7 @@ Gem::Specification.new do |s|
12
12
 
13
13
  s.required_rubygems_version = ">= 1.3.6"
14
14
 
15
- s.add_dependency('rails', '3.0.7')
15
+ s.add_dependency('rails', '3.2.1')
16
16
  s.add_dependency('bundler', '~> 1.0.10')
17
17
  s.add_dependency('trout', '~> 0.3')
18
18
 
@@ -1,23 +1,41 @@
1
1
  Feature: Running cucumber in the generated project
2
2
 
3
- Scenario: jQuery and Modernizr work in the generated project
3
+ Scenario: The generated project works correctly
4
4
  Given I drop and create the required databases
5
5
  And I generate "scaffold user username:string"
6
6
  And I run the rake task "db:migrate"
7
- And I create a file named "features/js_test.feature" with:
7
+ And I create a file named "features/test.feature" with:
8
8
  """
9
- Feature: Javascript
9
+ Feature: The application works correctly
10
+
10
11
  @javascript
11
- Scenario: Test jQuery and Modernizr
12
+ Scenario: jQuery and Modernizr work correctly
12
13
  When I visit the users page
13
14
  Then the javascript expression "$('html').hasClass('js')" should return "true"
14
15
  And the javascript expression "$('html').hasClass('no-js')" should return "false"
16
+
17
+ Scenario: Stylesheets are generated correctly
18
+ Given there are no cached assets
19
+ When I visit the application stylesheet
20
+ Then it should contain the css rules from formtastic
15
21
  """
16
- And I create a file named "features/step_definitions/user_steps.rb" with:
22
+ And I create a file named "features/step_definitions/test_steps.rb" with:
17
23
  """
18
24
  When /^I visit the users page/ do
19
25
  visit "/users"
20
26
  end
27
+
28
+ Given /^there are no cached assets$/ do
29
+ FileUtils.rm_rf ["#{Rails.root}/tmp/cache/assets", "#{Rails.root}/tmp/cache/sass"]
30
+ end
31
+
32
+ When /^I visit the application stylesheet$/ do
33
+ visit "/assets/application.css"
34
+ end
35
+
36
+ Then /^it should contain the css rules from formtastic$/ do
37
+ page.should have_content ".formtastic"
38
+ end
21
39
  """
22
40
  When I run the rake task "cucumber"
23
41
  Then I see a successful response in the shell
data/lib/create.rb CHANGED
@@ -5,18 +5,20 @@ require File.expand_path(File.dirname(__FILE__) + "/errors")
5
5
 
6
6
  module DaSuspenders
7
7
  class Create
8
- attr_accessor :project_path, :repo
8
+ attr_accessor :project_path, :with_mongoid, :repo
9
9
 
10
- def self.run!(project_path, repo)
11
- creator = self.new(project_path, repo)
10
+ def self.run!(project_path, with_mongoid, repo)
11
+ creator = self.new(project_path, with_mongoid == "--with-mongoid", repo)
12
12
  creator.create_project!
13
13
  end
14
14
 
15
- def initialize(project_path, repo)
15
+ def initialize(project_path, with_mongoid, repo)
16
16
  self.project_path = project_path
17
+ self.with_mongoid = with_mongoid
17
18
  self.repo = repo
18
19
  validate_project_path
19
20
  validate_project_name
21
+ check_for_mongod_process if with_mongoid
20
22
  end
21
23
 
22
24
  def create_project!
@@ -24,9 +26,11 @@ module DaSuspenders
24
26
  rails new #{project_path} \
25
27
  --template="#{template}" \
26
28
  --database=mysql \
27
- --skip-test-unit
29
+ --skip-test-unit \
30
+ #{'--skip-active-record' if with_mongoid}
28
31
  COMMAND
29
32
  ENV["REPO"] = repo if repo
33
+ ENV["WITH_MONGOID"] = "1" if with_mongoid
30
34
  exec(command)
31
35
  end
32
36
 
@@ -50,6 +54,12 @@ module DaSuspenders
50
54
  end
51
55
  end
52
56
 
57
+ def check_for_mongod_process
58
+ unless system("ps aux | grep mongod | grep -vq grep")
59
+ raise InvalidInput.new("mongod process not found (mongod must be running when using --with-mongoid)")
60
+ end
61
+ end
62
+
53
63
  def template
54
64
  File.expand_path(File.dirname(__FILE__) + "/../template/da-suspenders.rb")
55
65
  end
@@ -1,3 +1,3 @@
1
1
  module DaSuspenders
2
- VERSION = "1.2.0"
2
+ VERSION = "1.2.1"
3
3
  end
@@ -30,6 +30,13 @@ end
30
30
  def create_gemfile_and_install_gems
31
31
  say "Creating Gemfile and installing gems (this may take a while)", :yellow
32
32
  trout "Gemfile"
33
+ if ENV["WITH_MONGOID"]
34
+ inject_into_file "Gemfile",
35
+ %Q{gem "mongoid", "~> 2.4"\n} +
36
+ %Q{gem "bson_ext", "~> 1.5"},
37
+ :after => 'gem "mysql"'
38
+ gsub_file "Gemfile", 'gem "mysql"', ""
39
+ end
33
40
  run "bundle install"
34
41
  end
35
42
 
@@ -85,6 +92,11 @@ def create_application_layout_and_views
85
92
  trout "app/views/shared/_flashes.html.erb"
86
93
  end
87
94
 
95
+ def install_mongoid
96
+ say "Installing Mongoid", :yellow
97
+ generate "mongoid:config"
98
+ end
99
+
88
100
  def install_misc_support_files
89
101
  say "Installing miscellaneous support files", :yellow
90
102
  trout "config/initializers/errors.rb"
@@ -135,12 +147,13 @@ end
135
147
 
136
148
  create_gemfile_and_install_gems
137
149
  add_staging_environment
138
- setup_database
150
+ setup_database unless ENV["WITH_MONGOID"]
139
151
  setup_german_locale
140
152
  setup_viennese_timezone
141
- disable_timestamped_migrations
153
+ disable_timestamped_migrations unless ENV["WITH_MONGOID"]
142
154
  update_generators_config
143
155
  create_application_layout_and_views
156
+ install_mongoid if ENV["WITH_MONGOID"]
144
157
  install_misc_support_files
145
158
  install_app_config
146
159
  install_compass
@@ -11,7 +11,8 @@ group :assets do
11
11
  gem 'sass-rails', '~> 3.2.3'
12
12
  gem 'coffee-rails', '~> 3.2.1'
13
13
  gem 'uglifier', '>= 1.0.3'
14
- gem "compass", "~> 0.12.rc.0"
14
+ gem 'compass', :git => 'git://github.com/chriseppstein/compass.git', :branch => 'no_rails_integration'
15
+ gem 'compass-rails', :git => 'git://github.com/Compass/compass-rails.git'
15
16
  end
16
17
 
17
18
  gem "app_config", :git => "git://github.com/die-antwort/app_config.git"
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: da-suspenders
3
3
  version: !ruby/object:Gem::Version
4
- hash: 31
4
+ hash: 29
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 2
9
- - 0
10
- version: 1.2.0
9
+ - 1
10
+ version: 1.2.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - thoughtbot
@@ -26,12 +26,12 @@ dependencies:
26
26
  requirements:
27
27
  - - "="
28
28
  - !ruby/object:Gem::Version
29
- hash: 9
29
+ hash: 13
30
30
  segments:
31
31
  - 3
32
- - 0
33
- - 7
34
- version: 3.0.7
32
+ - 2
33
+ - 1
34
+ version: 3.2.1
35
35
  type: :runtime
36
36
  version_requirements: *id001
37
37
  - !ruby/object:Gem::Dependency