micon 0.1.1 → 0.1.4
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/Rakefile +9 -54
- data/lib/micon/metadata.rb +4 -0
- data/readme.md +5 -6
- data/spec/callbacks_spec.rb +2 -2
- data/spec/custom_scope_spec.rb +2 -2
- data/spec/helper.rb +3 -5
- data/spec/managed_spec.rb +2 -2
- data/spec/micelaneous_spec.rb +2 -2
- data/spec/nested_custom_scope_spec.rb +2 -2
- data/spec/overview_spec.rb +9 -10
- data/spec/static_scope_spec.rb +2 -2
- metadata +7 -8
- data/spec/spec.opts +0 -2
data/Rakefile
CHANGED
@@ -1,56 +1,11 @@
|
|
1
|
-
require '
|
2
|
-
require 'spec/rake/spectask'
|
1
|
+
require 'rake_ext'
|
3
2
|
|
4
|
-
|
3
|
+
gem_spec(
|
4
|
+
:name => "micon",
|
5
|
+
:version => "0.1.4",
|
6
|
+
:summary => "Assembles and manages pieces of your application",
|
7
|
+
:dependencies => %w(),
|
5
8
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
Spec::Rake::SpecTask.new('spec') do |t|
|
10
|
-
t.spec_files = FileList["spec/**/*_spec.rb"].select{|f| f !~ /\/_/}
|
11
|
-
t.libs = ['lib'].collect{|f| "#{File.dirname __FILE__}/#{f}"}
|
12
|
-
end
|
13
|
-
|
14
|
-
# Gem
|
15
|
-
require 'rake/clean'
|
16
|
-
require 'rake/gempackagetask'
|
17
|
-
require 'fileutils'
|
18
|
-
|
19
|
-
spec = Gem::Specification.new do |s|
|
20
|
-
s.name = "micon"
|
21
|
-
s.version = "0.1.1"
|
22
|
-
s.summary = "Micro Container assembles and manages pieces of your application"
|
23
|
-
s.description = "Micro Container assembles and manages pieces of your application"
|
24
|
-
s.author = "Alexey Petrushin"
|
25
|
-
s.homepage = "http://github.com/alexeypetrushin/micon"
|
26
|
-
s.platform = Gem::Platform::RUBY
|
27
|
-
s.has_rdoc = true
|
28
|
-
s.files = (%w{Rakefile readme.md} + Dir.glob("{lib,spec}/**/*"))
|
29
|
-
# s.add_dependency "ruby-ext"
|
30
|
-
s.require_path = "lib"
|
31
|
-
end
|
32
|
-
|
33
|
-
PACKAGE_DIR = "#{File.expand_path File.dirname(__FILE__)}/build"
|
34
|
-
|
35
|
-
Rake::GemPackageTask.new(spec) do |p|
|
36
|
-
package_dir = PACKAGE_DIR
|
37
|
-
# FileUtils.mkdir package_dir unless File.exist? package_dir
|
38
|
-
p.need_tar = true if RUBY_PLATFORM !~ /mswin/
|
39
|
-
p.need_zip = true
|
40
|
-
p.package_dir = package_dir
|
41
|
-
end
|
42
|
-
|
43
|
-
# CLEAN.include [ 'pkg', '*.gem']
|
44
|
-
|
45
|
-
task :push do
|
46
|
-
dir = Dir.chdir PACKAGE_DIR do
|
47
|
-
gem_file = Dir.glob("micon*.gem").first
|
48
|
-
system "gem push #{gem_file}"
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
task :clean do
|
53
|
-
system "rm -r #{PACKAGE_DIR}"
|
54
|
-
end
|
55
|
-
|
56
|
-
task :release => [:gem, :push, :clean]
|
9
|
+
:author => "Alexey Petrushin",
|
10
|
+
:homepage => "http://github.com/alexeypetrushin/jquery_client"
|
11
|
+
)
|
data/lib/micon/metadata.rb
CHANGED
@@ -16,6 +16,8 @@ module Micon
|
|
16
16
|
@initializers.clear
|
17
17
|
@before.clear
|
18
18
|
@after.clear
|
19
|
+
@before_scope.clear
|
20
|
+
@after_scope.clear
|
19
21
|
end
|
20
22
|
end
|
21
23
|
|
@@ -25,6 +27,8 @@ module Micon
|
|
25
27
|
@initializers.delete key
|
26
28
|
@before.delete key
|
27
29
|
@after.delete key
|
30
|
+
@before_scope.delete key
|
31
|
+
@after_scope.delete key
|
28
32
|
end
|
29
33
|
end
|
30
34
|
|
data/readme.md
CHANGED
@@ -1,10 +1,10 @@
|
|
1
|
-
#
|
1
|
+
# Assembles and manages pieces of your application
|
2
2
|
|
3
3
|
Micon is infrastructural component, invisible to user and it's main goal is to simplify development. It reduces complex monolithic application to set of simple low coupled components.
|
4
4
|
|
5
5
|
Concentrate on business logic and interfaces and Micon will provide automatic configuration, life cycle management and dependency resolving.
|
6
6
|
|
7
|
-
Technically it's
|
7
|
+
Technically it's [IoC][ioc] like framework with components, callbacks, scopes and bijections, inspired by Spring and JBoss Seam.
|
8
8
|
|
9
9
|
## Usage
|
10
10
|
|
@@ -32,12 +32,12 @@ Let's suppose you are building the Ruby on Rails clone, there are lots of module
|
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
35
|
-
# callbacks, we need to parse routes right after environment
|
35
|
+
# callbacks, we need to parse routes right after environment is initialized
|
36
36
|
app.after :environment do
|
37
37
|
app[:router].parse '/config/routes.rb'
|
38
38
|
end
|
39
39
|
|
40
|
-
# dynamic
|
40
|
+
# dynamic components, will be created and destroyed for every request
|
41
41
|
class Request
|
42
42
|
register_as :request, :scope => :request
|
43
43
|
end
|
@@ -48,9 +48,8 @@ Let's suppose you are building the Ruby on Rails clone, there are lots of module
|
|
48
48
|
|
49
49
|
def do_business
|
50
50
|
# now we can use injected component
|
51
|
-
logger.info "routes parsed"
|
52
51
|
do_something_with request
|
53
|
-
logger.info '
|
52
|
+
logger.info 'done'
|
54
53
|
end
|
55
54
|
|
56
55
|
def do_something_with request; end
|
data/spec/callbacks_spec.rb
CHANGED
data/spec/custom_scope_spec.rb
CHANGED
data/spec/helper.rb
CHANGED
data/spec/managed_spec.rb
CHANGED
data/spec/micelaneous_spec.rb
CHANGED
data/spec/overview_spec.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
|
2
|
-
require "#{
|
1
|
+
require 'rspec_ext'
|
2
|
+
require "#{__FILE__.dirname}/helper"
|
3
3
|
|
4
4
|
describe "Micon Overview" do
|
5
5
|
it "sample" do
|
@@ -14,24 +14,24 @@ describe "Micon Overview" do
|
|
14
14
|
|
15
15
|
class Logger
|
16
16
|
register_as :logger
|
17
|
-
|
17
|
+
|
18
18
|
def info msg; end
|
19
19
|
end
|
20
20
|
|
21
21
|
class Router
|
22
22
|
register_as :router
|
23
|
-
|
23
|
+
|
24
24
|
def parse rote_filename
|
25
25
|
# do something
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
29
|
-
# callbacks, we need to parse routes right after environment
|
29
|
+
# callbacks, we need to parse routes right after environment is initialized
|
30
30
|
app.after :environment do
|
31
31
|
app[:router].parse '/config/routes.rb'
|
32
32
|
end
|
33
33
|
|
34
|
-
# dynamic
|
34
|
+
# dynamic components, will be created and destroyed for every request
|
35
35
|
class Request
|
36
36
|
register_as :request, :scope => :request
|
37
37
|
end
|
@@ -42,11 +42,10 @@ describe "Micon Overview" do
|
|
42
42
|
|
43
43
|
def do_business
|
44
44
|
# now we can use injected component
|
45
|
-
logger.info "routes parsed"
|
46
45
|
do_something_with request
|
47
|
-
logger.info '
|
46
|
+
logger.info 'done'
|
48
47
|
end
|
49
|
-
|
48
|
+
|
50
49
|
def do_something_with request; end
|
51
50
|
end
|
52
51
|
|
@@ -59,7 +58,7 @@ describe "Micon Overview" do
|
|
59
58
|
end
|
60
59
|
end
|
61
60
|
end
|
62
|
-
|
61
|
+
|
63
62
|
RackAdapter.new.call({})
|
64
63
|
end
|
65
64
|
end
|
data/spec/static_scope_spec.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: micon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 19
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 4
|
10
|
+
version: 0.1.4
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Alexey Petrushin
|
@@ -15,11 +15,11 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-10-
|
18
|
+
date: 2010-10-13 00:00:00 +04:00
|
19
19
|
default_executable:
|
20
20
|
dependencies: []
|
21
21
|
|
22
|
-
description:
|
22
|
+
description:
|
23
23
|
email:
|
24
24
|
executables: []
|
25
25
|
|
@@ -43,10 +43,9 @@ files:
|
|
43
43
|
- spec/micelaneous_spec.rb
|
44
44
|
- spec/nested_custom_scope_spec.rb
|
45
45
|
- spec/overview_spec.rb
|
46
|
-
- spec/spec.opts
|
47
46
|
- spec/static_scope_spec.rb
|
48
47
|
has_rdoc: true
|
49
|
-
homepage: http://github.com/alexeypetrushin/
|
48
|
+
homepage: http://github.com/alexeypetrushin/jquery_client
|
50
49
|
licenses: []
|
51
50
|
|
52
51
|
post_install_message:
|
@@ -78,6 +77,6 @@ rubyforge_project:
|
|
78
77
|
rubygems_version: 1.3.7
|
79
78
|
signing_key:
|
80
79
|
specification_version: 3
|
81
|
-
summary:
|
80
|
+
summary: Assembles and manages pieces of your application
|
82
81
|
test_files: []
|
83
82
|
|
data/spec/spec.opts
DELETED