meskyanichi-generators 0.2.0 → 0.3.1
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/CHANGELOG +13 -0
- data/README.rdoc +64 -8
- data/Rakefile +1 -0
- data/VERSION.yml +2 -2
- data/generators.gemspec +13 -9
- data/generators/.gitignore +0 -0
- data/generators/git_template/git_template_generator.rb +1 -1
- data/generators/rake_tasks/.gitignore +0 -0
- data/generators/rake_tasks/repository/repository_rake_tasks_generator.rb +38 -0
- data/generators/rake_tasks/repository/templates/repository.rake +43 -0
- metadata +19 -8
data/CHANGELOG
CHANGED
@@ -1,4 +1,17 @@
|
|
1
1
|
|
2
|
+
Meskyanichi - Generators |0.3.1|
|
3
|
+
-----------------------------------------------------------
|
4
|
+
|
5
|
+
- Fixed a small bug
|
6
|
+
|
7
|
+
|
8
|
+
Meskyanichi - Generators |0.3.0|
|
9
|
+
-----------------------------------------------------------
|
10
|
+
|
11
|
+
- Added Rake Tasks
|
12
|
+
- Added Repository Rake Task
|
13
|
+
- Updated the README
|
14
|
+
|
2
15
|
Meskyanichi - Generators |0.2.0|
|
3
16
|
-----------------------------------------------------------
|
4
17
|
|
data/README.rdoc
CHANGED
@@ -2,7 +2,11 @@
|
|
2
2
|
|
3
3
|
a few simple generators that might help you get your application up and running just a little bit faster!
|
4
4
|
|
5
|
-
|
5
|
+
|
6
|
+
== Installation
|
7
|
+
|
8
|
+
gem sources -a http://gems.github.com
|
9
|
+
sudo gem install meskyanichi-generators
|
6
10
|
|
7
11
|
|
8
12
|
== The Capistrano Template
|
@@ -47,19 +51,20 @@ This generates the deploy.rb file with the specified settings in the RAILS_ROOT/
|
|
47
51
|
|
48
52
|
Now the whole process in steps:
|
49
53
|
|
50
|
-
1:
|
51
|
-
2:
|
52
|
-
3:
|
53
|
-
4:
|
54
|
-
5:
|
55
|
-
6:
|
54
|
+
1: gem sources -a http://gems.github.com
|
55
|
+
2: sudo gem install meskyanichi-generators
|
56
|
+
3: go to root of rails app and type "capify ."
|
57
|
+
4: then type "script/generate capistrano_template [arg1..arg6]"
|
58
|
+
5: when it prompts if you wish to overwrite, type "y" and hit return
|
59
|
+
6: now type "cap deploy:setup" to set up the whole directory structure and files
|
60
|
+
7: after the setup is finished, and assuming you have your local git repository set up correctly,
|
56
61
|
type "cap deploy" and your application will go live in a matter of seconds!
|
57
62
|
|
58
63
|
If you did not fill in all the arguments, or wish double check if it was all set up correctly, open the
|
59
64
|
deploy.rb file located in the config directory and have a look. You can easily modify everything to your liking as well!
|
60
65
|
|
61
66
|
|
62
|
-
|
67
|
+
=== The Capistrano Template - Commands
|
63
68
|
|
64
69
|
The recipe provides a few commands which are pretty useful. Including syncing your local database.yml file
|
65
70
|
with the one on the server so that you are not forced to go SSH or FTP to the server to manually change it.
|
@@ -104,6 +109,10 @@ After the whole script has run, you will most likely want to add a remote reposi
|
|
104
109
|
|
105
110
|
git remote add origin #{path_to_remote_repository.git}
|
106
111
|
|
112
|
+
NOTE: Below you can find the rake tasks generator that provides rake tasks for creating
|
113
|
+
and destroying remote repositories. So if you're lazy like I am, and don't want to manually
|
114
|
+
SSH to your server, you can use it to create and destroy repositories and add them to git.
|
115
|
+
|
107
116
|
Now, add, commit and push the files to your remote server like so:
|
108
117
|
|
109
118
|
git add .
|
@@ -120,6 +129,53 @@ The default ignoration rules that are added to the main .gitignore file located
|
|
120
129
|
config/database.yml
|
121
130
|
db/*.sqlite3
|
122
131
|
|
132
|
+
|
133
|
+
== Rake Tasks
|
134
|
+
|
135
|
+
This generator gem includes a few rake tasks that might also help you get up and running faster.
|
136
|
+
|
137
|
+
|
138
|
+
=== Repository
|
139
|
+
|
140
|
+
If you're working with a remote repository, this script can help you out by creating and/or destroying it for you.
|
141
|
+
Generate the repository rake tasks like so:
|
142
|
+
|
143
|
+
script/generate repository_rake_tasks
|
144
|
+
|
145
|
+
This will generate the default rake task template for creating and destroying a remote repository. If you do not give additional arguments to the generate script, you will have to manually go into the lib/tasks/generators/repository.rake file yourself to see if the settings are as expected.
|
146
|
+
|
147
|
+
Consider using the arguments like so:
|
148
|
+
|
149
|
+
script/generate repository_rake_tasks host user password repository_directory
|
150
|
+
|
151
|
+
Example:
|
152
|
+
|
153
|
+
script/generate repository_rake_tasks my-domain.com root my-secret-pasword /var/git/my-repo.git
|
154
|
+
|
155
|
+
This will generate the rake tasks correctly.
|
156
|
+
Once you've done that, you will be able to perform the following rake tasks:
|
157
|
+
|
158
|
+
Create The Remote Repository:
|
159
|
+
rake generators:repository:create
|
160
|
+
This will create the remote remote repository on the server.
|
161
|
+
|
162
|
+
|
163
|
+
Destroy The Remote Repository:
|
164
|
+
rake generators:repository:destroy
|
165
|
+
This will destroy the remote repository from the server.
|
166
|
+
|
167
|
+
|
168
|
+
Add Remote Repository To Git (origin)
|
169
|
+
rake generators:repository:add_to_git
|
170
|
+
This will add the currently used remote repository to git's origin.
|
171
|
+
Be sure to have git initialized, you can use "The Git Template Generator"
|
172
|
+
to get git up and running, or do it manually of course.
|
173
|
+
|
174
|
+
|
175
|
+
If all was set up correctly, you should now be able to push your local repository's files to your remote repository!
|
176
|
+
|
177
|
+
|
178
|
+
|
123
179
|
== Copyright
|
124
180
|
|
125
181
|
Copyright (c) 2009 Michael. See LICENSE for details.
|
data/Rakefile
CHANGED
@@ -12,6 +12,7 @@ begin
|
|
12
12
|
gem.add_dependency('capistrano')
|
13
13
|
gem.add_dependency('git')
|
14
14
|
gem.add_dependency('git-rails')
|
15
|
+
gem.add_dependency('net-ssh')
|
15
16
|
end
|
16
17
|
rescue LoadError
|
17
18
|
puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
|
data/VERSION.yml
CHANGED
data/generators.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{generators}
|
5
|
-
s.version = "0.
|
5
|
+
s.version = "0.3.1"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Michael"]
|
9
|
-
s.date = %q{2009-06-
|
9
|
+
s.date = %q{2009-06-04}
|
10
10
|
s.email = %q{meskyan@gmail.com}
|
11
11
|
s.extra_rdoc_files = [
|
12
12
|
"LICENSE",
|
@@ -21,17 +21,18 @@ Gem::Specification.new do |s|
|
|
21
21
|
"Rakefile",
|
22
22
|
"VERSION.yml",
|
23
23
|
"generators.gemspec",
|
24
|
-
"
|
25
|
-
"test/generators_test.rb",
|
26
|
-
"test/test_helper.rb",
|
27
|
-
"generators",
|
28
|
-
"generators/capistrano_template",
|
24
|
+
"generators/.gitignore",
|
29
25
|
"generators/capistrano_template/capistrano_template_generator.rb",
|
30
26
|
"generators/capistrano_template/templates/deploy.rb",
|
31
|
-
"generators/git_template",
|
32
27
|
"generators/git_template/git_template_generator.rb",
|
33
28
|
"generators/git_template/templates/git_ignore_empty.txt",
|
34
|
-
"generators/git_template/templates/git_ignore_template.txt.erb"
|
29
|
+
"generators/git_template/templates/git_ignore_template.txt.erb",
|
30
|
+
"generators/rake_tasks/.gitignore",
|
31
|
+
"generators/rake_tasks/repository/repository_rake_tasks_generator.rb",
|
32
|
+
"generators/rake_tasks/repository/templates/repository.rake",
|
33
|
+
"lib/generators.rb",
|
34
|
+
"test/generators_test.rb",
|
35
|
+
"test/test_helper.rb"
|
35
36
|
]
|
36
37
|
s.has_rdoc = true
|
37
38
|
s.homepage = %q{http://github.com/meskyanichi/generators}
|
@@ -52,14 +53,17 @@ Gem::Specification.new do |s|
|
|
52
53
|
s.add_runtime_dependency(%q<capistrano>, [">= 0"])
|
53
54
|
s.add_runtime_dependency(%q<git>, [">= 0"])
|
54
55
|
s.add_runtime_dependency(%q<git-rails>, [">= 0"])
|
56
|
+
s.add_runtime_dependency(%q<net-ssh>, [">= 0"])
|
55
57
|
else
|
56
58
|
s.add_dependency(%q<capistrano>, [">= 0"])
|
57
59
|
s.add_dependency(%q<git>, [">= 0"])
|
58
60
|
s.add_dependency(%q<git-rails>, [">= 0"])
|
61
|
+
s.add_dependency(%q<net-ssh>, [">= 0"])
|
59
62
|
end
|
60
63
|
else
|
61
64
|
s.add_dependency(%q<capistrano>, [">= 0"])
|
62
65
|
s.add_dependency(%q<git>, [">= 0"])
|
63
66
|
s.add_dependency(%q<git-rails>, [">= 0"])
|
67
|
+
s.add_dependency(%q<net-ssh>, [">= 0"])
|
64
68
|
end
|
65
69
|
end
|
File without changes
|
File without changes
|
@@ -0,0 +1,38 @@
|
|
1
|
+
class RepositoryRakeTasksGenerator < Rails::Generator::Base
|
2
|
+
|
3
|
+
def initialize(runtime_args, runtime_options = {})
|
4
|
+
super
|
5
|
+
|
6
|
+
@repo_host = @args[0]
|
7
|
+
@repo_user = @args[1]
|
8
|
+
@repo_password = @args[2]
|
9
|
+
@repo_dir = @args[3]
|
10
|
+
|
11
|
+
unless File.directory? "lib/tasks/generators"
|
12
|
+
Dir.mkdir "lib/tasks/generators"
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def manifest
|
17
|
+
record do |m|
|
18
|
+
m.template 'repository.rake', 'lib/tasks/generators/repository.rake'
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def repo_host
|
23
|
+
@repo_host
|
24
|
+
end
|
25
|
+
|
26
|
+
def repo_user
|
27
|
+
@repo_user
|
28
|
+
end
|
29
|
+
|
30
|
+
def repo_password
|
31
|
+
@repo_password
|
32
|
+
end
|
33
|
+
|
34
|
+
def repo_dir
|
35
|
+
@repo_dir
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
require 'net/ssh'
|
2
|
+
|
3
|
+
namespace :generators do
|
4
|
+
|
5
|
+
namespace :repository do
|
6
|
+
|
7
|
+
repository_host = "<%= repo_host %>"
|
8
|
+
repository_user = "<%= repo_user %>"
|
9
|
+
repository_password = "<%= repo_password %>"
|
10
|
+
repository_dir = "<%= repo_dir %>"
|
11
|
+
|
12
|
+
desc "Creates a remote repository for the Rails application."
|
13
|
+
task :create => :filter do
|
14
|
+
puts "Creating remote repository.."
|
15
|
+
Net::SSH.start(repository_host, repository_user, :password => repository_password) do |ssh|
|
16
|
+
ssh.exec "mkdir -p #{repository_dir}; git --bare --git-dir=#{repository_dir} init"
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
desc "Removes a remote repository for the Rails application."
|
21
|
+
task :destroy => :filter do
|
22
|
+
puts "Removing remote repository.."
|
23
|
+
Net::SSH.start(repository_host, repository_user, :password => repository_password) do |ssh|
|
24
|
+
ssh.exec "rm -rf #{repository_dir}"
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
desc "Adds the remote repository as origin to git."
|
29
|
+
task :add_to_git do
|
30
|
+
system "git remote rm origin"
|
31
|
+
system "git remote add origin ssh://#{repository_user}@#{repository_host}/#{repository_dir}"
|
32
|
+
puts "ssh://#{repository_user}@#{repository_host}/#{repository_dir}"
|
33
|
+
puts "was successfully added as remote repository (origin)."
|
34
|
+
end
|
35
|
+
|
36
|
+
desc "Filters anything that might cause an error."
|
37
|
+
task :filter do
|
38
|
+
# => no filters added at the moment
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: meskyanichi-generators
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-06-
|
12
|
+
date: 2009-06-04 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -42,6 +42,16 @@ dependencies:
|
|
42
42
|
- !ruby/object:Gem::Version
|
43
43
|
version: "0"
|
44
44
|
version:
|
45
|
+
- !ruby/object:Gem::Dependency
|
46
|
+
name: net-ssh
|
47
|
+
type: :runtime
|
48
|
+
version_requirement:
|
49
|
+
version_requirements: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - ">="
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: "0"
|
54
|
+
version:
|
45
55
|
description:
|
46
56
|
email: meskyan@gmail.com
|
47
57
|
executables: []
|
@@ -60,17 +70,18 @@ files:
|
|
60
70
|
- Rakefile
|
61
71
|
- VERSION.yml
|
62
72
|
- generators.gemspec
|
63
|
-
-
|
64
|
-
- test/generators_test.rb
|
65
|
-
- test/test_helper.rb
|
66
|
-
- generators
|
67
|
-
- generators/capistrano_template
|
73
|
+
- generators/.gitignore
|
68
74
|
- generators/capistrano_template/capistrano_template_generator.rb
|
69
75
|
- generators/capistrano_template/templates/deploy.rb
|
70
|
-
- generators/git_template
|
71
76
|
- generators/git_template/git_template_generator.rb
|
72
77
|
- generators/git_template/templates/git_ignore_empty.txt
|
73
78
|
- generators/git_template/templates/git_ignore_template.txt.erb
|
79
|
+
- generators/rake_tasks/.gitignore
|
80
|
+
- generators/rake_tasks/repository/repository_rake_tasks_generator.rb
|
81
|
+
- generators/rake_tasks/repository/templates/repository.rake
|
82
|
+
- lib/generators.rb
|
83
|
+
- test/generators_test.rb
|
84
|
+
- test/test_helper.rb
|
74
85
|
has_rdoc: true
|
75
86
|
homepage: http://github.com/meskyanichi/generators
|
76
87
|
post_install_message:
|