ixtlan-guard 0.7.2 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +104 -0
- data/lib/ixtlan/guard.rb +1 -1
- data/lib/ixtlan/guard/{guard_ng.rb → guard.rb} +50 -34
- data/lib/ixtlan/guard/guard.rb~ +195 -0
- data/lib/ixtlan/guard/guard_config.rb +1 -2
- data/lib/ixtlan/guard/guard_rails.rb +181 -35
- data/lib/ixtlan/guard/railtie.rb +8 -5
- data/spec/guard_cache_spec.rb +4 -4
- data/spec/guard_export_spec.rb +48 -20
- data/spec/guard_rails_spec.rb +150 -0
- data/spec/guard_rails_spec.rb~ +150 -0
- data/spec/guard_spec.rb +17 -11
- data/spec/guard_with_associations_spec.rb +91 -75
- data/spec/guards/re_users_guard.yaml~ +4 -0
- metadata +10 -8
- data/features/step_definitions/ruby_maven.rb +0 -170
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: ixtlan-guard
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.
|
5
|
+
version: 0.8.0
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- mkristian
|
@@ -10,8 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2012-
|
14
|
-
default_executable:
|
13
|
+
date: 2012-03-20 00:00:00 Z
|
15
14
|
dependencies:
|
16
15
|
- !ruby/object:Gem::Dependency
|
17
16
|
name: ixtlan-core
|
@@ -90,6 +89,7 @@ extra_rdoc_files: []
|
|
90
89
|
|
91
90
|
files:
|
92
91
|
- MIT-LICENSE
|
92
|
+
- README.md
|
93
93
|
- lib/ixtlan-guard.rb
|
94
94
|
- lib/generators/guard/controller/USAGE
|
95
95
|
- lib/generators/guard/controller/controller_generator.rb
|
@@ -102,12 +102,13 @@ files:
|
|
102
102
|
- lib/ixtlan/guard/abstract_session.rb
|
103
103
|
- lib/ixtlan/guard/abstract_session.rb~
|
104
104
|
- lib/ixtlan/guard/guard_rails.rb~
|
105
|
-
- lib/ixtlan/guard/
|
105
|
+
- lib/ixtlan/guard/guard.rb
|
106
106
|
- lib/ixtlan/guard/permission_builder.rb~
|
107
107
|
- lib/ixtlan/guard/guard_ng.rb~
|
108
108
|
- lib/ixtlan/guard/guard_config.rb
|
109
109
|
- lib/ixtlan/guard/guard_rails.rb
|
110
110
|
- lib/ixtlan/guard/guard_config.rb~
|
111
|
+
- lib/ixtlan/guard/guard.rb~
|
111
112
|
- lib/ixtlan/guard/railtie.rb
|
112
113
|
- spec/guard_export_spec.rb~
|
113
114
|
- spec/guard_with_associations_spec.rb
|
@@ -115,9 +116,11 @@ files:
|
|
115
116
|
- spec/guard_export_spec.rb
|
116
117
|
- spec/spec_helper.rb
|
117
118
|
- spec/guard_cache_spec.rb
|
119
|
+
- spec/guard_rails_spec.rb~
|
118
120
|
- spec/guard_cache_spec.rb~
|
119
121
|
- spec/guard_spec.rb
|
120
122
|
- spec/railtie_spec.rb
|
123
|
+
- spec/guard_rails_spec.rb
|
121
124
|
- spec/guards/accounts1_guard.yml~
|
122
125
|
- spec/guards/users_guard.yml
|
123
126
|
- spec/guards/users2_guard.yml
|
@@ -129,6 +132,7 @@ files:
|
|
129
132
|
- spec/guards/users_guard.yml~
|
130
133
|
- spec/guards/users1_guard.yml~
|
131
134
|
- spec/guards/tools_guard.yml~
|
135
|
+
- spec/guards/re_users_guard.yaml~
|
132
136
|
- spec/guards/no_defaults_guard.yml
|
133
137
|
- spec/guards/regions_guard.yml~
|
134
138
|
- spec/guards/defaults_guard.yml
|
@@ -140,10 +144,8 @@ files:
|
|
140
144
|
- spec/guards/allow_all_defaults_guard.yml
|
141
145
|
- spec/guards/allow_all_defaults_guard.yml~
|
142
146
|
- spec/guards/defaults_guard.yml~
|
143
|
-
- features/step_definitions/ruby_maven.rb
|
144
147
|
- features/step_definitions/simple_steps.rb
|
145
148
|
- features/generators.feature
|
146
|
-
has_rdoc: true
|
147
149
|
homepage: http://github.com/mkristian/ixtlan-guard
|
148
150
|
licenses:
|
149
151
|
- MIT-LICENSE
|
@@ -167,7 +169,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
167
169
|
requirements: []
|
168
170
|
|
169
171
|
rubyforge_project:
|
170
|
-
rubygems_version: 1.
|
172
|
+
rubygems_version: 1.8.15
|
171
173
|
signing_key:
|
172
174
|
specification_version: 3
|
173
175
|
summary: guard your controller actions
|
@@ -177,6 +179,6 @@ test_files:
|
|
177
179
|
- spec/guard_cache_spec.rb
|
178
180
|
- spec/guard_spec.rb
|
179
181
|
- spec/railtie_spec.rb
|
182
|
+
- spec/guard_rails_spec.rb
|
180
183
|
- features/generators.feature
|
181
|
-
- features/step_definitions/ruby_maven.rb
|
182
184
|
- features/step_definitions/simple_steps.rb
|
@@ -1,170 +0,0 @@
|
|
1
|
-
require 'fileutils'
|
2
|
-
|
3
|
-
module Maven
|
4
|
-
class RubyMaven
|
5
|
-
|
6
|
-
# make the command line for the goals of the jruby-maven-plugins nicer
|
7
|
-
PLUGINS = {
|
8
|
-
:rake => [:rake],
|
9
|
-
:ruby => [:jruby, :compile],
|
10
|
-
:gem => [:package, :install, :push, :exec, :pom, :initialize, :irb],
|
11
|
-
:gemify => [:gemify, :versions],
|
12
|
-
:rails2 => [:new, :generate, :rake, :server, :console],
|
13
|
-
:rails3 => [:new, :generate, :rake, :server, :console, :dbconsole, :pom, :initialize],
|
14
|
-
:cucumber => [:test],
|
15
|
-
:rspec => [:test],
|
16
|
-
:runit => [:test],
|
17
|
-
:bundler => [:install]
|
18
|
-
}
|
19
|
-
ALIASES = {
|
20
|
-
:jruby => :ruby,
|
21
|
-
:spec => :rspec,
|
22
|
-
:rails => :rails3,
|
23
|
-
:bundle => :bundler
|
24
|
-
}
|
25
|
-
|
26
|
-
def initialize
|
27
|
-
@command = "#{ENV['GEM_HOME']}/bin/rmvn"
|
28
|
-
@jruby = File.read(@command).split("\n")[0].sub(/^#!/, '')
|
29
|
-
@maven_home = File.expand_path(Dir.glob("#{ENV['GEM_HOME']}/gems/ruby-maven-*-java")[0])
|
30
|
-
end
|
31
|
-
|
32
|
-
def launch_jruby(args)
|
33
|
-
classpath_array.each do |path|
|
34
|
-
require path
|
35
|
-
end
|
36
|
-
|
37
|
-
java.lang.System.setProperty("classworlds.conf",
|
38
|
-
File.join(@maven_home, 'bin', "m2.conf"))
|
39
|
-
|
40
|
-
java.lang.System.setProperty("maven.home", @maven_home)
|
41
|
-
|
42
|
-
org.codehaus.plexus.classworlds.launcher.Launcher.main(args)
|
43
|
-
end
|
44
|
-
|
45
|
-
def classpath_array
|
46
|
-
(Dir.glob(File.join(@maven_home, "boot", "*jar")) +
|
47
|
-
Dir.glob(File.join(@maven_home, "ext", "ruby-tools*jar"))).each do |path|
|
48
|
-
path
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
def launch_java(*args)
|
53
|
-
"java -cp #{classpath_array.join(':')} -Dmaven.home=#{File.expand_path(@maven_home)} -Dclassworlds.conf=#{File.expand_path(File.join(@maven_home, 'bin', 'm2.conf'))} org.codehaus.plexus.classworlds.launcher.Launcher #{args.join ' '}"
|
54
|
-
end
|
55
|
-
|
56
|
-
def prepare(args)
|
57
|
-
if args.size > 0
|
58
|
-
name = args[0].to_sym
|
59
|
-
name = ALIASES[name] || name
|
60
|
-
if PLUGINS.member?(name)
|
61
|
-
start = 1
|
62
|
-
if args.size > 1
|
63
|
-
if PLUGINS[name].member? args[1].to_sym
|
64
|
-
goal = args[1].to_sym
|
65
|
-
start = 2
|
66
|
-
else
|
67
|
-
goal = PLUGINS[name][0]
|
68
|
-
end
|
69
|
-
else
|
70
|
-
goal = PLUGINS[name][0]
|
71
|
-
end
|
72
|
-
aa = if index = args.index("--")
|
73
|
-
args[(index + 1)..-1]
|
74
|
-
else
|
75
|
-
[]
|
76
|
-
end
|
77
|
-
ruby_args = (args[start, (index || 1000) - start] || []).join(' ')
|
78
|
-
|
79
|
-
# determine the version and delete from args if given
|
80
|
-
version = args.detect do |a|
|
81
|
-
a =~ /^-Dplugin.version=/
|
82
|
-
end
|
83
|
-
if version
|
84
|
-
aa.delete(version)
|
85
|
-
version.sub!(/^-Dplugin.version=/, ':')
|
86
|
-
end
|
87
|
-
aa << "de.saumya.mojo:#{name}-maven-plugin#{version}:#{goal}"
|
88
|
-
aa << "-Dargs=#{ruby_args}" if ruby_args.size > 0
|
89
|
-
args.replace(aa)
|
90
|
-
else
|
91
|
-
args.delete("--")
|
92
|
-
end
|
93
|
-
end
|
94
|
-
args
|
95
|
-
end
|
96
|
-
|
97
|
-
def log(args)
|
98
|
-
log = File.join('log', 'rmvn.log')
|
99
|
-
if File.exists? File.dirname(log)
|
100
|
-
File.open(log, 'a') do |f|
|
101
|
-
f.puts args.join ' '
|
102
|
-
end
|
103
|
-
end
|
104
|
-
end
|
105
|
-
|
106
|
-
def maybe_print_help(args)
|
107
|
-
if args.size == 0 || args[0] == "--help"
|
108
|
-
puts "usage: rmvn [<plugin name>|<plugin alias> [<args>] [-- <maven options>] | [<maven goal>|<maven phase> <maven options>] | --help"
|
109
|
-
PLUGINS.each do |name, goals|
|
110
|
-
puts
|
111
|
-
print "plugin #{name}"
|
112
|
-
print " - alias: #{ALIASES[name]}" if ALIASES[name]
|
113
|
-
puts
|
114
|
-
if goals.size > 1
|
115
|
-
print "\tgoals : #{goals.join(',')}"
|
116
|
-
puts
|
117
|
-
end
|
118
|
-
print "\tdefault goal: #{goals[0]}"
|
119
|
-
puts
|
120
|
-
end
|
121
|
-
puts
|
122
|
-
["--help"]
|
123
|
-
else
|
124
|
-
args
|
125
|
-
end
|
126
|
-
end
|
127
|
-
|
128
|
-
def options
|
129
|
-
@options ||= {}
|
130
|
-
end
|
131
|
-
|
132
|
-
def options_string
|
133
|
-
options_array.join ' '
|
134
|
-
end
|
135
|
-
|
136
|
-
def options_array
|
137
|
-
options.collect do |k,v|
|
138
|
-
if k =~ /^-D/
|
139
|
-
v = "=#{v}" if v
|
140
|
-
else
|
141
|
-
v = " #{v}" if v
|
142
|
-
end
|
143
|
-
"#{k}#{v}"
|
144
|
-
end
|
145
|
-
end
|
146
|
-
|
147
|
-
def command_line(args)
|
148
|
-
args = prepare(args)
|
149
|
-
args = maybe_print_help(args)
|
150
|
-
args
|
151
|
-
end
|
152
|
-
|
153
|
-
def exec(*args)
|
154
|
-
a = command_line(args.dup.flatten)
|
155
|
-
a << options_array
|
156
|
-
a.flatten!
|
157
|
-
#puts a.join ' '
|
158
|
-
#launch_jruby(a)
|
159
|
-
args_line = args.join ' '
|
160
|
-
full = "#{@jruby} #{@command} #{args_line} #{args_line =~ / -- / ? '' : '--'} #{options_string}"
|
161
|
-
system full
|
162
|
-
end
|
163
|
-
|
164
|
-
def exec_in(launchdirectory, *args)
|
165
|
-
FileUtils.cd(launchdirectory) do
|
166
|
-
exec(args)
|
167
|
-
end
|
168
|
-
end
|
169
|
-
end
|
170
|
-
end
|