lazy-head-gen 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # lazy-head-gen
2
2
 
3
- Lazy Head Gen provides a couple of extra generators for the excellent [Padrino](https://github.com/padrino/padrino-framework) framework.
3
+ lazy-head-gen provides some extra generators for the excellent [Padrino](https://github.com/padrino/padrino-framework) framework.
4
4
 
5
- It is assuming that you are using ActiveRecord and MiniTest, as that is the options we normally use when developing at [Head](http://www.headlondon.com).
5
+ It is assuming that you are using ActiveRecord and MiniTest, as that is the options we normally use in our development at [Head](http://www.headlondon.com).
6
6
 
7
7
  ## Installation
8
8
 
@@ -17,63 +17,111 @@ gem 'lazy-head-gen', :group => [:development, :test]
17
17
  ```
18
18
 
19
19
  Padrino gotcha: You'll need to put the `gem 'lazy-head-gen'` requirement *after* `gem 'padrino'` in your Gemfile.
20
- Lazy Head Gen needs Padrino loaded before it can work.
20
+ lazy-head-gen depends on Padrino being loaded before it can do it's stuff.
21
21
 
22
- Also you will need to add this gem for both :development and :test groups. This is because there are a couple of added test helper functions and assertions used by the output from the generators.
22
+ Also you will need to add this gem for both :development and :test groups. There are a few bundled in test helper functions and assertions used by the test files outputted from the generators.
23
23
 
24
24
  ## Usage
25
25
 
26
- ### Scaffold Generator
26
+ ### Bootstrapped Admin Generator
27
+
28
+ Generates a new Padrino Admin application with Twitter Bootstrapped integrated.
29
+
30
+ **Usage:**
31
+
32
+ ```
33
+ padrino g bootstrapped_admin
34
+ ```
35
+
36
+ **Options:**
37
+
38
+ -r, [--root=ROOT] The root destination. Default: .
27
39
 
28
- To generate a new scaffold:
40
+ -s, [--skip-migration]
41
+
42
+ -d, [--destroy]
43
+
44
+ -m, [--admin-model=ADMIN_MODEL] The name of model for access controlling. Default: Account
45
+
46
+ -a, [--app=APP] The model destination path. Default: .
47
+
48
+ **Example:**
29
49
 
30
50
  ```
31
- padrino g scaffold ModelName property:type
51
+ padrino g bootstrapped_admin
32
52
  ```
33
53
 
34
- For example to generate a scaffold for Products:
54
+ ### Bootstrapped Admin Page Generator
55
+
56
+ Generates a new Padrino Admin page with Twitter Bootstrapped integrated.
57
+
58
+ **Usage:**
35
59
 
36
60
  ```
37
- padrino g scaffold Product title:string summary:text quantity:integer available_from:datetime display:boolean
61
+ padrino g bootstrapped_admin_page [model]
38
62
  ```
39
63
 
40
- This will generate the following:
64
+ **Options:**
65
+
66
+ -r, [--root=ROOT] The root destination.
67
+
68
+ -s, [--skip-migration]
41
69
 
42
- * A controller, helper and controller test for Products
43
- * An index and show view for Products
44
- * A model, model test and database migration for Product
45
- * A blueprints file if one doesn't exist
70
+ -d, [--destroy]
46
71
 
47
- It will also add:
72
+ **Example:**
48
73
 
49
- * A reference to blueprints.rb to test_config.rb if required
50
- * Add a Product blueprint and it's properties to the blueprints.rb file
74
+ ```
75
+ padrino g bootstrapped_admin_page product
76
+ ```
51
77
 
52
78
  ### Admin Controller Tests Generator
53
79
 
54
- To generate a new admin controller test:
80
+ Generates a fully tested admin controller test for the 6 CRUD actions of a standard Padrino admin controller.
81
+
82
+ **Usage:**
55
83
 
56
84
  ```
57
- padrino g admin_controller_tests ControllerName
85
+ padrino g admin_controller_test [name]
58
86
  ```
59
87
 
60
- Controller name should be the name of an existing admin controller.
88
+ **Options:**
61
89
 
62
- For example to generate an admin controller test for products:
90
+ -r, [--root=ROOT] The root destination. Default: .
91
+
92
+ **Example:**
63
93
 
64
94
  ```
65
95
  padrino g admin_controller_tests products
66
96
  ```
67
97
 
68
- This will generate a fully tested admin controller test for the 6 CRUD routes of a standard Padrino admin controller.
98
+ ### Scaffold Generator
69
99
 
70
- ### Bootstrapped Admin Generator
100
+ Generates a fully tested Padrino resource scaffold
71
101
 
72
- TODO: write about this
102
+ **Usage:**
73
103
 
74
- ### Bootstrapped Admin Page Generator
104
+ ```
105
+ padrino g scaffold [name]
106
+ ```
75
107
 
76
- TODO: write about this
108
+ **Options:**
109
+
110
+ -r, [--root=ROOT] The root destination. Default: .
111
+
112
+ -s, [--skip-migration] Specify whether to skip generating a migration
113
+
114
+ -a, [--app-path=APP_PATH] The application destination path. Default: /app
115
+
116
+ -m, [--model-path=MODEL_PATH] he model destination path. Default: .
117
+
118
+ -c, [--create-full-actions] Specify whether to generate basic (index and show) or full (index, show, new, create, edit, update and delete) actions.
119
+
120
+ **Example:**
121
+
122
+ ```
123
+ padrino g scaffold Product title:string summary:text quantity:integer available_from:datetime display:boolean -c
124
+ ```
77
125
 
78
126
  ## Extras
79
127
 
@@ -87,8 +135,9 @@ If you already have a blueprints.rb file, the scaffold generator looks for *# EN
87
135
 
88
136
  ## To Do List
89
137
 
90
- * Finish README
138
+ * Finish README - Built in assertions and test helpers
91
139
  * See if there is a better way to do the blueprint inserts
140
+ * Add form output to the scaffold generator
92
141
 
93
142
  ## Contributing to lazy-head-gen
94
143
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.0
1
+ 0.3.1
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "lazy-head-gen"
8
- s.version = "0.3.0"
8
+ s.version = "0.3.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Stuart Chinery"]
12
- s.date = "2012-07-04"
12
+ s.date = "2012-07-05"
13
13
  s.description = "Lazy Head Gen is simply a couple of extra generators for the excellent Padrino framework."
14
14
  s.email = "stuart.chinery@headlondon.com"
15
15
  s.extra_rdoc_files = [
@@ -35,6 +35,7 @@ Gem::Specification.new do |s|
35
35
  "lib/lazy-head-gen/templates/admin_app/app.rb.tt",
36
36
  "lib/lazy-head-gen/templates/admin_app/app/controllers/base.rb",
37
37
  "lib/lazy-head-gen/templates/admin_app/app/controllers/sessions.rb.tt",
38
+ "lib/lazy-head-gen/templates/admin_app/app/helpers/application_helper.rb",
38
39
  "lib/lazy-head-gen/templates/admin_app/assets/css/bootstrap-responsive.css",
39
40
  "lib/lazy-head-gen/templates/admin_app/assets/css/bootstrap-responsive.min.css",
40
41
  "lib/lazy-head-gen/templates/admin_app/assets/css/bootstrap.css",
@@ -1,6 +1,6 @@
1
1
  begin
2
2
  require 'padrino-gen'
3
- Padrino::Generators.load_paths << Dir[File.dirname(__FILE__) + '/lazy-head-gen/{admin_controller_test,scaffold,actions,orm,bootstrapped_admin_app,bootstrapped_admin_page}.rb']
3
+ Padrino::Generators.load_paths << Dir[File.dirname(__FILE__) + '/lazy-head-gen/{bootstrapped_admin_app,bootstrapped_admin_page,admin_controller_test,scaffold}.rb']
4
4
  rescue LoadError
5
5
  # Fail silently
6
6
  end
@@ -8,7 +8,7 @@ module Padrino
8
8
  # Define the source template root
9
9
  def self.source_root; File.expand_path(File.dirname(__FILE__)); end
10
10
  # Defines the banner for this CLI generator
11
- def self.banner; "padrino-gen admin_controller_test [name]"; end
11
+ def self.banner; "padrino g admin_controller_test [name]"; end
12
12
 
13
13
  # Include related modules
14
14
  include Thor::Actions
@@ -17,7 +17,7 @@ module Padrino
17
17
  include Padrino::Generators::Runner
18
18
  include Padrino::Generators::Components::Actions
19
19
 
20
- desc "Description:\n\n\tlazy-head-gen admin_controller_test generates basic tests for an admin controller"
20
+ desc "Description:\n\n\tpadrino g admin_controller_test - Generates basic tests for an admin controller"
21
21
 
22
22
  argument :name, :desc => "The name of your admin controller"
23
23
 
@@ -11,16 +11,14 @@ module Padrino
11
11
  # Define the source template root and themes.
12
12
  def self.source_root; File.expand_path(File.dirname(__FILE__)); end
13
13
  # Defines the "banner" text for the CLI.
14
- def self.banner; "padrino-gen bootstrapped_admin"; end
15
- # Defines the theme names for admin based on available.
16
- # def self.themes; Dir[File.dirname(__FILE__) + "/templates/admin_app/assets/stylesheets/themes/*"].map { |t| File.basename(t) }.sort; end
14
+ def self.banner; "padrino g bootstrapped_admin"; end
17
15
 
18
16
  # Include related modules
19
17
  include Thor::Actions
20
18
  include Padrino::Generators::Actions
21
19
  include Padrino::Generators::Admin::Actions
22
20
 
23
- desc "Description:\n\n\tpadrino-gen bootstrapped_admin generates a new Padrino Admin application with Twitter Bootstrapped integrated"
21
+ desc "Description:\n\n\tpadrino g bootstrapped_admin - Generates a new Padrino Admin application with Twitter Bootstrapped integrated"
24
22
 
25
23
  class_option :skip_migration, :aliases => "-s", :default => false, :type => :boolean
26
24
 
@@ -12,14 +12,14 @@ module Padrino
12
12
  # Define the source template root
13
13
  def self.source_root; File.expand_path(File.dirname(__FILE__)); end
14
14
  # Defines the "banner" text for the CLI.
15
- def self.banner; "padrino-gen bootstrapped_admin_page [model]"; end
15
+ def self.banner; "padrino g bootstrapped_admin_page [model]"; end
16
16
 
17
17
  # Include related modules
18
18
  include Thor::Actions
19
19
  include Padrino::Generators::Actions
20
20
  include Padrino::Generators::Admin::Actions
21
21
 
22
- desc "Description:\n\n\tpadrino-gen bootstrapped_admin_page model(s) generates a new Padrino Admin page with Twitter Bootstrapped integrated"
22
+ desc "Description:\n\n\tpadrino g bootstrapped_admin_page [model(s)] - Generates a new Padrino Admin page with Twitter Bootstrapped integrated"
23
23
 
24
24
  argument :models, :desc => "The name(s) of your model(s)", :type => :array
25
25
 
@@ -55,4 +55,4 @@ module Padrino
55
55
  end
56
56
  end # AdminPage
57
57
  end # Generators
58
- end # Padrino
58
+ end # Padrino
@@ -8,7 +8,7 @@ module Padrino
8
8
  # Define the source template root
9
9
  def self.source_root; File.expand_path(File.dirname(__FILE__)); end
10
10
  # Defines the banner for this CLI generator
11
- def self.banner; "padrino-gen scaffold [name]"; end
11
+ def self.banner; "padrino g scaffold [name]"; end
12
12
 
13
13
  # Include related modules
14
14
  include Thor::Actions
@@ -17,7 +17,7 @@ module Padrino
17
17
  include Padrino::Generators::Runner
18
18
  include Padrino::Generators::Components::Actions
19
19
 
20
- desc "Description:\n\n\tlazy-head-gen scaffold generates a new Padrino scaffold"
20
+ desc "Description:\n\n\tpadrino g scaffold - Generates a fully tested Padrino resource scaffold"
21
21
 
22
22
  argument :name, :desc => "The name of your scaffold resource"
23
23
 
@@ -0,0 +1,23 @@
1
+ # Helper methods defined here can be accessed in any controller or view in the application
2
+
3
+ Admin.helpers do
4
+
5
+ # Translates default Padrino flash keys into default Twitter Bootstrap
6
+ # alert CSS class name extension.
7
+ #
8
+ # @param [Symbol] flash - The flash key
9
+ # @return [String] the CSS class name
10
+ def bootstrap_alert_for(flash)
11
+ case flash
12
+ when :error
13
+ return "error"
14
+ when :warning
15
+ return "block"
16
+ when :notice
17
+ return "success"
18
+ when :info
19
+ return "info"
20
+ end
21
+ end
22
+
23
+ end
@@ -1,6 +1,8 @@
1
1
  <div class="row">
2
2
  <div class="span12">
3
- <h2>Dashboard</h2>
3
+ <div class="page-header">
4
+ <h2>Dashboard</h2>
5
+ </div>
4
6
  <p>
5
7
  Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
6
8
  </p>
@@ -62,7 +62,7 @@
62
62
  </div>
63
63
 
64
64
  <div class="container">
65
- <%%= [:error, :warning, :notice].map { |type| flash_tag(type, :class => "message #{type}") }.join %>
65
+ <%%= [:error, :warning, :notice, :info].map { |type| flash_tag(type, :class => "alert alert-#{bootstrap_alert_for(type)}") }.join %>
66
66
 
67
67
  <%%= yield %>
68
68
 
@@ -47,7 +47,7 @@
47
47
  </div>
48
48
 
49
49
  <div class="container">
50
- <%%= [:error, :warning, :notice].map { |type| flash_tag(type, :class => "alert alert-#{type}") }.join %>
50
+ <%%= [:error, :warning, :notice, :info].map { |type| flash_tag(type, :class => "alert alert-#{bootstrap_alert_for(type)}") }.join %>
51
51
 
52
52
  <div class="row">
53
53
  <div class="span6 offset3">
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lazy-head-gen
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
4
+ hash: 17
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 3
9
- - 0
10
- version: 0.3.0
9
+ - 1
10
+ version: 0.3.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Stuart Chinery
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-07-04 00:00:00 Z
18
+ date: 2012-07-05 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  type: :runtime
@@ -416,6 +416,7 @@ files:
416
416
  - lib/lazy-head-gen/templates/admin_app/app.rb.tt
417
417
  - lib/lazy-head-gen/templates/admin_app/app/controllers/base.rb
418
418
  - lib/lazy-head-gen/templates/admin_app/app/controllers/sessions.rb.tt
419
+ - lib/lazy-head-gen/templates/admin_app/app/helpers/application_helper.rb
419
420
  - lib/lazy-head-gen/templates/admin_app/assets/css/bootstrap-responsive.css
420
421
  - lib/lazy-head-gen/templates/admin_app/assets/css/bootstrap-responsive.min.css
421
422
  - lib/lazy-head-gen/templates/admin_app/assets/css/bootstrap.css