joyce 0.1.6 → 0.1.7

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: 2fa1b198571ca80749e7e0e1ca01ed9df2e2c233
4
- data.tar.gz: 8d267c34c5eb8b3419963bfa2202b901d7b6ab88
3
+ metadata.gz: 0d42e1e79a1140e554ac88148a552d2b0587d00f
4
+ data.tar.gz: f392da031015657bdbd66acf2dcb1ad09984440f
5
5
  SHA512:
6
- metadata.gz: 8a7b5193272e1b1152fedd96a4298367bc329f300e05eaa14a18ae7c1d923526cb240b03a61473a0df83a369d00e384d13162b44a2f446a0c579f76e68719ea6
7
- data.tar.gz: e96a5f0d8c8d603e90505b6811af0df21f6e42bad2bd1a3a2285dd72f293a072b6946c666ec838bbf3fd0926d64aa96272cdd53d6d34cb4b3a8181b44c681962
6
+ metadata.gz: 307dd117a856a9328243eb805defef33cfbb8a32fe0e43cacd5a5e758c089d4d3c4c46f3205fe4c9f695da5b8cf8b5b99f85f7b2a61241b99c29c376af99f110
7
+ data.tar.gz: 1af7145be05a8df3df15da75c2e5878da645c92fa1dbee149ecc1b90a89ed8c08565aa3dc376a1995375e4c6dba5d39412502ac7bcff27064586b11cadc26fc1
data/example/Gemfile CHANGED
@@ -1,7 +1,7 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
3
  # example app gemfile
4
- gem 'joyce', '0.1.5'
4
+ gem 'joyce', '0.1.6'
5
5
  gem 'bundler'
6
6
  gem 'pry'
7
7
 
data/example/Gemfile.lock CHANGED
@@ -25,7 +25,7 @@ GEM
25
25
  erubis (2.7.0)
26
26
  gosu (0.10.6)
27
27
  i18n (0.7.0)
28
- joyce (0.1.5)
28
+ joyce (0.1.6)
29
29
  actionpack (~> 4.2)
30
30
  gosu (~> 0.10)
31
31
  metacosm (~> 0.3)
@@ -69,7 +69,7 @@ PLATFORMS
69
69
 
70
70
  DEPENDENCIES
71
71
  bundler
72
- joyce (= 0.1.5)
72
+ joyce (= 0.1.6)
73
73
  pry
74
74
  rake
75
75
 
data/example/Rakefile CHANGED
@@ -6,6 +6,9 @@ require 'joyce/tasks/build'
6
6
 
7
7
  task :app do
8
8
  Joyce::Tasks::AppBuilder.new.make({
9
- app_name: "Joyce Example App"
9
+ app_name: "joyce-example",
10
+ app_class_name: 'Example::Application',
11
+ template_location: "../dist/Ruby.app",
12
+ target_directory: "../dist"
10
13
  })
11
14
  end
@@ -3,91 +3,69 @@ module Joyce
3
3
  class AppBuilder
4
4
  include FileUtils
5
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
6
+ def make(app_name:, app_class_name:, template_location:, target_directory:)
7
+ target_app_bundle_root = File.join(target_directory, "#{app_name}.app")
8
+ cp_r template_location, target_app_bundle_root
11
9
  puts "--- Ruby.app copied!"
12
10
 
13
11
  puts "--- copying your source code..."
14
- cp_r "lib", "#{target_app_bundle_root}/Contents/Resources/lib"
15
-
16
- puts "--- Analyzing your gems..."
17
- p Bundler.definition.specs_for([:default])
18
-
19
- puts "--- Okay, let's copy gems in..."
12
+ cp_r "lib/.", "#{target_app_bundle_root}/Contents/Resources/lib"
13
+ puts "--- source code copied in!"
20
14
 
15
+ puts "--- let's copy gems in..."
21
16
  gem_destination = "#{target_app_bundle_root}/Contents/Resources/vendor"
22
17
 
23
- # info "Copying source gems from system"
24
18
  binary_gems_to_ignore = %w[ gosu minitest ]
25
19
  gem_list = vendored_gem_names(ignoring: binary_gems_to_ignore)
26
20
 
27
21
  copy_gems(gem_list, destination: File.join(gem_destination))
22
+ puts "--- gems copied"
28
23
 
29
- write_main_rb(root: target_app_bundle_root) #(app_class: "#{app_name}::Application")
24
+ puts "--- writing main.rb..."
25
+ write_main_rb(app_class_name: app_class_name, root: target_app_bundle_root, app_name: app_name)
26
+ puts "--- main.rb written!"
30
27
  end
31
28
 
32
- def write_main_rb(root:)
33
- File.open("#{root}/Contents/Resources/main.rb", "w") do |file|
34
- require_paths = gemspecs.map do |spec|
35
- spec.require_paths.map {|path| "#{spec.name}-#{spec.version}/#{path}" }
36
- end
37
-
38
- file.puts <<-ruby
39
- $stdout.reopen("/Users/joe/joyce/game.log", "w")
40
- $stderr.reopen("/Users/joe/joyce/err.log", "w")
41
-
42
- puts "--- unshifting gem paths"
43
-
44
- GEM_REQUIRE_PATHS = #{require_paths.flatten.inspect}
45
-
46
- GEM_REQUIRE_PATHS.each do |path|
47
- $LOAD_PATH.unshift File.expand_path(File.join("../vendor/gems", path), __FILE__)
48
- end
49
-
50
- puts "--- gems shifted"
51
-
52
- require 'forwardable'
29
+ def write_main_rb(root:,app_name:,app_class_name:)
30
+ File.open("#{root}/Contents/Resources/main.rb", "w") do |file|
31
+ require_paths = gemspecs.map do |spec|
32
+ spec.require_paths.map {|path| "#{spec.name}-#{spec.version}/#{path}" }
33
+ end
34
+
35
+ file.puts <<-ruby
36
+ $stdout.reopen("#{Dir.home}/#{app_name}/app.log", "w")
37
+ $stderr.reopen("#{Dir.home}/#{app_name}/err.log", "w")
38
+ GEM_REQUIRE_PATHS = #{require_paths.flatten.inspect}
39
+ GEM_REQUIRE_PATHS.each do |path|
40
+ $LOAD_PATH.unshift File.expand_path(File.join("../vendor/gems", path), __FILE__)
41
+ end
53
42
  require 'joyce'
54
43
  require 'application'
55
-
56
- Example::Application.kickstart!
44
+ #{app_class_name}.kickstart!
57
45
  ruby
58
- end
46
+ end
59
47
  end
60
48
 
61
49
  # the gem approach from releasy: https://github.com/Spooner/releasy/blob/master/lib/releasy/mixins/has_gemspecs.rb
62
- # basically just copy over your own system gems, ignoring binary things
63
- # then we'll write out a prelude in main.rb that $unshifts the load path for each of these :/
64
- # but it should almost certainly work!
65
50
  def copy_gems(gems, destination:)
66
- gems_dir = "#{destination}/gems"
67
- # specs_dir = "#{destination}/specifications"
68
- mkdir_p gems_dir #, fileutils_options
69
- # mkdir_p specs_dir, fileutils_options
70
-
71
- gems.each do |gem|
72
- spec = gemspecs.find {|g| g.name == gem }
73
- gem_dir = spec.full_gem_path
74
- puts "Copying gem: #{spec.name} #{spec.version}"
75
-
76
- cp_r gem_dir, gems_dir
77
- #, fileutils_options
78
- # spec_file = File.expand_path("../../specifications/#{File.basename gem_dir}.gemspec", gem_dir)
79
- # cp_r spec_file, specs_dir, fileutils_options
80
- end
51
+ gems_dir = "#{destination}/gems"
52
+ mkdir_p gems_dir
53
+ gems.each do |gem|
54
+ spec = gemspecs.find { |g| g.name == gem }
55
+ gem_dir = spec.full_gem_path
56
+ puts "Copying gem: #{spec.name} #{spec.version}"
57
+ cp_r gem_dir, gems_dir
58
+ end
81
59
  end
82
60
 
83
61
  def vendored_gem_names(ignoring:)
84
- (gemspecs.map(&:name) - ignoring).sort
62
+ (gemspecs.map(&:name) - ignoring).sort
85
63
  end
86
64
 
87
65
  private
88
66
 
89
67
  def gemspecs
90
- @gemspecs ||= Bundler.definition.specs_for([:default])
68
+ @gemspecs ||= Bundler.definition.specs_for([:default])
91
69
  end
92
70
  end
93
71
  end
data/lib/joyce/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module Joyce
2
2
  # joyce version
3
- VERSION = "0.1.6"
3
+ VERSION = "0.1.7"
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: joyce
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joseph Weissman