bootstrap-on 0.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/Gemfile +13 -0
- data/Gemfile.lock +90 -0
- data/LICENSE.txt +20 -0
- data/README.md +98 -0
- data/Rakefile +38 -0
- data/VERSION +1 -0
- data/bootstrap-on.gemspec +127 -0
- data/lib/bootstrap-on.rb +6 -0
- data/lib/bootstrap-on/bs_admin.rb +138 -0
- data/lib/bootstrap-on/bs_admin_page.rb +55 -0
- data/lib/bootstrap-on/templates/.DS_Store +0 -0
- data/lib/bootstrap-on/templates/account/.DS_Store +0 -0
- data/lib/bootstrap-on/templates/account/activerecord.rb.tt +38 -0
- data/lib/bootstrap-on/templates/account/couchrest.rb.tt +66 -0
- data/lib/bootstrap-on/templates/account/datamapper.rb.tt +55 -0
- data/lib/bootstrap-on/templates/account/mini_record.rb.tt +41 -0
- data/lib/bootstrap-on/templates/account/mongoid.rb.tt +53 -0
- data/lib/bootstrap-on/templates/account/mongomapper.rb.tt +46 -0
- data/lib/bootstrap-on/templates/account/seeds.rb.tt +28 -0
- data/lib/bootstrap-on/templates/account/sequel.rb.tt +52 -0
- data/lib/bootstrap-on/templates/app.rb.tt +36 -0
- data/lib/bootstrap-on/templates/app/controllers/base.rb +6 -0
- data/lib/bootstrap-on/templates/app/controllers/sessions.rb.tt +26 -0
- data/lib/bootstrap-on/templates/app/helpers/application_helper.rb +23 -0
- data/lib/bootstrap-on/templates/assets/.DS_Store +0 -0
- data/lib/bootstrap-on/templates/assets/css/bootstrap-responsive.css +815 -0
- data/lib/bootstrap-on/templates/assets/css/bootstrap-responsive.min.css +9 -0
- data/lib/bootstrap-on/templates/assets/css/bootstrap.css +4983 -0
- data/lib/bootstrap-on/templates/assets/css/bootstrap.min.css +9 -0
- data/lib/bootstrap-on/templates/assets/ico/apple-touch-icon-114-precomposed.png +0 -0
- data/lib/bootstrap-on/templates/assets/ico/apple-touch-icon-144-precomposed.png +0 -0
- data/lib/bootstrap-on/templates/assets/ico/apple-touch-icon-57-precomposed.png +0 -0
- data/lib/bootstrap-on/templates/assets/ico/apple-touch-icon-72-precomposed.png +0 -0
- data/lib/bootstrap-on/templates/assets/ico/favicon.ico +0 -0
- data/lib/bootstrap-on/templates/assets/img/glyphicons-halflings-white.png +0 -0
- data/lib/bootstrap-on/templates/assets/img/glyphicons-halflings.png +0 -0
- data/lib/bootstrap-on/templates/assets/js/.DS_Store +0 -0
- data/lib/bootstrap-on/templates/assets/js/bootstrap.js +1825 -0
- data/lib/bootstrap-on/templates/assets/js/bootstrap.min.js +6 -0
- data/lib/bootstrap-on/templates/assets/js/jquery-min.js +4 -0
- data/lib/bootstrap-on/templates/assets/js/jquery-ujs.js +92 -0
- data/lib/bootstrap-on/templates/assets/js/jquery.js +9404 -0
- data/lib/bootstrap-on/templates/erb/app/base/index.erb.tt +16 -0
- data/lib/bootstrap-on/templates/erb/app/layouts/application.erb.tt +79 -0
- data/lib/bootstrap-on/templates/erb/app/sessions/new.erb.tt +98 -0
- data/lib/bootstrap-on/templates/erb/page/_form.erb.tt +16 -0
- data/lib/bootstrap-on/templates/erb/page/edit.erb.tt +26 -0
- data/lib/bootstrap-on/templates/erb/page/index.erb.tt +41 -0
- data/lib/bootstrap-on/templates/erb/page/new.erb.tt +23 -0
- data/lib/bootstrap-on/templates/haml/app/base/index.haml.tt +23 -0
- data/lib/bootstrap-on/templates/haml/app/layouts/application.haml.tt +31 -0
- data/lib/bootstrap-on/templates/haml/app/sessions/new.haml.tt +30 -0
- data/lib/bootstrap-on/templates/haml/page/_form.haml.tt +12 -0
- data/lib/bootstrap-on/templates/haml/page/edit.haml.tt +15 -0
- data/lib/bootstrap-on/templates/haml/page/index.haml.tt +29 -0
- data/lib/bootstrap-on/templates/haml/page/new.haml.tt +14 -0
- data/lib/bootstrap-on/templates/page/controller.rb.tt +47 -0
- data/lib/bootstrap-on/templates/slim/app/base/index.slim.tt +23 -0
- data/lib/bootstrap-on/templates/slim/app/layouts/application.slim.tt +31 -0
- data/lib/bootstrap-on/templates/slim/app/sessions/new.slim.tt +31 -0
- data/lib/bootstrap-on/templates/slim/page/_form.slim.tt +14 -0
- data/lib/bootstrap-on/templates/slim/page/edit.slim.tt +16 -0
- data/lib/bootstrap-on/templates/slim/page/index.slim.tt +30 -0
- data/lib/bootstrap-on/templates/slim/page/new.slim.tt +15 -0
- data/test/bootstrap-on/test_bs_admin_generator.rb +332 -0
- data/test/bootstrap-on/test_bs_admin_page_generator.rb +132 -0
- data/test/helper.rb +98 -0
- data/test/load_paths.rb +6 -0
- data/test/test_bootstrap-on.rb +15 -0
- metadata +240 -0
data/.document
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,90 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
activesupport (3.2.6)
|
5
|
+
i18n (~> 0.6)
|
6
|
+
multi_json (~> 1.0)
|
7
|
+
ansi (1.4.3)
|
8
|
+
git (1.2.5)
|
9
|
+
http_router (0.10.2)
|
10
|
+
rack (>= 1.0.0)
|
11
|
+
url_mount (~> 0.2.1)
|
12
|
+
i18n (0.6.0)
|
13
|
+
jeweler (1.8.4)
|
14
|
+
bundler (~> 1.0)
|
15
|
+
git (>= 1.2.5)
|
16
|
+
rake
|
17
|
+
rdoc
|
18
|
+
json (1.7.3)
|
19
|
+
macaddr (1.6.1)
|
20
|
+
systemu (~> 2.5.0)
|
21
|
+
mail (2.3.3)
|
22
|
+
i18n (>= 0.4.0)
|
23
|
+
mime-types (~> 1.16)
|
24
|
+
treetop (~> 1.4.8)
|
25
|
+
mime-types (1.19)
|
26
|
+
minitest (3.2.0)
|
27
|
+
multi_json (1.3.6)
|
28
|
+
padrino (0.10.7)
|
29
|
+
padrino-admin (= 0.10.7)
|
30
|
+
padrino-cache (= 0.10.7)
|
31
|
+
padrino-core (= 0.10.7)
|
32
|
+
padrino-gen (= 0.10.7)
|
33
|
+
padrino-helpers (= 0.10.7)
|
34
|
+
padrino-mailer (= 0.10.7)
|
35
|
+
padrino-admin (0.10.7)
|
36
|
+
padrino-core (= 0.10.7)
|
37
|
+
padrino-helpers (= 0.10.7)
|
38
|
+
padrino-cache (0.10.7)
|
39
|
+
padrino-core (= 0.10.7)
|
40
|
+
padrino-core (0.10.7)
|
41
|
+
activesupport (~> 3.2.0)
|
42
|
+
http_router (~> 0.10.2)
|
43
|
+
sinatra (~> 1.3.1)
|
44
|
+
thor (~> 0.15.2)
|
45
|
+
tilt (~> 1.3.0)
|
46
|
+
padrino-gen (0.10.7)
|
47
|
+
bundler (~> 1.0)
|
48
|
+
padrino-core (= 0.10.7)
|
49
|
+
padrino-helpers (0.10.7)
|
50
|
+
i18n (~> 0.6)
|
51
|
+
padrino-core (= 0.10.7)
|
52
|
+
padrino-mailer (0.10.7)
|
53
|
+
mail (~> 2.3.0)
|
54
|
+
padrino-core (= 0.10.7)
|
55
|
+
polyglot (0.3.3)
|
56
|
+
rack (1.4.1)
|
57
|
+
rack-protection (1.2.0)
|
58
|
+
rack
|
59
|
+
rake (0.9.2.2)
|
60
|
+
rdoc (3.12)
|
61
|
+
json (~> 1.4)
|
62
|
+
sinatra (1.3.2)
|
63
|
+
rack (~> 1.3, >= 1.3.6)
|
64
|
+
rack-protection (~> 1.2)
|
65
|
+
tilt (~> 1.3, >= 1.3.3)
|
66
|
+
systemu (2.5.1)
|
67
|
+
thor (0.15.4)
|
68
|
+
tilt (1.3.3)
|
69
|
+
treetop (1.4.10)
|
70
|
+
polyglot
|
71
|
+
polyglot (>= 0.3.1)
|
72
|
+
turn (0.9.6)
|
73
|
+
ansi
|
74
|
+
url_mount (0.2.1)
|
75
|
+
rack
|
76
|
+
uuid (2.3.5)
|
77
|
+
macaddr (~> 1.0)
|
78
|
+
yard (0.6.8)
|
79
|
+
|
80
|
+
PLATFORMS
|
81
|
+
ruby
|
82
|
+
|
83
|
+
DEPENDENCIES
|
84
|
+
bundler (~> 1.1.4)
|
85
|
+
jeweler (~> 1.8.3)
|
86
|
+
minitest
|
87
|
+
padrino
|
88
|
+
turn (~> 0.9.5)
|
89
|
+
uuid
|
90
|
+
yard (~> 0.6.0)
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2012 Stuart Chinery
|
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.
|
data/README.md
ADDED
@@ -0,0 +1,98 @@
|
|
1
|
+
# bootstrap-on
|
2
|
+
|
3
|
+
Padrino admin generators with Twitter Bootstrap integration
|
4
|
+
|
5
|
+
|
6
|
+
## Installation
|
7
|
+
|
8
|
+
```ruby
|
9
|
+
gem install bootstrap-on
|
10
|
+
```
|
11
|
+
|
12
|
+
In a Gemfile:
|
13
|
+
|
14
|
+
```ruby
|
15
|
+
gem 'bootstrap-on', :group => :development
|
16
|
+
```
|
17
|
+
|
18
|
+
Padrino gotcha: You'll need to put the `gem 'bootstrap-on'` requirement in your Gemfile *after* `gem 'padrino'`.
|
19
|
+
bootstrap-on depends on Padrino being loaded before it can do it's stuff.
|
20
|
+
|
21
|
+
|
22
|
+
## Usage
|
23
|
+
|
24
|
+
### Bootstrapped Admin Generator
|
25
|
+
|
26
|
+
Generates a new Padrino Admin application with Twitter Bootstrapped integrated.
|
27
|
+
|
28
|
+
**Command:**
|
29
|
+
|
30
|
+
```
|
31
|
+
padrino g bs_admin
|
32
|
+
```
|
33
|
+
|
34
|
+
**Options:**
|
35
|
+
|
36
|
+
-r, [--root=ROOT] The root destination. Default: .
|
37
|
+
|
38
|
+
-s, [--skip-migration]
|
39
|
+
|
40
|
+
-d, [--destroy]
|
41
|
+
|
42
|
+
-e, [--renderer=RENDERER] Rendering engine (erb, haml or slim)
|
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:**
|
49
|
+
|
50
|
+
```
|
51
|
+
padrino g bs_admin
|
52
|
+
```
|
53
|
+
|
54
|
+
### Bootstrapped Admin Page Generator
|
55
|
+
|
56
|
+
Generates a new Padrino Admin page with Twitter Bootstrapped integrated.
|
57
|
+
|
58
|
+
**Command:**
|
59
|
+
|
60
|
+
```
|
61
|
+
padrino g bootstrapped_admin_page [model]
|
62
|
+
```
|
63
|
+
|
64
|
+
**Options:**
|
65
|
+
|
66
|
+
-r, [--root=ROOT] The root destination.
|
67
|
+
|
68
|
+
-s, [--skip-migration]
|
69
|
+
|
70
|
+
-d, [--destroy]
|
71
|
+
|
72
|
+
**Example:**
|
73
|
+
|
74
|
+
```
|
75
|
+
padrino g bootstrapped_admin_page product
|
76
|
+
```
|
77
|
+
|
78
|
+
|
79
|
+
## To Do List
|
80
|
+
|
81
|
+
* Format haml and slim templates
|
82
|
+
|
83
|
+
|
84
|
+
## Contributing to bootstrap-on
|
85
|
+
|
86
|
+
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
|
87
|
+
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
|
88
|
+
* Fork the project
|
89
|
+
* Start a feature/bugfix branch
|
90
|
+
* Commit and push until you are happy with your contribution
|
91
|
+
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
92
|
+
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
93
|
+
|
94
|
+
|
95
|
+
## Copyright
|
96
|
+
|
97
|
+
Copyright (c) 2012 [Stuart Chinery](http://www.headlondon.com/who-we-are#stuart-chinery), [headlondon.com](http://www.headlondon.com)
|
98
|
+
See LICENSE.txt for further details.
|
data/Rakefile
ADDED
@@ -0,0 +1,38 @@
|
|
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 = "bootstrap-on"
|
18
|
+
gem.homepage = "http://github.com/sleepingstu/bootstrap-on"
|
19
|
+
gem.license = "MIT"
|
20
|
+
gem.summary = %Q{Padrino admin generators with Twitter Bootstrap integration}
|
21
|
+
gem.description = %Q{Padrino admin generators with Twitter Bootstrap integration}
|
22
|
+
gem.email = "stuart.chinery@headlondon.com"
|
23
|
+
gem.authors = ["Stuart Chinery"]
|
24
|
+
# dependencies defined in Gemfile
|
25
|
+
end
|
26
|
+
Jeweler::RubygemsDotOrgTasks.new
|
27
|
+
|
28
|
+
require 'rake/testtask'
|
29
|
+
Rake::TestTask.new(:test) do |test|
|
30
|
+
test.libs << 'lib' << 'test'
|
31
|
+
test.pattern = 'test/**/test_*.rb'
|
32
|
+
test.verbose = true
|
33
|
+
end
|
34
|
+
|
35
|
+
task :default => :test
|
36
|
+
|
37
|
+
require 'yard'
|
38
|
+
YARD::Rake::YardocTask.new
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.0.0
|
@@ -0,0 +1,127 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = "bootstrap-on"
|
8
|
+
s.version = "0.0.0"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Stuart Chinery"]
|
12
|
+
s.date = "2012-07-05"
|
13
|
+
s.description = "Padrino admin generators with Twitter Bootstrap integration"
|
14
|
+
s.email = "stuart.chinery@headlondon.com"
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"LICENSE.txt",
|
17
|
+
"README.md"
|
18
|
+
]
|
19
|
+
s.files = [
|
20
|
+
".document",
|
21
|
+
"Gemfile",
|
22
|
+
"Gemfile.lock",
|
23
|
+
"LICENSE.txt",
|
24
|
+
"README.md",
|
25
|
+
"Rakefile",
|
26
|
+
"VERSION",
|
27
|
+
"bootstrap-on.gemspec",
|
28
|
+
"lib/bootstrap-on.rb",
|
29
|
+
"lib/bootstrap-on/bs_admin.rb",
|
30
|
+
"lib/bootstrap-on/bs_admin_page.rb",
|
31
|
+
"lib/bootstrap-on/templates/.DS_Store",
|
32
|
+
"lib/bootstrap-on/templates/account/.DS_Store",
|
33
|
+
"lib/bootstrap-on/templates/account/activerecord.rb.tt",
|
34
|
+
"lib/bootstrap-on/templates/account/couchrest.rb.tt",
|
35
|
+
"lib/bootstrap-on/templates/account/datamapper.rb.tt",
|
36
|
+
"lib/bootstrap-on/templates/account/mini_record.rb.tt",
|
37
|
+
"lib/bootstrap-on/templates/account/mongoid.rb.tt",
|
38
|
+
"lib/bootstrap-on/templates/account/mongomapper.rb.tt",
|
39
|
+
"lib/bootstrap-on/templates/account/seeds.rb.tt",
|
40
|
+
"lib/bootstrap-on/templates/account/sequel.rb.tt",
|
41
|
+
"lib/bootstrap-on/templates/app.rb.tt",
|
42
|
+
"lib/bootstrap-on/templates/app/controllers/base.rb",
|
43
|
+
"lib/bootstrap-on/templates/app/controllers/sessions.rb.tt",
|
44
|
+
"lib/bootstrap-on/templates/app/helpers/application_helper.rb",
|
45
|
+
"lib/bootstrap-on/templates/assets/.DS_Store",
|
46
|
+
"lib/bootstrap-on/templates/assets/css/bootstrap-responsive.css",
|
47
|
+
"lib/bootstrap-on/templates/assets/css/bootstrap-responsive.min.css",
|
48
|
+
"lib/bootstrap-on/templates/assets/css/bootstrap.css",
|
49
|
+
"lib/bootstrap-on/templates/assets/css/bootstrap.min.css",
|
50
|
+
"lib/bootstrap-on/templates/assets/ico/apple-touch-icon-114-precomposed.png",
|
51
|
+
"lib/bootstrap-on/templates/assets/ico/apple-touch-icon-144-precomposed.png",
|
52
|
+
"lib/bootstrap-on/templates/assets/ico/apple-touch-icon-57-precomposed.png",
|
53
|
+
"lib/bootstrap-on/templates/assets/ico/apple-touch-icon-72-precomposed.png",
|
54
|
+
"lib/bootstrap-on/templates/assets/ico/favicon.ico",
|
55
|
+
"lib/bootstrap-on/templates/assets/img/glyphicons-halflings-white.png",
|
56
|
+
"lib/bootstrap-on/templates/assets/img/glyphicons-halflings.png",
|
57
|
+
"lib/bootstrap-on/templates/assets/js/.DS_Store",
|
58
|
+
"lib/bootstrap-on/templates/assets/js/bootstrap.js",
|
59
|
+
"lib/bootstrap-on/templates/assets/js/bootstrap.min.js",
|
60
|
+
"lib/bootstrap-on/templates/assets/js/jquery-min.js",
|
61
|
+
"lib/bootstrap-on/templates/assets/js/jquery-ujs.js",
|
62
|
+
"lib/bootstrap-on/templates/assets/js/jquery.js",
|
63
|
+
"lib/bootstrap-on/templates/erb/app/base/index.erb.tt",
|
64
|
+
"lib/bootstrap-on/templates/erb/app/layouts/application.erb.tt",
|
65
|
+
"lib/bootstrap-on/templates/erb/app/sessions/new.erb.tt",
|
66
|
+
"lib/bootstrap-on/templates/erb/page/_form.erb.tt",
|
67
|
+
"lib/bootstrap-on/templates/erb/page/edit.erb.tt",
|
68
|
+
"lib/bootstrap-on/templates/erb/page/index.erb.tt",
|
69
|
+
"lib/bootstrap-on/templates/erb/page/new.erb.tt",
|
70
|
+
"lib/bootstrap-on/templates/haml/app/base/index.haml.tt",
|
71
|
+
"lib/bootstrap-on/templates/haml/app/layouts/application.haml.tt",
|
72
|
+
"lib/bootstrap-on/templates/haml/app/sessions/new.haml.tt",
|
73
|
+
"lib/bootstrap-on/templates/haml/page/_form.haml.tt",
|
74
|
+
"lib/bootstrap-on/templates/haml/page/edit.haml.tt",
|
75
|
+
"lib/bootstrap-on/templates/haml/page/index.haml.tt",
|
76
|
+
"lib/bootstrap-on/templates/haml/page/new.haml.tt",
|
77
|
+
"lib/bootstrap-on/templates/page/controller.rb.tt",
|
78
|
+
"lib/bootstrap-on/templates/slim/app/base/index.slim.tt",
|
79
|
+
"lib/bootstrap-on/templates/slim/app/layouts/application.slim.tt",
|
80
|
+
"lib/bootstrap-on/templates/slim/app/sessions/new.slim.tt",
|
81
|
+
"lib/bootstrap-on/templates/slim/page/_form.slim.tt",
|
82
|
+
"lib/bootstrap-on/templates/slim/page/edit.slim.tt",
|
83
|
+
"lib/bootstrap-on/templates/slim/page/index.slim.tt",
|
84
|
+
"lib/bootstrap-on/templates/slim/page/new.slim.tt",
|
85
|
+
"test/bootstrap-on/test_bs_admin_generator.rb",
|
86
|
+
"test/bootstrap-on/test_bs_admin_page_generator.rb",
|
87
|
+
"test/helper.rb",
|
88
|
+
"test/load_paths.rb",
|
89
|
+
"test/test_bootstrap-on.rb"
|
90
|
+
]
|
91
|
+
s.homepage = "http://github.com/sleepingstu/bootstrap-on"
|
92
|
+
s.licenses = ["MIT"]
|
93
|
+
s.require_paths = ["lib"]
|
94
|
+
s.rubygems_version = "1.8.19"
|
95
|
+
s.summary = "Padrino admin generators with Twitter Bootstrap integration"
|
96
|
+
|
97
|
+
if s.respond_to? :specification_version then
|
98
|
+
s.specification_version = 3
|
99
|
+
|
100
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
101
|
+
s.add_development_dependency(%q<minitest>, [">= 0"])
|
102
|
+
s.add_development_dependency(%q<turn>, ["~> 0.9.5"])
|
103
|
+
s.add_development_dependency(%q<bundler>, ["~> 1.1.4"])
|
104
|
+
s.add_development_dependency(%q<jeweler>, ["~> 1.8.3"])
|
105
|
+
s.add_development_dependency(%q<yard>, ["~> 0.6.0"])
|
106
|
+
s.add_development_dependency(%q<padrino>, [">= 0"])
|
107
|
+
s.add_development_dependency(%q<uuid>, [">= 0"])
|
108
|
+
else
|
109
|
+
s.add_dependency(%q<minitest>, [">= 0"])
|
110
|
+
s.add_dependency(%q<turn>, ["~> 0.9.5"])
|
111
|
+
s.add_dependency(%q<bundler>, ["~> 1.1.4"])
|
112
|
+
s.add_dependency(%q<jeweler>, ["~> 1.8.3"])
|
113
|
+
s.add_dependency(%q<yard>, ["~> 0.6.0"])
|
114
|
+
s.add_dependency(%q<padrino>, [">= 0"])
|
115
|
+
s.add_dependency(%q<uuid>, [">= 0"])
|
116
|
+
end
|
117
|
+
else
|
118
|
+
s.add_dependency(%q<minitest>, [">= 0"])
|
119
|
+
s.add_dependency(%q<turn>, ["~> 0.9.5"])
|
120
|
+
s.add_dependency(%q<bundler>, ["~> 1.1.4"])
|
121
|
+
s.add_dependency(%q<jeweler>, ["~> 1.8.3"])
|
122
|
+
s.add_dependency(%q<yard>, ["~> 0.6.0"])
|
123
|
+
s.add_dependency(%q<padrino>, [">= 0"])
|
124
|
+
s.add_dependency(%q<uuid>, [">= 0"])
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
data/lib/bootstrap-on.rb
ADDED
@@ -0,0 +1,138 @@
|
|
1
|
+
module Padrino
|
2
|
+
module Generators
|
3
|
+
##
|
4
|
+
# Defines the generator for creating a new admin app.
|
5
|
+
#
|
6
|
+
class BsAdmin < Thor::Group
|
7
|
+
|
8
|
+
# Add this generator to our padrino-gen
|
9
|
+
Padrino::Generators.add_generator(:bs_admin, self)
|
10
|
+
|
11
|
+
# Define the source template root and themes.
|
12
|
+
def self.source_root; File.expand_path(File.dirname(__FILE__)); end
|
13
|
+
# Defines the "banner" text for the CLI.
|
14
|
+
def self.banner; "padrino g bs_admin"; end
|
15
|
+
|
16
|
+
# Include related modules
|
17
|
+
include Thor::Actions
|
18
|
+
include Padrino::Generators::Actions
|
19
|
+
include Padrino::Generators::Admin::Actions
|
20
|
+
|
21
|
+
desc "Description:\n\n\tpadrino g bs_admin - Generates a new Padrino Admin application with Twitter bs integrated"
|
22
|
+
|
23
|
+
class_option :skip_migration, :aliases => "-s", :default => false, :type => :boolean
|
24
|
+
class_option :app, :aliases => "-a", :desc => "The model destination path", :default => '.', :type => :string
|
25
|
+
class_option :root, :desc => "The root destination", :aliases => '-r', :default => ".", :type => :string
|
26
|
+
class_option :destroy, :aliases => '-d', :default => false, :type => :boolean
|
27
|
+
class_option :renderer, :aliases => '-e', :desc => "Rendering engine (erb, haml)", :type => :string
|
28
|
+
class_option :admin_model, :aliases => '-m', :desc => "The name of model for access controlling", :default => 'Account', :type => :string
|
29
|
+
|
30
|
+
# Copies over the Padrino base admin application
|
31
|
+
def create_admin
|
32
|
+
self.destination_root = options[:root]
|
33
|
+
if in_app_root?
|
34
|
+
unless supported_orm.include?(orm)
|
35
|
+
say "<= At the moment, Padrino only supports #{supported_orm.join(" or ")}. Sorry!", :yellow
|
36
|
+
raise SystemExit
|
37
|
+
end
|
38
|
+
|
39
|
+
# unless self.class.themes.include?(options[:theme])
|
40
|
+
# say "<= You need to choose a theme from: #{self.class.themes.join(", ")}", :yellow
|
41
|
+
# raise SystemExit
|
42
|
+
# end
|
43
|
+
|
44
|
+
tmp_ext = options[:renderer] || fetch_component_choice(:renderer)
|
45
|
+
unless supported_ext.include?(tmp_ext.to_sym)
|
46
|
+
say "<= Your are using '#{tmp_ext}' and for the admin we only support '#{supported_ext.join(', ')}'. Please use -e haml or -e erb or -e slim", :yellow
|
47
|
+
raise SystemExit
|
48
|
+
end
|
49
|
+
|
50
|
+
store_component_choice(:admin_renderer, tmp_ext)
|
51
|
+
|
52
|
+
self.behavior = :revoke if options[:destroy]
|
53
|
+
|
54
|
+
empty_directory destination_root("admin")
|
55
|
+
|
56
|
+
# Setup Admin Model
|
57
|
+
@model_name = options[:admin_model].classify
|
58
|
+
@model_singular = @model_name.underscore
|
59
|
+
@model_plural = @model_singular.pluralize
|
60
|
+
|
61
|
+
directory "templates/app", destination_root("admin")
|
62
|
+
directory "templates/assets", destination_root("public", "admin")
|
63
|
+
template "templates/app.rb.tt", destination_root("admin/app.rb")
|
64
|
+
append_file destination_root("config/apps.rb"), "\nPadrino.mount(\"Admin\").to(\"/admin\")"
|
65
|
+
insert_middleware 'ActiveRecord::ConnectionAdapters::ConnectionManagement', 'admin' if [:mini_record, :activerecord].include?(orm)
|
66
|
+
|
67
|
+
params = [
|
68
|
+
@model_singular, "name:string", "surname:string", "email:string", "crypted_password:string", "role:string",
|
69
|
+
"-a=#{options[:app]}",
|
70
|
+
"-r=#{options[:root]}"
|
71
|
+
]
|
72
|
+
params << "-s" if options[:skip_migration]
|
73
|
+
params << "-d" if options[:destroy]
|
74
|
+
|
75
|
+
Padrino::Generators::Model.start(params)
|
76
|
+
column = Struct.new(:name, :type)
|
77
|
+
columns = [:id, :name, :surname, :email].map { |col| column.new(col) }
|
78
|
+
column_fields = [
|
79
|
+
{ :name => :name, :field_type => :text_field },
|
80
|
+
{ :name => :surname, :field_type => :text_field },
|
81
|
+
{ :name => :email, :field_type => :text_field },
|
82
|
+
{ :name => :password, :field_type => :password_field },
|
83
|
+
{ :name => :password_confirmation, :field_type => :password_field },
|
84
|
+
{ :name => :role, :field_type => :text_field }
|
85
|
+
]
|
86
|
+
|
87
|
+
admin_app = Padrino::Generators::BsAdminPage.new([@model_singular], :root => options[:root], :destroy => options[:destroy])
|
88
|
+
admin_app.default_orm = Padrino::Admin::Generators::Orm.new(@model_singular, orm, columns, column_fields)
|
89
|
+
admin_app.invoke_all
|
90
|
+
|
91
|
+
template "templates/account/#{orm}.rb.tt", destination_root(options[:app], "models", "#{@model_singular}.rb"), :force => true
|
92
|
+
|
93
|
+
if File.exist?(destination_root("db/seeds.rb"))
|
94
|
+
run "mv #{destination_root('db/seeds.rb')} #{destination_root('db/seeds.old')}"
|
95
|
+
end
|
96
|
+
template "templates/account/seeds.rb.tt", destination_root("db/seeds.rb")
|
97
|
+
|
98
|
+
empty_directory destination_root("admin/controllers")
|
99
|
+
empty_directory destination_root("admin/views")
|
100
|
+
empty_directory destination_root("admin/views/base")
|
101
|
+
empty_directory destination_root("admin/views/layouts")
|
102
|
+
empty_directory destination_root("admin/views/sessions")
|
103
|
+
|
104
|
+
template "templates/#{ext}/app/base/index.#{ext}.tt", destination_root("admin/views/base/index.#{ext}")
|
105
|
+
template "templates/#{ext}/app/layouts/application.#{ext}.tt", destination_root("admin/views/layouts/application.#{ext}")
|
106
|
+
template "templates/#{ext}/app/sessions/new.#{ext}.tt", destination_root("admin/views/sessions/new.#{ext}")
|
107
|
+
|
108
|
+
add_project_module @model_plural
|
109
|
+
require_dependencies('bcrypt-ruby', :require => 'bcrypt')
|
110
|
+
|
111
|
+
# A nicer select box
|
112
|
+
gsub_file destination_root("admin/views/#{@model_plural}/_form.#{ext}"), "f.text_field :role, :class => :text_field", "f.select :role, :options => access_control.roles"
|
113
|
+
|
114
|
+
# Destroy account only if not logged in
|
115
|
+
gsub_file destination_root("admin/controllers/#{@model_plural}.rb"), "if #{@model_singular}.destroy", "if #{@model_singular} != current_account && #{@model_singular}.destroy"
|
116
|
+
return if self.behavior == :revoke
|
117
|
+
|
118
|
+
instructions = []
|
119
|
+
instructions << "Run 'bundle install'"
|
120
|
+
instructions << "Run 'padrino rake ar:migrate'"
|
121
|
+
instructions << "Run 'padrino rake seed'"
|
122
|
+
instructions << "Visit the admin panel in the browser at '/admin'"
|
123
|
+
instructions.map! { |i| " #{instructions.index(i)+1}) #{i}" }
|
124
|
+
|
125
|
+
say
|
126
|
+
say "="*65, :green
|
127
|
+
say "The admin panel has been mounted! Next, follow these steps:", :green
|
128
|
+
say "="*65, :green
|
129
|
+
say instructions.join("\n")
|
130
|
+
say "="*65, :green
|
131
|
+
say
|
132
|
+
else
|
133
|
+
say "You are not at the root of a Padrino application! (config/boot.rb not found)"
|
134
|
+
end
|
135
|
+
end
|
136
|
+
end # AdminApp
|
137
|
+
end # Generators
|
138
|
+
end # Padrino
|