juwelier 2.4.4 → 2.4.5

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: 1190a17f82cfa17316cf86f8234002e3e4c05d98
4
- data.tar.gz: 48c4de6dd0d56d3bc011fd645bd5c8c41afc0736
3
+ metadata.gz: cf1bec15715e87a06e04a838735e4b40521be1b5
4
+ data.tar.gz: a204d0a1f80fed8f7dc7724e74551d7b50b2ec40
5
5
  SHA512:
6
- metadata.gz: 7c27bb06b416645d11b2f8612381ef4927cbfa6206686779a4605489af6b73bf234d9e062a2a51c7c74e0003c5e42fec2b34836f801194b433d918f8dd65ad8e
7
- data.tar.gz: 89afd4469fd8851f97358a8fce39dba7ace950007740a125ab1be930ec251b85453dbb175b8a036b1de09e008707aa345d221e3180ae8de0bcb23742923f49fe
6
+ metadata.gz: 3b8502e6b0a074838f26e25764e1128c49deacae2733ba3c0845925cbe38f6d77a196ec6cadd57285bc2913422a33e0aff245392c1041956f16ff05f0fa204ff
7
+ data.tar.gz: e0f3d315f049045482c2d22e0a8c6780cdaad6a164ea37fe541931a1fb03d1fc6e13b07016536f0745abd00bffa0c8d3ab8ff5de40e8c58d326c67c5975e21fc
data/.semver CHANGED
@@ -1,5 +1,5 @@
1
1
  ---
2
2
  :major: 2
3
3
  :minor: 4
4
- :patch: 1
4
+ :patch: 5
5
5
  :special: ''
@@ -0,0 +1,9 @@
1
+ ---
2
+ :major: 2
3
+ :minor: 4
4
+ <<<<<<< HEAD
5
+ :patch: 1
6
+ =======
7
+ :patch: 4
8
+ >>>>>>> feature/rusty
9
+ :special: ''
data/README.org CHANGED
@@ -367,7 +367,7 @@ 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
369
  ** New Features
370
- *** Rusty Gems Support (highly experimental)
370
+ *** Rusty Gems Support
371
371
  Beginning with version 2.4.0, we now have integration
372
372
  with Rust, so you are able to write Rust-enabled gems.
373
373
  Your users will have to have Rust installed on their
@@ -376,6 +376,11 @@ use third party Rake libraries without cause for concern.
376
376
  This interface currently uses FFI, and I don't have all
377
377
  the bugs worked out, so use at your own risk (for now).
378
378
  **** Example
379
+ The example code generated illustrates how to pass
380
+ strings to Rust, and also how to pass data structures
381
+ to Rust as JSON (highly recommended) and have it
382
+ reformed into Rust structures in a typesafe manner.
383
+
379
384
  First, create your Rusty Gem:
380
385
  #+begin_src bash
381
386
  juwelier --semver --rusty foo
@@ -416,7 +421,8 @@ use third party Rake libraries without cause for concern.
416
421
  ** Release Notes
417
422
  | Version | Date | Notes |
418
423
  |---------+------------+-------------------------------------------------------------------------------------------------------------|
419
- | 2.4.0 | 2017-05-09 | Support for Rusty Gems (highly experimental) |
424
+ | 2.4.5 | 2017-05-14 | Fixed Rusty interfacing example and the segfault it was generating. |
425
+ | 2.4.0 | 2017-05-09 | Support for Rusty Gems |
420
426
  | 2.3.5 | 2017-02-10 | Revving Semver to be Semver2 |
421
427
  | 2.2.3 | 2016-11-21 | Psych bug fixed |
422
428
  | 2.2.2 | 2016-11-19 | Added support for pry -- includes pry, pry-byebug, pry-doc, pry-remote, pry-rescue. and pry-stack_explorer. |
@@ -2,11 +2,11 @@
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.4 ruby lib
5
+ # stub: juwelier 2.4.5 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "juwelier".freeze
9
- s.version = "2.4.4"
9
+ s.version = "2.4.5"
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]
@@ -24,6 +24,7 @@ Gem::Specification.new do |s|
24
24
  ".coveralls.yml",
25
25
  ".document",
26
26
  ".semver",
27
+ ".semver.orig",
27
28
  ".travis.yml",
28
29
  ".yardopts",
29
30
  "ChangeLog.markdown",
@@ -134,6 +135,7 @@ Gem::Specification.new do |s|
134
135
  "lib/juwelier/templates/testunit/helper.rb",
135
136
  "lib/juwelier/version.rb",
136
137
  "lib/juwelier/version_helper.rb",
138
+ "oldREADME.md",
137
139
  "test/fixtures/bar/VERSION.yml",
138
140
  "test/fixtures/bar/bin/foo_the_ultimate_bin",
139
141
  "test/fixtures/bar/hey_include_me_in_gemspec",
@@ -4,8 +4,8 @@ module <%= constant_name %>
4
4
  extend FFI::Library
5
5
  ffi_lib 'rust/target/release/<%= extension_name %>'
6
6
 
7
- attach_function :simple_test, [ :string, :int ], :int
8
- attach_function :hello_world, [ :string, :int ], :int
7
+ attach_function :simple_test, [ :string, :uint ], :uint
8
+ attach_function :hello_world, [ :string, :uint ], :uint
9
9
  end
10
10
 
11
11
  if $0 == __FILE__
@@ -13,6 +13,6 @@ if $0 == __FILE__
13
13
  {"hello":"Hello", "world":"World" }
14
14
  JSON
15
15
 
16
- puts <%= constant_name %>::simple_test "Hi there!", 10
16
+ puts <%= constant_name %>::simple_test "Hi there!", 21
17
17
  puts <%= constant_name %>::hello_world json, 3
18
18
  end
@@ -11,7 +11,9 @@ extern crate serde_derive;
11
11
  use serde_json::from_str;
12
12
  use serde_json::Error;
13
13
  use std::result::Result;
14
-
14
+ use std::ffi::CStr;
15
+ use libc::c_char;
16
+
15
17
  /// HelloWorld as a target from the JSON from Ruby
16
18
  #[derive(Debug)]
17
19
  #[derive(Serialize, Deserialize)]
@@ -22,7 +24,11 @@ pub struct HelloWorld {
22
24
 
23
25
  /// Super-simple test
24
26
  #[no_mangle]
25
- pub extern "C" fn simple_test(s: &str, i: u32) -> u32 {
27
+ pub extern "C" fn simple_test(cs: *const c_char, i: u32) -> u32 {
28
+ let s = unsafe {
29
+ assert!(!cs.is_null());
30
+ CStr::from_ptr(cs).to_str().unwrap()
31
+ };
26
32
  println!("got a string of {}", s);
27
33
  println!("got an integer of {}", i);
28
34
  i + 10
@@ -31,7 +37,11 @@ pub extern "C" fn simple_test(s: &str, i: u32) -> u32 {
31
37
  /// This is an example of passing complex objects
32
38
  /// from Ruby to Rust with strong type checking as JSON
33
39
  #[no_mangle]
34
- pub extern "C" fn hello_world(json: &str, count: u32) -> Result<u32, Error> {
40
+ pub extern "C" fn hello_world(cjson: *const c_char, count: u32) -> Result<u32, Error> {
41
+ let json = unsafe {
42
+ assert!(!cjson.is_null());
43
+ CStr::from_ptr(cjson).to_str().unwrap()
44
+ };
35
45
  let hw: HelloWorld = from_str(json)?;
36
46
 
37
47
  println!("hello_world called with {:?} to be printed {} times.", hw, count);
@@ -0,0 +1,271 @@
1
+ # Juwelier: Craft the perfect RubyGem for Ruby 2.3.x and Beyond
2
+
3
+ Provides the noble ruby developer with two primary features:
4
+
5
+ * a library or managing and releasing RubyGem projects
6
+ * a scaffold generator for starting new RubyGem projects
7
+
8
+ PLEASE NOTE that I have recently taken over the original Jeweler and will be
9
+ maintaining both repos for a while, and eventually converge them to one. In
10
+ the mean time, all new features shall be added to Juwelier, while keeping
11
+ the origial Jeweler up-to-date with the latest Ruby releases.
12
+
13
+ ALSO NOTE that I am transistioning the README to the orgmode format. As such,
14
+ the Markdown version may be out of date, especially with the release notes
15
+ and changelogs. Please refer to it instead.
16
+
17
+ [![Build Status](https://travis-ci.org/flajann2/juwelier.png)](https://travis-ci.org/flajann2/juwelier)
18
+ [![Coverage Status](https://coveralls.io/repos/flajann2/juwelier/badge.png)](https://coveralls.io/r/flajann2/juwelier)
19
+ [![Dependency Status](https://www.versioneye.com/ruby/juwelier/2.0.0/badge.png)](https://www.versioneye.com/ruby/juwelier/2.0.0)
20
+
21
+ "Juwelier" is pronounced "you-ve-LEER" (with German inflection! :))
22
+
23
+ Note that his has been forked from the old Jeweler by Josh Nichols
24
+ due to lack of maintenance. I need this to work alread with the
25
+ latest Ruby, so I've taken it over. All is cool because
26
+ sometimes we move on and loose interest. I wish to thank
27
+ Josh and others who were behind the original Jeweler for
28
+ creating this awesome tool.
29
+
30
+ Note that if you have a preexisting project created with
31
+ Jeweler, you may have some issues. Eventally I will provide
32
+ a migration option, but in the meantime, you may wish to
33
+ run this bash script from the root directory of your project:
34
+
35
+ ```bash
36
+ for f in $(grep -irl jeweler *)
37
+ do
38
+ sed -i 's/jeweler/juwelier/g' $f
39
+ sed -i 's/Jeweler/Juwelier/g' $f
40
+ done
41
+ bundle update
42
+ ```
43
+
44
+ As you know, "Juwelier" is "Jeweler" in German. Since I
45
+ have made Germany my new home, it only seemed approporiate.
46
+
47
+ ## Hello, world
48
+
49
+ Use RubyGems to install the heck out of juwelier to get started:
50
+
51
+ `$ gem install juwelier`
52
+
53
+ With juwelier installed, you can use the `juwelier` command to generate a new project. For the most basic use, just give it a name:
54
+
55
+ `$ juwelier hello-gem`
56
+
57
+ This requires some Git configuration (like name, email, GitHub account, etc), but `juwelier` will prompt along the way.
58
+
59
+ Your new `hello-gem` gem is ready in the `hello-gem` directory. Take a peek, and you'll see several files and directories
60
+
61
+ * `Rakefile` setup for juwelier, running tests, generating documentation, and releasing to [rubygems.org](http://rubygems.org/)
62
+ * `README.rdoc` with contribution guidelines and copyright info crediting you
63
+ * `LICENSE` with the MIT licensed crediting you
64
+ * `Gemfile` with development dependencies filled in
65
+ * `lib/hello-gem.rb` waiting for you to code
66
+ * `test/` containing a (failing) shoulda test suite [shoulda](http://github.com/thoughtbot/shoulda)
67
+
68
+
69
+ ### More `juwelier` options
70
+
71
+ The `juwelier` command supports a lot of options. Mostly, they are for generating baked in support for this test framework, or that.
72
+
73
+ Check out `juwelier --help` for the most up to date options.
74
+
75
+ ## Hello, rake tasks
76
+
77
+ Beyond just editing source code, you'll be interacting with your gem using `rake` a lot. To see all the tasks available with a brief description, you can run:
78
+
79
+ `$ rake -T`
80
+
81
+ You'll need a version before you can start installing your gem locally. The easiest way is with the `version:write` Rake task. Let's imagine you start with 0.1.0
82
+
83
+ `$ rake version:write MAJOR=0 MINOR=1 PATCH=0`
84
+
85
+ You can now go forth and develop, now that there's an initial version defined. Eventually, you should install and test the gem:
86
+
87
+ `$ rake install`
88
+
89
+ The `install` rake task builds the gem and `gem install`s it. You're all set if you're using [RVM](http://rvm.beginrescueend.com/), but you may need to run it with sudo if you have a system-installed ruby:
90
+
91
+ `$ sudo rake install`
92
+
93
+ ### Releasing
94
+
95
+ At last, it's time to [ship it](http://shipitsquirrel.github.com/)! Make sure you have everything committed and pushed, then go wild:
96
+
97
+ `$ rake release`
98
+
99
+ This will automatically:
100
+
101
+ * Juwelier Generate `hello-gem.gemspec` and commit it
102
+ * Use `git` to tag `v0.1.0` and push it
103
+ * Build `hello-gem-0.1.0.gem` and push it to [rubygems.org](http://rubygems.org/gems/)
104
+
105
+ `rake release` accepts REMOTE(default: `origin`), LOCAL_BRANCH(default: `master`), REMOTE_BRANCH(default: `master`) and BRANCH(default: master)as options.
106
+
107
+ `$ rake release REMOTE=upstream LOCAL_BRANCH=critical-security-fix REMOTE_BRANCH=v3`
108
+
109
+ This will tag and push the commits on your local branch named `critical-security-fix` to branch named `v3` in remote named `upstream` (if you have commit rights
110
+ on `upstream`) and release the gem.
111
+
112
+ `$ rake release BRANCH=v3`
113
+
114
+ If both remote and local branches are the same, use `BRANCH` option to simplify.
115
+ This will tag and push the commits on your local branch named `v3` to branch named `v3` in remote named `origin` (if you have commit rights
116
+ on `origin`) and release the gem.
117
+
118
+ ### Version bumping
119
+
120
+ It feels good to release code. Do it, do it often. But before that, bump the version. Then release it. There's a few ways to update the version:
121
+
122
+ ```bash
123
+ # version:write like before
124
+ $ rake version:write MAJOR=0 MINOR=3 PATCH=0
125
+
126
+ # bump just major, ie 0.1.0 -> 1.0.0
127
+ $ rake version:bump:major
128
+
129
+ # bump just minor, ie 0.1.0 -> 0.2.0
130
+ $ rake version:bump:minor
131
+
132
+ # bump just patch, ie 0.1.0 -> 0.1.1
133
+ $ rake version:bump:patch
134
+ ```
135
+
136
+ Then it's the same `release` we used before:
137
+
138
+ `$ rake release`
139
+
140
+ ## Customizing your gem
141
+
142
+ If you've been following along so far, your gem is just a blank slate. You're going to need to make it colorful and full of metadata.
143
+
144
+ You can customize your gem by updating your `Rakefile`. With a newly generated project, it will look something like this:
145
+
146
+ ```ruby
147
+ require 'juwelier'
148
+ Juwelier::Tasks.new do |gem|
149
+ # gem is a Gem::Specification... see http://guides.rubygems.org/specification-reference/ for more options
150
+ gem.name = "whatwhatwhat"
151
+ gem.summary = %Q{TODO: one-line summary of your gem}
152
+ gem.description = %Q{TODO: longer description of your gem}
153
+ gem.email = "fred.mitchell@gmx.com"
154
+ gem.homepage = "http://github.com/flajann2/whatwhatwhat"
155
+ gem.authors = ["Joshua Nichols"]
156
+ end
157
+ JuwelierJuwelier::RubygemsDotOrgTasks.new
158
+ ```
159
+
160
+ It's crucial to understand the `gem` object is just a Gem::Specification. You can read up about it at [guides.rubygems.org/specification-reference](http://guides.rubygems.org/specification-reference/). This is the most basic way of specifying a gem, -managed or not. just exposes this to you, in addition to providing some reasonable defaults, which we'll explore now.
161
+
162
+ ### Project information
163
+
164
+ A short description about the configuration in the previous item.
165
+
166
+ - **gem.name**: Every gem has a name. Among other things, the gem name is how you are able to `gem install` it. [Reference](http://guides.rubygems.org/specification-reference/#name)
167
+
168
+ - **gem.summary**: This is a one line summary of your gem. This is displayed, for example, when you use `gem list --details` or view it on [rubygems.org](http://rubygems.org/gems/).
169
+
170
+ - **gem.description**: Description is a longer description. Scholars ascertain that knowledge of where the description is used was lost centuries ago.
171
+
172
+ - **gem.email**: This should be a way to get a hold of you regarding the gem.
173
+
174
+ - **gem.homepage**: The homepage should have more information about your gem. The juwelier generator guesses this based on the assumption your code lives on [GitHub](http://github.com/), using your Git configuration to find your GitHub username. This is displayed by `gem list --details` and on rubygems.org.
175
+
176
+ - **gem.authors**: Hey, this is you, the author (or me in this case). The `juwelier` generator also guesses this from your Git configuration. This is displayed by `gem list --details` and on rubygems.org.
177
+
178
+ ### Files
179
+
180
+ The quickest way to add more files is to `git add` them. Juwelier uses your git repository to populate your gem's files by including added and committed and excluding `.gitignore`d. In most cases, this is reasonable enough.
181
+
182
+ If you need to tweak the files, that's cool. Juwelier populates `gem.files` as a `Rake::FileList`. It's like a normal array, except you can `include` and `exclude` file globs:
183
+
184
+ ```ruby
185
+ gem.files.exclude 'tmp' # exclude temporary directory
186
+ gem.files.include 'lib/foo/bar.rb' # explicitly include lib/foo/bar.rb
187
+ ```
188
+
189
+ If that's not enough, you can just set `gem.files` outright
190
+
191
+ `gem.files = Dir.glob('lib/**/*.rb')`
192
+
193
+ ### Dependencies
194
+
195
+ Dependencies let you define other gems that your gem needs to function. `gem install your-gem` will install your-gem's dependencies along with it, and when you use your-gem in an application, the dependencies will be made available. Use `gem.add_dependency` to register them. [Reference](http://guides.rubygems.org/specification-reference/#add_development_dependency)
196
+
197
+ `gem.add_dependency 'nokogiri'`
198
+
199
+ This will ensure a version of `nokogiri` is installed, but it doesn't require anything more than that. You can provide extra args to be more specific:
200
+
201
+ ```ruby
202
+ gem.add_dependency 'nokogiri', '= 1.2.1' # exactly version 1.2.1
203
+ gem.add_dependency 'nokogiri', '>= 1.2.1' # greater than or equal to 1.2.1, ie, 1.2.1, 1.2.2, 1.3.0, 2.0.0, etc
204
+ gem.add_dependency 'nokogiri', '>= 1.2.1', '< 1.3.0' # greater than or equal to 1.2.1, but less than 1.3.0
205
+ gem.add_dependency 'nokogiri', '~> 1.2.1' # same thing, but more concise
206
+ ```
207
+
208
+ When specifying which version is required, there's a bit of the condunrum. You want to allow the most versions possible, but you want to be sure they are compatible. Using `>= 1.2.1` is fine most of the time, except until the point that 2.0.0 comes out and totally breaks backwards the API. That's when it's good to use `~> 1.2.1`, which requires any version in the `1.2` family, starting with `1.2.1`.
209
+
210
+ ### Executables
211
+
212
+ Executables let your gem install shell commands. Just put any executable scripts in the `bin/` directory, make sure they are added using `git`, and will take care of the rest.
213
+
214
+ When you need more finely grained control over it, you can set it yourself:
215
+
216
+ `gem.executables = ['foo'] # note, it's the file name relative to bin/, not the project root`
217
+
218
+ ### Versioning
219
+
220
+ We discussed earlier how to bump the version. The rake tasks are really just convience methods for manipulating the `VERSION` file. It just contains a version string, like `1.2.3`.
221
+
222
+ `VERSION` is a convention used by , and is used to populate `gem.version`. You can actually set this yourself, and won't try to override it:
223
+
224
+ `gem.version = '1.2.3'`
225
+
226
+ A common pattern is to have this in a version constant in your library. This is convenient, because users of the library can query the version they are using at runtime.
227
+
228
+ ```ruby
229
+ # in lib/foo/version.rb
230
+ class Foo
231
+ module Version
232
+ MAJOR = 1
233
+ MINOR = 2
234
+ PATCH = 3
235
+ BUILD = 'pre3'
236
+
237
+ STRING = [MAJOR, MINOR, PATCH, BUILD].compact.join('.')
238
+ end
239
+ end
240
+ ```
241
+
242
+ ```ruby
243
+ # in Rakefile
244
+ require 'juwelier'
245
+ require './lib/foo/version.rb'
246
+ Juwelier::Tasks.new do |gem|
247
+ # snip
248
+ gem.version = Foo::Version::STRING
249
+ end
250
+ ```
251
+
252
+ ### Rake tasks
253
+
254
+ Juwelier tasks lives inside of Rake. As a result, they are dear friends. But, that friendship doesn't interfere with typical Rake operations.
255
+
256
+ This means you can define your own namespaces, tasks, or use third party Rake libraries without cause for concern.
257
+
258
+ ## Contributing to
259
+
260
+ * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
261
+ * Ask on the [mailing list](http://groups.google.com/group/juwelier-rb) for feedback on your proposal, to see if somebody else has done it.
262
+ * Check out the [issue tracker](http://github.com/flajann2/juwelier/issues) to make sure someone already hasn't requested it and/or contributed it
263
+ * Fork the project
264
+ * Start a feature/bugfix branch
265
+ * Commit and push until you are happy with your contribution
266
+ * Make sure to add tests for the feature/bugfix. This is important so I don't break it in a future version unintentionally.
267
+ * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate it to its own commit so I can cherry-pick around it.
268
+
269
+ ## Copyright
270
+
271
+ Copyright (c) 2016 Fred Mitchell. See LICENSE for details.
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
4
+ version: 2.4.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fred Mitchell
@@ -238,6 +238,7 @@ files:
238
238
  - ".coveralls.yml"
239
239
  - ".document"
240
240
  - ".semver"
241
+ - ".semver.orig"
241
242
  - ".travis.yml"
242
243
  - ".yardopts"
243
244
  - ChangeLog.markdown
@@ -348,6 +349,7 @@ files:
348
349
  - lib/juwelier/templates/testunit/helper.rb
349
350
  - lib/juwelier/version.rb
350
351
  - lib/juwelier/version_helper.rb
352
+ - oldREADME.md
351
353
  - test/fixtures/bar/VERSION.yml
352
354
  - test/fixtures/bar/bin/foo_the_ultimate_bin
353
355
  - test/fixtures/bar/hey_include_me_in_gemspec