jakewendt-grape_juice 0.3.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.
- data/README.rdoc +41 -0
- data/bin/grape +30 -0
- data/lib/grape_juice.rb +1 -0
- data/lib/grape_juice/template_runner.rb +6 -0
- data/templates/grape.rb +109 -0
- metadata +100 -0
data/README.rdoc
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
= Grape Juice (Coming soon!)
|
2
|
+
|
3
|
+
Rails generator to creates the full structure of a
|
4
|
+
ruby Gem, Rails Application and Plugin / Engine.
|
5
|
+
|
6
|
+
I was tired of creating a plugin with the generator and then
|
7
|
+
having to make all of the same mods all the time.
|
8
|
+
|
9
|
+
It is probably simpler now just to generate an application
|
10
|
+
and then add the plugin-specific and gem-specific code.
|
11
|
+
|
12
|
+
This generator may end up being more of a rails template
|
13
|
+
which makes it kinda pointless, but an exercise nonetheless.
|
14
|
+
|
15
|
+
== Installation / Usage
|
16
|
+
|
17
|
+
gem install jakewendt-grape_juice --source http://rubygems.org
|
18
|
+
|
19
|
+
== Gemified with Jeweler
|
20
|
+
|
21
|
+
vi Rakefile
|
22
|
+
rake version:write
|
23
|
+
rake gemspec
|
24
|
+
rake install
|
25
|
+
|
26
|
+
rake version:bump:major
|
27
|
+
rake release
|
28
|
+
|
29
|
+
== References
|
30
|
+
|
31
|
+
http://railscasts.com/episodes/33-making-a-plugin
|
32
|
+
|
33
|
+
http://railscasts.com/episodes/135-making-a-gem
|
34
|
+
|
35
|
+
http://asciicasts.com/episodes/148-app-templates-in-rails-2-3
|
36
|
+
|
37
|
+
http://railscasts.com/episodes/183-gemcutter-jeweler
|
38
|
+
|
39
|
+
|
40
|
+
|
41
|
+
Copyright (c) 2010 [George 'Jake' Wendt], released under the MIT license
|
data/bin/grape
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# This file was generated by RubyGems. (and then I took it)
|
4
|
+
#
|
5
|
+
# The application 'rails' is installed as part of a gem, and
|
6
|
+
# this file is here to facilitate running it.
|
7
|
+
#
|
8
|
+
|
9
|
+
require 'rubygems'
|
10
|
+
|
11
|
+
version = ">= 0"
|
12
|
+
|
13
|
+
if ARGV.first =~ /^_(.*)_$/ and Gem::Version.correct? $1 then
|
14
|
+
version = $1
|
15
|
+
ARGV.shift
|
16
|
+
end
|
17
|
+
|
18
|
+
#$command_line = $*.dup
|
19
|
+
#require 'rails_generator'
|
20
|
+
#require 'rails_generator/scripts'
|
21
|
+
#require 'rails_generator/scripts/generate'
|
22
|
+
#
|
23
|
+
#Rails::Generator::Base.use_application_sources!
|
24
|
+
#parser = Rails::Generator::Base.instance('app',ARGV.dup,{})
|
25
|
+
#$app_name = parser.instance_variable_get(:@app_name)
|
26
|
+
|
27
|
+
ARGV.push("--template=#{File.expand_path('../../templates/grape.rb',__FILE__)}")
|
28
|
+
|
29
|
+
gem 'rails', version
|
30
|
+
load Gem.bin_path('rails', 'rails', version)
|
data/lib/grape_juice.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
#require 'grape_juice/template_runner.rb
|
data/templates/grape.rb
ADDED
@@ -0,0 +1,109 @@
|
|
1
|
+
require 'grape_juice'
|
2
|
+
|
3
|
+
# cat /usr/lib/ruby/user-gems/1.8/gems/rails-2.3.8/lib/rails_generator/generators/applications/app/template_runner.rb
|
4
|
+
|
5
|
+
app_name = self.root.split('/').last
|
6
|
+
|
7
|
+
|
8
|
+
#puts "In Template"
|
9
|
+
#puts "Command Line"
|
10
|
+
#puts $command_line.inspect
|
11
|
+
# => ["-d", "mysql", "testin"]
|
12
|
+
#
|
13
|
+
#puts "app_name"
|
14
|
+
#puts $app_name
|
15
|
+
# => testin
|
16
|
+
|
17
|
+
# CREATE .gitignore
|
18
|
+
file ".gitignore", <<-END
|
19
|
+
.DS_Store
|
20
|
+
log/*.log
|
21
|
+
tmp/**/*
|
22
|
+
db/*.sqlite3
|
23
|
+
versions
|
24
|
+
coverage
|
25
|
+
coverage.data
|
26
|
+
db/*.sqlite3
|
27
|
+
db/*.sqlite3-journal
|
28
|
+
/config/database.yml
|
29
|
+
/config/initializers/mail.rb
|
30
|
+
/config/initializers/session_store.rb
|
31
|
+
/config/fed_ex.yml
|
32
|
+
/config/s3.yml
|
33
|
+
END
|
34
|
+
|
35
|
+
run "cp config/database.yml config/database.yml.example"
|
36
|
+
run "cp config/initializers/mail.rb config/initializers/mail.rb.example"
|
37
|
+
run "cp config/initializers/session_store.rb config/initializers/session_store.rb.example"
|
38
|
+
|
39
|
+
|
40
|
+
# For the 'Ruby Gem'
|
41
|
+
# Modified rake file
|
42
|
+
# VERSION
|
43
|
+
|
44
|
+
# APPEND Rakefile
|
45
|
+
append_file 'Rakefile',<<-END
|
46
|
+
begin
|
47
|
+
require 'jeweler'
|
48
|
+
Jeweler::Tasks.new do |gem|
|
49
|
+
gem.name = "#{app_name}"
|
50
|
+
gem.summary = %Q{one-line summary of your gem}
|
51
|
+
gem.description = %Q{longer description of your gem}
|
52
|
+
gem.email = "insert_your_email@here.com"
|
53
|
+
gem.homepage = "insert_a_url_here"
|
54
|
+
gem.authors = ["insert your name here"]
|
55
|
+
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
56
|
+
#
|
57
|
+
# gem.files = FileList['lib/**/*.rb','bin/**/*.rb','templates/**/*.rb']
|
58
|
+
# gem.test_files = []
|
59
|
+
#
|
60
|
+
# gem.add_dependency('jeweler')
|
61
|
+
# gem.add_dependency('rails', '>= 2.3.8')
|
62
|
+
#
|
63
|
+
# gem.default_executable = %q{grape}
|
64
|
+
# gem.executables = ["grape"]
|
65
|
+
#
|
66
|
+
end
|
67
|
+
Jeweler::GemcutterTasks.new
|
68
|
+
rescue LoadError
|
69
|
+
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
|
70
|
+
end
|
71
|
+
END
|
72
|
+
|
73
|
+
rake "version:write"
|
74
|
+
|
75
|
+
|
76
|
+
# For the 'Rails Plugin'
|
77
|
+
# create init.rb, install.rb, uninstall.rb rails/init.rb
|
78
|
+
file "init.rb", <<-END
|
79
|
+
require 'rails/init'
|
80
|
+
END
|
81
|
+
|
82
|
+
file "install.rb", <<-END
|
83
|
+
END
|
84
|
+
|
85
|
+
file "uninstall.rb", <<-END
|
86
|
+
END
|
87
|
+
|
88
|
+
file 'rails/init.rb', <<-END
|
89
|
+
require '#{app_name}'
|
90
|
+
END
|
91
|
+
|
92
|
+
file "lib/#{app_name}.rb", <<-END
|
93
|
+
module #{app_name.camelize}
|
94
|
+
# predefine assumed namespace
|
95
|
+
end
|
96
|
+
# From http://guides.rubyonrails.org/plugins.html#controllers
|
97
|
+
# Fix for:
|
98
|
+
# ArgumentError in _some_Controller#_some_action_
|
99
|
+
# A copy of ApplicationController has been removed from the module tree but is still active!
|
100
|
+
# Equivalent of using "unloadable" in _some_Controller (unloadable has been deprecated)
|
101
|
+
%w{models controllers}.each do |dir|
|
102
|
+
path = File.expand_path(File.join(File.dirname(__FILE__), '../app', dir))
|
103
|
+
ActiveSupport::Dependencies.load_once_paths.delete(path)
|
104
|
+
end
|
105
|
+
END
|
106
|
+
|
107
|
+
inside "lib/#{app_name}" do
|
108
|
+
end
|
109
|
+
|
metadata
ADDED
@@ -0,0 +1,100 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: jakewendt-grape_juice
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 19
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 3
|
9
|
+
- 0
|
10
|
+
version: 0.3.0
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- George 'Jake' Wendt
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2010-08-30 00:00:00 -07:00
|
19
|
+
default_executable: grape
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
name: jeweler
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
hash: 3
|
30
|
+
segments:
|
31
|
+
- 0
|
32
|
+
version: "0"
|
33
|
+
type: :runtime
|
34
|
+
version_requirements: *id001
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
name: rails
|
37
|
+
prerelease: false
|
38
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
hash: 19
|
44
|
+
segments:
|
45
|
+
- 2
|
46
|
+
- 3
|
47
|
+
- 8
|
48
|
+
version: 2.3.8
|
49
|
+
type: :runtime
|
50
|
+
version_requirements: *id002
|
51
|
+
description: longer description of your gem
|
52
|
+
email: github@jake.otherinbox.com
|
53
|
+
executables:
|
54
|
+
- grape
|
55
|
+
extensions: []
|
56
|
+
|
57
|
+
extra_rdoc_files:
|
58
|
+
- README.rdoc
|
59
|
+
files:
|
60
|
+
- lib/grape_juice.rb
|
61
|
+
- lib/grape_juice/template_runner.rb
|
62
|
+
- templates/grape.rb
|
63
|
+
- README.rdoc
|
64
|
+
- bin/grape
|
65
|
+
has_rdoc: true
|
66
|
+
homepage: http://github.com/jakewendt/grape_juice
|
67
|
+
licenses: []
|
68
|
+
|
69
|
+
post_install_message:
|
70
|
+
rdoc_options:
|
71
|
+
- --charset=UTF-8
|
72
|
+
require_paths:
|
73
|
+
- lib
|
74
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
75
|
+
none: false
|
76
|
+
requirements:
|
77
|
+
- - ">="
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
hash: 3
|
80
|
+
segments:
|
81
|
+
- 0
|
82
|
+
version: "0"
|
83
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
84
|
+
none: false
|
85
|
+
requirements:
|
86
|
+
- - ">="
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
hash: 3
|
89
|
+
segments:
|
90
|
+
- 0
|
91
|
+
version: "0"
|
92
|
+
requirements: []
|
93
|
+
|
94
|
+
rubyforge_project:
|
95
|
+
rubygems_version: 1.3.7
|
96
|
+
signing_key:
|
97
|
+
specification_version: 3
|
98
|
+
summary: one-line summary of your gem
|
99
|
+
test_files: []
|
100
|
+
|