lockdown 0.5.2 → 0.5.3
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +5 -0
- data/bin/lockdown +54 -59
- data/lib/lockdown/version.rb +1 -1
- data/rails_generators/lockdown/lockdown_generator.rb +10 -0
- data/rails_generators/lockdown/templates/app/controllers/user_groups_controller.rb +1 -0
- data/website/generator.html +1 -1
- data/website/index.html +1 -1
- metadata +2 -2
data/History.txt
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
== 0.5.3 2008-06-01
|
2
|
+
* Fixed: Issue with new timestamped based migrations in rails 2.1. Migration templates created were all done within the same second, therefore having the same timestamp, added a sleep call to the next_migration_string to get around the issue.
|
3
|
+
|
4
|
+
* Fixed: User Groups management template had a bug on the show screen. Was not getting @all_permissions instance variable set.
|
5
|
+
|
1
6
|
== 0.5.2 2008-05-26
|
2
7
|
* Fixed: make call to Dependencies.clear after inspecting controllers. Using Dependencies.require_or_load is not sufficient it seems.
|
3
8
|
|
data/bin/lockdown
CHANGED
@@ -11,55 +11,50 @@ if %w(-v --version).include? ARGV.first
|
|
11
11
|
exit(0)
|
12
12
|
end
|
13
13
|
|
14
|
+
MERB_CONFIG = 'config/init.rb'
|
15
|
+
RAILS_CONFIG = 'config/environment.rb'
|
16
|
+
|
17
|
+
if File.exists?(MERB_CONFIG)
|
18
|
+
@framework = "merb"
|
19
|
+
elsif File.exists?(RAILS_CONFIG)
|
20
|
+
@framework = "rails"
|
21
|
+
else
|
22
|
+
raise NotImplementedError, "Configuration file not found. Looking for init.rb (Merb) or environment.rb (Rails)"
|
23
|
+
end
|
14
24
|
|
15
|
-
|
16
|
-
|
17
|
-
|
25
|
+
def merb_app?
|
26
|
+
@framework == "merb"
|
27
|
+
end
|
18
28
|
|
19
|
-
|
20
|
-
|
29
|
+
def rails_app?
|
30
|
+
@framework == "rails"
|
31
|
+
end
|
21
32
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
33
|
+
#
|
34
|
+
# Right now we only have the two and we raise an exception
|
35
|
+
# if we don't know prior to getting here..
|
36
|
+
#
|
37
|
+
def config_file
|
38
|
+
if merb_app?
|
39
|
+
MERB_CONFIG
|
26
40
|
else
|
27
|
-
|
28
|
-
end
|
29
|
-
|
30
|
-
def merb_app?
|
31
|
-
@framework == "merb"
|
32
|
-
end
|
33
|
-
|
34
|
-
def rails_app?
|
35
|
-
@framework == "rails"
|
36
|
-
end
|
37
|
-
|
38
|
-
#
|
39
|
-
# Right now we only have the two and we raise an exception
|
40
|
-
# if we don't know prior to getting here..
|
41
|
-
#
|
42
|
-
def config_file
|
43
|
-
if merb_app?
|
44
|
-
MERB_CONFIG
|
45
|
-
else
|
46
|
-
RAILS_CONFIG
|
47
|
-
end
|
41
|
+
RAILS_CONFIG
|
48
42
|
end
|
43
|
+
end
|
49
44
|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
45
|
+
begin
|
46
|
+
require 'rubygems'
|
47
|
+
rescue LoadError
|
48
|
+
# no rubygems to load, so we fail silently
|
49
|
+
end
|
55
50
|
|
56
51
|
|
57
|
-
|
58
|
-
|
59
|
-
|
52
|
+
OPTIONS = {
|
53
|
+
:path => File.expand_path('.')
|
54
|
+
}
|
60
55
|
|
61
|
-
|
62
|
-
|
56
|
+
parser = OptionParser.new do |opts|
|
57
|
+
opts.banner = <<-BANNER
|
63
58
|
Lockdown will add init.rb and session.rb to the lib/lockdown directory and require them in #{config_file}.
|
64
59
|
|
65
60
|
Usage: #{File.basename($0)} [options]
|
@@ -67,25 +62,25 @@ end
|
|
67
62
|
Options are:
|
68
63
|
BANNER
|
69
64
|
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
#
|
80
|
-
# Load up the config file contents
|
81
|
-
#
|
82
|
-
@configuration = File.open config_file do |f|
|
83
|
-
f.map {|line| line.chomp}
|
84
|
-
end
|
65
|
+
opts.separator ""
|
66
|
+
opts.on("-p", "--path=PATH", String,
|
67
|
+
"The root path for selecting files",
|
68
|
+
"Default: [current directory]") { |OPTIONS[:path]| }
|
69
|
+
opts.on("-h", "--help",
|
70
|
+
"Show this help message.") { puts opts; exit }
|
71
|
+
opts.parse!(ARGV)
|
72
|
+
end
|
85
73
|
|
86
|
-
|
87
|
-
|
88
|
-
|
74
|
+
#
|
75
|
+
# Load up the config file contents
|
76
|
+
#
|
77
|
+
@configuration = File.open config_file do |f|
|
78
|
+
f.map {|line| line.chomp}
|
79
|
+
end
|
80
|
+
|
81
|
+
def configuration_file_has?(req)
|
82
|
+
@configuration.include?(req)
|
83
|
+
end
|
89
84
|
|
90
85
|
puts <<-MSG
|
91
86
|
\n------------------------------------------------------------
|
@@ -94,7 +89,7 @@ MSG
|
|
94
89
|
|
95
90
|
begin
|
96
91
|
source = RubiGen::PathSource.new(:application,
|
97
|
-
|
92
|
+
File.join(File.dirname(__FILE__), "../app_generators"))
|
98
93
|
RubiGen::Base.reset_sources
|
99
94
|
RubiGen::Base.append_sources source
|
100
95
|
RubiGen::Scripts::Generate.new.run(ARGV, :generator => 'lockdown', :framework => @framework)
|
data/lib/lockdown/version.rb
CHANGED
@@ -1,3 +1,13 @@
|
|
1
|
+
if Rails::VERSION::MAJOR >= 2 && Rails::VERSION::MINOR >= 1
|
2
|
+
class Rails::Generator::Commands::Base
|
3
|
+
protected
|
4
|
+
def next_migration_string(padding = 3)
|
5
|
+
sleep(1)
|
6
|
+
Time.now.utc.strftime("%Y%m%d%H%M%S")
|
7
|
+
end
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
1
11
|
class LockdownGenerator < Rails::Generator::Base
|
2
12
|
attr_accessor :file_name
|
3
13
|
|
@@ -16,6 +16,7 @@ class UserGroupsController < ApplicationController
|
|
16
16
|
# GET /user_groups/1
|
17
17
|
# GET /user_groups/1.xml
|
18
18
|
def show
|
19
|
+
@all_permissions = Lockdown::System.permissions_assignable_for_user(current_user)
|
19
20
|
respond_to do |format|
|
20
21
|
format.html # show.html.erb
|
21
22
|
format.xml { render :xml => @user_group }
|
data/website/generator.html
CHANGED
@@ -33,7 +33,7 @@
|
|
33
33
|
<h1>Lockdown</h1>
|
34
34
|
<div id="version" class="clickable" onclick='document.location = "http://rubyforge.org/projects/lockdown"; return false'>
|
35
35
|
<p>Get Version</p>
|
36
|
-
<a href="http://rubyforge.org/projects/lockdown" class="numbers">0.5.
|
36
|
+
<a href="http://rubyforge.org/projects/lockdown" class="numbers">0.5.3</a>
|
37
37
|
</div>
|
38
38
|
<h2>What</h2>
|
39
39
|
|
data/website/index.html
CHANGED
@@ -33,7 +33,7 @@
|
|
33
33
|
<h1>Lockdown</h1>
|
34
34
|
<div id="version" class="clickable" onclick='document.location = "http://rubyforge.org/projects/lockdown"; return false'>
|
35
35
|
<p>Get Version</p>
|
36
|
-
<a href="http://rubyforge.org/projects/lockdown" class="numbers">0.5.
|
36
|
+
<a href="http://rubyforge.org/projects/lockdown" class="numbers">0.5.3</a>
|
37
37
|
</div>
|
38
38
|
<h2>What</h2>
|
39
39
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lockdown
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Stone
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-
|
12
|
+
date: 2008-06-01 00:00:00 -04:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|