mimi 0.0.1 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a04fe0a1d2e8c2e0a26f31132ad30693266fae63
4
- data.tar.gz: 0950fe8b4616796f47a5482fa60839379919cdbd
3
+ metadata.gz: 50aa52965b69cf0acfebc2aa2567e3e0c8b2f538
4
+ data.tar.gz: b2067e89e1fdd6082303f5c0ae276cf9d324f924
5
5
  SHA512:
6
- metadata.gz: 5769d422c022bb31497b27c0d3ef79474f768c66242f19f07ed425f496f6b60eade069775e11b8dfc02a3805685eb7fcdc7cfceff5312702c8f9f6ab6bdcb1f6
7
- data.tar.gz: 0c98d24a778e8d01bf11c9671d644cc078caf5fbaa15c907e5971295b997757fea46f56d716d3dae8b032c613fe8541412d8014842c3d25b8fe0ddd0eaabfeb2
6
+ metadata.gz: 428879cddaf1aa447424f681612262f9718f2fe90260f172622a007ce3517de734c34564bd7ed7d692700a887b91be2f8f9461756d97cbded1ff65b44f687f14
7
+ data.tar.gz: a6d47b0780faf22eee3ebba4959307e8563a377b7f90f06aebf67bfc623fd93d453f61d8277fa7cfcc01806e70e814e19b4d17fd762542969467b29caf2579a5
data/Gemfile CHANGED
@@ -1,4 +1,3 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- # Specify your gem's dependencies in mimi.gemspec
4
3
  gemspec
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # mimi -- microframework for microservices
1
+ # mimi microframework for microservices
2
2
 
3
3
  [in development]
4
4
 
@@ -10,4 +10,3 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/kukush
10
10
  ## License
11
11
 
12
12
  The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
13
-
data/bin/console CHANGED
@@ -1,14 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require "bundler/setup"
4
- require "mimi"
3
+ require 'bundler/setup'
4
+ require 'mimi'
5
5
 
6
- # You can add fixtures and/or initialization code here to make experimenting
7
- # with your gem easier. You can also use a different console, if you like.
8
-
9
- # (If you use this, don't forget to add pry to your Gemfile!)
10
- # require "pry"
11
- # Pry.start
12
-
13
- require "irb"
14
- IRB.start
6
+ require 'pry'
7
+ Pry.start
data/exe/mimi ADDED
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ require 'mimi/cli'
3
+
4
+ Mimi::CLI.start(ARGV)
@@ -0,0 +1,58 @@
1
+ module Mimi
2
+ class Application
3
+ module DSL
4
+ extend ActiveSupport::Concern
5
+
6
+ class_methods do
7
+ #
8
+ #
9
+ def configure(opts = nil, &block)
10
+ if opts
11
+ super(opts)
12
+ else
13
+ register_event_handler(:configure, block)
14
+ end
15
+ end
16
+
17
+ # Registers handler
18
+ #
19
+ def on(event, &block)
20
+ register_event_handler(event, block)
21
+ end
22
+
23
+ # Registers 'every <sec>' handler
24
+ #
25
+ def every(seconds, &block)
26
+ if !seconds.is_a?(Numeric) || seconds <= 0
27
+ raise ArgumentError, 'Positive number of seconds is expected as an argument'
28
+ end
29
+ wrap_block = proc do
30
+ @every_block_opts ||= {}
31
+ opts = @every_block_opts[block.object_id] || {}
32
+ next_run_at = opts[:next_run_at]
33
+ next if next_run_at && next_run_at >= Time.now
34
+ block.call
35
+ opts[:next_run_at] = Time.now + seconds
36
+ @every_block_opts[block.object_id] = opts
37
+ end
38
+ register_event_handler(:every, wrap_block)
39
+ end
40
+
41
+ # Registers event handler
42
+ #
43
+ def register_event_handler(event, block, opts = {})
44
+ @event_handlers ||= []
45
+ @event_handlers << { event: event, block: block, options: opts }
46
+ end
47
+
48
+ # Returns list of event handlers, including those defined in a subclass
49
+ #
50
+ def event_handlers
51
+ local_event_handlers = @event_handlers || []
52
+ return local_event_handlers unless superclass.respond_to?(:event_handlers)
53
+ superclass.event_handlers + local_event_handlers
54
+ end
55
+ end
56
+ end # module DSL
57
+ end # class Application
58
+ end # module Mimi
@@ -0,0 +1,60 @@
1
+ module Mimi
2
+ class Application
3
+ class Runner
4
+ include Mimi::Logger::Instance
5
+
6
+ attr_reader :application_class, :application_instance
7
+
8
+ def initialize(application_class)
9
+ @application_class = application_class
10
+ @application_instance = application_class.instance
11
+ end
12
+
13
+ def run
14
+ application_instance.stop_requested = false
15
+ init_signal_handlers
16
+ emit(:configure)
17
+ emit(:start)
18
+ loop do
19
+ break if application_instance.stop_requested
20
+ emit(:tick)
21
+ emit(:every)
22
+ break if application_instance.stop_requested
23
+ sleep Mimi::Application.module_options[:tick_interval]
24
+ end
25
+ emit(:stop)
26
+ true
27
+ rescue Exception => e
28
+ # abort "FATAL: #{e}"
29
+ abort "FATAL: #{e}"
30
+ end
31
+
32
+ def stop_by_signal(signal)
33
+ # TODO: cant' run to log in the trap context
34
+ # puts "Signal caught (#{signal}), exiting"
35
+ application_instance.stop_requested = true
36
+ end
37
+
38
+ def emit(event)
39
+ logger.debug "emit(#{event})"
40
+ handlers = application_class.event_handlers.select { |h| h[:event] == event }
41
+ handlers.each do |h|
42
+ application_instance.instance_exec(&h[:block])
43
+ end
44
+ rescue Exception => e
45
+ logger.fatal "Failed to process event '#{event}': #{e}"
46
+ logger.debug e.backtrace.join("\n")
47
+ raise
48
+ end
49
+
50
+ private
51
+
52
+ def init_signal_handlers
53
+ %w(INT TERM QUIT).each do |stop_signal|
54
+ Signal.trap(stop_signal) { stop_by_signal(stop_signal) }
55
+ end
56
+ # Signal.trap('KILL') { stop_now! }
57
+ end
58
+ end # class Runner
59
+ end # class Application
60
+ end # module Mimi
@@ -0,0 +1,83 @@
1
+ require 'mimi/logger'
2
+ require 'mimi/config'
3
+ require 'singleton'
4
+
5
+ require_relative 'application/dsl'
6
+ require_relative 'application/runner'
7
+
8
+ module Mimi
9
+ class Application
10
+ include Mimi::Core::Module
11
+ include Mimi::Logger::Instance
12
+ include Singleton
13
+ include DSL
14
+
15
+ default_options(
16
+ manifest_filename: 'config/manifest.yml',
17
+ tick_interval: 1.second
18
+ )
19
+
20
+ def self.module_path
21
+ Pathname.new(__dir__).join('..', '..').expand_path
22
+ end
23
+
24
+ configure do
25
+ config # read config or fail
26
+ logger.level = config.log_level if config.include?(:log_level)
27
+ logger.debug "Configuring the application: #{config.params}"
28
+ # TODO: application-wide configuration
29
+ end
30
+
31
+ on :start do
32
+ logger.debug "Starting the application: #{self.class}"
33
+ Mimi.start
34
+ end
35
+
36
+ on :tick do
37
+ # nothing
38
+ end
39
+
40
+ on :stop do
41
+ logger.debug "Shutting down the application: #{self.class}"
42
+ Mimi.stop
43
+ end
44
+
45
+ def self.manifest_filename
46
+ Mimi.app_path_to(Mimi::Application.module_options[:manifest_filename])
47
+ end
48
+
49
+ def use(mod, opts = nil)
50
+ Mimi.use(mod, opts || config.to_h)
51
+ end
52
+
53
+ def config
54
+ @config ||= Mimi::Config.new(self.class.manifest_filename)
55
+ end
56
+
57
+ def self.inherited(subclass)
58
+ super
59
+ @default_application_class = subclass
60
+ end
61
+
62
+ def self.run(application_class = nil)
63
+ runner(application_class).run
64
+ end
65
+
66
+ def self.runner(application_class = nil)
67
+ return @runner if @runner
68
+ application_class ||= @default_application_class || self
69
+ @runner = Mimi::Application::Runner.new(application_class)
70
+ end
71
+
72
+ attr_accessor :stop_requested
73
+ def stop
74
+ self.stop_requested = true
75
+ end
76
+
77
+ def self.name_version
78
+ name = defined?(self::NAME) ? self::NAME : '<unnamed>'
79
+ version = defined?(self::VERSION) ? self::VERSION : '<unknown>'
80
+ "#{name} v#{version}"
81
+ end
82
+ end # class Application
83
+ end # module Mimi
@@ -0,0 +1,112 @@
1
+ require 'pathname'
2
+ require 'erb'
3
+
4
+ module Mimi
5
+ class CLI
6
+ class AppGenerator
7
+ attr_reader :app_name, :target_path
8
+ FILE_MAPPINGS = {
9
+ 'app/models/README.md' => 'app/models/README.md',
10
+ 'app/messaging/README.md' => 'app/messaging/README.md',
11
+ 'bin/start' => 'bin/start',
12
+ 'config/manifest.yml' => 'config/manifest.yml',
13
+ 'lib/file_name.rb' => 'lib/#{file_dirname}/#{file_basename}.rb',
14
+ 'lib/file_name/application.rb' => 'lib/#{file_name}/application.rb',
15
+ 'lib/file_name/version.rb' => 'lib/#{file_name}/version.rb',
16
+ 'lib/boot.rb' => 'lib/boot.rb',
17
+ 'Gemfile' => 'Gemfile',
18
+ 'Rakefile' => 'Rakefile',
19
+ 'app.env' => '.env',
20
+ 'app.gitignore' => '.gitignore'
21
+ }
22
+ FILE_MAPPINGS_EXEC = ['bin/start']
23
+
24
+ APP_TEMPLATE_PATH = Pathname.new(__FILE__).dirname.join('template')
25
+
26
+ def initialize(app_name, target_path = nil)
27
+ @app_name = app_name
28
+ @target_path = Pathname.new(target_path).expand_path
29
+ end
30
+
31
+ # Returns application name as class name.
32
+ #
33
+ # @example
34
+ # "some-my_app" -> "Some::MyApp"
35
+ #
36
+ def module_name
37
+ name_parts = app_name.split('-').map do |word|
38
+ word.gsub(/(^|_)(\w)/) { |m| m.chars.last.upcase }
39
+ end
40
+ name_parts.join('::')
41
+ end
42
+
43
+ # Returns module name split into parts
44
+ #
45
+ def module_name_parts
46
+ module_name.split('::')
47
+ end
48
+
49
+ # Returns application name as file name.
50
+ #
51
+ # @example
52
+ # "some-my_app" -> "some/my_app"
53
+ #
54
+ def file_name
55
+ app_name.split('-').join('/')
56
+ end
57
+
58
+ # Returns base part of the application name as file name.
59
+ #
60
+ # @example
61
+ # "some-my_app" -> "my_app"
62
+ #
63
+ def file_basename
64
+ app_name.split('-').last
65
+ end
66
+
67
+ # Returns directory part of the application name as file name.
68
+ #
69
+ # @example
70
+ # "some-my_app" -> "some"
71
+ #
72
+ def file_dirname
73
+ app_name.split('-')[0..-2].join('/')
74
+ end
75
+
76
+ def app_root_path
77
+ target_path.join(app_name).expand_path
78
+ end
79
+
80
+ def generate(opts = {})
81
+ raise "Application already exists: #{app_root_path}" if app_root_path.exist?
82
+ install_path(app_root_path) unless opts[:dry_run]
83
+ FILE_MAPPINGS.each do |from_file, to_file|
84
+ to_file = eval "\"#{to_file}\""
85
+ from_path = APP_TEMPLATE_PATH.join(from_file)
86
+ to_path = app_root_path.join(to_file)
87
+ puts " #{from_path} -> #{to_path}"
88
+ next if opts[:dry_run]
89
+ if from_path.directory?
90
+ install_path(to_path)
91
+ else
92
+ file_contents = File.read(from_path)
93
+ file_processed = ERB.new(file_contents).result(binding)
94
+ install_file(to_path, file_processed, FILE_MAPPINGS_EXEC.include?(from_file))
95
+ end
96
+ end
97
+ end
98
+
99
+ def install_path(path)
100
+ FileUtils.mkdir_p(path)
101
+ end
102
+
103
+ def install_file(path, contents, executable = false)
104
+ FileUtils.mkdir_p(path.dirname)
105
+ File.open(path, 'w') do |f|
106
+ f.puts contents
107
+ end
108
+ FileUtils.chmod(0755, path, verbose: true) if executable
109
+ end
110
+ end # class AppGenerator
111
+ end # class CLI
112
+ end # module Mimi
@@ -0,0 +1,8 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'mimi', '~> 0.1'
4
+
5
+ # Uncomment these lines to use mimi-db or mimi-messaging:
6
+ #
7
+ # gem 'mimi/db', '~> 0.1'
8
+ # gem 'mimi/messaging', '~> 0.1'
@@ -0,0 +1,3 @@
1
+ require 'bundler/setup'
2
+ require_relative 'lib/<%= file_name %>'
3
+ require 'mimi/core/rake'
File without changes
File without changes
File without changes
File without changes
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'bundler/setup'
4
+ require '<%= file_name %>'
5
+
6
+ Mimi::Application.run
@@ -0,0 +1,3 @@
1
+ # Empty manifest
2
+ # Use 'rake config:manifest:create' to populate it with the combined manifest
3
+ #
@@ -0,0 +1 @@
1
+ require_relative '<%= file_name %>'
@@ -0,0 +1,13 @@
1
+ require 'mimi'
2
+ # require 'mimi/db'
3
+ # require 'mimi/messaging'
4
+
5
+ class <%= module_name %>::Application < Mimi::Application
6
+ NAME = '<%= app_name %>'.freeze
7
+ VERSION = '0.0.1'.freeze
8
+
9
+ configure do
10
+ # use Mimi::DB
11
+ # use Mimi::Messaging
12
+ end
13
+ end # class <%= module_name %>::Application
@@ -0,0 +1,13 @@
1
+ <%=
2
+ @module_statements = module_name_parts.reverse.reduce(['# Your code here']) do |a, e|
3
+ # indent accumulator
4
+ a = a.map { |l| ' ' + l }
5
+
6
+ # wrap in module clause
7
+ ["module #{e}", *a, "end # module #{e}"]
8
+ end
9
+ @module_statements.join("\n")
10
+ %>
11
+
12
+ require_relative '<%= file_basename %>/application'
13
+ require_relative '<%= file_basename %>/version'
data/lib/mimi/cli.rb ADDED
@@ -0,0 +1,30 @@
1
+ require 'thor'
2
+ require 'pathname'
3
+
4
+ module Mimi
5
+ class CLI < Thor
6
+ map %w(--version -v) => :__print_version
7
+ desc '--version, -v', 'Display version'
8
+ def __print_version
9
+ puts "mimi v#{Mimi::VERSION}"
10
+ end
11
+
12
+ desc 'create NAME [PATH]', 'Create application in the specified directory'
13
+ def create(name, path = Pathname.pwd)
14
+ app_generator = Mimi::CLI::AppGenerator.new(name, path)
15
+ puts " name: #{app_generator.app_name}"
16
+ puts " path: #{app_generator.target_path}"
17
+ puts "app_root_path: #{app_generator.app_root_path}"
18
+ puts " module_name: #{app_generator.module_name}"
19
+ puts
20
+ app_generator.generate # (dry_run: truew)
21
+ end
22
+
23
+ private
24
+
25
+ def app_name_to_class_name(name)
26
+ end
27
+ end # class CLI
28
+ end # module Mimi
29
+
30
+ require_relative 'cli/app_generator'
@@ -0,0 +1,115 @@
1
+ module Mimi
2
+ module Console
3
+ module Colors
4
+ SEQUENCE = %w(31 32 33 34 35 36 37 31;1 32;1 33;1 34;1 35;1 36;1 37;1)
5
+
6
+ # Returns ANSI escaped string.
7
+ #
8
+ def esc_string(esc, text)
9
+ esc + text.to_s + "\e[0m"
10
+ end
11
+
12
+ def unesc_string(text)
13
+ text.gsub(/\e[^m]+m/, '')
14
+ end
15
+
16
+ # Returns ANSI escaped string for the colored text.
17
+ #
18
+ def esc_color(color_code, text)
19
+ esc_string "\e[#{color_code}m", text
20
+ end
21
+
22
+ # Returns ANSI escaped string for the red colored text.
23
+ #
24
+ def esc_red(text)
25
+ esc_color 31, text
26
+ end
27
+
28
+ # Returns ANSI escaped string for the green colored text.
29
+ #
30
+ def esc_green(text)
31
+ esc_color 32, text
32
+ end
33
+
34
+ # Returns ANSI escaped string for the yellow colored text.
35
+ #
36
+ def esc_yellow(text)
37
+ esc_color 33, text
38
+ end
39
+
40
+ # Returns ANSI escaped string for the blue colored text.
41
+ #
42
+ def esc_blue(text)
43
+ esc_color 34, text
44
+ end
45
+
46
+ #
47
+ #
48
+ def esc_gray(text)
49
+ esc_color '30;1', text
50
+ end
51
+
52
+ # Returns ANSI escaped string for the bold text.
53
+ #
54
+ def esc_bold(text)
55
+ esc_string "\e[01;37m", text
56
+ end
57
+
58
+ # Returns string padded to given number of characters, text can be escaped.
59
+ #
60
+ def esc_pad(text, num, color = nil)
61
+ text = text.to_s
62
+ esc_text = text
63
+ case color
64
+ when :red, :yellow, :green
65
+ esc_text = send :"esc_#{color}", text
66
+ end
67
+ pad = esc_text.size - unesc_string(text).size
68
+ num > 0 ? ("%-#{num + pad}s" % esc_text) : esc_text
69
+ end
70
+
71
+ # Returns string with formatted and padded fields
72
+ # Each arg is an Array:
73
+ # [<text>, [padding_num], [color]]
74
+ #
75
+ def esc_format(*args)
76
+ out = []
77
+ args.each do |arg|
78
+ out << esc_pad(arg[0], arg[1] || 0, arg[2])
79
+ end
80
+ out.join(' ')
81
+ end
82
+
83
+ # Returns rows, as arrays strings, formatted as a table
84
+ #
85
+ # @param rows [Array<Array<String>>]
86
+ #
87
+ # @return [String]
88
+ #
89
+ def esc_format_table(rows, params = {})
90
+ return nil if rows.empty?
91
+ params = {
92
+ delimiter: ' '
93
+ }.merge(params)
94
+ columns_count = rows.map(&:size).max
95
+ columns = columns_count.times.map do |c|
96
+ rows.map { |r| unesc_string(r[c].to_s).size }.max # width of the column
97
+ end
98
+ rows.map do |row|
99
+ row.map.with_index do |t, i|
100
+ esc_pad(t, columns[i])
101
+ end.join(params[:delimiter])
102
+ end.join("\n")
103
+ end
104
+
105
+ # Color output disabled
106
+ #
107
+ module Disabled
108
+ def esc_string(_, text)
109
+ text
110
+ end
111
+ end # module Disabled
112
+
113
+ end # module Colors
114
+ end # module Console
115
+ end # module Mimi
data/lib/mimi/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Mimi
2
- VERSION = '0.0.1'.freeze
2
+ VERSION = '0.1.0'.freeze
3
3
  end
data/lib/mimi.rb CHANGED
@@ -1,4 +1,7 @@
1
- require 'mimi/version'
1
+ require 'mimi/core'
2
2
 
3
3
  module Mimi
4
4
  end
5
+
6
+ require_relative 'mimi/version'
7
+ require_relative 'mimi/application'
@@ -0,0 +1,69 @@
1
+ def rake_task_config(show_all = false)
2
+ config = Mimi::Config.new(
3
+ Mimi::Application.manifest_filename, raise_on_missing_params: false
4
+ )
5
+ config.manifest.each do |param|
6
+ next if param[:const] && !show_all
7
+ name = param[:name]
8
+ annotation = []
9
+ if param[:const]
10
+ annotation << esc_bold('[CONST]')
11
+ else
12
+ annotation << esc_red('[MISSING]') if config.missing_params.include?(name)
13
+ annotation << "(default: #{param[:default].inspect})" unless param[:required]
14
+ end
15
+ annotation << param[:desc] if param.key?(:desc)
16
+ annotation.unshift(' #') unless annotation.empty?
17
+ puts "#{name}=#{config[name]}#{annotation.join(' ')}"
18
+ end
19
+ abort(esc_red('# configure missing parameters')) unless config.missing_params.empty?
20
+ end
21
+
22
+ def rake_task_config_manifest_generate
23
+ config = Mimi::Config.new
24
+ config.load(
25
+ Mimi::Application.manifest_filename, raise_on_missing_params: false
26
+ ) if File.exist?(Mimi::Application.manifest_filename)
27
+
28
+ # first deep_merge to preserve key order in the existing app manifest
29
+ manifest = config.manifest_raw.deep_merge(Mimi.loaded_modules_manifest)
30
+ # second deep_merge to preserve key values in the existing app manifest
31
+ manifest = manifest.deep_merge(config.manifest_raw)
32
+
33
+ manifest.to_yaml
34
+ end
35
+
36
+ desc 'Display config manifest and current config'
37
+ task :config do
38
+ rake_task_config(false)
39
+ end
40
+
41
+ namespace :config do
42
+ desc 'Display config manifest and current config, including consts'
43
+ task :all do
44
+ rake_task_config(true)
45
+ end
46
+
47
+ desc 'Generate and display a combined manifest for all loaded modules'
48
+ task :manifest do
49
+ puts rake_task_config_manifest_generate
50
+ end
51
+
52
+ namespace :manifest do
53
+ desc "Generate and write a combined manifest to: #{Mimi::Application.manifest_filename}"
54
+ task :create do
55
+ if File.exist?(Mimi::Application.manifest_filename)
56
+ puts "* Found an existing application manifest, loading: #{Mimi::Application.manifest_filename}"
57
+ end
58
+ puts '* Generating a combined manifest'
59
+ manifest_contents = rake_task_config_manifest_generate
60
+ config_path = Mimi.app_path_to('config')
61
+ puts "* Writing the combined manifest to: #{Mimi::Application.manifest_filename}"
62
+ sh "install -d #{config_path}" unless File.directory?(config_path)
63
+ manifest_filename = Mimi.app_path_to('config', 'manifest.yml')
64
+ File.open(manifest_filename, 'w') do |f|
65
+ f.puts manifest_contents
66
+ end
67
+ end
68
+ end
69
+ end
@@ -0,0 +1,16 @@
1
+ desc 'Start development console'
2
+ task console: :"application:configure" do
3
+ require 'pry'
4
+ puts "** @application: #{@application.class.name_version}, used modules: #{Mimi.used_modules.join(', ')}"
5
+ puts '** run "Mimi.start" to start modules' unless Mimi.used_modules.empty?
6
+ Pry.start
7
+ end
8
+
9
+ namespace :console do
10
+ desc 'Run development console in debug mode'
11
+ task :debug do
12
+ Mimi::Logger.configure(level: :debug)
13
+ ENV['log_level'] = 'debug'
14
+ Rake::Task['console'].invoke
15
+ end
16
+ end
@@ -0,0 +1,30 @@
1
+ require 'mimi/console'
2
+
3
+ extend Mimi::Console::Colors
4
+ extend Mimi::Console::Colors::Disabled unless STDOUT.isatty
5
+
6
+ #
7
+ # Include this task as dependency to require application instantiation
8
+ #
9
+ task :application do
10
+ @application_runner = Mimi::Application.runner
11
+ @application = @application_runner.application_instance
12
+ define_method :logger do
13
+ @application.logger
14
+ end
15
+ end
16
+
17
+ namespace :application do
18
+ # Include this task as dependency to require application instantiation and startup
19
+ #
20
+ task configure: :application do
21
+ @application_runner.emit(:configure)
22
+ end
23
+
24
+ # Include this task as dependency to require application instantiation, startup
25
+ # and starting of all modules
26
+ #
27
+ task environment: [:application, :"application:configure"] do
28
+ @application_runner.emit(:start)
29
+ end
30
+ end
data/mimi.gemspec CHANGED
@@ -27,7 +27,13 @@ Gem::Specification.new do |spec|
27
27
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
28
28
  spec.require_paths = ['lib']
29
29
 
30
+ spec.add_dependency 'mimi-core', '~> 0.1'
31
+ spec.add_dependency 'mimi-logger', '~> 0.1'
32
+ spec.add_dependency 'mimi-config', '~> 0.1'
33
+ spec.add_dependency 'thor', '~> 0.19'
34
+
30
35
  spec.add_development_dependency 'bundler', '~> 1.11'
31
36
  spec.add_development_dependency 'rake', '~> 10.0'
32
37
  spec.add_development_dependency 'rspec', '~> 3.0'
38
+ spec.add_development_dependency 'pry', '~> 0.10'
33
39
  end
metadata CHANGED
@@ -1,15 +1,71 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mimi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Kukushkin
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-04-29 00:00:00.000000000 Z
11
+ date: 2016-05-09 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: mimi-core
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '0.1'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '0.1'
27
+ - !ruby/object:Gem::Dependency
28
+ name: mimi-logger
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '0.1'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '0.1'
41
+ - !ruby/object:Gem::Dependency
42
+ name: mimi-config
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '0.1'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '0.1'
55
+ - !ruby/object:Gem::Dependency
56
+ name: thor
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '0.19'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '0.19'
13
69
  - !ruby/object:Gem::Dependency
14
70
  name: bundler
15
71
  requirement: !ruby/object:Gem::Requirement
@@ -52,10 +108,25 @@ dependencies:
52
108
  - - "~>"
53
109
  - !ruby/object:Gem::Version
54
110
  version: '3.0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: pry
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: '0.10'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: '0.10'
55
125
  description: microframework for microservices
56
126
  email:
57
127
  - alex@kukushk.in
58
- executables: []
128
+ executables:
129
+ - mimi
59
130
  extensions: []
60
131
  extra_rdoc_files: []
61
132
  files:
@@ -69,8 +140,30 @@ files:
69
140
  - Rakefile
70
141
  - bin/console
71
142
  - bin/setup
143
+ - exe/mimi
72
144
  - lib/mimi.rb
145
+ - lib/mimi/application.rb
146
+ - lib/mimi/application/dsl.rb
147
+ - lib/mimi/application/runner.rb
148
+ - lib/mimi/cli.rb
149
+ - lib/mimi/cli/app_generator.rb
150
+ - lib/mimi/cli/template/Gemfile
151
+ - lib/mimi/cli/template/Rakefile
152
+ - lib/mimi/cli/template/app.env
153
+ - lib/mimi/cli/template/app.gitignore
154
+ - lib/mimi/cli/template/app/messaging/README.md
155
+ - lib/mimi/cli/template/app/models/README.md
156
+ - lib/mimi/cli/template/bin/start
157
+ - lib/mimi/cli/template/config/manifest.yml
158
+ - lib/mimi/cli/template/lib/boot.rb
159
+ - lib/mimi/cli/template/lib/file_name.rb
160
+ - lib/mimi/cli/template/lib/file_name/application.rb
161
+ - lib/mimi/cli/template/lib/file_name/version.rb
162
+ - lib/mimi/console.rb
73
163
  - lib/mimi/version.rb
164
+ - lib/tasks/config.rake
165
+ - lib/tasks/console.rake
166
+ - lib/tasks/core.rake
74
167
  - mimi.gemspec
75
168
  homepage: https://github.com/kukushkin/mimi
76
169
  licenses: