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 +4 -4
- data/example/Gemfile +1 -1
- data/example/Gemfile.lock +2 -2
- data/example/Rakefile +4 -1
- data/lib/joyce/tasks/build.rb +35 -57
- data/lib/joyce/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0d42e1e79a1140e554ac88148a552d2b0587d00f
|
4
|
+
data.tar.gz: f392da031015657bdbd66acf2dcb1ad09984440f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 307dd117a856a9328243eb805defef33cfbb8a32fe0e43cacd5a5e758c089d4d3c4c46f3205fe4c9f695da5b8cf8b5b99f85f7b2a61241b99c29c376af99f110
|
7
|
+
data.tar.gz: 1af7145be05a8df3df15da75c2e5878da645c92fa1dbee149ecc1b90a89ed8c08565aa3dc376a1995375e4c6dba5d39412502ac7bcff27064586b11cadc26fc1
|
data/example/Gemfile
CHANGED
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.
|
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.
|
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: "
|
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
|
data/lib/joyce/tasks/build.rb
CHANGED
@@ -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(
|
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
|
-
|
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
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
$stdout.reopen("/
|
40
|
-
$stderr.reopen("/
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
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
|
-
|
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
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
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
|
-
|
62
|
+
(gemspecs.map(&:name) - ignoring).sort
|
85
63
|
end
|
86
64
|
|
87
65
|
private
|
88
66
|
|
89
67
|
def gemspecs
|
90
|
-
|
68
|
+
@gemspecs ||= Bundler.definition.specs_for([:default])
|
91
69
|
end
|
92
70
|
end
|
93
71
|
end
|
data/lib/joyce/version.rb
CHANGED