scaffoldr 0.1.0

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 (54) hide show
  1. checksums.yaml +15 -0
  2. data/.document +5 -0
  3. data/.rspec +1 -0
  4. data/Gemfile +18 -0
  5. data/Gemfile.lock +99 -0
  6. data/LICENSE.txt +20 -0
  7. data/README.md +95 -0
  8. data/Rakefile +49 -0
  9. data/VERSION +1 -0
  10. data/images/Basic.png +0 -0
  11. data/images/Fluid.png +0 -0
  12. data/images/JustifiedNav.png +0 -0
  13. data/images/MarketingNarrow.png +0 -0
  14. data/images/Starter.png +0 -0
  15. data/lib/generators/bootstrap/layout/basic/USAGE +6 -0
  16. data/lib/generators/bootstrap/layout/basic/basic_generator.rb +13 -0
  17. data/lib/generators/bootstrap/layout/fluid/USAGE +6 -0
  18. data/lib/generators/bootstrap/layout/fluid/fluid_generator.rb +13 -0
  19. data/lib/generators/bootstrap/layout/generator_base.rb +38 -0
  20. data/lib/generators/bootstrap/layout/justified_nav/USAGE +6 -0
  21. data/lib/generators/bootstrap/layout/justified_nav/justified_nav_generator.rb +12 -0
  22. data/lib/generators/bootstrap/layout/marketing_narrow/USAGE +6 -0
  23. data/lib/generators/bootstrap/layout/marketing_narrow/marketing_narrow_generator.rb +12 -0
  24. data/lib/generators/bootstrap/layout/starter/USAGE +6 -0
  25. data/lib/generators/bootstrap/layout/starter/starter_generator.rb +12 -0
  26. data/lib/generators/bootstrap/layout/templates/_nav.html.erb +6 -0
  27. data/lib/generators/bootstrap/layout/templates/_nav.html.haml +18 -0
  28. data/lib/generators/bootstrap/layout/templates/_nav_second_tier.html.erb +7 -0
  29. data/lib/generators/bootstrap/layout/templates/_nav_second_tier.html.haml +19 -0
  30. data/lib/generators/bootstrap/layout/templates/base.html.erb +46 -0
  31. data/lib/generators/bootstrap/layout/templates/base.html.haml +23 -0
  32. data/lib/generators/bootstrap/layout/templates/basic.css +5 -0
  33. data/lib/generators/bootstrap/layout/templates/basic.html.erb +67 -0
  34. data/lib/generators/bootstrap/layout/templates/basic.html.haml +70 -0
  35. data/lib/generators/bootstrap/layout/templates/fluid.css +17 -0
  36. data/lib/generators/bootstrap/layout/templates/fluid.html.erb +83 -0
  37. data/lib/generators/bootstrap/layout/templates/fluid.html.haml +94 -0
  38. data/lib/generators/bootstrap/layout/templates/home_controller.rb.erb +2 -0
  39. data/lib/generators/bootstrap/layout/templates/index.html.erb +5 -0
  40. data/lib/generators/bootstrap/layout/templates/index.html.haml +4 -0
  41. data/lib/generators/bootstrap/layout/templates/justified_nav.css +70 -0
  42. data/lib/generators/bootstrap/layout/templates/justified_nav.html.erb +53 -0
  43. data/lib/generators/bootstrap/layout/templates/justified_nav.html.haml +53 -0
  44. data/lib/generators/bootstrap/layout/templates/marketing_narrow.css +36 -0
  45. data/lib/generators/bootstrap/layout/templates/marketing_narrow.html.erb +52 -0
  46. data/lib/generators/bootstrap/layout/templates/marketing_narrow.html.haml +58 -0
  47. data/lib/generators/bootstrap/layout/templates/starter.css +5 -0
  48. data/lib/generators/bootstrap/layout/templates/starter.html.erb +23 -0
  49. data/lib/generators/bootstrap/layout/templates/starter.html.haml +18 -0
  50. data/lib/scaffoldr.rb +4 -0
  51. data/scaffoldr.gemspec +106 -0
  52. data/spec/scaffoldr_spec.rb +7 -0
  53. data/spec/spec_helper.rb +12 -0
  54. metadata +182 -0
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ ZWNlNjExOGQwMGRjM2MzZTg2ZjZiMmRlYjVlNTE5Y2U4YTlhNzQ4NA==
5
+ data.tar.gz: !binary |-
6
+ ZmJiMTk1ZWI1NTk1ZTYwNWRkZWQxY2MxZTE0ZjgyYjJkY2U4ODAxNw==
7
+ !binary "U0hBNTEy":
8
+ metadata.gz: !binary |-
9
+ M2RkYjdhZGZkMTM2YzE1MmMwNzVkY2VmZGU3MGE1YjI0YzJkZDA1ZmVhMjIz
10
+ Mzg3ZjhiY2UxNjVkODNhZTdhODRmYmM2ZWJjY2ZkZDZjY2RhN2IxZDIyMTUx
11
+ YTMzMGFjNGZmNGU4MWJhOTczYmNjZTA2Y2JjYTQxMTk2YThlYjY=
12
+ data.tar.gz: !binary |-
13
+ Yzg4NDE0OTVhZDA1YzRlOGY2ODcyNjY4NjE1OGRhYzIyOWQ0M2Q0ODE1ODNi
14
+ ZTFkZTZhM2M1MTZlYWMxYjBjNzk3NTJkOTYwMjhhMmYwYzQ2ZjdkMmYyYzc5
15
+ YmFlMTkxZWMyMTk2ZTMyODY0ZTNiNWMzOTIxN2UzZmY1YmFkZDM=
@@ -0,0 +1,5 @@
1
+ lib/**/*.rb
2
+ bin/*
3
+ -
4
+ features/**/*.feature
5
+ LICENSE.txt
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --color
data/Gemfile ADDED
@@ -0,0 +1,18 @@
1
+ source "http://rubygems.org"
2
+ # Add dependencies required to use your gem here.
3
+ # Example:
4
+ # gem "activesupport", ">= 2.3.5"
5
+
6
+ # gem 'builder', '~> 3.0.0' # without this being first, and with this version, bundler goes into infinite loop.
7
+ # gem "twitter-bootstrap-rails", '>= 2.2.8'
8
+ gem "actionpack", '~> 3'
9
+
10
+ # Add dependencies to develop your gem here.
11
+ # Include everything needed to run rake, tests, features, etc.
12
+ group :development do
13
+ gem "rspec", "~> 2.8.0"
14
+ gem "rdoc", "~> 3.12"
15
+ gem "bundler", "~> 1.0.0"
16
+ gem "jeweler", "~> 1.8.4"
17
+ gem "simplecov", ">= 0"
18
+ end
@@ -0,0 +1,99 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ actionpack (3.2.14)
5
+ activemodel (= 3.2.14)
6
+ activesupport (= 3.2.14)
7
+ builder (~> 3.0.0)
8
+ erubis (~> 2.7.0)
9
+ journey (~> 1.0.4)
10
+ rack (~> 1.4.5)
11
+ rack-cache (~> 1.2)
12
+ rack-test (~> 0.6.1)
13
+ sprockets (~> 2.2.1)
14
+ activemodel (3.2.14)
15
+ activesupport (= 3.2.14)
16
+ builder (~> 3.0.0)
17
+ activesupport (3.2.14)
18
+ i18n (~> 0.6, >= 0.6.4)
19
+ multi_json (~> 1.0)
20
+ addressable (2.3.5)
21
+ builder (3.0.4)
22
+ diff-lcs (1.1.3)
23
+ erubis (2.7.0)
24
+ faraday (0.8.8)
25
+ multipart-post (~> 1.2.0)
26
+ git (1.2.5)
27
+ github_api (0.10.1)
28
+ addressable
29
+ faraday (~> 0.8.1)
30
+ hashie (>= 1.2)
31
+ multi_json (~> 1.4)
32
+ nokogiri (~> 1.5.2)
33
+ oauth2
34
+ hashie (2.0.5)
35
+ highline (1.6.19)
36
+ hike (1.2.3)
37
+ httpauth (0.2.0)
38
+ i18n (0.6.4)
39
+ jeweler (1.8.6)
40
+ builder
41
+ bundler (~> 1.0)
42
+ git (>= 1.2.5)
43
+ github_api (= 0.10.1)
44
+ highline (>= 1.6.15)
45
+ nokogiri (= 1.5.10)
46
+ rake
47
+ rdoc
48
+ journey (1.0.4)
49
+ json (1.8.0)
50
+ jwt (0.1.8)
51
+ multi_json (>= 1.5)
52
+ multi_json (1.7.8)
53
+ multi_xml (0.5.5)
54
+ multipart-post (1.2.0)
55
+ nokogiri (1.5.10)
56
+ oauth2 (0.9.2)
57
+ faraday (~> 0.8)
58
+ httpauth (~> 0.2)
59
+ jwt (~> 0.1.4)
60
+ multi_json (~> 1.0)
61
+ multi_xml (~> 0.5)
62
+ rack (~> 1.2)
63
+ rack (1.4.5)
64
+ rack-cache (1.2)
65
+ rack (>= 0.4)
66
+ rack-test (0.6.2)
67
+ rack (>= 1.0)
68
+ rake (10.1.0)
69
+ rdoc (3.12.2)
70
+ json (~> 1.4)
71
+ rspec (2.8.0)
72
+ rspec-core (~> 2.8.0)
73
+ rspec-expectations (~> 2.8.0)
74
+ rspec-mocks (~> 2.8.0)
75
+ rspec-core (2.8.0)
76
+ rspec-expectations (2.8.0)
77
+ diff-lcs (~> 1.1.2)
78
+ rspec-mocks (2.8.0)
79
+ simplecov (0.7.1)
80
+ multi_json (~> 1.0)
81
+ simplecov-html (~> 0.7.1)
82
+ simplecov-html (0.7.1)
83
+ sprockets (2.2.2)
84
+ hike (~> 1.2)
85
+ multi_json (~> 1.0)
86
+ rack (~> 1.0)
87
+ tilt (~> 1.1, != 1.3.0)
88
+ tilt (1.4.1)
89
+
90
+ PLATFORMS
91
+ ruby
92
+
93
+ DEPENDENCIES
94
+ actionpack (~> 3)
95
+ bundler (~> 1.0.0)
96
+ jeweler (~> 1.8.4)
97
+ rdoc (~> 3.12)
98
+ rspec (~> 2.8.0)
99
+ simplecov
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2013 Farley Knight Consulting, LLC
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,95 @@
1
+ # scaffoldr
2
+
3
+ Start your Rails 3.1+ application with some default layouts, styled by
4
+ Twitter Bootstrap. The available layouts are the ones
5
+ from [The Twitter Bootstrap documentation](http://getbootstrap.com/2.3.2/getting-started.html#examples).
6
+
7
+ # Usage
8
+
9
+ Add to your Gemfile:
10
+
11
+ gem 'scaffoldr', :git => 'git@github.com:EncomLabs/scaffoldr.git'
12
+ gem 'twitter-bootstrap-rails'
13
+
14
+ Right now there is a bug where we can't add the
15
+ twitter-bootstrap-rails gem as a dependency, due to bundler errors, so
16
+ include that in your Gemfile as well.
17
+
18
+ Run the twitter-bootstrap-rails `static` or `less` installation so
19
+ that the Twitter Bootstrap stylesheets and javascript are included in
20
+ your application manifest files. The below example installs the `static`
21
+ version:
22
+
23
+ rails g bootstrap:install static
24
+
25
+ Generate a bootstrap example layout for yourself. Either of the following will work:
26
+
27
+ **Warning: This will remove and overwrite your application.html.erb/haml file.**
28
+
29
+ rails g bootstrap:layout:starter
30
+ rails g bootstrap:layout:basic
31
+ rails g bootstrap:layout:fluid
32
+ rails g bootstrap:layout:marketing_narrow
33
+ rails g bootstrap:layout:justified_nav
34
+
35
+ The layouts are also available in HAML form:
36
+
37
+ rails g bootstrap:layout:starter --template-engine=haml
38
+
39
+ # Examples
40
+
41
+ ## Starter
42
+
43
+ ![Starter](https://raw.github.com/EncomLabs/scaffoldr/master/images/Starter.png)
44
+
45
+ ## Basic
46
+
47
+ ![Basic](https://raw.github.com/EncomLabs/scaffoldr/master/images/Basic.png)
48
+
49
+ ## Fluid
50
+
51
+ ![Fluid](https://raw.github.com/EncomLabs/scaffoldr/master/images/Fluid.png)
52
+
53
+ ## Marketing Narrow
54
+
55
+ ![Marketing Narrow](https://raw.github.com/EncomLabs/scaffoldr/master/images/MarketingNarrow.png)
56
+
57
+ ## Justified Nav
58
+
59
+ ![Justified Nav](https://raw.github.com/EncomLabs/scaffoldr/master/images/JustifiedNav.png)
60
+
61
+ # Development
62
+
63
+ Here are the commands mikedll uses to exercise the code manually. First we presume a Rails application
64
+ template, named `gemtest.rb`:
65
+
66
+ gem 'twitter-bootstrap-rails'
67
+ gem 'haml'
68
+ gem 'scaffoldr', '0.1.0', :path => '/home/USERHOMEDIRECTORY/work/scaffoldr'
69
+
70
+ Then run these two commands to rapidly execute a full new app and
71
+ scaffold action. The second assumes you're already in the target app
72
+ directory, dino_dictionary. That is, *it assumes you are in the middle
73
+ of a redeploy loop*. Below "dino dictionary" is used as the name of the app, but
74
+ that's arbitrary of course.
75
+
76
+ rm -rf dino_dictionary; rails new dino_dictionary -m ~/PATH/TO/gemtest.rb
77
+ cd ..; cd dino_dictionary; rails g bootstrap:install static; rails g bootstrap:layout:starter --template-engine=haml; rails s
78
+
79
+ ## Tips
80
+
81
+ - Look at the rails generators from other gems such as simple_form to
82
+ get an idea of how they work.
83
+
84
+ - The command-line invocation is derived from
85
+ the module namespacing, and directory structure, of where you place
86
+ the generator file in the generators directory.
87
+
88
+ # Contributors
89
+
90
+ - [Mike De La Loza](http://www.mikedll.com)
91
+
92
+ # Copyright
93
+
94
+ Copyright (c) 2013 Encom Labs. See LICENSE.txt for further details.
95
+
@@ -0,0 +1,49 @@
1
+ # encoding: utf-8
2
+
3
+ require 'rubygems'
4
+ require 'bundler'
5
+ begin
6
+ Bundler.setup(:default, :development)
7
+ rescue Bundler::BundlerError => e
8
+ $stderr.puts e.message
9
+ $stderr.puts "Run `bundle install` to install missing gems"
10
+ exit e.status_code
11
+ end
12
+ require 'rake'
13
+
14
+ require 'jeweler'
15
+ Jeweler::Tasks.new do |gem|
16
+ # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
17
+ gem.name = "scaffoldr"
18
+ gem.homepage = "http://encomlabs.github.io/scaffoldr/"
19
+ gem.license = "MIT"
20
+ gem.summary = %Q{Twitter Bootstrap scaffolding layouts to get your app started.}
21
+ gem.description = %Q{Create scaffolding layouts for your application quickly. }
22
+ gem.email = "mikedll@mikedll.com"
23
+ gem.authors = ["Farley Knight Consulting, LLC", "Mike De La Loza"]
24
+ # dependencies defined in Gemfile
25
+ end
26
+ Jeweler::RubygemsDotOrgTasks.new
27
+
28
+ require 'rspec/core'
29
+ require 'rspec/core/rake_task'
30
+ RSpec::Core::RakeTask.new(:spec) do |spec|
31
+ spec.pattern = FileList['spec/**/*_spec.rb']
32
+ end
33
+
34
+ RSpec::Core::RakeTask.new(:rcov) do |spec|
35
+ spec.pattern = 'spec/**/*_spec.rb'
36
+ spec.rcov = true
37
+ end
38
+
39
+ task :default => :spec
40
+
41
+ require 'rdoc/task'
42
+ Rake::RDocTask.new do |rdoc|
43
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
44
+
45
+ rdoc.rdoc_dir = 'rdoc'
46
+ rdoc.title = "scaffoldr #{version}"
47
+ rdoc.rdoc_files.include('README*')
48
+ rdoc.rdoc_files.include('lib/**/*.rb')
49
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.1.0
Binary file
Binary file
Binary file
Binary file
@@ -0,0 +1,6 @@
1
+
2
+ To create the Basic example layout in your application, run:
3
+
4
+ rails generate bootstrap:layout:basic
5
+
6
+
@@ -0,0 +1,13 @@
1
+ require 'generators/bootstrap/layout/generator_base'
2
+
3
+ module Bootstrap
4
+ module Layout
5
+ module Generators
6
+ class BasicGenerator < Bootstrap::Layout::GeneratorBase
7
+ source_root File.expand_path('../../templates', __FILE__)
8
+ desc "Create basic scaffolding layout file."
9
+ def nav_second_tier; true; end;
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,6 @@
1
+
2
+ To create the Starter example layout in your application, run:
3
+
4
+ rails generate bootstrap:layout:fluid
5
+
6
+
@@ -0,0 +1,13 @@
1
+ require 'generators/bootstrap/layout/generator_base'
2
+
3
+ module Bootstrap
4
+ module Layout
5
+ module Generators
6
+ class FluidGenerator < Bootstrap::Layout::GeneratorBase
7
+ source_root File.expand_path('../../templates', __FILE__)
8
+ desc "Create fluid scaffolding layout file."
9
+ def nav_second_tier; true; end
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,38 @@
1
+ module Bootstrap
2
+ module Layout
3
+ class GeneratorBase < Rails::Generators::Base
4
+
5
+ attr_accessor :style, :body, :app_name
6
+
7
+ class_option :template_engine
8
+
9
+ def nav_second_tier; false; end
10
+
11
+ def create_layout
12
+ # Heavily from twitter-bootstrap-rails
13
+ app = ::Rails.application
14
+ self.app_name = app.class.to_s.split("::").first
15
+ layout_name = self.class.name.chomp("Generator").demodulize.underscore
16
+ engine = options[:template_engine] || :erb
17
+ context = instance_eval('binding')
18
+ self.style = ERB.new(::File.new(::File.expand_path(find_in_source_paths("#{layout_name}.css"))).read).result(context)
19
+ self.body = ERB.new(::File.new(::File.expand_path(find_in_source_paths("#{layout_name}.html.#{engine}"))).read).result(context)
20
+
21
+ remove_file "app/views/layouts/application.html.erb"
22
+ remove_file "app/views/layouts/application.html.haml"
23
+
24
+ template "base.html.#{engine}", "app/views/layouts/application.html.#{engine}"
25
+ remove_file "public/index.html"
26
+ copy_file "_nav.html.#{engine}", "app/views/shared/_nav.html.#{engine}"
27
+ copy_file "_nav_second_tier.html.#{engine}", "app/views/shared/_nav_second_tier.html.#{engine}" if nav_second_tier
28
+ copy_file "home_controller.rb.erb", "app/controllers/home_controller.rb"
29
+ template "index.html.#{engine}", "app/views/home/index.html.#{engine}"
30
+ end
31
+
32
+ def routes
33
+ route 'root :to => "home#index"'
34
+ end
35
+
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,6 @@
1
+
2
+ To create the Starter example layout in your application, run:
3
+
4
+ rails generate bootstrap:layout:justified_nav
5
+
6
+
@@ -0,0 +1,12 @@
1
+ require 'generators/bootstrap/layout/generator_base'
2
+
3
+ module Bootstrap
4
+ module Layout
5
+ module Generators
6
+ class JustifiedNavGenerator < Bootstrap::Layout::GeneratorBase
7
+ source_root File.expand_path('../../templates', __FILE__)
8
+ desc "Create justfied nav scaffolding layout file."
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,6 @@
1
+
2
+ To create the Starter example layout in your application, run:
3
+
4
+ rails generate bootstrap:layout:marketing_narrow
5
+
6
+
@@ -0,0 +1,12 @@
1
+ require 'generators/bootstrap/layout/generator_base'
2
+
3
+ module Bootstrap
4
+ module Layout
5
+ module Generators
6
+ class MarketingNarrowGenerator < Bootstrap::Layout::GeneratorBase
7
+ source_root File.expand_path('../../templates', __FILE__)
8
+ desc "Create marketing narrow scaffolding layout file."
9
+ end
10
+ end
11
+ end
12
+ end