joyce 0.1.4 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9f3f7e98db904127cefcca9ec0707630dc98e623
4
- data.tar.gz: 57f1d846912a6954e4676d057036b098dcdd9308
3
+ metadata.gz: 4f674e642d790e256e97ba2fae4c7bbee2f2d72f
4
+ data.tar.gz: 58d3f39e91b3f878a3cc870757276ebb9e88d63b
5
5
  SHA512:
6
- metadata.gz: bed3d1ef1be0507643775a96251b7a6b59328165ba97f6d470ef693dbb062e281d0a75ce53861e6ea25143d87d4cb5ad8cbe65d724f274425c53b17ac3b44737
7
- data.tar.gz: b42084dee6ea088c408d52eacb3a91de3e42bfd45d3cbeb15a9d9e30c491a0e60be07b8a955e9c4bd110321ae8dd0a23fd3fa839fe5dc39bd3d6482fcfc25763
6
+ metadata.gz: ffd6d61babdd1c7f807f919016a1af58fd2720276d012cca08e6204e89a2f36086879cb213a5034d9ea76092f12131f1e653c2ad4970a118843bab70afc9169e
7
+ data.tar.gz: a8fc5bd435c42be4e0655a878ea20de7be086ec3eb28d75849ada58557ac8abcd5d19f9ac40ec884d0372459f3c97d0537b87eb7ebfd7175bc212bb92440e6ed
data/.gitignore CHANGED
@@ -4,3 +4,4 @@
4
4
  /doc/
5
5
  /pkg/
6
6
  /vendor/cache/*.gem
7
+ /dist/
data/Rakefile CHANGED
@@ -10,7 +10,6 @@ end
10
10
 
11
11
  require 'rake'
12
12
 
13
-
14
13
  require 'rubygems/tasks'
15
14
  Gem::Tasks.new
16
15
 
@@ -21,7 +20,7 @@ task :test => :spec
21
20
  task :default => :spec
22
21
 
23
22
  require 'yard'
24
- YARD::Rake::YardocTask.new
23
+ YARD::Rake::YardocTask.new
25
24
  task :doc => :yard
26
25
 
27
26
  require 'cucumber/rake/task'
@@ -29,3 +28,5 @@ require 'cucumber/rake/task'
29
28
  Cucumber::Rake::Task.new do |t|
30
29
  t.cucumber_opts = %w[--format pretty]
31
30
  end
31
+
32
+
@@ -0,0 +1,8 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # example app gemfile
4
+ gem 'joyce', '0.1.4'
5
+ gem 'bundler'
6
+ gem 'pry'
7
+
8
+ gem 'rake'
@@ -0,0 +1,77 @@
1
+ GEM
2
+ remote: https://rubygems.org/
3
+ specs:
4
+ actionpack (4.2.6)
5
+ actionview (= 4.2.6)
6
+ activesupport (= 4.2.6)
7
+ rack (~> 1.6)
8
+ rack-test (~> 0.6.2)
9
+ rails-dom-testing (~> 1.0, >= 1.0.5)
10
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
11
+ actionview (4.2.6)
12
+ activesupport (= 4.2.6)
13
+ builder (~> 3.1)
14
+ erubis (~> 2.7.0)
15
+ rails-dom-testing (~> 1.0, >= 1.0.5)
16
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
17
+ activesupport (4.2.6)
18
+ i18n (~> 0.7)
19
+ json (~> 1.7, >= 1.7.7)
20
+ minitest (~> 5.1)
21
+ thread_safe (~> 0.3, >= 0.3.4)
22
+ tzinfo (~> 1.1)
23
+ builder (3.2.2)
24
+ coderay (1.1.1)
25
+ erubis (2.7.0)
26
+ gosu (0.10.6)
27
+ i18n (0.7.0)
28
+ joyce (0.1.3)
29
+ actionpack (~> 4.2)
30
+ gosu (~> 0.10)
31
+ metacosm (~> 0.3)
32
+ json (1.8.3)
33
+ loofah (2.0.3)
34
+ nokogiri (>= 1.5.9)
35
+ metacosm (0.3.2)
36
+ passive_record (~> 0.4)
37
+ redis (~> 3.2)
38
+ method_source (0.8.2)
39
+ mini_portile2 (2.0.0)
40
+ minitest (5.8.4)
41
+ nokogiri (1.6.7.2)
42
+ mini_portile2 (~> 2.0.0.rc2)
43
+ passive_record (0.4.3)
44
+ activesupport (~> 4.2)
45
+ pry (0.10.3)
46
+ coderay (~> 1.1.0)
47
+ method_source (~> 0.8.1)
48
+ slop (~> 3.4)
49
+ rack (1.6.4)
50
+ rack-test (0.6.3)
51
+ rack (>= 1.0)
52
+ rails-deprecated_sanitizer (1.0.3)
53
+ activesupport (>= 4.2.0.alpha)
54
+ rails-dom-testing (1.0.7)
55
+ activesupport (>= 4.2.0.beta, < 5.0)
56
+ nokogiri (~> 1.6.0)
57
+ rails-deprecated_sanitizer (>= 1.0.1)
58
+ rails-html-sanitizer (1.0.3)
59
+ loofah (~> 2.0)
60
+ rake (11.1.2)
61
+ redis (3.3.0)
62
+ slop (3.6.0)
63
+ thread_safe (0.3.5)
64
+ tzinfo (1.2.2)
65
+ thread_safe (~> 0.1)
66
+
67
+ PLATFORMS
68
+ ruby
69
+
70
+ DEPENDENCIES
71
+ bundler
72
+ joyce (= 0.1.3)
73
+ pry
74
+ rake
75
+
76
+ BUNDLED WITH
77
+ 1.11.2
@@ -0,0 +1,11 @@
1
+ require 'rubygems'
2
+ require 'bundler/setup'
3
+ require 'fileutils'
4
+ require 'joyce'
5
+ require 'joyce/tasks/build'
6
+
7
+ task :app do
8
+ Joyce::Tasks::AppBuilder.new.make({
9
+ app_name: "Joyce Example App"
10
+ })
11
+ end
@@ -8,18 +8,16 @@ module Example
8
8
  end
9
9
 
10
10
  def game_view
11
- GameView.find_by active_player_id: application.player_id
11
+ GameView.find_by(active_player_id: application.player_id)
12
12
  end
13
13
  end
14
14
 
15
15
  class SampleServer < Joyce::Server
16
16
  def setup
17
- # p [ :sample_server_setup ]
18
17
  Game.create
19
18
  end
20
19
 
21
20
  def tick
22
- # p [ :sample_server_tick ]
23
21
  Game.all.each(&:iterate!)
24
22
  end
25
23
  end
@@ -28,7 +26,6 @@ module Example
28
26
  viewed_with Example::SampleAppView
29
27
 
30
28
  def setup
31
- # p [ :sample_app_setup ]
32
29
  GameView.create(active_player_id: player_id)
33
30
  sim.params[:active_player_id] = player_id
34
31
  end
@@ -36,7 +33,6 @@ module Example
36
33
  def tick
37
34
  @ticks ||= 0
38
35
  @ticks += 1
39
- # p [ :sample_app_tick ]
40
36
  if (@ticks % 30 == 0)
41
37
  fire(PingCommand.create(player_id: player_id, player_name: player_name))
42
38
  end
@@ -0,0 +1,8 @@
1
+ # load deps and kickstart the app
2
+ require 'rubygems'
3
+ # require 'bundler/setup'
4
+
5
+ require 'joyce'
6
+ require 'application'
7
+
8
+ Example::Application.kickstart!
@@ -0,0 +1,88 @@
1
+ module Joyce
2
+ module Tasks
3
+ class AppBuilder
4
+ include FileUtils
5
+
6
+ def make(app_name:)
7
+ target_app_bundle_root = File.join("..", "dist", "#{app_name}.app")
8
+
9
+ puts "--- build os x app here!"
10
+ cp_r "../dist/Ruby.app", target_app_bundle_root
11
+ puts "--- Ruby.app copied!"
12
+
13
+ puts "--- Analyzing your gems..."
14
+ p Bundler.definition.specs_for([:default])
15
+
16
+ puts "--- Okay, let's copy gems in..."
17
+
18
+ gem_destination = "#{target_app_bundle_root}/Contents/Resources/vendor"
19
+
20
+ # info "Copying source gems from system"
21
+ binary_gems_to_ignore = %w[ gosu minitest ]
22
+ gem_list = vendored_gem_names(ignoring: binary_gems_to_ignore)
23
+ copy_gems(gem_list, destination: File.join(gem_destination))
24
+ write_main_rb(root: target_app_bundle_root) #(app_class: "#{app_name}::Application")
25
+ end
26
+
27
+ def write_main_rb(root:)
28
+ File.open("#{root}/Contents/Resources/main.rb", "w") do |file|
29
+ require_paths = gemspecs.map do |spec|
30
+ spec.require_paths.map {|path| "#{spec.name}-#{spec.version}/#{path}" }
31
+ end
32
+
33
+ file.puts <<-ruby
34
+ $stdout.reopen("/Users/joe/joyce/game.log", "w")
35
+ $stderr.reopen("/Users/joe/joyce/err.log", "w")
36
+
37
+ puts "--- unshifting gem paths"
38
+
39
+ GEM_REQUIRE_PATHS = #{require_paths.flatten.inspect}
40
+
41
+ GEM_REQUIRE_PATHS.each do |path|
42
+ $LOAD_PATH.unshift File.expand_path(File.join("../vendor/gems", path), __FILE__)
43
+ end
44
+
45
+ puts "--- gems shifted"
46
+
47
+ require 'joyce'
48
+ require 'application'
49
+
50
+ Example::Application.kickstart!
51
+ ruby
52
+ end
53
+ end
54
+
55
+ # the gem approach from releasy: https://github.com/Spooner/releasy/blob/master/lib/releasy/mixins/has_gemspecs.rb
56
+ # basically just copy over your own system gems, ignoring binary things
57
+ # then we'll write out a prelude in main.rb that $unshifts the load path for each of these :/
58
+ # but it should almost certainly work!
59
+ def copy_gems(gems, destination:)
60
+ gems_dir = "#{destination}/gems"
61
+ # specs_dir = "#{destination}/specifications"
62
+ mkdir_p gems_dir #, fileutils_options
63
+ # mkdir_p specs_dir, fileutils_options
64
+
65
+ gems.each do |gem|
66
+ spec = gemspecs.find {|g| g.name == gem }
67
+ gem_dir = spec.full_gem_path
68
+ puts "Copying gem: #{spec.name} #{spec.version}"
69
+
70
+ cp_r gem_dir, gems_dir
71
+ #, fileutils_options
72
+ # spec_file = File.expand_path("../../specifications/#{File.basename gem_dir}.gemspec", gem_dir)
73
+ # cp_r spec_file, specs_dir, fileutils_options
74
+ end
75
+ end
76
+
77
+ def vendored_gem_names(ignoring:)
78
+ (gemspecs.map(&:name) - ignoring).sort
79
+ end
80
+
81
+ private
82
+
83
+ def gemspecs
84
+ @gemspecs ||= Bundler.definition.specs_for([:default])
85
+ end
86
+ end
87
+ end
88
+ end
@@ -1,4 +1,4 @@
1
1
  module Joyce
2
2
  # joyce version
3
- VERSION = "0.1.4"
3
+ VERSION = "0.1.5"
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: joyce
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joseph Weissman
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-20 00:00:00.000000000 Z
11
+ date: 2016-04-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gosu
@@ -171,7 +171,11 @@ files:
171
171
  - Rakefile
172
172
  - bin/joyce
173
173
  - dump.rdb
174
+ - example/Gemfile
175
+ - example/Gemfile.lock
176
+ - example/Rakefile
174
177
  - example/application.rb
178
+ - example/main.rb
175
179
  - example/models/game.rb
176
180
  - example/models/player.rb
177
181
  - features/.gitkeep
@@ -182,6 +186,7 @@ files:
182
186
  - joyce.gemspec
183
187
  - lib/joyce.rb
184
188
  - lib/joyce/application.rb
189
+ - lib/joyce/tasks/build.rb
185
190
  - lib/joyce/version.rb
186
191
  - spec/joyce_spec.rb
187
192
  - spec/spec_helper.rb