railsrumble-rumble-tools 0.1.2 → 0.2.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/bin/rumble +19 -3
- data/config/rumble.yml +3 -1
- data/lib/rumble-tools.rb +40 -0
- metadata +5 -5
data/bin/rumble
CHANGED
@@ -7,8 +7,10 @@ require File.join(File.dirname(__FILE__), '..', 'lib', 'rumble-tools')
|
|
7
7
|
|
8
8
|
class RumbleTools < Thor
|
9
9
|
|
10
|
-
map "twitter:setup"
|
11
|
-
map "tumblr:setup"
|
10
|
+
map "twitter:setup" => :twitter_setup
|
11
|
+
map "tumblr:setup" => :tumblr_setup
|
12
|
+
map "setup-ssh-key" => :setup_ssh_key
|
13
|
+
map "notify-vps-details" => :notify_vps_details
|
12
14
|
|
13
15
|
# Twitter Tasks
|
14
16
|
desc "twitter:setup","setup your twitter information"
|
@@ -76,12 +78,26 @@ class RumbleTools < Thor
|
|
76
78
|
puts "API Key Accepted."
|
77
79
|
end
|
78
80
|
|
79
|
-
desc "init","set the current directory as your application"
|
81
|
+
desc "init [PATH=pwd]","set the current directory as your application"
|
80
82
|
def init(path = Dir.pwd)
|
81
83
|
RailsRumble.update_user_config! :repository => File.expand_path(path)
|
82
84
|
puts "Repository path '#{path}' stored."
|
83
85
|
end
|
84
86
|
|
87
|
+
desc 'setup-ssh-key', 'Sets up the SSH Public Key for this user (Run on Server)'
|
88
|
+
def setup_ssh_key
|
89
|
+
RailsRumble.install_ssh_key
|
90
|
+
end
|
91
|
+
|
92
|
+
desc 'notify-vps-details [PATH=pwd]', 'Updates application with the given SSH user and deployment path (Run on Server)'
|
93
|
+
def notify_vps_details(path = Dir.pwd)
|
94
|
+
path = File.expand_path(path)
|
95
|
+
user = ENV['USER']
|
96
|
+
puts "Notifying competition - deployed to #{path} as #{user}"
|
97
|
+
RailsRumble.notify_vps_details(user, path)
|
98
|
+
puts "Notified."
|
99
|
+
end
|
100
|
+
|
85
101
|
protected
|
86
102
|
|
87
103
|
def ask(text = "")
|
data/config/rumble.yml
CHANGED
data/lib/rumble-tools.rb
CHANGED
@@ -2,6 +2,8 @@ $:.unshift(File.dirname(__FILE__) + '/../lib')
|
|
2
2
|
|
3
3
|
require 'rubygems'
|
4
4
|
require 'thor'
|
5
|
+
require 'fileutils'
|
6
|
+
require 'open-uri'
|
5
7
|
|
6
8
|
%w{network_helpers git tumble tweet}.each{|x|require "rails_rumble/#{x}"}
|
7
9
|
|
@@ -49,6 +51,44 @@ module RailsRumble
|
|
49
51
|
f.write previous_config.merge(params).to_yaml
|
50
52
|
end
|
51
53
|
end
|
54
|
+
|
55
|
+
def install_ssh_key
|
56
|
+
root_path = File.expand_path("~/.ssh")
|
57
|
+
puts "Making Folder (if not present) at '#{root_path}'"
|
58
|
+
FileUtils.mkdir_p(root_path)
|
59
|
+
puts "Getting Key..."
|
60
|
+
key_url = File.join(configuration.competition_host, configuration.ssh_key_path)
|
61
|
+
key_contents = open(key_url).read
|
62
|
+
key_path = File.join(root_path, "authorized_keys")
|
63
|
+
puts "Writing Key to '#{key_path}'"
|
64
|
+
File.open(key_path, "a+") do |file|
|
65
|
+
file.puts ""
|
66
|
+
file.puts "##### #{configuration.competition_name} SSH Public Key #####"
|
67
|
+
file.puts key_contents
|
68
|
+
file.puts "##### End #{configuration.competition_name} Public Key #####"
|
69
|
+
file.puts ""
|
70
|
+
end
|
71
|
+
|
72
|
+
puts "Chmodding the parent directory"
|
73
|
+
FileUtils.chmod 0700, root_path
|
74
|
+
|
75
|
+
puts "Chmodding the key file"
|
76
|
+
FileUtils.chmod 0644, key_path
|
77
|
+
|
78
|
+
puts "Done."
|
79
|
+
end
|
80
|
+
|
81
|
+
def notify_vps_details(user, path)
|
82
|
+
slug = live_configuration["team"]["slug"]
|
83
|
+
current_user_path = "/teams/#{slug}"
|
84
|
+
options = {
|
85
|
+
'team[deployment_location]' => path,
|
86
|
+
'team[vps_login]' => user,
|
87
|
+
'_method' => 'put',
|
88
|
+
'api_key' => user_config.api_key
|
89
|
+
}
|
90
|
+
RailsRumble::NetworkHelpers.post current_user_path, options
|
91
|
+
end
|
52
92
|
|
53
93
|
def git
|
54
94
|
c = user_config
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: railsrumble-rumble-tools
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Darcy Laycock
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2009-08-
|
13
|
+
date: 2009-08-22 00:00:00 -07:00
|
14
14
|
default_executable: rumble
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
@@ -44,7 +44,7 @@ files:
|
|
44
44
|
- test/test_helper.rb
|
45
45
|
- LICENSE
|
46
46
|
- README.rdoc
|
47
|
-
has_rdoc:
|
47
|
+
has_rdoc: false
|
48
48
|
homepage: http://github.com/railsrumble/cli-toolkit
|
49
49
|
licenses:
|
50
50
|
post_install_message:
|
@@ -69,8 +69,8 @@ requirements: []
|
|
69
69
|
rubyforge_project:
|
70
70
|
rubygems_version: 1.3.5
|
71
71
|
signing_key:
|
72
|
-
specification_version:
|
72
|
+
specification_version: 3
|
73
73
|
summary: Tools for the RailsRumble
|
74
74
|
test_files:
|
75
|
-
- test/test_helper.rb
|
76
75
|
- test/rumble_tools_test.rb
|
76
|
+
- test/test_helper.rb
|