ruby-app 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +2 -2
- data/bin/ruby-app +2 -1
- data/generator/Gemfile +2 -1
- data/generator/bin/console +7 -0
- data/generator/bin/{dummy → example} +0 -0
- data/generator/config/boot.rb +1 -1
- data/lib/ruby-app/application.rb +12 -0
- data/lib/ruby-app/common_config.rb +6 -6
- data/lib/ruby-app/environment.rb +7 -0
- data/lib/ruby-app/tasks.rake +8 -1
- data/lib/ruby-app/version.rb +1 -1
- data/spec/app_spec.rb +8 -0
- data/spec/gem_app/gem.rb +6 -0
- data/spec/test_app/config/environment.rb +4 -0
- data/spec/test_app/config/environments/test3.rb +4 -0
- metadata +107 -100
data/README.md
CHANGED
data/bin/ruby-app
CHANGED
data/generator/Gemfile
CHANGED
File without changes
|
data/generator/config/boot.rb
CHANGED
data/lib/ruby-app/application.rb
CHANGED
@@ -19,14 +19,12 @@ class CommonConfig
|
|
19
19
|
private
|
20
20
|
|
21
21
|
def method_missing(name, *params, &block)
|
22
|
-
params = block.call if block
|
23
|
-
|
24
22
|
if name.to_s =~ /_address$/i
|
25
23
|
require 'ostruct'
|
26
|
-
@configs[name] = OpenStruct.new(:host => params[0], :port => params[1].to_i)
|
24
|
+
@configs[name] = block || OpenStruct.new(:host => params[0], :port => params[1].to_i)
|
27
25
|
else
|
28
26
|
params = params[0] if params.size == 1
|
29
|
-
@configs[name] = params
|
27
|
+
@configs[name] = block || params
|
30
28
|
end
|
31
29
|
end
|
32
30
|
end
|
@@ -37,7 +35,8 @@ class CommonConfig
|
|
37
35
|
|
38
36
|
def self.[](option)
|
39
37
|
if @@configs.key?(option)
|
40
|
-
@@configs[option]
|
38
|
+
res = @@configs[option]
|
39
|
+
res.is_a?(Proc) ? res.call : res
|
41
40
|
else
|
42
41
|
super
|
43
42
|
end
|
@@ -45,7 +44,8 @@ class CommonConfig
|
|
45
44
|
|
46
45
|
def self.method_missing(*args)
|
47
46
|
if @@configs.key?(args[0])
|
48
|
-
@@configs[args[0]]
|
47
|
+
res = @@configs[args[0]]
|
48
|
+
res.is_a?(Proc) ? res.call : res
|
49
49
|
else
|
50
50
|
super
|
51
51
|
end
|
data/lib/ruby-app/environment.rb
CHANGED
@@ -36,6 +36,13 @@ end
|
|
36
36
|
# default config from app
|
37
37
|
require File.join(App.root, %w{config config})
|
38
38
|
|
39
|
+
# load initializers from other gems
|
40
|
+
unless App.initializer_paths.empty?
|
41
|
+
App.initializer_paths.flatten.each do |path|
|
42
|
+
require File.expand_path(path)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
39
46
|
# configs from app for env
|
40
47
|
begin
|
41
48
|
require File.join(App.root, %W( config environments #{App.env}))
|
data/lib/ruby-app/tasks.rake
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
|
2
2
|
task :environment do
|
3
|
-
require File.join(App.root, %w{config environment})
|
3
|
+
require File.join(App.root, %w{ config environment })
|
4
4
|
end
|
5
5
|
|
6
6
|
# load gem rakes
|
@@ -8,6 +8,13 @@ Dir["#{File.dirname(__FILE__)}/tasks/*.{rb,rake}"].each do |f|
|
|
8
8
|
load f
|
9
9
|
end
|
10
10
|
|
11
|
+
# load other gems rakes
|
12
|
+
if defined?(App) && !App.rake_paths.empty?
|
13
|
+
App.rake_paths.each do |path|
|
14
|
+
load File.expand_path(path)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
11
18
|
# load app rakes
|
12
19
|
if defined?(App)
|
13
20
|
Dir["#{App.root}/lib/rake_tasks/*.{rb,rake}"].each do |f|
|
data/lib/ruby-app/version.rb
CHANGED
data/spec/app_spec.rb
CHANGED
@@ -24,6 +24,14 @@ describe "RubyApp" do
|
|
24
24
|
App::BLA.should == 1
|
25
25
|
end
|
26
26
|
|
27
|
+
it "proc in config" do
|
28
|
+
App.config.proc_test.should == "bbbccc"
|
29
|
+
end
|
30
|
+
|
31
|
+
it "should load extensions" do
|
32
|
+
App.some_gem_method.should == "some gem method"
|
33
|
+
end
|
34
|
+
|
27
35
|
it "force set env" do
|
28
36
|
App.env.should == 'test3'
|
29
37
|
App.config.apps.size.should == 4
|
data/spec/gem_app/gem.rb
ADDED
@@ -4,6 +4,10 @@ require File.join(File.dirname(__FILE__), %w{ boot })
|
|
4
4
|
ENV['APP_ENV'] = 'test3'
|
5
5
|
|
6
6
|
$:.unshift(File.join(File.dirname(__FILE__), %w{.. .. .. lib}))
|
7
|
+
|
8
|
+
# gem extension
|
9
|
+
App.initializer_paths << File.join(File.dirname(__FILE__), %w{.. .. gem_app gem})
|
10
|
+
|
7
11
|
require 'ruby-app/environment'
|
8
12
|
|
9
13
|
App.config.test_thing << 3
|
metadata
CHANGED
@@ -1,120 +1,115 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-app
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 19
|
5
5
|
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 1
|
9
|
+
- 4
|
10
|
+
version: 0.1.4
|
6
11
|
platform: ruby
|
7
|
-
authors:
|
12
|
+
authors:
|
8
13
|
- Makarchev Konstantin
|
9
14
|
autorequire:
|
10
15
|
bindir: bin
|
11
16
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
17
|
+
|
18
|
+
date: 2012-06-22 00:00:00 Z
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
15
21
|
name: activesupport
|
16
|
-
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
|
-
requirements:
|
19
|
-
- - ! '>='
|
20
|
-
- !ruby/object:Gem::Version
|
21
|
-
version: '0'
|
22
|
-
type: :runtime
|
23
22
|
prerelease: false
|
24
|
-
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
24
|
none: false
|
26
|
-
requirements:
|
27
|
-
- -
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
none: false
|
34
|
-
requirements:
|
35
|
-
- - ! '>='
|
36
|
-
- !ruby/object:Gem::Version
|
37
|
-
version: '0'
|
25
|
+
requirements:
|
26
|
+
- - ">="
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
hash: 3
|
29
|
+
segments:
|
30
|
+
- 0
|
31
|
+
version: "0"
|
38
32
|
type: :runtime
|
33
|
+
version_requirements: *id001
|
34
|
+
- !ruby/object:Gem::Dependency
|
35
|
+
name: rake
|
39
36
|
prerelease: false
|
40
|
-
|
37
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
41
38
|
none: false
|
42
|
-
requirements:
|
43
|
-
- -
|
44
|
-
- !ruby/object:Gem::Version
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
none: false
|
50
|
-
requirements:
|
51
|
-
- - ! '>='
|
52
|
-
- !ruby/object:Gem::Version
|
53
|
-
version: '0'
|
39
|
+
requirements:
|
40
|
+
- - ">="
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
hash: 3
|
43
|
+
segments:
|
44
|
+
- 0
|
45
|
+
version: "0"
|
54
46
|
type: :runtime
|
47
|
+
version_requirements: *id002
|
48
|
+
- !ruby/object:Gem::Dependency
|
49
|
+
name: thor
|
55
50
|
prerelease: false
|
56
|
-
|
57
|
-
none: false
|
58
|
-
requirements:
|
59
|
-
- - ! '>='
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
62
|
-
- !ruby/object:Gem::Dependency
|
63
|
-
name: bundler
|
64
|
-
requirement: !ruby/object:Gem::Requirement
|
51
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
65
52
|
none: false
|
66
|
-
requirements:
|
67
|
-
- -
|
68
|
-
- !ruby/object:Gem::Version
|
69
|
-
|
53
|
+
requirements:
|
54
|
+
- - ">="
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
hash: 3
|
57
|
+
segments:
|
58
|
+
- 0
|
59
|
+
version: "0"
|
70
60
|
type: :runtime
|
61
|
+
version_requirements: *id003
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: bundler
|
71
64
|
prerelease: false
|
72
|
-
|
65
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
73
66
|
none: false
|
74
|
-
requirements:
|
75
|
-
- -
|
76
|
-
- !ruby/object:Gem::Version
|
77
|
-
|
78
|
-
|
67
|
+
requirements:
|
68
|
+
- - ">="
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
hash: 3
|
71
|
+
segments:
|
72
|
+
- 0
|
73
|
+
version: "0"
|
74
|
+
type: :runtime
|
75
|
+
version_requirements: *id004
|
76
|
+
- !ruby/object:Gem::Dependency
|
79
77
|
name: rspec
|
80
|
-
requirement: !ruby/object:Gem::Requirement
|
81
|
-
none: false
|
82
|
-
requirements:
|
83
|
-
- - ! '>='
|
84
|
-
- !ruby/object:Gem::Version
|
85
|
-
version: '0'
|
86
|
-
type: :development
|
87
78
|
prerelease: false
|
88
|
-
|
79
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
89
80
|
none: false
|
90
|
-
requirements:
|
91
|
-
- -
|
92
|
-
- !ruby/object:Gem::Version
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
none: false
|
98
|
-
requirements:
|
99
|
-
- - ! '>='
|
100
|
-
- !ruby/object:Gem::Version
|
101
|
-
version: '0'
|
81
|
+
requirements:
|
82
|
+
- - ">="
|
83
|
+
- !ruby/object:Gem::Version
|
84
|
+
hash: 3
|
85
|
+
segments:
|
86
|
+
- 0
|
87
|
+
version: "0"
|
102
88
|
type: :development
|
89
|
+
version_requirements: *id005
|
90
|
+
- !ruby/object:Gem::Dependency
|
91
|
+
name: rake
|
103
92
|
prerelease: false
|
104
|
-
|
93
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
105
94
|
none: false
|
106
|
-
requirements:
|
107
|
-
- -
|
108
|
-
- !ruby/object:Gem::Version
|
109
|
-
|
110
|
-
|
111
|
-
|
95
|
+
requirements:
|
96
|
+
- - ">="
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
hash: 3
|
99
|
+
segments:
|
100
|
+
- 0
|
101
|
+
version: "0"
|
102
|
+
type: :development
|
103
|
+
version_requirements: *id006
|
104
|
+
description: Little ruby application template. For creates light ruby apps (daemons, EventMachine-apps, ...). Supports bundler, environments, rails dirs tree.
|
112
105
|
email: kostya27@gmail.com
|
113
|
-
executables:
|
106
|
+
executables:
|
114
107
|
- ruby-app
|
115
108
|
extensions: []
|
109
|
+
|
116
110
|
extra_rdoc_files: []
|
117
|
-
|
111
|
+
|
112
|
+
files:
|
118
113
|
- .gitignore
|
119
114
|
- Gemfile
|
120
115
|
- LICENSE
|
@@ -125,7 +120,8 @@ files:
|
|
125
120
|
- generator/Gemfile
|
126
121
|
- generator/Rakefile
|
127
122
|
- generator/app/models/.gitkeep
|
128
|
-
- generator/bin/
|
123
|
+
- generator/bin/console
|
124
|
+
- generator/bin/example
|
129
125
|
- generator/config/boot.rb
|
130
126
|
- generator/config/config.rb
|
131
127
|
- generator/config/environment.rb
|
@@ -148,6 +144,7 @@ files:
|
|
148
144
|
- lib/ruby-app/version.rb
|
149
145
|
- ruby-app.gemspec
|
150
146
|
- spec/app_spec.rb
|
147
|
+
- spec/gem_app/gem.rb
|
151
148
|
- spec/spec_helper.rb
|
152
149
|
- spec/test_app/.gitignore
|
153
150
|
- spec/test_app/app/models/.gitkeep
|
@@ -168,26 +165,36 @@ files:
|
|
168
165
|
- spec/test_app/lib/application.rb
|
169
166
|
homepage: http://github.com/kostya/ruby-app
|
170
167
|
licenses: []
|
168
|
+
|
171
169
|
post_install_message:
|
172
170
|
rdoc_options: []
|
173
|
-
|
171
|
+
|
172
|
+
require_paths:
|
174
173
|
- lib
|
175
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
174
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
176
175
|
none: false
|
177
|
-
requirements:
|
178
|
-
- -
|
179
|
-
- !ruby/object:Gem::Version
|
180
|
-
|
181
|
-
|
176
|
+
requirements:
|
177
|
+
- - ">="
|
178
|
+
- !ruby/object:Gem::Version
|
179
|
+
hash: 3
|
180
|
+
segments:
|
181
|
+
- 0
|
182
|
+
version: "0"
|
183
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
182
184
|
none: false
|
183
|
-
requirements:
|
184
|
-
- -
|
185
|
-
- !ruby/object:Gem::Version
|
186
|
-
|
185
|
+
requirements:
|
186
|
+
- - ">="
|
187
|
+
- !ruby/object:Gem::Version
|
188
|
+
hash: 3
|
189
|
+
segments:
|
190
|
+
- 0
|
191
|
+
version: "0"
|
187
192
|
requirements: []
|
193
|
+
|
188
194
|
rubyforge_project:
|
189
195
|
rubygems_version: 1.8.24
|
190
196
|
signing_key:
|
191
197
|
specification_version: 3
|
192
198
|
summary: Ruby application template
|
193
199
|
test_files: []
|
200
|
+
|