juwelier 2.4.0 → 2.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.semver +2 -2
- data/Gemfile +1 -0
- data/README.org +48 -0
- data/juwelier.gemspec +10 -5
- data/lib/juwelier/generator.rb +31 -20
- data/lib/juwelier/generator/options.rb +4 -0
- data/lib/juwelier/tasks.rb +1 -1
- data/lib/juwelier/templates/Rakefile +0 -2
- data/lib/juwelier/templates/juwelier_tasks.erb +5 -0
- data/lib/juwelier/templates/lib/rustygem.rb +18 -0
- data/lib/juwelier/templates/rust/Cargo.toml +14 -0
- data/lib/juwelier/templates/rust/Makefile +11 -0
- data/lib/juwelier/templates/rust/extconf.rb +2 -0
- data/lib/juwelier/templates/rust/src/lib.rs +55 -0
- data/lib/juwelier/templates/rusty_setup.erb +0 -0
- data/{README.markdown → oldREADME.md} +0 -0
- metadata +9 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 50da599b91b3c3ee8a0b551339bc03d4ee2911d0
|
4
|
+
data.tar.gz: f05218665fa821263f12c87565d7ebd0973e0f18
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ff469e8865a3fd3084b0dd6a6abb0a9135a9bd784c177039bc2db744b0693ff661108aab76d6696aeb506ea6c9c753f06b0303fea3a184bdb673b20294e909db
|
7
|
+
data.tar.gz: 35feec9cb55040de84973b9ccdc7b258ba2d7bf27047fbe28d433df4559158ef67bb4ebc6202acb5db2bad899380a1f92a5a2b2176975f96b912af01bee8d800
|
data/.semver
CHANGED
data/Gemfile
CHANGED
data/README.org
CHANGED
@@ -366,9 +366,57 @@ friendship doesn't interfere with typical Rake operations.
|
|
366
366
|
The Juwelier Rake means you can define your own namespaces, tasks, or
|
367
367
|
use third party Rake libraries without cause for concern.
|
368
368
|
|
369
|
+
** New Features
|
370
|
+
*** Rusty Gems Support (highly experimental)
|
371
|
+
Beginning with version 2.4.0, we now have integration
|
372
|
+
with Rust, so you are able to write Rust-enabled gems.
|
373
|
+
Your users will have to have Rust installed on their
|
374
|
+
systems, but this is easy to do.
|
375
|
+
|
376
|
+
This interface currently uses FFI, and I don't have all
|
377
|
+
the bugs worked out, so use at your own risk (for now).
|
378
|
+
**** Example
|
379
|
+
First, create your Rusty Gem:
|
380
|
+
#+begin_src bash
|
381
|
+
juwelier --semver --rusty foo
|
382
|
+
#+end_src
|
383
|
+
|
384
|
+
Next, cd into the foo directory and run bundle
|
385
|
+
and attempt to run the test:
|
386
|
+
#+begin_src bash
|
387
|
+
bundle
|
388
|
+
ruby lib/foo.rb
|
389
|
+
#+end_src
|
390
|
+
|
391
|
+
The test attempt should fail, since we have not built
|
392
|
+
the Rust extension yet. Do so by doing the following:
|
393
|
+
#+begin_src
|
394
|
+
cd rust
|
395
|
+
make
|
396
|
+
cd ..
|
397
|
+
#+end_src
|
398
|
+
|
399
|
+
And then attempt to run the test again:
|
400
|
+
#+begin_src bash
|
401
|
+
ruby lib/foo.rb
|
402
|
+
#+end_src
|
403
|
+
|
404
|
+
That should work. Now install the gem locally with:
|
405
|
+
#+begin_src bash
|
406
|
+
rake gemspec
|
407
|
+
rake install
|
408
|
+
#+end_src
|
409
|
+
|
410
|
+
And that should install your foo gem cleanly.
|
411
|
+
|
412
|
+
As of now, this feature is extremely experimental, but
|
413
|
+
if you should be able to use this as a nice scafford
|
414
|
+
to do your own Rusty Gems. I will improve this later.
|
415
|
+
|
369
416
|
** Release Notes
|
370
417
|
| Version | Date | Notes |
|
371
418
|
|---------+------------+-------------------------------------------------------------------------------------------------------------|
|
419
|
+
| 2.4.0 | 2017-05-09 | Support for Rusty Gems (highly experimental) |
|
372
420
|
| 2.3.5 | 2017-02-10 | Revving Semver to be Semver2 |
|
373
421
|
| 2.2.3 | 2016-11-21 | Psych bug fixed |
|
374
422
|
| 2.2.2 | 2016-11-19 | Added support for pry -- includes pry, pry-byebug, pry-doc, pry-remote, pry-rescue. and pry-stack_explorer. |
|
data/juwelier.gemspec
CHANGED
@@ -2,23 +2,22 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Juwelier::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: juwelier 2.4.
|
5
|
+
# stub: juwelier 2.4.1 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "juwelier".freeze
|
9
|
-
s.version = "2.4.
|
9
|
+
s.version = "2.4.1"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib".freeze]
|
13
13
|
s.authors = ["Fred Mitchell".freeze, "Josh Nichols".freeze, "Yusuke Murata".freeze]
|
14
|
-
s.date = "2017-05-
|
14
|
+
s.date = "2017-05-10"
|
15
15
|
s.description = "Simple and opinionated helper for creating Rubygem projects on GitHub".freeze
|
16
16
|
s.email = ["fred.mitchell@gmx.de".freeze, "fred.mitchell@gmx.com".freeze, "info@muratayusuke.com".freeze]
|
17
17
|
s.executables = ["juwelier".freeze]
|
18
18
|
s.extra_rdoc_files = [
|
19
19
|
"ChangeLog.markdown",
|
20
20
|
"LICENSE.txt",
|
21
|
-
"README.markdown",
|
22
21
|
"README.org"
|
23
22
|
]
|
24
23
|
s.files = [
|
@@ -30,7 +29,6 @@ Gem::Specification.new do |s|
|
|
30
29
|
"ChangeLog.markdown",
|
31
30
|
"Gemfile",
|
32
31
|
"LICENSE.txt",
|
33
|
-
"README.markdown",
|
34
32
|
"README.org",
|
35
33
|
"Rakefile",
|
36
34
|
"bin/juwelier",
|
@@ -108,6 +106,7 @@ Gem::Specification.new do |s|
|
|
108
106
|
"lib/juwelier/templates/features/default.feature",
|
109
107
|
"lib/juwelier/templates/features/support/env.rb",
|
110
108
|
"lib/juwelier/templates/juwelier_tasks.erb",
|
109
|
+
"lib/juwelier/templates/lib/rustygem.rb",
|
111
110
|
"lib/juwelier/templates/micronaut/flunking.rb",
|
112
111
|
"lib/juwelier/templates/micronaut/helper.rb",
|
113
112
|
"lib/juwelier/templates/minitest/flunking.rb",
|
@@ -118,6 +117,11 @@ Gem::Specification.new do |s|
|
|
118
117
|
"lib/juwelier/templates/rspec/.rspec",
|
119
118
|
"lib/juwelier/templates/rspec/flunking.rb",
|
120
119
|
"lib/juwelier/templates/rspec/helper.rb",
|
120
|
+
"lib/juwelier/templates/rust/Cargo.toml",
|
121
|
+
"lib/juwelier/templates/rust/Makefile",
|
122
|
+
"lib/juwelier/templates/rust/extconf.rb",
|
123
|
+
"lib/juwelier/templates/rust/src/lib.rs",
|
124
|
+
"lib/juwelier/templates/rusty_setup.erb",
|
121
125
|
"lib/juwelier/templates/semver_tasks.erb",
|
122
126
|
"lib/juwelier/templates/shindo/flunking.rb",
|
123
127
|
"lib/juwelier/templates/shindo/helper.rb",
|
@@ -130,6 +134,7 @@ Gem::Specification.new do |s|
|
|
130
134
|
"lib/juwelier/templates/testunit/helper.rb",
|
131
135
|
"lib/juwelier/version.rb",
|
132
136
|
"lib/juwelier/version_helper.rb",
|
137
|
+
"oldREADME.md",
|
133
138
|
"test/fixtures/bar/VERSION.yml",
|
134
139
|
"test/fixtures/bar/bin/foo_the_ultimate_bin",
|
135
140
|
"test/fixtures/bar/hey_include_me_in_gemspec",
|
data/lib/juwelier/generator.rb
CHANGED
@@ -3,7 +3,7 @@ require 'git'
|
|
3
3
|
require 'github_api'
|
4
4
|
require 'highline/import'
|
5
5
|
require 'erb'
|
6
|
-
|
6
|
+
require 'kamelcase'
|
7
7
|
require 'net/http'
|
8
8
|
require 'uri'
|
9
9
|
|
@@ -56,7 +56,8 @@ class Juwelier
|
|
56
56
|
:should_setup_rubyforge, :should_use_reek, :should_use_roodi,
|
57
57
|
:development_dependencies, :production_dependencies,
|
58
58
|
:options, :require_ruby_version, :should_create_bin,
|
59
|
-
:git_remote, :use_readme_format, :should_use_pry
|
59
|
+
:git_remote, :use_readme_format, :should_use_pry,
|
60
|
+
:should_be_rusty
|
60
61
|
|
61
62
|
def initialize(options = {})
|
62
63
|
self.options = options
|
@@ -106,6 +107,7 @@ class Juwelier
|
|
106
107
|
self.should_use_semver = options[:use_semver]
|
107
108
|
self.require_ruby_version = options[:use_required_version]
|
108
109
|
self.should_create_bin = options[:create_bin]
|
110
|
+
self.should_be_rusty = options[:be_rusty]
|
109
111
|
self.should_use_pry = options[:use_pry]
|
110
112
|
self.use_readme_format = options[:readme_format]
|
111
113
|
|
@@ -127,7 +129,8 @@ class Juwelier
|
|
127
129
|
["pry-stack_explorer", "~> 0"] if should_use_pry
|
128
130
|
|
129
131
|
production_dependencies << ["semver2", "~> 3"] if should_use_semver
|
130
|
-
|
132
|
+
production_dependencies << ['ffi', '~> 1'] if should_be_rusty
|
133
|
+
|
131
134
|
self.user_name = options[:user_name]
|
132
135
|
self.user_email = options[:user_email]
|
133
136
|
self.homepage = options[:homepage]
|
@@ -151,16 +154,15 @@ class Juwelier
|
|
151
154
|
end
|
152
155
|
|
153
156
|
def constant_name
|
154
|
-
self.project_name.
|
155
|
-
end
|
156
|
-
|
157
|
-
def lib_filename
|
158
|
-
"#{project_name}.rb"
|
157
|
+
self.project_name.camel
|
159
158
|
end
|
160
159
|
|
161
|
-
def
|
162
|
-
"#{
|
160
|
+
def extension_name
|
161
|
+
"lib#{self.project_name.snake}.so"
|
163
162
|
end
|
163
|
+
|
164
|
+
def lib_filename ; "#{project_name}.rb" ; end
|
165
|
+
def bin_filename ; "#{should_create_bin}" ; end
|
164
166
|
|
165
167
|
def require_name
|
166
168
|
self.project_name
|
@@ -170,13 +172,10 @@ class Juwelier
|
|
170
172
|
self.project_name.gsub('-', '_')
|
171
173
|
end
|
172
174
|
|
173
|
-
def lib_dir
|
174
|
-
'
|
175
|
-
end
|
176
|
-
|
177
|
-
def bin_dir
|
178
|
-
'bin'
|
179
|
-
end
|
175
|
+
def lib_dir ; 'lib' ; end
|
176
|
+
def bin_dir ; 'bin' ; end
|
177
|
+
def rust_dir ; 'rust' ; end
|
178
|
+
def rust_src_dir ; rust_dir + '/src' ; end
|
180
179
|
|
181
180
|
def feature_filename
|
182
181
|
"#{project_name}.feature"
|
@@ -207,7 +206,6 @@ class Juwelier
|
|
207
206
|
raise FileInTheWay, "The directory #{target_dir} already exists, aborting. Maybe move it out of the way before continuing?"
|
208
207
|
end
|
209
208
|
|
210
|
-
|
211
209
|
output_template_in_target '.gitignore'
|
212
210
|
output_template_in_target 'Rakefile'
|
213
211
|
output_template_in_target 'Gemfile' if should_use_bundler
|
@@ -216,7 +214,12 @@ class Juwelier
|
|
216
214
|
output_template_in_target '.document'
|
217
215
|
|
218
216
|
mkdir_in_target lib_dir
|
219
|
-
|
217
|
+
unless should_be_rusty
|
218
|
+
touch_in_target File.join(lib_dir, lib_filename)
|
219
|
+
else
|
220
|
+
output_template_in_target File.join(lib_dir, 'rustygem.rb'),
|
221
|
+
File.join(lib_dir, lib_filename)
|
222
|
+
end
|
220
223
|
|
221
224
|
if should_use_semver
|
222
225
|
output_template_in_target '.semver'
|
@@ -233,10 +236,18 @@ class Juwelier
|
|
233
236
|
File.join(test_dir, test_filename)
|
234
237
|
end
|
235
238
|
|
239
|
+
if should_be_rusty
|
240
|
+
mkdir_in_target rust_dir
|
241
|
+
output_template_in_target File.join(rust_dir, 'Cargo.toml')
|
242
|
+
output_template_in_target File.join(rust_dir, 'extconf.rb')
|
243
|
+
output_template_in_target File.join(rust_dir, 'Makefile')
|
244
|
+
mkdir_in_target rust_src_dir
|
245
|
+
output_template_in_target File.join(rust_src_dir, 'lib.rs')
|
246
|
+
end
|
247
|
+
|
236
248
|
if testing_framework == :rspec
|
237
249
|
output_template_in_target File.join(testing_framework.to_s, '.rspec'),
|
238
250
|
'.rspec'
|
239
|
-
|
240
251
|
end
|
241
252
|
|
242
253
|
if should_use_cucumber
|
@@ -81,6 +81,10 @@ class Juwelier
|
|
81
81
|
self[:create_bin] = v
|
82
82
|
end
|
83
83
|
|
84
|
+
o.on('--[no-]rusty', 'create a gem using Rust') do |v|
|
85
|
+
self[:be_rusty] = v
|
86
|
+
end
|
87
|
+
|
84
88
|
o.on('--cucumber', 'generate cucumber stories in addition to the other tests') do
|
85
89
|
self[:use_cucumber] = true
|
86
90
|
end
|
data/lib/juwelier/tasks.rb
CHANGED
@@ -27,7 +27,7 @@ class Juwelier
|
|
27
27
|
# gem.email = "fred.mitchell@gmx.com"
|
28
28
|
# gem.homepage = "http://github.com/flajann2/juwelier"
|
29
29
|
# gem.description = "Simple and opinionated helper for creating RubyGem projects on GitHub"
|
30
|
-
# gem.authors = ["
|
30
|
+
# gem.authors = ["Fred Mitchell"]
|
31
31
|
# end
|
32
32
|
#
|
33
33
|
# The block variable gem is actually a Gem::Specification, so you can
|
@@ -15,6 +15,11 @@ Juwelier::Tasks.new do |gem|
|
|
15
15
|
gem.required_ruby_version = '>= <%= require_ruby_version %>'
|
16
16
|
<% end %>
|
17
17
|
|
18
|
+
<% if should_be_rusty %>
|
19
|
+
# Rusty Gem
|
20
|
+
gem.extensions = Dir['rust/extconf.rb']
|
21
|
+
<% end %>
|
22
|
+
|
18
23
|
<% if should_setup_rubyforge %>
|
19
24
|
gem.rubyforge_project = "<%= project_name %>"
|
20
25
|
<% end %>
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'ffi'
|
2
|
+
|
3
|
+
module <%= constant_name %>
|
4
|
+
extend FFI::Library
|
5
|
+
ffi_lib 'rust/target/release/<%= extension_name %>'
|
6
|
+
|
7
|
+
attach_function :simple_test, [ :string, :int ], :int
|
8
|
+
attach_function :hello_world, [ :string, :int ], :int
|
9
|
+
end
|
10
|
+
|
11
|
+
if $0 == __FILE__
|
12
|
+
json = <<-JSON
|
13
|
+
{"hello":"Hello", "world":"World" }
|
14
|
+
JSON
|
15
|
+
|
16
|
+
puts <%= constant_name %>::simple_test "Hi there!", 10
|
17
|
+
puts <%= constant_name %>::hello_world json, 3
|
18
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
[package]
|
2
|
+
name = "<%= project_name %>"
|
3
|
+
version = "0.1.0"
|
4
|
+
authors = ["<%= user_name %> <%= user_email %>"]
|
5
|
+
|
6
|
+
[dependencies]
|
7
|
+
serde = "1.0.2"
|
8
|
+
serde_json = "1.0.1"
|
9
|
+
serde_derive = "1.0.2"
|
10
|
+
libc = "0.2.22"
|
11
|
+
|
12
|
+
[lib]
|
13
|
+
name = "<%= project_name %>"
|
14
|
+
crate-type = ["dylib"]
|
@@ -0,0 +1,55 @@
|
|
1
|
+
|
2
|
+
#[cfg(test)]
|
3
|
+
|
4
|
+
extern crate serde;
|
5
|
+
extern crate libc;
|
6
|
+
extern crate serde_json;
|
7
|
+
|
8
|
+
#[macro_use]
|
9
|
+
extern crate serde_derive;
|
10
|
+
|
11
|
+
use serde_json::from_str;
|
12
|
+
use serde_json::Error;
|
13
|
+
use std::result::Result;
|
14
|
+
|
15
|
+
/// HelloWorld as a target from the JSON from Ruby
|
16
|
+
#[derive(Debug)]
|
17
|
+
#[derive(Serialize, Deserialize)]
|
18
|
+
pub struct HelloWorld {
|
19
|
+
hello: String,
|
20
|
+
world: String
|
21
|
+
}
|
22
|
+
|
23
|
+
/// Super-simple test
|
24
|
+
#[no_mangle]
|
25
|
+
pub extern "C" fn simple_test(s: &str, i: u32) -> u32 {
|
26
|
+
println!("got a string of {}", s);
|
27
|
+
println!("got an integer of {}", i);
|
28
|
+
i + 10
|
29
|
+
}
|
30
|
+
|
31
|
+
/// This is an example of passing complex objects
|
32
|
+
/// from Ruby to Rust with strong type checking as JSON
|
33
|
+
#[no_mangle]
|
34
|
+
pub extern "C" fn hello_world(json: &str, count: u32) -> Result<u32, Error> {
|
35
|
+
let hw: HelloWorld = from_str(json)?;
|
36
|
+
|
37
|
+
println!("hello_world called with {:?} to be printed {} times.", hw, count);
|
38
|
+
|
39
|
+
// We simply want to show how to pass primitives as well
|
40
|
+
for i in 0..count {
|
41
|
+
println!("{}: hw: {:?}", i, hw);
|
42
|
+
}
|
43
|
+
|
44
|
+
// return one less than the count given
|
45
|
+
Ok(count - 1)
|
46
|
+
}
|
47
|
+
|
48
|
+
/// Here we must free strings from Rust when we are done
|
49
|
+
/// with them.
|
50
|
+
#[no_mangle]
|
51
|
+
pub extern fn rust_free(c_ptr: *mut libc::c_void) {
|
52
|
+
unsafe {
|
53
|
+
libc::free(c_ptr);
|
54
|
+
}
|
55
|
+
}
|
File without changes
|
File without changes
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: juwelier
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.4.
|
4
|
+
version: 2.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Fred Mitchell
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2017-05-
|
13
|
+
date: 2017-05-10 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rake
|
@@ -233,7 +233,6 @@ extensions: []
|
|
233
233
|
extra_rdoc_files:
|
234
234
|
- ChangeLog.markdown
|
235
235
|
- LICENSE.txt
|
236
|
-
- README.markdown
|
237
236
|
- README.org
|
238
237
|
files:
|
239
238
|
- ".coveralls.yml"
|
@@ -244,7 +243,6 @@ files:
|
|
244
243
|
- ChangeLog.markdown
|
245
244
|
- Gemfile
|
246
245
|
- LICENSE.txt
|
247
|
-
- README.markdown
|
248
246
|
- README.org
|
249
247
|
- Rakefile
|
250
248
|
- bin/juwelier
|
@@ -322,6 +320,7 @@ files:
|
|
322
320
|
- lib/juwelier/templates/features/default.feature
|
323
321
|
- lib/juwelier/templates/features/support/env.rb
|
324
322
|
- lib/juwelier/templates/juwelier_tasks.erb
|
323
|
+
- lib/juwelier/templates/lib/rustygem.rb
|
325
324
|
- lib/juwelier/templates/micronaut/flunking.rb
|
326
325
|
- lib/juwelier/templates/micronaut/helper.rb
|
327
326
|
- lib/juwelier/templates/minitest/flunking.rb
|
@@ -332,6 +331,11 @@ files:
|
|
332
331
|
- lib/juwelier/templates/rspec/.rspec
|
333
332
|
- lib/juwelier/templates/rspec/flunking.rb
|
334
333
|
- lib/juwelier/templates/rspec/helper.rb
|
334
|
+
- lib/juwelier/templates/rust/Cargo.toml
|
335
|
+
- lib/juwelier/templates/rust/Makefile
|
336
|
+
- lib/juwelier/templates/rust/extconf.rb
|
337
|
+
- lib/juwelier/templates/rust/src/lib.rs
|
338
|
+
- lib/juwelier/templates/rusty_setup.erb
|
335
339
|
- lib/juwelier/templates/semver_tasks.erb
|
336
340
|
- lib/juwelier/templates/shindo/flunking.rb
|
337
341
|
- lib/juwelier/templates/shindo/helper.rb
|
@@ -344,6 +348,7 @@ files:
|
|
344
348
|
- lib/juwelier/templates/testunit/helper.rb
|
345
349
|
- lib/juwelier/version.rb
|
346
350
|
- lib/juwelier/version_helper.rb
|
351
|
+
- oldREADME.md
|
347
352
|
- test/fixtures/bar/VERSION.yml
|
348
353
|
- test/fixtures/bar/bin/foo_the_ultimate_bin
|
349
354
|
- test/fixtures/bar/hey_include_me_in_gemspec
|