suspenders 0.2.5 → 0.2.6

Sign up to get free protection for your applications and to get access to all the features.
data/CONTRIBUTING.md ADDED
@@ -0,0 +1,38 @@
1
+ We love pull requests. Here's a quick guide:
2
+
3
+ 1. Fork the repo.
4
+
5
+ 2. Run the tests. We only take pull requests with passing tests, and it's great
6
+ to know that you have a clean slate: `bundle && rake`
7
+
8
+ 3. Add a test for your change. Only refactoring and documentation changes
9
+ require no new tests. If you are adding functionality or fixing a bug, we need
10
+ a test!
11
+
12
+ 4. Make the test pass.
13
+
14
+ 5. Push to your fork and submit a pull request.
15
+
16
+
17
+ At this point you're waiting on us. We like to at least comment on, if not
18
+ accept, pull requests within three business days (and, typically, one business
19
+ day). We may suggest some changes or improvements or alternatives.
20
+
21
+ Some things that will increase the chance that your pull request is accepted,
22
+ taken straight from the Ruby on Rails guide:
23
+
24
+ * Use Rails idioms and helpers
25
+ * Include tests that fail without your code, and pass with it
26
+ * Update the documentation, the surrounding one, examples elsewhere, guides,
27
+ whatever is affected by your contribution
28
+
29
+ Syntax:
30
+
31
+ * Two spaces, no tabs.
32
+ * No trailing whitespace. Blank lines should not have any space.
33
+ * Prefer &&/|| over and/or.
34
+ * my_method(my_arg) not my_method( my_arg ) or my_method my_arg.
35
+ * a = b and not a=b.
36
+ * Follow the conventions you see used in the source already.
37
+
38
+ And in case we didn't emphasize it enough: we love tests!
data/README.md CHANGED
@@ -41,10 +41,10 @@ It includes application gems like:
41
41
 
42
42
  And testing gems like:
43
43
 
44
- * [Cucumber, Capybara, and Akephalos](http://robots.thoughtbot.com/post/1658763359/thoughtbot-and-the-holy-grail) for integration testing, including Javascript behavior
44
+ * [Cucumber, Capybara, and Capybara Webkit](http://robots.thoughtbot.com/post/4583605733/capybara-webkit) for integration testing, including Javascript behavior
45
45
  * [RSpec](https://github.com/rspec/rspec) for awesome, readable isolation testing
46
46
  * [Factory Girl](https://github.com/thoughtbot/factory_girl) for easier creation of test data
47
- * [Shoulda](http://github.com/thoughtbot/shoulda) for frequently needed Rails and RSpec matchers
47
+ * [Shoulda Matchers](http://github.com/thoughtbot/shoulda-matchers) for frequently needed Rails and RSpec matchers
48
48
  * [Timecop](https://github.com/jtrupiano/timecop) for dealing with time
49
49
  * [Bourne](https://github.com/thoughtbot/bourne) and Mocha for stubbing and spying
50
50
 
@@ -65,6 +65,11 @@ Issues
65
65
 
66
66
  If you have problems, please create a [Github issue](https://github.com/thoughtbot/suspenders/issues).
67
67
 
68
+ Contributing
69
+ ------------
70
+
71
+ Please see CONTRIBUTING.md for details.
72
+
68
73
  Credits
69
74
  -------
70
75
 
data/Rakefile CHANGED
@@ -4,7 +4,7 @@ require 'cucumber/rake/task'
4
4
  require 'date'
5
5
 
6
6
  TEST_PROJECT = 'test_project'
7
- SUSPENDERS_GEM_VERSION = '0.2.5'
7
+ SUSPENDERS_GEM_VERSION = '0.2.6'
8
8
 
9
9
  #############################################################################
10
10
  #
@@ -20,10 +20,11 @@ namespace :test do
20
20
  end
21
21
 
22
22
  namespace :test_project do
23
- desc 'Suspend a new project. Pass REPO=... to change the Suspenders repo.'
23
+ desc 'Suspend a new project. Pass REPO=... to change the Suspenders repo (defaults to dir with Rakefile).'
24
24
  task :generate do
25
25
  FileUtils.rm_rf(TEST_PROJECT)
26
- sh './bin/suspenders', 'create', TEST_PROJECT, ENV['REPO'].to_s
26
+ repo = (ENV['REPO'].to_s || "file://#{Dir.pwd}").to_s
27
+ sh "./bin/suspenders", 'create', TEST_PROJECT, repo
27
28
  end
28
29
 
29
30
  desc 'Remove a suspended project'
data/bin/suspenders CHANGED
@@ -12,7 +12,7 @@ end
12
12
  case ARGV[0]
13
13
  when 'create', '--create'
14
14
  begin
15
- Suspenders::Create.run!(ARGV[1])
15
+ Suspenders::Create.run!(ARGV[1], ARGV[2])
16
16
  rescue Suspenders::InvalidInput => e
17
17
  error_with_message(e.message)
18
18
  end
data/lib/create.rb CHANGED
@@ -5,26 +5,33 @@ require File.expand_path(File.dirname(__FILE__) + "/errors")
5
5
 
6
6
  module Suspenders
7
7
  class Create
8
- attr_accessor :project_path
8
+ attr_accessor :project_path, :repo
9
9
 
10
- def self.run!(project_path)
11
- creator = self.new(project_path)
10
+ def self.run!(project_path, repo)
11
+ creator = self.new(project_path, repo)
12
12
  creator.create_project!
13
13
  end
14
14
 
15
- def initialize(project_path)
15
+ def initialize(project_path, repo)
16
16
  self.project_path = project_path
17
17
  validate_project_path
18
18
  validate_project_name
19
+ self.repo = repo if present?(repo)
19
20
  end
20
21
 
21
22
  def create_project!
22
- exec(<<-COMMAND)
23
- rails new #{project_path} \
23
+ command = <<-COMMAND
24
+ rails #{rails_version} new #{project_path} \
24
25
  --template=#{template} \
25
26
  --skip-test-unit \
26
27
  --skip-prototype
27
28
  COMMAND
29
+ command_with_repo = if repo
30
+ "REPO='#{repo}' #{command}"
31
+ else
32
+ command
33
+ end
34
+ exec(command_with_repo)
28
35
  end
29
36
 
30
37
  private
@@ -50,5 +57,23 @@ module Suspenders
50
57
  def template
51
58
  File.expand_path(File.dirname(__FILE__) + "/../template/suspenders.rb")
52
59
  end
60
+
61
+ def gemfile
62
+ File.expand_path(File.dirname(__FILE__) + "/../template/trout/Gemfile")
63
+ end
64
+
65
+ def rails_version
66
+ gemfile_contents = File.read(gemfile)
67
+ gemfile_contents =~ /gem "rails", "(.*)"/
68
+ if $1.nil? || $1 == ''
69
+ ''
70
+ else
71
+ "_#{$1}_"
72
+ end
73
+ end
74
+
75
+ def present?(string)
76
+ string && string != ''
77
+ end
53
78
  end
54
79
  end
data/suspenders.gemspec CHANGED
@@ -4,8 +4,8 @@ Gem::Specification.new do |s|
4
4
  s.rubygems_version = '1.3.5'
5
5
 
6
6
  s.name = 'suspenders'
7
- s.version = '0.2.5'
8
- s.date = '2011-06-01'
7
+ s.version = '0.2.6'
8
+ s.date = '2011-07-26'
9
9
 
10
10
  s.summary = "Generate a Rails app using thoughtbot's best practices."
11
11
  s.description = <<-HERE
@@ -16,7 +16,7 @@ rush to build something amazing; don't use it if you like missing deadlines.
16
16
 
17
17
  s.authors = ["thoughtbot"]
18
18
  s.email = 'support@thoughtbot.com'
19
- s.homepage = 'http://github.com/thoughtbot/suspenders-gem'
19
+ s.homepage = 'http://github.com/thoughtbot/suspenders'
20
20
 
21
21
  s.executables = ["suspenders"]
22
22
  s.default_executable = 'suspenders'
@@ -24,19 +24,20 @@ rush to build something amazing; don't use it if you like missing deadlines.
24
24
  s.rdoc_options = ["--charset=UTF-8"]
25
25
  s.extra_rdoc_files = %w[README.md LICENSE]
26
26
 
27
- s.add_dependency('rails', '3.0.7')
27
+ s.add_dependency('rails', '3.0.9')
28
28
  s.add_dependency('bundler', '>= 1.0.7')
29
29
  s.add_dependency('trout', '>= 0.3.0')
30
+ s.add_development_dependency('cucumber', '~> 1.0.2')
30
31
 
31
32
  # = MANIFEST =
32
33
  s.files = %w[
34
+ CONTRIBUTING.md
33
35
  LICENSE
34
36
  README.md
35
37
  Rakefile
36
38
  bin/suspenders
37
39
  features/rake_clean.feature
38
40
  features/step_definitions/shell.rb
39
- features/support/env.rb
40
41
  lib/create.rb
41
42
  lib/errors.rb
42
43
  suspenders.gemspec
@@ -44,9 +45,10 @@ rush to build something amazing; don't use it if you like missing deadlines.
44
45
  template/files/_flashes.html.erb
45
46
  template/files/_javascript.html.erb
46
47
  template/files/body_class_helper.rb
48
+ template/files/cucumber_assertions_hack
47
49
  template/files/errors.rb
48
50
  template/files/factory_girl_steps.rb
49
- template/files/mysql_database.yml.erb
51
+ template/files/postgresql_database.yml.erb
50
52
  template/files/suspenders_gitignore
51
53
  template/files/suspenders_layout.html.erb.erb
52
54
  template/files/time_formats.rb
@@ -1,5 +1,5 @@
1
1
  <div id="flash">
2
2
  <% flash.each do |key, value| -%>
3
- <div id="flash_<%= key %>"><%=h value %></div>
3
+ <div id="flash_<%= key %>"><%= value %></div>
4
4
  <% end -%>
5
5
  </div>
@@ -0,0 +1,4 @@
1
+ if RUBY_VERSION =~ /1.8/
2
+ require 'test/unit/testresult'
3
+ Test::Unit.run = true
4
+ end
@@ -1,12 +1,10 @@
1
1
  development: &default
2
- adapter: mysql
2
+ adapter: postgresql
3
3
  database: <%= app_name %>_development
4
- username: root
5
- password:
6
- host: localhost
7
- encoding: utf8
4
+ pool: 5
5
+ timeout: 5000
8
6
 
9
7
  test: &TEST
10
8
  <<: *default
11
9
  database: <%= app_name %>_test
12
-
10
+ min_messages: warning
@@ -7,4 +7,3 @@ rerun.txt
7
7
  tags
8
8
  !.keep
9
9
  vendor/bundler_gems
10
- .rvmrc
@@ -43,7 +43,11 @@ def download_file(uri_string, destination)
43
43
  end
44
44
 
45
45
  def origin
46
- "git://github.com/thoughtbot/suspenders.git"
46
+ if ENV['REPO'].present?
47
+ ENV['REPO']
48
+ else
49
+ "git://github.com/thoughtbot/suspenders.git"
50
+ end
47
51
  end
48
52
 
49
53
  def trout(destination_path)
@@ -85,9 +89,9 @@ copy_file "README_FOR_SUSPENDERS", "doc/README_FOR_SUSPENDERS"
85
89
 
86
90
  say "Get ready for bundler... (this will take a while)"
87
91
 
88
- say "Let's use MySQL"
92
+ say "Let's use PostgreSQL"
89
93
 
90
- template "mysql_database.yml.erb", "config/database.yml", :force => true
94
+ template "postgresql_database.yml.erb", "config/database.yml", :force => true
91
95
  rake "db:create"
92
96
 
93
97
  say "Setting up plugins"
@@ -118,7 +122,7 @@ replace_in_file "spec/spec_helper.rb", "mock_with :rspec", "mock_with :mocha"
118
122
 
119
123
  inject_into_file "features/support/env.rb",
120
124
  %{Capybara.save_and_open_page_path = 'tmp'\n} +
121
- %{Capybara.javascript_driver = :akephalos\n},
125
+ %{Capybara.javascript_driver = :webkit\n},
122
126
  :before => %{Capybara.default_selector = :css}
123
127
 
124
128
  rake "flutie:install"
@@ -126,6 +130,7 @@ rake "flutie:install"
126
130
  say "Ignore the right files"
127
131
 
128
132
  concat_file "suspenders_gitignore", ".gitignore"
133
+ concat_file "cucumber_assertions_hack", "features/support/env.rb"
129
134
 
130
135
  ["app/models",
131
136
  "app/views/pages",
@@ -139,7 +144,7 @@ concat_file "suspenders_gitignore", ".gitignore"
139
144
  "spec/controllers",
140
145
  "spec/helpers",
141
146
  "spec/support/matchers",
142
- "spec/support/helpers",
147
+ "spec/support/mixins",
143
148
  "spec/support/shared_examples"].each do |dir|
144
149
  empty_directory_with_gitkeep dir
145
150
  end
@@ -1,6 +1,6 @@
1
1
  source :rubygems
2
2
 
3
- gem "rails", "~> 3.0.7"
3
+ gem "rails", "3.0.9"
4
4
  gem "rack"
5
5
  gem "clearance", "~> 0.11.1"
6
6
  gem "sass"
@@ -10,18 +10,17 @@ gem "RedCloth", :require => "redcloth"
10
10
  gem "paperclip"
11
11
  gem "validation_reflection"
12
12
  gem "formtastic"
13
- gem "mysql"
13
+ gem "pg"
14
14
  gem "flutie", "~> 1.1.8"
15
15
  gem "dynamic_form"
16
16
  gem "jquery-rails"
17
- gem "rake", "0.8.7"
17
+ gem "rake", "0.9.2"
18
18
 
19
19
  # RSpec needs to be in :development group to expose generators
20
20
  # and rake tasks without having to type RAILS_ENV=test.
21
21
  group :development, :test do
22
22
  gem "rspec-rails", "~> 2.6.1"
23
23
  gem "ruby-debug", :platforms => :mri_18
24
- gem "ruby-debug19", :platforms => :mri_19
25
24
  end
26
25
 
27
26
  group :test do
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: suspenders
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 27
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 5
10
- version: 0.2.5
9
+ - 6
10
+ version: 0.2.6
11
11
  platform: ruby
12
12
  authors:
13
13
  - thoughtbot
@@ -15,7 +15,8 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-06-01 00:00:00 Z
18
+ date: 2011-07-26 00:00:00 -04:00
19
+ default_executable: suspenders
19
20
  dependencies:
20
21
  - !ruby/object:Gem::Dependency
21
22
  name: rails
@@ -25,12 +26,12 @@ dependencies:
25
26
  requirements:
26
27
  - - "="
27
28
  - !ruby/object:Gem::Version
28
- hash: 9
29
+ hash: 21
29
30
  segments:
30
31
  - 3
31
32
  - 0
32
- - 7
33
- version: 3.0.7
33
+ - 9
34
+ version: 3.0.9
34
35
  type: :runtime
35
36
  version_requirements: *id001
36
37
  - !ruby/object:Gem::Dependency
@@ -65,6 +66,22 @@ dependencies:
65
66
  version: 0.3.0
66
67
  type: :runtime
67
68
  version_requirements: *id003
69
+ - !ruby/object:Gem::Dependency
70
+ name: cucumber
71
+ prerelease: false
72
+ requirement: &id004 !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ~>
76
+ - !ruby/object:Gem::Version
77
+ hash: 19
78
+ segments:
79
+ - 1
80
+ - 0
81
+ - 2
82
+ version: 1.0.2
83
+ type: :development
84
+ version_requirements: *id004
68
85
  description: |
69
86
  Suspenders is a base Rails project that you can upgrade. It is used by
70
87
  thoughtbot to get a jump start on a working app. Use Suspenders if you're in a
@@ -79,13 +96,13 @@ extra_rdoc_files:
79
96
  - README.md
80
97
  - LICENSE
81
98
  files:
99
+ - CONTRIBUTING.md
82
100
  - LICENSE
83
101
  - README.md
84
102
  - Rakefile
85
103
  - bin/suspenders
86
104
  - features/rake_clean.feature
87
105
  - features/step_definitions/shell.rb
88
- - features/support/env.rb
89
106
  - lib/create.rb
90
107
  - lib/errors.rb
91
108
  - suspenders.gemspec
@@ -93,16 +110,18 @@ files:
93
110
  - template/files/_flashes.html.erb
94
111
  - template/files/_javascript.html.erb
95
112
  - template/files/body_class_helper.rb
113
+ - template/files/cucumber_assertions_hack
96
114
  - template/files/errors.rb
97
115
  - template/files/factory_girl_steps.rb
98
- - template/files/mysql_database.yml.erb
116
+ - template/files/postgresql_database.yml.erb
99
117
  - template/files/suspenders_gitignore
100
118
  - template/files/suspenders_layout.html.erb.erb
101
119
  - template/files/time_formats.rb
102
120
  - template/suspenders.rb
103
121
  - template/trout/Gemfile
104
122
  - template/trout/public/javascripts/prefilled_input.js
105
- homepage: http://github.com/thoughtbot/suspenders-gem
123
+ has_rdoc: true
124
+ homepage: http://github.com/thoughtbot/suspenders
106
125
  licenses: []
107
126
 
108
127
  post_install_message:
@@ -131,11 +150,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
131
150
  requirements: []
132
151
 
133
152
  rubyforge_project:
134
- rubygems_version: 1.7.2
153
+ rubygems_version: 1.6.2
135
154
  signing_key:
136
155
  specification_version: 2
137
156
  summary: Generate a Rails app using thoughtbot's best practices.
138
157
  test_files:
139
158
  - features/rake_clean.feature
140
159
  - features/step_definitions/shell.rb
141
- - features/support/env.rb
@@ -1 +0,0 @@
1
- require 'spec/expectations'