mrb 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 8bb6d0e160ebb33813b85d595db3c87eb5f74e15
4
+ data.tar.gz: 39173d4dfda81fb268d13cfd098a93737baedd96
5
+ SHA512:
6
+ metadata.gz: cd4c1796ffda77f980810a4fa0fe999f1e17f00c74a90fd40cf084d129538d7b5cb75bb794a2d617bf3adacd1891d1582c96f5bfd5159aed29fb5d197dd80fc6
7
+ data.tar.gz: e7417782862f43a02cb385df0f3c2150d34de7ea98979a3da23100c0bb740d38a3a6d410fb56ffb000a274fdf5b9f4cdbdee185435de1ec251157b4506f46829
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/.travis.yml ADDED
@@ -0,0 +1,4 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.1.5
4
+ before_install: gem install bundler -v 1.10.6
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in mrb.gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 qtakamitsu
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 qtakamitsu
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,36 @@
1
+ # Mrb
2
+
3
+ The Command Line Interface is a unified tool to manage your mruby and mrbgems.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'mrb'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install mrb
20
+
21
+ ## Usage
22
+
23
+ ```
24
+ Commands:
25
+ mrb config # create mruby build config
26
+ mrb gem NAME # create necessary files, directory constitution
27
+ mrb get # get mruby source code
28
+ mrb help [COMMAND] # Describe available commands or one specific command
29
+ mrb version # show version number
30
+ ```
31
+
32
+
33
+ ## License
34
+
35
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
36
+
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
@@ -0,0 +1,27 @@
1
+ MRuby::Build.new do |conf|
2
+ if ENV['VisualStudioVersion'] || ENV['VSINSTALLDIR']
3
+ toolchain :visualcpp
4
+ else
5
+ toolchain :gcc
6
+ end
7
+
8
+ enable_debug
9
+
10
+ conf.gembox 'default'
11
+ end
12
+
13
+ MRuby::Build.new('host-debug') do |conf|
14
+ if ENV['VisualStudioVersion'] || ENV['VSINSTALLDIR']
15
+ toolchain :visualcpp
16
+ else
17
+ toolchain :gcc
18
+ end
19
+
20
+ enable_debug
21
+
22
+ conf.gembox 'default'
23
+
24
+ conf.cc.defines = %w(ENABLE_DEBUG)
25
+
26
+ conf.gem :core => "mruby-bin-debugger"
27
+ end
@@ -0,0 +1,4 @@
1
+ C Extension Example
2
+ =========
3
+
4
+ This is an example gem which implements a C extension.
@@ -0,0 +1,20 @@
1
+ #include <mruby.h>
2
+ #include <stdio.h>
3
+
4
+ static mrb_value
5
+ mrb_c_method(mrb_state *mrb, mrb_value self)
6
+ {
7
+ puts("A C Extension");
8
+ return self;
9
+ }
10
+
11
+ void
12
+ mrb_<%= variables[:name] %>_gem_init(mrb_state* mrb) {
13
+ struct RClass *class_<%= variables[:name] %> = mrb_define_module(mrb, "<%= variables[:name].capitalize %>");
14
+ mrb_define_class_method(mrb, class_<%= variables[:name] %>, "c_method", mrb_c_method, MRB_ARGS_NONE());
15
+ }
16
+
17
+ void
18
+ mrb_<%= variables[:name] %>_gem_final(mrb_state* mrb) {
19
+ /* finalizer */
20
+ }
@@ -0,0 +1,5 @@
1
+ MRuby::Gem::Specification.new('<%= variables[:full_name] %>') do |spec|
2
+ spec.license = 'MIT'
3
+ spec.author = 'mruby developers'
4
+ spec.summary = 'This is a template'
5
+ end
@@ -0,0 +1,7 @@
1
+ #include <mruby.h>
2
+
3
+ void
4
+ mrb_<%= variables[:name] %>_gem_test(mrb_state *mrb)
5
+ {
6
+ /* test initializer in C */
7
+ }
@@ -0,0 +1,3 @@
1
+ assert('C Extension Example') do
2
+ <%= variables[:name].capitalize %>.respond_to? :c_method
3
+ end
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "mrb"
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
data/bin/setup ADDED
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
6
+
7
+ # Do any other automated setup that you need to do here
data/exe/mrb ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "mrb"
4
+
5
+ Mrb::CLI.start
data/lib/mrb/cli.rb ADDED
@@ -0,0 +1,59 @@
1
+ require 'thor'
2
+ require 'erb'
3
+ require 'fileutils'
4
+
5
+ module Mrb
6
+ class CLI < Thor
7
+ desc "get", "get mruby source code"
8
+ def get()
9
+ %x{git clone https://github.com/mruby/mruby.git}
10
+ end
11
+
12
+ desc "gem NAME", "create necessary files, directory constitution"
13
+ def gem(name)
14
+ if m = name.match(/^mruby-(.*)/)
15
+ full_name = name
16
+ name = m[1]
17
+ else
18
+ full_name = "mruby-#{name}"
19
+ name = name
20
+ end
21
+
22
+ puts "Creating gem '#{full_name}'..."
23
+
24
+ variables = {
25
+ :full_name => full_name,
26
+ :name => name,
27
+ }
28
+
29
+ FileUtils.mkdir_p full_name
30
+ File.write "#{full_name}/README.md", Mrb::Template.render('gem/README.md.erb', variables)
31
+ puts " create #{full_name}/README.md"
32
+ File.write "#{full_name}/mrbgem.rake", Mrb::Template.render('gem/mrbgem.rake.erb', variables)
33
+ puts " create #{full_name}/mrbgem.rake"
34
+
35
+ FileUtils.mkdir_p "#{full_name}/src"
36
+ File.write "#{full_name}/src/example.c", Mrb::Template.render('gem/example.c.erb', variables)
37
+ puts " create #{full_name}/src/example.c"
38
+
39
+ FileUtils.mkdir_p "#{full_name}/test"
40
+ File.write "#{full_name}/test/example.c", Mrb::Template.render('gem/test_example.c.erb', variables)
41
+ puts " create #{full_name}/test/example.c"
42
+ File.write "#{full_name}/test/example.rb", Mrb::Template.render('gem/test_example.rb.erb', variables)
43
+ puts " create #{full_name}/test/example.rb"
44
+ end
45
+
46
+ desc "config", "create mruby build config"
47
+ def config()
48
+ variables = {}
49
+
50
+ puts "Creating build_config.rb"
51
+ File.write './build_config.rb', Mrb::Template.render('config/build_config.rb.erb', variables)
52
+ end
53
+
54
+ desc "version", "show version number"
55
+ def version()
56
+ puts Mrb::VERSION
57
+ end
58
+ end
59
+ end
@@ -0,0 +1,14 @@
1
+ require 'erb'
2
+
3
+ module Mrb
4
+ class Template
5
+ def self.read(name)
6
+ assets_template_path = File.expand_path('../../../assets/templates', __FILE__)
7
+ File.read(assets_template_path + '/' + name)
8
+ end
9
+
10
+ def self.render(name, variables)
11
+ ERB.new(self.read(name)).result(binding)
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,3 @@
1
+ module Mrb
2
+ VERSION = "0.0.1"
3
+ end
data/lib/mrb.rb ADDED
@@ -0,0 +1,7 @@
1
+ require "mrb/version"
2
+ require "mrb/cli.rb"
3
+ require 'mrb/template.rb'
4
+
5
+ module Mrb
6
+ # Your code goes here...
7
+ end
data/mrb.gemspec ADDED
@@ -0,0 +1,34 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'mrb/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "mrb"
8
+ spec.version = Mrb::VERSION
9
+ spec.authors = ["qtakamitsu"]
10
+ spec.email = ["qtakamitsu@gmail.com"]
11
+
12
+ spec.summary = %q{command line tool for mruby}
13
+ spec.description = %q{The Command Line Interface is a unified tool to manage your mruby and mrbgems.}
14
+ spec.homepage = "https://github.com/qtkmz/mrb"
15
+ spec.license = "MIT"
16
+
17
+ # Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
18
+ # delete this section to allow pushing this gem to any host.
19
+ if spec.respond_to?(:metadata)
20
+ #spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'"
21
+ else
22
+ raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
23
+ end
24
+
25
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
26
+ spec.bindir = "exe"
27
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
28
+ spec.require_paths = ["lib"]
29
+
30
+ spec.add_development_dependency "bundler", "~> 1.10"
31
+ spec.add_development_dependency "rake", "~> 10.0"
32
+ spec.add_development_dependency "rspec"
33
+ spec.add_dependency "thor"
34
+ end
metadata ADDED
@@ -0,0 +1,124 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: mrb
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - qtakamitsu
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2015-07-30 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.10'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.10'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
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'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ description: The Command Line Interface is a unified tool to manage your mruby and
70
+ mrbgems.
71
+ email:
72
+ - qtakamitsu@gmail.com
73
+ executables:
74
+ - mrb
75
+ extensions: []
76
+ extra_rdoc_files: []
77
+ files:
78
+ - ".gitignore"
79
+ - ".rspec"
80
+ - ".travis.yml"
81
+ - Gemfile
82
+ - LICENSE
83
+ - LICENSE.txt
84
+ - README.md
85
+ - Rakefile
86
+ - assets/templates/config/build_config.rb.erb
87
+ - assets/templates/gem/README.md.erb
88
+ - assets/templates/gem/example.c.erb
89
+ - assets/templates/gem/mrbgem.rake.erb
90
+ - assets/templates/gem/test_example.c.erb
91
+ - assets/templates/gem/test_example.rb.erb
92
+ - bin/console
93
+ - bin/setup
94
+ - exe/mrb
95
+ - lib/mrb.rb
96
+ - lib/mrb/cli.rb
97
+ - lib/mrb/template.rb
98
+ - lib/mrb/version.rb
99
+ - mrb.gemspec
100
+ homepage: https://github.com/qtkmz/mrb
101
+ licenses:
102
+ - MIT
103
+ metadata: {}
104
+ post_install_message:
105
+ rdoc_options: []
106
+ require_paths:
107
+ - lib
108
+ required_ruby_version: !ruby/object:Gem::Requirement
109
+ requirements:
110
+ - - ">="
111
+ - !ruby/object:Gem::Version
112
+ version: '0'
113
+ required_rubygems_version: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ requirements: []
119
+ rubyforge_project:
120
+ rubygems_version: 2.2.2
121
+ signing_key:
122
+ specification_version: 4
123
+ summary: command line tool for mruby
124
+ test_files: []