capfire 0.1.0 → 0.1.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/VERSION +1 -1
- data/generators/capfire_generator.rb +8 -11
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.1
|
@@ -2,26 +2,22 @@ require File.expand_path(File.dirname(__FILE__) + "/lib/insert_commands.rb")
|
|
2
2
|
|
3
3
|
class CapfireGenerator < Rails::Generator::Base
|
4
4
|
def add_options!(opt)
|
5
|
-
puts "Adding options"
|
6
5
|
opt.on('-a', '--account=account', String, "Your account") {|v| options[:campfire_account] = v}
|
7
6
|
opt.on('-k', '--token=token', String, "Your token key") {|v| options[:campfire_token] = v}
|
8
7
|
opt.on('-r', '--chatroom=room', String, "The chatroom") {|v| options[:chat_room] = v}
|
9
8
|
end
|
10
9
|
|
11
10
|
def manifest
|
12
|
-
if campfire_file_exists?
|
13
|
-
puts "
|
14
|
-
exit
|
15
|
-
end
|
16
|
-
if !options[:campfire_token] && !options[:chat_room] && !options[:campfire_account]
|
17
|
-
puts options.inspect
|
18
|
-
puts "Token and chat room are required"
|
11
|
+
if !campfire_file_exists? && !options[:campfire_token] && !options[:chat_room] && !options[:campfire_account]
|
12
|
+
puts "Token (-k), account (-a) and chatroom (-r) are required on first run."
|
19
13
|
exit
|
20
14
|
end
|
21
15
|
|
22
16
|
record do |m|
|
23
17
|
if ['config/deploy.rb', 'Capfile'].all? { |file| File.exists?(file) }
|
24
18
|
m.append_to 'config/deploy.rb', capistrano_hook
|
19
|
+
else
|
20
|
+
puts "No config/deploy discovered, so I've done nothing."
|
25
21
|
end
|
26
22
|
|
27
23
|
conf = <<-CONF
|
@@ -30,9 +26,10 @@ campfire:
|
|
30
26
|
token: #{options[:campfire_token]}
|
31
27
|
room: #{options[:chat_room]}
|
32
28
|
CONF
|
33
|
-
|
34
|
-
|
35
|
-
|
29
|
+
unless campfire_file_exists?
|
30
|
+
File.open(File.join(ENV['HOME'],'.campfire'), 'w') do |out|
|
31
|
+
out.write(conf)
|
32
|
+
end
|
36
33
|
end
|
37
34
|
end
|
38
35
|
end
|