public
Rubygem
Description: JSON Web App Framework
Homepage: http://halcyon.rubyforge.org/
Clone URL: git://github.com/mtodd/halcyon.git
Search Repo:
Click here to lend your support to: halcyon and make a donation at www.pledgie.com !
Git Init option for app init now works, with added ability to commit as 
well. [#25 state:resolved]
mtodd (author)
Tue May 06 17:02:30 -0700 2008
commit  464942bc31b360995565fddead84505226b3771e
tree    0cbc29cf9733c6282132b23a8921427137ebeaba
parent  1da1bf7e19be7ef4f005c61963c0fdbb24531a12
...
86
87
88
 
 
89
90
91
...
101
102
103
 
104
105
106
...
114
115
116
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
117
118
119
...
86
87
88
89
90
91
92
93
...
103
104
105
106
107
108
109
...
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
0
@@ -86,6 +86,8 @@ module Halcyon
0
         
0
         # Generate a new Halcyon application
0
         def init(argv)
0
+ app_name = argv.last
0
+
0
           options = {
0
             :generator => 'halcyon',
0
             :git => false
0
@@ -101,6 +103,7 @@ module Halcyon
0
             opts.separator ""
0
             opts.separator "Additional options:"
0
             opts.on("-g", "--git", "Initialize a Git repository when finished generating") { options[:git] = true }
0
+ opts.on("-G", "--git-commit", "Initialize a Git repo and commit") { options[:git] = options[:git_commit] = true }
0
             
0
             begin
0
               opts.parse! argv
0
@@ -114,6 +117,21 @@ module Halcyon
0
           RubiGen::Base.use_application_sources!
0
           RubiGen::Base.sources << RubiGen::PathSource.new(:custom, File.expand_path(File.join(File.dirname(__FILE__), '..', '..', '..', "support/generators")))
0
           RubiGen::Scripts::Generate.new.run(argv, :generator => options[:generator])
0
+
0
+ # Create a Git repository in the new app dir
0
+ if options[:git]
0
+ system("cd #{app_name} && git init -q && cd #{Dir.pwd}")
0
+ puts "Initialized Git repository in #{app_name}/"
0
+ File.open(File.join("#{app_name}",'.gitignore'),"w") {|f| f << "log/*.log" }
0
+ File.open(File.join("#{app_name}",'log','.gitignore'),"w") {|f| f << "" }
0
+ end
0
+
0
+ # commit to the git repo
0
+ if options[:git_commit]
0
+ system("cd #{app_name} && git add . && git commit -m 'Initial import.' -q && cd #{Dir.pwd}")
0
+ puts "Committed empty application in #{app_name}/"
0
+ puts "Run `git commit --amend` to change the commit message."
0
+ end
0
         end
0
         
0
       end

Comments

    No one has commented yet.