rails_pwnerer 0.6.109 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,5 @@
1
+ v0.7.0. New config layout facilitates having per-host configs in separate repository.
2
+
1
3
  v0.6.109. Allow .crt for SSL certificate chains.
2
4
 
3
5
  v0.6.108. Re-release with X-Forwarded-For for real.
@@ -89,7 +89,7 @@ class RailsPwnerer::App::Config
89
89
  app_config[:port] = 443
90
90
  end
91
91
 
92
- ["config/rails_pwnerer/.yml", "config/rails_pwnerer/#{instance_name}.yml"].each do |fname|
92
+ ["config/rails_pwnerer.yml", "config/rails_pwnerer/#{instance_name}.yml"].each do |fname|
93
93
  next unless File.exists? fname
94
94
  config_update = File.open(fname, 'r') { |f| YAML.load f } rescue nil
95
95
  unless config_update
@@ -2,38 +2,38 @@ require 'pp'
2
2
 
3
3
  class RailsPwnerer::DevExecutor
4
4
  include RailsPwnerer::Base
5
-
5
+
6
6
  def read_config(instance)
7
7
  if instance == '*'
8
- file = File.join(@config_root, '.yml')
8
+ file = File.join(@config_root, 'rails_pwnerer.yml')
9
9
  else
10
- file = File.join(@config_root, instance + '.yml')
10
+ file = File.join(@instance_root, instance + '.yml')
11
11
  end
12
-
12
+
13
13
  begin
14
14
  File.open(file, 'r' ) { |f| YAML.load f }
15
15
  rescue
16
16
  return Hash.new
17
17
  end
18
18
  end
19
-
19
+
20
20
  def write_config(config, instance)
21
21
  if instance == '*'
22
- file = File.join(@config_root, '.yml')
22
+ file = File.join(@config_root, 'rails_pwnerer.yml')
23
23
  else
24
- file = File.join(@config_root, instance + '.yml')
24
+ file = File.join(@instance_root, instance + '.yml')
25
25
  end
26
26
 
27
27
  File.open(file, 'w') { |f| YAML.dump config, f }
28
28
  end
29
-
29
+
30
30
  def checkin_rails_app(checkin_command, path_base)
31
- is_empty = true
32
-
31
+ is_empty = true
32
+
33
33
  Dir.foreach(path_base) do |entry|
34
34
  # skip uninteresting entries
35
35
  next if ['.', '..'].include? entry
36
-
36
+
37
37
  # check in files and subdirectories
38
38
  is_empty = false
39
39
  path = File.join path_base, entry
@@ -44,34 +44,35 @@ class RailsPwnerer::DevExecutor
44
44
  checkin_rails_app checkin_command, path
45
45
  end
46
46
  end
47
-
47
+
48
48
  if is_empty
49
49
  # workaround to check in blank directory
50
- path = File.join path_base, '.not_blank'
50
+ path = File.join path_base, '.keep'
51
51
  File.open(path, 'w') { |f| f.write '' }
52
52
  Kernel.system "#{checkin_command} add #{path}"
53
53
  end
54
54
  end
55
-
56
-
55
+
56
+
57
57
  # standalone runner
58
58
  def run(args)
59
59
  unless check_rails_root '.'
60
60
  print "You need to run this at the root of your Rails application\n"
61
61
  return
62
62
  end
63
-
63
+
64
64
  # create the config root unless it exists
65
- @config_root = 'config/rails_pwnerer'
66
- Dir.mkdir @config_root unless File.exists? @config_root
67
-
65
+ @config_root = 'config'
66
+ @instance_root = File.join @config_root, 'rails_pwnerer'
67
+ Dir.mkdir @instance_root unless File.exists?(@instance_root)
68
+
68
69
  case args[0]
69
70
  when 'get', 'getprop'
70
71
  property = args[1]
71
72
  instance = args[2] || '*'
72
73
  config = read_config instance
73
74
  pp config[property]
74
-
75
+
75
76
  when 'set', 'setprop', 'setnum', 'setpropnum'
76
77
  property = args[1]
77
78
  if args[0].index 'num'
@@ -79,26 +80,26 @@ class RailsPwnerer::DevExecutor
79
80
  else
80
81
  value = args[2] || 'true'
81
82
  end
82
-
83
+
83
84
  instance = args[3] || '*'
84
85
  config = read_config instance
85
86
  config[property] = value
86
87
  write_config config, instance
87
-
88
+
88
89
  when 'del', 'delprop', 'delete', 'rm', 'remove'
89
90
  property = args[1]
90
91
  instance = args[2] || '*'
91
92
  config = read_config instance
92
93
  config.delete property
93
94
  write_config config, instance
94
-
95
+
95
96
  when 'checkin'
96
97
  unless args[1]
97
98
  print "Please provide the checkin command (e.g. git).\n"
98
99
  exit
99
100
  end
100
101
  checkin_rails_app args[1], '.'
101
-
102
+
102
103
  else
103
104
  print "Unrecognized command #{args[0]}\n"
104
105
  end
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "rails_pwnerer"
5
- s.version = "0.6.109"
5
+ s.version = "0.7.0"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Victor Costan"]
9
- s.date = "2012-12-16"
9
+ s.date = "2012-12-17"
10
10
  s.description = "Rails deployment hack."
11
11
  s.email = "victor@costan.us"
12
12
  s.executables = ["rpwn", "rpwnctl", "rpwndev"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_pwnerer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.109
4
+ version: 0.7.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-12-16 00:00:00.000000000 Z
12
+ date: 2012-12-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: zerg_support