bootstrapped 0.0.4 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. data/.gitignore +0 -1
  2. data/Gemfile.lock +133 -0
  3. data/README.rdoc +101 -0
  4. data/bootstrapped.gemspec +4 -0
  5. data/features/bootstrap_layout.feature +13 -0
  6. data/features/bootstrap_scaffold.feature +80 -0
  7. data/features/step_definitions/common_steps.rb +62 -0
  8. data/features/step_definitions/rails_setup_steps.rb +6 -0
  9. data/features/support/env.rb +6 -0
  10. data/features/support/matchers.rb +7 -0
  11. data/lib/bootstrapped.rb +2 -1
  12. data/lib/bootstrapped/engine.rb +3 -1
  13. data/lib/bootstrapped/version.rb +1 -1
  14. data/lib/generators/bootstrapped/install/install_generator.rb +26 -0
  15. data/{vendor/assets/stylesheets/bootstrap.css.less → lib/generators/bootstrapped/install/templates/bootstrap.less} +2 -2
  16. data/{vendor/assets/stylesheets/forms.css.less → lib/generators/bootstrapped/install/templates/forms.less} +49 -35
  17. data/{vendor/assets/stylesheets/mixins.css.less → lib/generators/bootstrapped/install/templates/mixins.less} +35 -30
  18. data/{vendor/assets/stylesheets/patterns.css.less → lib/generators/bootstrapped/install/templates/patterns.less} +97 -42
  19. data/{vendor/assets/stylesheets/reset.css.less → lib/generators/bootstrapped/install/templates/reset.less} +0 -0
  20. data/{vendor/assets/stylesheets/scaffolding.css.less → lib/generators/bootstrapped/install/templates/scaffolding.less} +20 -18
  21. data/{vendor/assets/stylesheets/tables.css.less → lib/generators/bootstrapped/install/templates/tables.less} +68 -15
  22. data/{vendor/assets/stylesheets/type.css.less → lib/generators/bootstrapped/install/templates/type.less} +0 -0
  23. data/{vendor/assets/stylesheets/variables.css.less → lib/generators/bootstrapped/install/templates/variables.less} +0 -0
  24. data/lib/generators/bootstrapped/layout/templates/error_messages_helper.rb +7 -5
  25. data/lib/generators/bootstrapped/layout/templates/layout.html.erb +13 -7
  26. data/lib/generators/bootstrapped/layout/templates/layout_helper.rb +5 -1
  27. data/lib/generators/bootstrapped/scaffold/templates/views/erb/_form.html.erb +1 -0
  28. data/vendor/assets/javascripts/.DS_Store +0 -0
  29. data/vendor/assets/javascripts/{bootstrap-alerts.js → twitter/bootstrap/bootstrap-alerts.js} +18 -9
  30. data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-buttons.js +62 -0
  31. data/vendor/assets/javascripts/{bootstrap-dropdown.js → twitter/bootstrap/bootstrap-dropdown.js} +17 -12
  32. data/vendor/assets/javascripts/{bootstrap-modal.js → twitter/bootstrap/bootstrap-modal.js} +57 -35
  33. data/vendor/assets/javascripts/{bootstrap-popover.js → twitter/bootstrap/bootstrap-popover.js} +20 -7
  34. data/vendor/assets/javascripts/{bootstrap-scrollspy.js → twitter/bootstrap/bootstrap-scrollspy.js} +4 -2
  35. data/vendor/assets/javascripts/{bootstrap-tabs.js → twitter/bootstrap/bootstrap-tabs.js} +25 -7
  36. data/vendor/assets/javascripts/{bootstrap-twipsy.js → twitter/bootstrap/bootstrap-twipsy.js} +30 -16
  37. data/vendor/assets/stylesheets/.DS_Store +0 -0
  38. data/vendor/assets/stylesheets/{bootstrap.css → twitter/bootstrap/bootstrap.css} +238 -133
  39. data/vendor/framework/bootstrap.less +26 -0
  40. data/vendor/framework/forms.less +479 -0
  41. data/vendor/framework/mixins.less +222 -0
  42. data/vendor/framework/patterns.less +1060 -0
  43. data/vendor/framework/reset.less +141 -0
  44. data/vendor/framework/scaffolding.less +137 -0
  45. data/vendor/framework/tables.less +224 -0
  46. data/vendor/framework/type.less +187 -0
  47. data/vendor/framework/variables.less +60 -0
  48. metadata +90 -29
  49. data/vendor/.DS_Store +0 -0
  50. data/vendor/assets/.DS_Store +0 -0
data/.gitignore CHANGED
@@ -1,5 +1,4 @@
1
1
  .DS_Store
2
2
  *.gem
3
3
  .bundle
4
- Gemfile.lock
5
4
  pkg/*
data/Gemfile.lock ADDED
@@ -0,0 +1,133 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ bootstrapped (0.0.6)
5
+ less-rails (~> 2.1.0)
6
+ railties (~> 3.1)
7
+ thor (~> 0.14)
8
+
9
+ GEM
10
+ remote: http://rubygems.org/
11
+ specs:
12
+ actionmailer (3.1.1)
13
+ actionpack (= 3.1.1)
14
+ mail (~> 2.3.0)
15
+ actionpack (3.1.1)
16
+ activemodel (= 3.1.1)
17
+ activesupport (= 3.1.1)
18
+ builder (~> 3.0.0)
19
+ erubis (~> 2.7.0)
20
+ i18n (~> 0.6)
21
+ rack (~> 1.3.2)
22
+ rack-cache (~> 1.1)
23
+ rack-mount (~> 0.8.2)
24
+ rack-test (~> 0.6.1)
25
+ sprockets (~> 2.0.2)
26
+ activemodel (3.1.1)
27
+ activesupport (= 3.1.1)
28
+ builder (~> 3.0.0)
29
+ i18n (~> 0.6)
30
+ activerecord (3.1.1)
31
+ activemodel (= 3.1.1)
32
+ activesupport (= 3.1.1)
33
+ arel (~> 2.2.1)
34
+ tzinfo (~> 0.3.29)
35
+ activeresource (3.1.1)
36
+ activemodel (= 3.1.1)
37
+ activesupport (= 3.1.1)
38
+ activesupport (3.1.1)
39
+ multi_json (~> 1.0)
40
+ arel (2.2.1)
41
+ builder (3.0.0)
42
+ cucumber (1.0.6)
43
+ builder (>= 2.1.2)
44
+ diff-lcs (>= 1.1.2)
45
+ gherkin (~> 2.4.18)
46
+ json (>= 1.4.6)
47
+ term-ansicolor (>= 1.0.6)
48
+ diff-lcs (1.1.3)
49
+ erubis (2.7.0)
50
+ gherkin (2.4.21)
51
+ json (>= 1.4.6)
52
+ hike (1.2.1)
53
+ i18n (0.6.0)
54
+ json (1.6.1)
55
+ less (2.0.7)
56
+ therubyracer (~> 0.9.2)
57
+ less-rails (2.1.0)
58
+ actionpack (~> 3.1.1)
59
+ less (~> 2.0.7)
60
+ libv8 (3.3.10.4)
61
+ mail (2.3.0)
62
+ i18n (>= 0.4.0)
63
+ mime-types (~> 1.16)
64
+ treetop (~> 1.4.8)
65
+ mime-types (1.16)
66
+ multi_json (1.0.3)
67
+ polyglot (0.3.2)
68
+ rack (1.3.4)
69
+ rack-cache (1.1)
70
+ rack (>= 0.4)
71
+ rack-mount (0.8.3)
72
+ rack (>= 1.0.0)
73
+ rack-ssl (1.3.2)
74
+ rack
75
+ rack-test (0.6.1)
76
+ rack (>= 1.0)
77
+ rails (3.1.1)
78
+ actionmailer (= 3.1.1)
79
+ actionpack (= 3.1.1)
80
+ activerecord (= 3.1.1)
81
+ activeresource (= 3.1.1)
82
+ activesupport (= 3.1.1)
83
+ bundler (~> 1.0)
84
+ railties (= 3.1.1)
85
+ railties (3.1.1)
86
+ actionpack (= 3.1.1)
87
+ activesupport (= 3.1.1)
88
+ rack-ssl (~> 1.3.2)
89
+ rake (>= 0.8.7)
90
+ rdoc (~> 3.4)
91
+ thor (~> 0.14.6)
92
+ rake (0.9.2)
93
+ rdoc (3.9.4)
94
+ rspec (2.6.0)
95
+ rspec-core (~> 2.6.0)
96
+ rspec-expectations (~> 2.6.0)
97
+ rspec-mocks (~> 2.6.0)
98
+ rspec-core (2.6.4)
99
+ rspec-expectations (2.6.0)
100
+ diff-lcs (~> 1.1.2)
101
+ rspec-mocks (2.6.0)
102
+ rspec-rails (2.6.1)
103
+ actionpack (~> 3.0)
104
+ activesupport (~> 3.0)
105
+ railties (~> 3.0)
106
+ rspec (~> 2.6.0)
107
+ sprockets (2.0.2)
108
+ hike (~> 1.2)
109
+ rack (~> 1.0)
110
+ tilt (~> 1.1, != 1.3.0)
111
+ sqlite3 (1.3.4)
112
+ sqlite3-ruby (1.3.3)
113
+ sqlite3 (>= 1.3.3)
114
+ term-ansicolor (1.0.7)
115
+ therubyracer (0.9.9)
116
+ libv8 (~> 3.3.10)
117
+ thor (0.14.6)
118
+ tilt (1.3.3)
119
+ treetop (1.4.10)
120
+ polyglot
121
+ polyglot (>= 0.3.1)
122
+ tzinfo (0.3.30)
123
+
124
+ PLATFORMS
125
+ ruby
126
+
127
+ DEPENDENCIES
128
+ bootstrapped!
129
+ bundler (~> 1.0.0)
130
+ cucumber (~> 1.0.6)
131
+ rails (~> 3.1)
132
+ rspec-rails (~> 2.6.1)
133
+ sqlite3-ruby (~> 1.3.1)
data/README.rdoc ADDED
@@ -0,0 +1,101 @@
1
+ = Bootstrapped
2
+
3
+ A gem containing Twitter's Bootstrap CSS Project, a JQuery Plugin to simply user interface interactivity, and generators to make scaffolds sexy.
4
+
5
+ In addition, it as generators based off of Ryan Bates nifty-generators https://github.com/ryanb/nifty-generators/. enables you to create fully styled user interfaces using Bootstrap CSS with very little effort. There is one difference though, HAML generators are not included.
6
+
7
+ == Setup
8
+
9
+ === Rails 3
10
+
11
+ Add the gem to your Gemfile.
12
+
13
+ gem "bootstrapped"
14
+
15
+ Add the following to the application.css in the Rails 3.1 pipeline pipeline
16
+
17
+ *= require bootstrap
18
+
19
+ Include any of the BootStrap JavaScript files as necessary
20
+
21
+ //= require bootstrap-alerts
22
+ //= require bootstrap-dropdown
23
+ //= require bootstrap-modal
24
+ //= require bootstrap-popover
25
+ //= require bootstrap-scrollspy
26
+ //= require bootstrap-tabs
27
+ //= require bootstrap-twipsy
28
+ //= require jquery.tablesorter
29
+
30
+ The Table Sorter JQuery plugin (jquery.tablesorter, not included) is only required if you want tables that allow you to order on the column headings.
31
+
32
+ Then you can run any of the included generators.
33
+
34
+ rails g bootstrapped:scaffold Recipe name:string index new
35
+
36
+ == Included Generators
37
+
38
+ * bootstrapped:layout: generates generic layout, stylesheet, and helper files.
39
+ * bootstrapped:scaffold: generates a controller and optional model/migration.
40
+
41
+ To view the README for each generator, run it with the +help+ option.
42
+
43
+ rails g bootstrapped:layout --help
44
+
45
+ == Troubleshooting and FAQs
46
+
47
+ <b>What is the difference between bootstrapped:scaffold and built-in scaffold?</b>
48
+
49
+ One of the primary differences is that bootstrapped:scaffold allows you to choose which controller actions to generate.
50
+
51
+ rails g bootstrapped:scaffold post name:string index new edit
52
+
53
+ There are a few changes to the generated code as well, such as no XML format by default.
54
+
55
+ It also offers support for Shoulda, and RSpec.
56
+
57
+
58
+ <b>I get "undefined method 'title'" error.</b>
59
+
60
+ Try running bootstrapped:layout, that will generate this helper method. Or you can just change the templates to whatever approach you prefer for setting the title.
61
+
62
+
63
+ <b>I can't set new attributes in my model.</b>
64
+
65
+ Add the attribute to the attr_accessible line in the model.
66
+
67
+
68
+ <b>I get "undefined method 'root_url'" error.</b>
69
+
70
+ Some generators default redirecting to the root_url. Set this in your routes.rb file like this (substituting your controller name).
71
+
72
+ root :to => "home#index"
73
+
74
+
75
+ <b>I get a missing database error.</b>
76
+
77
+ Run <tt>rake db:migrate</tt>.
78
+
79
+
80
+ <b>I get a routing error when I try to submit a form.</b>
81
+
82
+ Try restarting your development server. Sometimes it doesn't detect the change in the routing.
83
+
84
+
85
+ <b>The tests/specs don't work.</b>
86
+
87
+ Make sure you have mocha installed and require it in your spec/test helper.
88
+
89
+ gem install mocha
90
+
91
+ # in spec_helper.rb
92
+ config.mock_with :mocha
93
+
94
+ # in test_helper.rb
95
+ require 'mocha'
96
+
97
+ == Found a bug?
98
+
99
+ If you are having a problem with Bootstrapped, first look at the FAQs above. If you still cannot resolve it, please submit an issue here.
100
+
101
+ http://github.com/entropillc/bootstrapped/issues
data/bootstrapped.gemspec CHANGED
@@ -15,8 +15,12 @@ Gem::Specification.new do |s|
15
15
 
16
16
  s.add_dependency "railties", "~> 3.1"
17
17
  s.add_dependency "thor", "~> 0.14"
18
+ s.add_runtime_dependency "less-rails", "~> 2.1.0"
19
+ s.add_development_dependency 'rspec-rails', '~> 2.6.1'
20
+ s.add_development_dependency 'cucumber', '~> 1.0.6'
18
21
  s.add_development_dependency "bundler", "~> 1.0.0"
19
22
  s.add_development_dependency "rails", "~> 3.1"
23
+ s.add_development_dependency 'sqlite3-ruby', '~> 1.3.1'
20
24
 
21
25
  s.files = `git ls-files`.split("\n")
22
26
  s.executables = `git ls-files`.split("\n").select{|f| f =~ /^bin/}
@@ -0,0 +1,13 @@
1
+ Feature: Bootstrapped Layout Generator
2
+ In order to have a layout
3
+ As a rails developer
4
+ I want to generate a simple layout
5
+
6
+ Scenario: Generate normal application layout
7
+ Given a new Rails app
8
+ When I run "rails g bootstrapped:layout -f"
9
+ Then I should see "stylesheet_link_tag "application"" in file "app/views/layouts/application.html.erb"
10
+ Then I should see "h(page_title" in file "app/helpers/layout_helper.rb"
11
+ And I should see file "app/helpers/layout_helper.rb"
12
+ And I should see file "app/helpers/error_messages_helper.rb"
13
+ And I should see file "app/views/share/_flash.html.erb"
@@ -0,0 +1,80 @@
1
+ Feature: Bootstrapped Scaffold Generator
2
+ In order to manage a resource
3
+ As a rails developer
4
+ I want to generate a model, controller, and views for that resource
5
+
6
+ Scenario: Generate scaffold for simple resource
7
+ Given a new Rails app
8
+ When I run "rails g bootstrapped:scaffold Project name:string"
9
+ Then I should see the following files
10
+ | app/models/project.rb |
11
+ | app/controllers/projects_controller.rb |
12
+ | app/helpers/projects_helper.rb |
13
+ | app/views/projects/index.html.erb |
14
+ | app/views/projects/show.html.erb |
15
+ | app/views/projects/new.html.erb |
16
+ | app/views/projects/edit.html.erb |
17
+ | db/migrate |
18
+ And I should see "resources :projects" in file "config/routes.rb"
19
+ And I should see "gem "mocha", :group => :test" in file "Gemfile"
20
+ When I run "rails g bootstrapped:layout -f"
21
+ And I run "rake db:migrate"
22
+ And I should successfully run "rails g bootstrapped:scaffold Project -f"
23
+ Then I should successfully run "rake test"
24
+
25
+ Scenario: Generate scaffold with rspec tests
26
+ Given a new Rails app
27
+ When I run "rails g bootstrapped:scaffold Project name:string --rspec"
28
+ Then I should see the following files
29
+ | spec/models/project_spec.rb |
30
+ | spec/controllers/projects_controller_spec.rb |
31
+ When I run "rails g bootstrapped:scaffold Task project_id:integer"
32
+ Then I should see the following files
33
+ | spec/models/task_spec.rb |
34
+ | spec/controllers/tasks_controller_spec.rb |
35
+ When I run "rails g bootstrapped:layout -f"
36
+ And I run "rake db:migrate"
37
+ And I add "gem 'rspec-rails', '>= 2.6.1'" to file "Gemfile"
38
+ And I run "rails g rspec:install"
39
+ And I replace "mock_with :rspec" with "mock_with :mocha" in file "spec/spec_helper.rb"
40
+ Then I should successfully run "rake spec"
41
+
42
+ Scenario: Report error when invalid model name
43
+ Given a new Rails app
44
+ Then I should see "Usage:" when running "rails g bootstrapped:scaffold name:string parent_id:integer"
45
+
46
+ Scenario: Generate scaffold for namespaced resource
47
+ Given a new Rails app
48
+ When I run "rails g bootstrapped:scaffold Admin::User name:string"
49
+ Then I should see the following files
50
+ | app/models/user.rb |
51
+ | app/controllers/admin/users_controller.rb |
52
+ | app/helpers/admin/users_helper.rb |
53
+ | app/views/admin/users/index.html.erb |
54
+ | app/views/admin/users/show.html.erb |
55
+ | app/views/admin/users/new.html.erb |
56
+ | app/views/admin/users/edit.html.erb |
57
+ | db/migrate |
58
+ And I should see "class User" in file "app/models/user.rb"
59
+ And I should not see "set_table_name :" in file "app/models/user.rb"
60
+ And I should see "namespace(:admin){ resources :users }" in file "config/routes.rb"
61
+ When I run "rails g bootstrapped:layout -f"
62
+ And I run "rake db:migrate"
63
+ And I should successfully run "rails g bootstrapped:scaffold Admin::User -f"
64
+ Then I should successfully run "rake test"
65
+
66
+ Scenario: Generate scaffold with a namespaced model
67
+ Given a new Rails app
68
+ When I run "rails g bootstrapped:scaffold Admin::User name:string --namespace_model"
69
+ Then I should see "class Admin::User" in file "app/models/admin/user.rb"
70
+ And I should see "set_table_name :admin_users" in file "app/models/admin/user.rb"
71
+ When I run "rails g bootstrapped:layout -f"
72
+ And I run "rake db:migrate"
73
+ And I should successfully run "rails g bootstrapped:scaffold Admin::User -f --namespace_model"
74
+ Then I should successfully run "rake test"
75
+
76
+ Scenario: Given scaffold with a new and index action
77
+ Given a new Rails app
78
+ When I run "rails g bootstrapped:scaffold Project name:string index new"
79
+ Then I should see "class Project" in file "app/models/project.rb"
80
+ And I should see "<%= form_for @project do |f| %>" in file "app/views/projects/new.html.erb"
@@ -0,0 +1,62 @@
1
+ When /^I run "([^\"]*)"$/ do |command|
2
+ system("cd #{@current_directory} && #{command}").should be_true
3
+ end
4
+
5
+ When /^I add "([^\"]*)" to file "([^\"]*)"$/ do |content, short_path|
6
+ path = File.join(@current_directory, short_path)
7
+ File.should exist(path)
8
+ File.open(path, 'a') { |f| f.write(content + "\n") }
9
+ end
10
+
11
+ When /^I replace "([^\"]*)" with "([^\"]*)" in file "([^\"]*)"$/ do |old_content, new_content, short_path|
12
+ path = File.join(@current_directory, short_path)
13
+ File.should exist(path)
14
+ content = File.read(path).gsub(old_content, new_content)
15
+ File.open(path, 'w') { |f| f.write(content) }
16
+ end
17
+
18
+ When /^I insert "([^\"]*)" into "([^\"]*)" after line (\d+)$/ do |content, short_path, after_line|
19
+ path = File.join(@current_directory, short_path)
20
+ File.should exist(path)
21
+ lines = File.read(path).split("\n")
22
+ lines[after_line.to_i, 0] = content
23
+ File.open(path, 'w') { |f| f.write(lines.join("\n")) }
24
+ end
25
+
26
+ Then /^I should see file "([^\"]*)"$/ do |path|
27
+ File.should exist(File.join(@current_directory, path))
28
+ end
29
+
30
+ Then /^I should see "(.*)" in file "([^\"]*)"$/ do |content, short_path|
31
+ path = File.join(@current_directory, short_path)
32
+ File.should exist(path)
33
+ File.readlines(path).join.should include(content)
34
+ end
35
+
36
+ Then /^I should not see "(.*)" in file "([^\"]*)"$/ do |content, short_path|
37
+ path = File.join(@current_directory, short_path)
38
+ File.should exist(path)
39
+ File.readlines(path).join.should_not include(content)
40
+ end
41
+
42
+ Then /^I should see the following files$/ do |table|
43
+ table.raw.flatten.each do |path|
44
+ File.should exist(File.join(@current_directory, path))
45
+ end
46
+ end
47
+
48
+ Then /^I should see the following in file "([^\"]*)"$/ do |short_path, table|
49
+ path = File.join(@current_directory, short_path)
50
+ File.should exist(path)
51
+ table.raw.flatten.each do |content|
52
+ File.readlines(path).join.should include(content)
53
+ end
54
+ end
55
+
56
+ Then /^I should successfully run "([^\"]*)"$/ do |command|
57
+ system("cd #{@current_directory} && #{command}").should be_true
58
+ end
59
+
60
+ Then /^I should see "([^\"]*)" when running "([^\"]*)"$/ do |expected_response, command|
61
+ `cd #{@current_directory} && #{command}`.should include(expected_response)
62
+ end
@@ -0,0 +1,6 @@
1
+ Given /^a new Rails app$/ do
2
+ FileUtils.mkdir_p("tmp")
3
+ system("rails new tmp/rails_app").should be_true
4
+ system("ln -s ../../../lib/generators tmp/rails_app/lib/generators").should be_true
5
+ @current_directory = File.expand_path("tmp/rails_app")
6
+ end
@@ -0,0 +1,6 @@
1
+ require 'cucumber'
2
+ require 'rspec'
3
+
4
+ Before do
5
+ FileUtils.rm_rf "tmp/rails_app"
6
+ end
@@ -0,0 +1,7 @@
1
+ RSpec::Matchers.define :exist do |path|
2
+ match do
3
+ File.exist?(path)
4
+ end
5
+ failure_message_for_should { "Expected #{path} to exist but no file found" }
6
+ failure_message_for_should_not { "Expected #{path} to not exist but file was found" }
7
+ end
data/lib/bootstrapped.rb CHANGED
@@ -1,3 +1,4 @@
1
- require "bootstrapped/version"
1
+ require 'less-rails'
2
+ require 'bootstrapped/version'
2
3
  require 'bootstrapped/engine'
3
4