mruby-cli 0.1.2 → 0.2.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: b9096f41951c4437267245d883ac5d7f4027ebe7
4
- data.tar.gz: 1768d1709c0c8d1a018a668213ddd5fc70bda8d7
3
+ metadata.gz: 0422b29d9121b3caeccc2719fa4f535278771525
4
+ data.tar.gz: bc17ba03beeb2f0e31969dd55ef7e38f49b7566c
5
5
  SHA512:
6
- metadata.gz: f29307bc450300593c4257d094e58ad601c94f94f6a082fd48c0fc0be59d31ec9459618e0650da9089ca287e643bf5cdef1c264e23c50a820476e48204c84e97
7
- data.tar.gz: eadad2744e79a8f829918b894d149106eb3e1ee10d6504758d54b7a5d8e414dec99341735222eee35d87f4a02ad737f6e6d14e025838c0bf90ae254a8e6396c8
6
+ metadata.gz: b95b4fd1017a07d93ae021e2d717d0992b796bf5c9d398c4f0905330ade3e73cbe0c5f4ade8a382ca34c0a83ae3884ad1773b3ea6e3985d2d3eb448f6fe3d17c
7
+ data.tar.gz: ffbc2d6f031de50c01397cbbc09f2b31e6a162f0ea9aeeccac769c6037240228c73c62b42e682b38f6cf2e51d3bb80cd2d4daf92e6b3a5c8489eb790d25deca9
@@ -1,3 +1,5 @@
1
+ require 'mruby/cli/commands'
2
+
1
3
  module MRuby::CLI
2
4
  class App < Thor
3
5
  class_option(:build_config, {
@@ -45,9 +47,12 @@ module MRuby::CLI
45
47
  rake('test')
46
48
  end
47
49
 
48
- def help
50
+ def help(*args)
49
51
  Description.print(shell)
50
52
  super
51
53
  end
54
+
55
+ desc 'generate TEMPLATE NAME', 'Generate a new project'
56
+ subcommand 'generate', Commands::Generate
52
57
  end
53
58
  end
@@ -0,0 +1 @@
1
+ require_relative 'commands/generate'
@@ -0,0 +1,15 @@
1
+ require 'mruby/cli/generators'
2
+
3
+ module MRuby::CLI
4
+ module Commands
5
+ class Generate < Thor
6
+ register(
7
+ Generators::Build, 'build',
8
+ 'build PATH', "Generates a MRuby build project")
9
+
10
+ register(
11
+ Generators::Gem, 'gem',
12
+ 'gem PATH', "Generates a MRuby gem project")
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,3 @@
1
+ require_relative 'generators/base'
2
+ require_relative 'generators/build'
3
+ require_relative 'generators/gem'
@@ -0,0 +1,42 @@
1
+ module MRuby::CLI
2
+ module Generators
3
+ class Base < Thor::Group
4
+ include Thor::Actions
5
+
6
+ argument :path
7
+
8
+ def self.generator_name
9
+ self.name.split('::').last.downcase
10
+ end
11
+
12
+ def self.source_root
13
+ File.expand_path(File.join('..', self.generator_name), __FILE__)
14
+ end
15
+
16
+ def generate_gemfile
17
+ template('../base/gemfile.erb', "#{path}/Gemfile")
18
+ end
19
+
20
+ def generate_gitignore
21
+ template('../base/gitignore.erb', "#{path}/.gitignore")
22
+ end
23
+
24
+ def name
25
+ File.basename(path)
26
+ end
27
+
28
+ def short_name
29
+ self.name.gsub(/^mruby-/,'')
30
+ end
31
+
32
+ def module_name
33
+ short_name.split('-').map(&:capitalize).join('')
34
+ end
35
+
36
+ def c_function_prefix
37
+ self.name.gsub(/-/,'_')
38
+ end
39
+ end
40
+ end
41
+ end
42
+
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'mruby-cli'
4
+ gem 'mruby-source', github: 'sagmor/mruby'
@@ -0,0 +1,5 @@
1
+ build
2
+ .bundle
3
+ Gemfile.lock
4
+ doc
5
+ .yardoc
@@ -0,0 +1,25 @@
1
+ module MRuby::CLI
2
+ module Generators
3
+ class Build < Thor::Group
4
+ include Thor::Actions
5
+
6
+ argument :name
7
+
8
+ def self.source_root
9
+ File.expand_path('../build', __FILE__)
10
+ end
11
+
12
+ def generate_build_config
13
+ template('build_config.rb.erb', "#{name}/build_config.rb")
14
+ end
15
+
16
+ def generate_gemfile
17
+ template('gemfile.erb', "#{name}/Gemfile")
18
+ end
19
+
20
+ def generate_gitignore
21
+ template('gitignore.erb', "#{name}/.gitignore")
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,5 @@
1
+ MRuby::Build.new do |conf|
2
+ toolchain :gcc
3
+ enable_debug
4
+ conf.gembox 'default'
5
+ end
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'mruby-cli'
4
+ gem 'mruby-source', github: 'sagmor/mruby', branch: 'gem'
@@ -0,0 +1,2 @@
1
+ build
2
+ .bundle
@@ -0,0 +1,30 @@
1
+ module MRuby::CLI
2
+ module Generators
3
+ class Gem < Base
4
+
5
+ def generate_mrbgem_description
6
+ template('mrbgem.rake.erb', "#{path}/mrbgem.rake")
7
+ template('license.txt.erb', "#{path}/LICENSE.txt")
8
+ template('readme.md.erb', "#{path}/README.md")
9
+ template('code_of_conduct.md.erb', "#{path}/CODE_OF_CONDUCT.md")
10
+ end
11
+
12
+ def generate_source_files
13
+ template('mrblib.rb.erb', "#{path}/mrblib/#{short_name}.rb")
14
+ template('src.c.erb', "#{path}/src/#{short_name}.c")
15
+ end
16
+
17
+ def generate_documentation_files
18
+ template('yardopts.erb', "#{path}/.yardopts")
19
+ template('inch.yml.erb', "#{path}/.inch.yml")
20
+ end
21
+
22
+ def generate_test_files
23
+ template('test.rb.erb', "#{path}/test/#{short_name}_spec.rb")
24
+ template('build_config.rb.erb', "#{path}/build_config.rb")
25
+ template('travis.yml.erb', "#{path}/.travis.yml")
26
+ end
27
+
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,9 @@
1
+ MRuby::Build.new do |conf|
2
+ toolchain :gcc
3
+ enable_debug
4
+
5
+ conf.gem '.'
6
+
7
+ conf.enable_test
8
+ end
9
+
@@ -0,0 +1,13 @@
1
+ # Contributor Code of Conduct
2
+
3
+ As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
4
+
5
+ We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or religion.
6
+
7
+ Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
8
+
9
+ Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
10
+
11
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
12
+
13
+ This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
@@ -0,0 +1,3 @@
1
+ files:
2
+ included:
3
+ - mrblib/**/*.rb
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) <%= Time.now.year %> [PUT YOUR NAME HERE]
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.
@@ -0,0 +1,15 @@
1
+ MRuby::Gem::Specification.new('<%= name %>') do |spec|
2
+ spec.license = 'MIT'
3
+ spec.author = 'TODO: Put your name here'
4
+ spec.summary = %q{TODO: Write a short summary of your gem.}
5
+ spec.version = '0.1.0'
6
+
7
+ # Add your runtime dependencies here
8
+ # spec.add_dependency('mruby-math', :core => 'mruby-math')
9
+
10
+
11
+ # Add your test dependencies here
12
+ if build.test_enabled?
13
+ spec.add_dependency('mruby-spec', :github => 'sagmor/mruby-spec')
14
+ end
15
+ end
@@ -0,0 +1,3 @@
1
+ module <%= module_name %>
2
+ # TODO: Write your Ruby code here
3
+ end
@@ -0,0 +1,12 @@
1
+ # <%= name %>
2
+
3
+ TODO: Write your README
4
+
5
+ ## Contributing
6
+
7
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/<%= name %>. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
8
+
9
+
10
+ ## License
11
+
12
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
@@ -0,0 +1,13 @@
1
+ #include "mruby.h"
2
+
3
+ void
4
+ mrb_<%= c_function_prefix %>_gem_init(mrb_state* mrb)
5
+ {
6
+ // Your C initialization code goes here
7
+ }
8
+
9
+ void
10
+ mrb_<%= c_function_prefix %>_gem_final(mrb_state* mrb)
11
+ {
12
+ // Your C finalization code goes here
13
+ }
@@ -0,0 +1,5 @@
1
+ describe <%= module_name %> do
2
+ it 'exists' do
3
+ expect(<%= module_name %>).not_to be_nil
4
+ end
5
+ end
@@ -0,0 +1,2 @@
1
+ install: bundle install
2
+ script: bundle exec mrb test
@@ -0,0 +1 @@
1
+ mrblib/**/*.rb - README.md LICENSE.txt
@@ -1,5 +1,5 @@
1
1
  module MRuby
2
2
  module CLI
3
- VERSION = "0.1.2"
3
+ VERSION = "0.2.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mruby-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Seba Gamboa
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-09-07 00:00:00.000000000 Z
11
+ date: 2015-09-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -88,7 +88,29 @@ files:
88
88
  - exe/mrb
89
89
  - lib/mruby/cli.rb
90
90
  - lib/mruby/cli/app.rb
91
+ - lib/mruby/cli/commands.rb
92
+ - lib/mruby/cli/commands/generate.rb
91
93
  - lib/mruby/cli/description.rb
94
+ - lib/mruby/cli/generators.rb
95
+ - lib/mruby/cli/generators/base.rb
96
+ - lib/mruby/cli/generators/base/gemfile.erb
97
+ - lib/mruby/cli/generators/base/gitignore.erb
98
+ - lib/mruby/cli/generators/build.rb
99
+ - lib/mruby/cli/generators/build/build_config.rb.erb
100
+ - lib/mruby/cli/generators/build/gemfile.erb
101
+ - lib/mruby/cli/generators/build/gitignore.erb
102
+ - lib/mruby/cli/generators/gem.rb
103
+ - lib/mruby/cli/generators/gem/build_config.rb.erb
104
+ - lib/mruby/cli/generators/gem/code_of_conduct.md.erb
105
+ - lib/mruby/cli/generators/gem/inch.yml.erb
106
+ - lib/mruby/cli/generators/gem/license.txt.erb
107
+ - lib/mruby/cli/generators/gem/mrbgem.rake.erb
108
+ - lib/mruby/cli/generators/gem/mrblib.rb.erb
109
+ - lib/mruby/cli/generators/gem/readme.md.erb
110
+ - lib/mruby/cli/generators/gem/src.c.erb
111
+ - lib/mruby/cli/generators/gem/test.rb.erb
112
+ - lib/mruby/cli/generators/gem/travis.yml.erb
113
+ - lib/mruby/cli/generators/gem/yardopts.erb
92
114
  - lib/mruby/cli/rake.rb
93
115
  - lib/mruby/cli/source.rb
94
116
  - lib/mruby/cli/version.rb
@@ -118,3 +140,4 @@ signing_key:
118
140
  specification_version: 4
119
141
  summary: MRuby command line helper utility.
120
142
  test_files: []
143
+ has_rdoc: