cf3 1.0.0 → 1.0.1

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
  SHA256:
3
- metadata.gz: b71a0ec8b28c1fd599073b44c0d22ae1522d505b7969a535edf3dfed706491ad
4
- data.tar.gz: 36e50b4f45a4e77c6937e2e268f654c8563647045c44824c798cfb18879f3494
3
+ metadata.gz: cb9b632a3a5525bed8fd4b32f510abe90989add50b50ae31bfe5b60adef1c23b
4
+ data.tar.gz: 3ba5755cb4d30945ba2e320dbfea7b21c450e6b79b6915517553ad1e1a5e7f34
5
5
  SHA512:
6
- metadata.gz: d7d53015eeaff4ffe3b5a641c29e1774ce02ed669f2b4447b2da66d6babbc03c58c48b9c69292bc10ba71895069bc03a22f078aaff1337a434f8a5384234d581
7
- data.tar.gz: 4aca28d84f49c8f11bda4f028c20c8b9334eed0cab8259f3011129ff1f3c8e72d4dd4dcb67f7afc310e9525e1b36041d96dacb1a8b25d418d7fb81eda282c1ad
6
+ metadata.gz: 7dec9e31905d9748f19d32cd3c6905d053901dfa72754e88259ba29f6349251e6b9611be8d49834fa86ebbc9ebd0fd82c31ed91925a9e82ab27cb0813d895066
7
+ data.tar.gz: e57f11ec2c5e561294efe2c21d71efc22d3dd7259fa6d01c89c9a291f1fd7037774942d15ad96763926b8853a2ea77273f3f60f715a9a641ef11d50359848177
data/.gitignore CHANGED
@@ -18,3 +18,5 @@ spec/reports
18
18
  test/tmp
19
19
  test/version_tmp
20
20
  tmp
21
+ docs/_site
22
+
@@ -1,6 +1,8 @@
1
- v1.0.0 About time for a regular release number, fixed and update some examples NB: see also https://github.com/funatsufumiya/cf3ruby_sketches
1
+ v1.0.1 Created a website in docs folder (gemfile points to new website, that links to wiki and back to repo). Re-factored `class_eval` to `instance_eval` and added guards, somewhat simplifies code
2
2
 
3
- v0.0.7 Update for processing3 and JRubyArt by Funatsufumiya san (aka funniti)
3
+ v1.0.0 About time for a regular release number, fixed and update some examples NB: see also [Funatsufumiya san sketches][funniti]
4
+
5
+ v0.0.7 Update for processing3 and JRubyArt by Funatsufumiya san (aka [funniti][funniti])
4
6
 
5
7
  v0.0.6 Some tidy up remove @finished
6
8
 
@@ -21,3 +23,6 @@ v0.0.2 Second Gem Release
21
23
  v0.0.1. First Gem Release
22
24
  * very much base on jashkenas context-free.rb updated
23
25
  * for ruby-1.9 syntax (and DSL nearer to CF3 than the original cfdg)
26
+
27
+
28
+ [funniti]:https://github.com/funatsufumiya/cf3ruby_sketches
@@ -7,10 +7,10 @@
7
7
  home = ENV["HOME"]
8
8
  local = home + '/cf3work'
9
9
  file = __FILE__
10
- require "pathname"
10
+ require "pathname"
11
11
  require "fileutils"
12
12
  file = Pathname.new(file).realpath
13
13
 
14
14
  sample_dir = File.expand_path(File.dirname(file) + "/../samples")
15
- FileUtils.mkdir local unless Dir.exists? local
15
+ FileUtils.mkdir local unless Dir.exist? local
16
16
  FileUtils.cp_r sample_dir, local
@@ -16,7 +16,7 @@ Gem::Specification.new do |spec|
16
16
  predict what you are going to get.
17
17
  EOF
18
18
  spec.summary = %q{A ruby-DSL library for CF3 sketches}
19
- spec.homepage = 'http://learning-ruby-processing.blogspot.co.uk/'
19
+ spec.homepage = "http://monkstone.github.io/cf3ruby/"
20
20
  spec.default_executable = 'cf3samples'
21
21
  spec.licenses = %w(GPL-3.0 LGPL-2.0)
22
22
  spec.files = `git ls-files`.split($/)
@@ -0,0 +1 @@
1
+ ### Welcome to cf3ruby gem project
@@ -0,0 +1,31 @@
1
+ # Site settings
2
+ port: 4000
3
+ title: ContextFreeArt gem for JRubyArt
4
+ email: mamba2928@yahoo.co.uk
5
+ description: > # this means to ignore newlines until "baseurl:"
6
+ The cf3ruby gem is a kind of ruby DSL for contextfreeart. It is just a toy
7
+ really see https://www.contextfreeart.org/ for original.
8
+ baseurl: "" # the subpath of your site, e.g. /blog
9
+ regenerate: true
10
+ url: "https://monkstone.github.io/cf3ruby"
11
+
12
+ urls:
13
+ bugs: https://github.com/monkstone/cf3ruby/issues
14
+ github: https://github.com/monkstone/cf3ruby
15
+ twitter_username: monkstoneT
16
+ github_username: monkstone
17
+
18
+ theme: jekyll-theme-cayman
19
+
20
+ syntax-highlighting:
21
+ enabled: true
22
+
23
+ sass:
24
+ sass_dir: _sass
25
+
26
+ # Build settings
27
+ markdown: kramdown
28
+ gems:
29
+ - jekyll-sitemap
30
+ - jekyll-feed
31
+ - jekyll-seo-tag
@@ -0,0 +1,14 @@
1
+ ---
2
+ layout: default
3
+ title: Welcome to cf3ruby gem website
4
+ permalink: /about/
5
+ categories: jruby_art contextfreeart
6
+ ---
7
+ The inspiration for cf3ruby is [contextfreeart][] and the jashkenas [original][], so what is context free art?
8
+
9
+ Chris Coyne created a small language for design grammars called CFDG. These grammars are sets of non-deterministic rules to produce images. The images are surprisingly beautiful, often from very simple grammars.
10
+ In the original version there were 3 terminals of a TRIANGLE, SQUARE and CIRCLE see cfdg [how_to][].
11
+
12
+ [contextfreeart]:http://www.contextfreeart.org/
13
+ [original]:https://github.com/jashkenas/context_free
14
+ [how_to]:http://www.contextfreeart.org/mediawiki/index.php/CFDG_HOWTO
Binary file
@@ -0,0 +1,73 @@
1
+ ---
2
+ layout: default
3
+ title: A simple example with weighted shapes
4
+ permalink: /example/
5
+ categories: jruby_art contextfreeart
6
+ ---
7
+ ```ruby
8
+ # city.rb after city.cfdg
9
+
10
+ require 'cf3'
11
+
12
+ def setup_the_city
13
+ @city = ContextFree.define do
14
+
15
+ shape :neighborhood do
16
+ split do
17
+ block x: -0.25, y: -0.25
18
+ rewind
19
+ block x: 0.25, y: -0.25
20
+ rewind
21
+ block x: 0.25, y: 0.25
22
+ rewind
23
+ block x: -0.25, y: 0.25
24
+ end
25
+ end
26
+
27
+ shape :block do
28
+ buildings size: 0.85
29
+ end
30
+
31
+ shape :block, 5 do
32
+ neighborhood size: 0.5, rotation: rand(-PI..PI), hue: rand(2), brightness: rand(0.75..1.75)
33
+ end
34
+
35
+ shape :block, 0.1 do
36
+ # Do nothing
37
+ end
38
+
39
+ shape :buildings do
40
+ square
41
+ end
42
+
43
+ end
44
+ end
45
+
46
+ def settings
47
+ size 600, 600
48
+ end
49
+
50
+ def setup
51
+ sketch_title 'City'
52
+ setup_the_city
53
+ @background = color 255, 255, 255
54
+ draw_it
55
+ end
56
+
57
+ def draw
58
+ # Do nothing
59
+ end
60
+
61
+ def draw_it
62
+ background @background
63
+ @city.render :neighborhood,
64
+ start_x: width/2, start_y: height/2,
65
+ size: height/2.5, color: [0.1, 0.1, 0.1]
66
+ end
67
+
68
+ def mouse_clicked
69
+ draw_it
70
+ end
71
+
72
+
73
+ ```
Binary file
@@ -0,0 +1,10 @@
1
+ ---
2
+ layout: default
3
+ title: Welcome to cf3ruby gem website
4
+ categories: jruby_art contextfreeart
5
+ ---
6
+
7
+ ### Example output
8
+ [About]({{ site.github.url }}/about) [Example]({{ site.github.url }}/example) [Wiki](https://github.com/monkstone/cf3ruby/wiki)
9
+
10
+ ![y.png]({{ site.github.url }}/assets/y.png)
data/lib/cf3.rb CHANGED
@@ -51,19 +51,17 @@ module Processing
51
51
  total = @rules[rule_name][:total]
52
52
  @rules[rule_name][:procs] << [(total...(prob + total)), proc]
53
53
  @rules[rule_name][:total] += prob
54
- unless ContextFree.method_defined? rule_name
55
- self.class.class_eval do
56
- eval <<-METH
57
- def #{rule_name}(options)
58
- merge_options(@values, options)
59
- pick = determine_rule(#{rule_name.inspect})
60
- unless (@values[:size] - @values[:stop_size]) < 0
61
- prepare_to_draw
62
- pick[1].call(options)
63
- end
64
- end
65
- METH
54
+ return if ContextFree.method_defined? rule_name
55
+ self.instance_eval do
56
+ eval <<-METH
57
+ def #{rule_name}(options)
58
+ merge_options(@values, options)
59
+ pick = determine_rule(#{rule_name.inspect})
60
+ return if (@values[:size] - @values[:stop_size]) < 0
61
+ prepare_to_draw
62
+ pick[1].call(options)
66
63
  end
64
+ METH
67
65
  end
68
66
  end
69
67
 
@@ -1,3 +1,3 @@
1
1
  module Cf3
2
- VERSION = '1.0.0'
2
+ VERSION = '1.0.1'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cf3
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Ashkenas
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2018-02-10 00:00:00.000000000 Z
12
+ date: 2018-02-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: jruby_art
@@ -68,7 +68,7 @@ extra_rdoc_files: []
68
68
  files:
69
69
  - ".gitignore"
70
70
  - ".yardopts"
71
- - CHANGELOG
71
+ - CHANGELOG.md
72
72
  - CONTRIBUTING.md
73
73
  - Gemfile
74
74
  - LICENSE.md
@@ -76,6 +76,27 @@ files:
76
76
  - Rakefile
77
77
  - bin/cf3samples
78
78
  - cf3ruby.gemspec
79
+ - docs/.sass-cache/cd612fe6616e7f514a2421dc73159618de35b85d/jekyll-theme-cayman.scssc
80
+ - docs/.sass-cache/cd612fe6616e7f514a2421dc73159618de35b85d/normalize.scssc
81
+ - docs/.sass-cache/cd612fe6616e7f514a2421dc73159618de35b85d/rouge-github.scssc
82
+ - docs/.sass-cache/cd612fe6616e7f514a2421dc73159618de35b85d/variables.scssc
83
+ - docs/README.md
84
+ - docs/_config.yml
85
+ - docs/_site/README.md
86
+ - docs/_site/about/index.html
87
+ - docs/_site/assets/css/style.css
88
+ - docs/_site/assets/y.png
89
+ - docs/_site/example/index.html
90
+ - docs/_site/favicon.ico
91
+ - docs/_site/feed.xml
92
+ - docs/_site/index.html
93
+ - docs/_site/robots.txt
94
+ - docs/_site/sitemap.xml
95
+ - docs/about.md
96
+ - docs/assets/y.png
97
+ - docs/example.md
98
+ - docs/favicon.ico
99
+ - docs/index.md
79
100
  - lib/cf3.rb
80
101
  - lib/cf3/version.rb
81
102
  - samples/Rakefile
@@ -103,7 +124,7 @@ files:
103
124
  - samples/xcross.rb
104
125
  - samples/y.rb
105
126
  - test/test_cf3.rb
106
- homepage: http://learning-ruby-processing.blogspot.co.uk/
127
+ homepage: http://monkstone.github.io/cf3ruby/
107
128
  licenses:
108
129
  - GPL-3.0
109
130
  - LGPL-2.0
@@ -124,7 +145,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
124
145
  version: '0'
125
146
  requirements: []
126
147
  rubyforge_project:
127
- rubygems_version: 2.7.4
148
+ rubygems_version: 2.7.6
128
149
  signing_key:
129
150
  specification_version: 4
130
151
  summary: A ruby-DSL library for CF3 sketches