lazy-head-gen 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,5 @@
1
+ lib/**/*.rb
2
+ bin/*
3
+ -
4
+ features/**/*.feature
5
+ LICENSE.txt
data/Gemfile ADDED
@@ -0,0 +1,49 @@
1
+ source "http://rubygems.org"
2
+ # Add dependencies required to use your gem here.
3
+ # Example:
4
+ # gem "activesupport", ">= 2.3.5"
5
+
6
+ # Add dependencies to develop your gem here.
7
+ # Include everything needed to run rake, tests, features, etc.
8
+ group :development do
9
+ gem "shoulda", ">= 0"
10
+ gem "bundler", "~> 1.1.3"
11
+ gem "jeweler", "~> 1.6.4"
12
+ gem "rcov", ">= 0"
13
+
14
+ # From Padrino Framework
15
+ if ENV['SINATRA_EDGE']
16
+ puts "=> Using sinatra edge"
17
+ gem "sinatra", :git => "git://github.com/sinatra/sinatra.git" # :path => "/Developer/src/Extras/sinatra"
18
+ end
19
+ gem "json", ">= 1.5.3"
20
+ gem "nokogiri", ">= 1.4.4"
21
+ gem "grit", ">= 2.4.1"
22
+ gem "rack", ">= 1.3.0"
23
+ gem "rake", ">= 0.8.7"
24
+ gem "yard", ">= 0.7.2"
25
+ gem "rack-test", ">= 0.5.0"
26
+ gem "fakeweb", ">= 1.2.8"
27
+ gem "webrat", ">= 0.5.1"
28
+ gem "haml", ">= 2.2.22"
29
+ gem "erubis", ">= 2.7.0"
30
+ gem "slim", ">= 0.9.2"
31
+ gem "uuid", ">= 2.3.1"
32
+ gem "builder", ">= 2.1.2"
33
+ gem "bcrypt-ruby", :require => "bcrypt"
34
+ platforms :mri_18 do
35
+ # gem "rcov", "~> 0.9.8"
36
+ # gem "ruby-prof", ">= 0.9.1"
37
+ gem "system_timer", ">= 1.0"
38
+ end
39
+ platforms :jruby do
40
+ gem "jruby-openssl"
41
+ end
42
+ gem "mocha", "~>0.10.0"
43
+ gem "minitest", "~>2.6.0"
44
+ gem "lumberjack"
45
+
46
+ gem 'ruby-debug'
47
+ end
48
+
49
+ gem 'padrino'
@@ -0,0 +1,139 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ activesupport (3.2.3)
5
+ i18n (~> 0.6)
6
+ multi_json (~> 1.0)
7
+ bcrypt-ruby (3.0.1)
8
+ builder (3.0.0)
9
+ columnize (0.3.6)
10
+ diff-lcs (1.1.3)
11
+ erubis (2.7.0)
12
+ fakeweb (1.3.0)
13
+ git (1.2.5)
14
+ grit (2.4.1)
15
+ diff-lcs (~> 1.1)
16
+ mime-types (~> 1.15)
17
+ haml (3.1.4)
18
+ http_router (0.10.2)
19
+ rack (>= 1.0.0)
20
+ url_mount (~> 0.2.1)
21
+ i18n (0.6.0)
22
+ jeweler (1.6.4)
23
+ bundler (~> 1.0)
24
+ git (>= 1.2.5)
25
+ rake
26
+ json (1.6.6)
27
+ linecache (0.46)
28
+ rbx-require-relative (> 0.0.4)
29
+ lumberjack (1.0.2)
30
+ macaddr (1.5.0)
31
+ systemu (>= 2.4.0)
32
+ mail (2.3.3)
33
+ i18n (>= 0.4.0)
34
+ mime-types (~> 1.16)
35
+ treetop (~> 1.4.8)
36
+ metaclass (0.0.1)
37
+ mime-types (1.18)
38
+ minitest (2.6.2)
39
+ mocha (0.10.5)
40
+ metaclass (~> 0.0.1)
41
+ multi_json (1.3.2)
42
+ nokogiri (1.5.2)
43
+ padrino (0.10.6)
44
+ padrino-admin (= 0.10.6)
45
+ padrino-cache (= 0.10.6)
46
+ padrino-core (= 0.10.6)
47
+ padrino-gen (= 0.10.6)
48
+ padrino-helpers (= 0.10.6)
49
+ padrino-mailer (= 0.10.6)
50
+ padrino-admin (0.10.6)
51
+ padrino-core (= 0.10.6)
52
+ padrino-helpers (= 0.10.6)
53
+ padrino-cache (0.10.6)
54
+ padrino-core (= 0.10.6)
55
+ padrino-core (0.10.6)
56
+ activesupport (~> 3.2.0)
57
+ http_router (~> 0.10.2)
58
+ sinatra (~> 1.3.1)
59
+ thor (~> 0.14.3)
60
+ tilt (~> 1.3.0)
61
+ padrino-gen (0.10.6)
62
+ bundler (~> 1.0)
63
+ padrino-core (= 0.10.6)
64
+ padrino-helpers (0.10.6)
65
+ i18n (~> 0.6)
66
+ padrino-core (= 0.10.6)
67
+ padrino-mailer (0.10.6)
68
+ mail (~> 2.3.0)
69
+ padrino-core (= 0.10.6)
70
+ polyglot (0.3.3)
71
+ rack (1.4.1)
72
+ rack-protection (1.2.0)
73
+ rack
74
+ rack-test (0.6.1)
75
+ rack (>= 1.0)
76
+ rake (0.9.2.2)
77
+ rbx-require-relative (0.0.9)
78
+ rcov (0.9.11)
79
+ ruby-debug (0.10.4)
80
+ columnize (>= 0.1)
81
+ ruby-debug-base (~> 0.10.4.0)
82
+ ruby-debug-base (0.10.4)
83
+ linecache (>= 0.3)
84
+ shoulda (2.11.3)
85
+ sinatra (1.3.2)
86
+ rack (~> 1.3, >= 1.3.6)
87
+ rack-protection (~> 1.2)
88
+ tilt (~> 1.3, >= 1.3.3)
89
+ slim (1.2.0)
90
+ temple (~> 0.4.0)
91
+ tilt (~> 1.3.3)
92
+ system_timer (1.2.4)
93
+ systemu (2.5.0)
94
+ temple (0.4.0)
95
+ thor (0.14.6)
96
+ tilt (1.3.3)
97
+ treetop (1.4.10)
98
+ polyglot
99
+ polyglot (>= 0.3.1)
100
+ url_mount (0.2.1)
101
+ rack
102
+ uuid (2.3.5)
103
+ macaddr (~> 1.0)
104
+ webrat (0.7.3)
105
+ nokogiri (>= 1.2.0)
106
+ rack (>= 1.0)
107
+ rack-test (>= 0.5.3)
108
+ yard (0.7.5)
109
+
110
+ PLATFORMS
111
+ ruby
112
+
113
+ DEPENDENCIES
114
+ bcrypt-ruby
115
+ builder (>= 2.1.2)
116
+ bundler (~> 1.1.3)
117
+ erubis (>= 2.7.0)
118
+ fakeweb (>= 1.2.8)
119
+ grit (>= 2.4.1)
120
+ haml (>= 2.2.22)
121
+ jeweler (~> 1.6.4)
122
+ jruby-openssl
123
+ json (>= 1.5.3)
124
+ lumberjack
125
+ minitest (~> 2.6.0)
126
+ mocha (~> 0.10.0)
127
+ nokogiri (>= 1.4.4)
128
+ padrino
129
+ rack (>= 1.3.0)
130
+ rack-test (>= 0.5.0)
131
+ rake (>= 0.8.7)
132
+ rcov
133
+ ruby-debug
134
+ shoulda
135
+ slim (>= 0.9.2)
136
+ system_timer (>= 1.0)
137
+ uuid (>= 2.3.1)
138
+ webrat (>= 0.5.1)
139
+ yard (>= 0.7.2)
@@ -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.
@@ -0,0 +1,18 @@
1
+ = lazy-head-gen
2
+
3
+ Description goes here.
4
+
5
+ == Contributing to lazy-head-gen
6
+
7
+ * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
8
+ * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
9
+ * Fork the project
10
+ * Start a feature/bugfix branch
11
+ * Commit and push until you are happy with your contribution
12
+ * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
13
+ * 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.
14
+
15
+ == Copyright
16
+
17
+ Copyright (c) 2012 Stuart Chinery. See LICENSE.txt for
18
+ further details.
@@ -0,0 +1,53 @@
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 = "lazy-head-gen"
18
+ gem.homepage = "http://github.com/sleepingstu/lazy-head-gen"
19
+ gem.license = "MIT"
20
+ gem.summary = %Q{Some extra generators for the glorious Padrino, using ActiveRecord and MiniTest.}
21
+ gem.description = %Q{Blah: longer description of your gem}
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
+ require 'rcov/rcovtask'
36
+ Rcov::RcovTask.new do |test|
37
+ test.libs << 'test'
38
+ test.pattern = 'test/**/test_*.rb'
39
+ test.verbose = true
40
+ test.rcov_opts << '--exclude "gems/*"'
41
+ end
42
+
43
+ task :default => :test
44
+
45
+ require 'rake/rdoctask'
46
+ Rake::RDocTask.new do |rdoc|
47
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
48
+
49
+ rdoc.rdoc_dir = 'rdoc'
50
+ rdoc.title = "lazy-head-gen #{version}"
51
+ rdoc.rdoc_files.include('README*')
52
+ rdoc.rdoc_files.include('lib/**/*.rb')
53
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.1.0
@@ -0,0 +1,138 @@
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 = "lazy-head-gen"
8
+ s.version = "0.1.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-04-27"
13
+ s.description = "Blah: longer description of your gem"
14
+ s.email = "stuart.chinery@headlondon.com"
15
+ s.extra_rdoc_files = [
16
+ "LICENSE.txt",
17
+ "README.rdoc"
18
+ ]
19
+ s.files = [
20
+ ".document",
21
+ "Gemfile",
22
+ "Gemfile.lock",
23
+ "LICENSE.txt",
24
+ "README.rdoc",
25
+ "Rakefile",
26
+ "VERSION",
27
+ "lazy-head-gen.gemspec",
28
+ "lib/lazy-head-gen.rb",
29
+ "lib/lazy-head-gen/admin_controller_tests.rb",
30
+ "lib/lazy-head-gen/scaffold.rb",
31
+ "lib/lazy-head-gen/templates/admin_controller_test.rb.tt",
32
+ "lib/lazy-head-gen/templates/blueprints.rb.tt",
33
+ "lib/lazy-head-gen/templates/controller.rb.tt",
34
+ "lib/lazy-head-gen/templates/controller_test.rb.tt",
35
+ "lib/lazy-head-gen/templates/helper.rb.tt",
36
+ "lib/lazy-head-gen/templates/model.rb.tt",
37
+ "lib/lazy-head-gen/templates/model_test.rb.tt",
38
+ "lib/lazy-head-gen/templates/view.erb.tt",
39
+ "test/helper.rb",
40
+ "test/lazy-head-gen/test_admin_controller_tests.rb",
41
+ "test/lazy-head-gen/test_scaffold.rb",
42
+ "test/load_paths.rb",
43
+ "test/test_lazy-head-gen.rb"
44
+ ]
45
+ s.homepage = "http://github.com/sleepingstu/lazy-head-gen"
46
+ s.licenses = ["MIT"]
47
+ s.require_paths = ["lib"]
48
+ s.rubygems_version = "1.8.19"
49
+ s.summary = "Some extra generators for the glorious Padrino, using ActiveRecord and MiniTest."
50
+
51
+ if s.respond_to? :specification_version then
52
+ s.specification_version = 3
53
+
54
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
55
+ s.add_runtime_dependency(%q<padrino>, [">= 0"])
56
+ s.add_development_dependency(%q<shoulda>, [">= 0"])
57
+ s.add_development_dependency(%q<bundler>, ["~> 1.1.3"])
58
+ s.add_development_dependency(%q<jeweler>, ["~> 1.6.4"])
59
+ s.add_development_dependency(%q<rcov>, [">= 0"])
60
+ s.add_development_dependency(%q<json>, [">= 1.5.3"])
61
+ s.add_development_dependency(%q<nokogiri>, [">= 1.4.4"])
62
+ s.add_development_dependency(%q<grit>, [">= 2.4.1"])
63
+ s.add_development_dependency(%q<rack>, [">= 1.3.0"])
64
+ s.add_development_dependency(%q<rake>, [">= 0.8.7"])
65
+ s.add_development_dependency(%q<yard>, [">= 0.7.2"])
66
+ s.add_development_dependency(%q<rack-test>, [">= 0.5.0"])
67
+ s.add_development_dependency(%q<fakeweb>, [">= 1.2.8"])
68
+ s.add_development_dependency(%q<webrat>, [">= 0.5.1"])
69
+ s.add_development_dependency(%q<haml>, [">= 2.2.22"])
70
+ s.add_development_dependency(%q<erubis>, [">= 2.7.0"])
71
+ s.add_development_dependency(%q<slim>, [">= 0.9.2"])
72
+ s.add_development_dependency(%q<uuid>, [">= 2.3.1"])
73
+ s.add_development_dependency(%q<builder>, [">= 2.1.2"])
74
+ s.add_development_dependency(%q<bcrypt-ruby>, [">= 0"])
75
+ s.add_development_dependency(%q<system_timer>, [">= 1.0"])
76
+ s.add_development_dependency(%q<jruby-openssl>, [">= 0"])
77
+ s.add_development_dependency(%q<mocha>, ["~> 0.10.0"])
78
+ s.add_development_dependency(%q<minitest>, ["~> 2.6.0"])
79
+ s.add_development_dependency(%q<lumberjack>, [">= 0"])
80
+ s.add_development_dependency(%q<ruby-debug>, [">= 0"])
81
+ else
82
+ s.add_dependency(%q<padrino>, [">= 0"])
83
+ s.add_dependency(%q<shoulda>, [">= 0"])
84
+ s.add_dependency(%q<bundler>, ["~> 1.1.3"])
85
+ s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
86
+ s.add_dependency(%q<rcov>, [">= 0"])
87
+ s.add_dependency(%q<json>, [">= 1.5.3"])
88
+ s.add_dependency(%q<nokogiri>, [">= 1.4.4"])
89
+ s.add_dependency(%q<grit>, [">= 2.4.1"])
90
+ s.add_dependency(%q<rack>, [">= 1.3.0"])
91
+ s.add_dependency(%q<rake>, [">= 0.8.7"])
92
+ s.add_dependency(%q<yard>, [">= 0.7.2"])
93
+ s.add_dependency(%q<rack-test>, [">= 0.5.0"])
94
+ s.add_dependency(%q<fakeweb>, [">= 1.2.8"])
95
+ s.add_dependency(%q<webrat>, [">= 0.5.1"])
96
+ s.add_dependency(%q<haml>, [">= 2.2.22"])
97
+ s.add_dependency(%q<erubis>, [">= 2.7.0"])
98
+ s.add_dependency(%q<slim>, [">= 0.9.2"])
99
+ s.add_dependency(%q<uuid>, [">= 2.3.1"])
100
+ s.add_dependency(%q<builder>, [">= 2.1.2"])
101
+ s.add_dependency(%q<bcrypt-ruby>, [">= 0"])
102
+ s.add_dependency(%q<system_timer>, [">= 1.0"])
103
+ s.add_dependency(%q<jruby-openssl>, [">= 0"])
104
+ s.add_dependency(%q<mocha>, ["~> 0.10.0"])
105
+ s.add_dependency(%q<minitest>, ["~> 2.6.0"])
106
+ s.add_dependency(%q<lumberjack>, [">= 0"])
107
+ s.add_dependency(%q<ruby-debug>, [">= 0"])
108
+ end
109
+ else
110
+ s.add_dependency(%q<padrino>, [">= 0"])
111
+ s.add_dependency(%q<shoulda>, [">= 0"])
112
+ s.add_dependency(%q<bundler>, ["~> 1.1.3"])
113
+ s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
114
+ s.add_dependency(%q<rcov>, [">= 0"])
115
+ s.add_dependency(%q<json>, [">= 1.5.3"])
116
+ s.add_dependency(%q<nokogiri>, [">= 1.4.4"])
117
+ s.add_dependency(%q<grit>, [">= 2.4.1"])
118
+ s.add_dependency(%q<rack>, [">= 1.3.0"])
119
+ s.add_dependency(%q<rake>, [">= 0.8.7"])
120
+ s.add_dependency(%q<yard>, [">= 0.7.2"])
121
+ s.add_dependency(%q<rack-test>, [">= 0.5.0"])
122
+ s.add_dependency(%q<fakeweb>, [">= 1.2.8"])
123
+ s.add_dependency(%q<webrat>, [">= 0.5.1"])
124
+ s.add_dependency(%q<haml>, [">= 2.2.22"])
125
+ s.add_dependency(%q<erubis>, [">= 2.7.0"])
126
+ s.add_dependency(%q<slim>, [">= 0.9.2"])
127
+ s.add_dependency(%q<uuid>, [">= 2.3.1"])
128
+ s.add_dependency(%q<builder>, [">= 2.1.2"])
129
+ s.add_dependency(%q<bcrypt-ruby>, [">= 0"])
130
+ s.add_dependency(%q<system_timer>, [">= 1.0"])
131
+ s.add_dependency(%q<jruby-openssl>, [">= 0"])
132
+ s.add_dependency(%q<mocha>, ["~> 0.10.0"])
133
+ s.add_dependency(%q<minitest>, ["~> 2.6.0"])
134
+ s.add_dependency(%q<lumberjack>, [">= 0"])
135
+ s.add_dependency(%q<ruby-debug>, [">= 0"])
136
+ end
137
+ end
138
+
@@ -0,0 +1,6 @@
1
+ begin
2
+ require 'padrino-gen'
3
+ Padrino::Generators.load_paths << Dir[File.dirname(__FILE__) + '/lazy-head-gen/{admin_controller_tests,scaffold}.rb']
4
+ rescue LoadError
5
+ # Fail silently
6
+ end
@@ -0,0 +1,58 @@
1
+ module Padrino
2
+ module Generators
3
+
4
+ class AdminControllerTests < Thor::Group
5
+ # register with Padrino
6
+ Padrino::Generators.add_generator(:admin_controller_tests, self)
7
+
8
+ # Define the source template root
9
+ def self.source_root; File.expand_path(File.dirname(__FILE__)); end
10
+ # Defines the banner for this CLI generator
11
+ def self.banner; "padrino-gen admin_controller_tests [name]"; end
12
+
13
+ # Include related modules
14
+ include Thor::Actions
15
+ include Padrino::Generators
16
+ include Padrino::Generators::Actions
17
+ include Padrino::Generators::Runner
18
+ include Padrino::Generators::Components::Actions
19
+
20
+ desc "Description:\n\n\tlazy-head-gen admin_controller_tests generates basic tests for an admin controller"
21
+
22
+ argument :name, :desc => "The name of your admin controller"
23
+
24
+ class_option :root, :desc => "The root destination", :aliases => '-r', :default => ".", :type => :string
25
+
26
+ require_arguments!
27
+
28
+ def create_admin_controller_tests
29
+ self.destination_root = options[:root]
30
+
31
+ if in_app_root?
32
+ say "Creating basic admin controller tests for '#{name}'", :green
33
+
34
+ # Set variables
35
+ @pluralized = name.to_s.tableize
36
+ @singular = name.to_s.underscore.singularize
37
+ @controller = @pluralized.camelize
38
+ @model = @singular.camelize
39
+
40
+ # Check that the admin controller exists
41
+ controller_path = destination_root("admin", "controllers", "#{@pluralized}.rb")
42
+
43
+ if File.exist?(controller_path)
44
+ template "templates/admin_controller_test.rb.tt", destination_root("test", "admin", "controllers", "#{@pluralized}_controller_test.rb")
45
+ else
46
+ say "The controller '#{controller_path} does not exist, please run 'padrino g admin_page #{@model}' to create the initial admin controller", :red
47
+ return
48
+ end
49
+
50
+ say "Admin controller tests generation for '#{name}' completed", :green
51
+ else
52
+ say "You are not at the root of a Padrino application! (config/boot.rb not found)", :red
53
+ end
54
+ end
55
+
56
+ end # AdminControllerTests
57
+ end # Generators
58
+ end # Padrino