macgap 0.0.5 → 0.0.6

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.
Files changed (5) hide show
  1. data/README.md +13 -4
  2. data/assets/index.html +34 -0
  3. data/bin/macgap +29 -8
  4. data/macgap.gemspec +1 -1
  5. metadata +2 -1
data/README.md CHANGED
@@ -8,12 +8,21 @@ For more information on MacGap, please see [its repository](http://github.com/ma
8
8
 
9
9
  gem install macgap
10
10
 
11
- macgap macgap [options] DIR
11
+ # macgap new DIR
12
+ # macgap build DIR
12
13
 
13
- For example:
14
+ For example, to create a new MacGap app use the `new` command:
14
15
 
15
- macgap --name MyApp --output ./build ./public
16
+ macgap new MyApp
17
+
18
+ To build a MacGap app use the `build` command, specifying the app's directory.
19
+
20
+ macgap build MyApp
21
+
22
+ # Advanced
23
+
24
+ Or a more advanced example:
16
25
 
17
- This will build `MyApp.app` in the specified `build` dir.
26
+ macgap build --name MyApp --output ./build ./public
18
27
 
19
28
  The directory (`DIR`) you specify should contain a file called `index.html` which will be loaded when the application starts.
@@ -0,0 +1,34 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>MacGap</title>
5
+ <style type="text/css" media="screen">
6
+ html, body {
7
+ height: 100%;
8
+ width: 100%;
9
+ background: #FFF;
10
+ padding: 0;
11
+ margin: 0;
12
+ overflow: hidden;
13
+ -webkit-user-select: none;
14
+ }
15
+
16
+ h1 {
17
+ color: #E0E0E0;
18
+ margin: 18% 0;
19
+ text-align: center;
20
+ font-family: helvetica;
21
+ }
22
+ </style>
23
+
24
+ <meta http-equiv="refresh" content="5;url=http://google.com">
25
+ </head>
26
+ <body>
27
+
28
+ <script type="text/javascript" charset="utf-8">
29
+ macgap.growl.notify({title: 'MacGap', content: 'Hello World'});
30
+ </script>
31
+
32
+ <h1>MacGap</h1>
33
+ </body>
34
+ </html>
data/bin/macgap CHANGED
@@ -7,9 +7,11 @@ require "fileutils"
7
7
  options = {}
8
8
 
9
9
  optparse = OptionParser.new do|opts|
10
- opts.banner = "Usage: macgap [options] DIR"
10
+ opts.banner = "Usage: macgag COMMAND [OPTIONS] DIR"
11
+ opts.banner += "\n\tAvailable commands are:"
12
+ opts.banner += "\n\t build - build application in DIR"
13
+ opts.banner += "\n\t new - new application in DIR"
11
14
 
12
- options[:name] = "MacGap"
13
15
  opts.on( "-n", "--name NAME", "Application name" ) do |name|
14
16
  options[:name] = name
15
17
  end
@@ -27,17 +29,34 @@ end
27
29
 
28
30
  optparse.parse!
29
31
 
30
- public_dir = ARGV[0]
32
+ command = ARGV[0]
33
+ public_dir = ARGV[1]
31
34
 
32
- unless public_dir
35
+ unless command && public_dir
33
36
  puts optparse
34
37
  exit
35
38
  end
36
39
 
37
40
  # Setup directories
38
- public_dir = Pathname.new(public_dir).expand_path
39
- build_dir = Pathname.new(options[:output]).join(options[:name] + ".app")
40
- lib_dir = Pathname.new(File.join(__FILE__, *%w{.. ..})).expand_path
41
+ public_dir = Pathname.new(public_dir).expand_path
42
+ options[:name] ||= public_dir.basename.to_s
43
+ build_dir = Pathname.new(options[:output]).join(options[:name] + ".app")
44
+ lib_dir = Pathname.new(File.join(__FILE__, *%w{.. ..})).expand_path
45
+
46
+ case command
47
+ when "build"
48
+ when "new"
49
+ public_dir.mkpath
50
+ FileUtils.cp_r(
51
+ lib_dir.join("assets", "index.html"),
52
+ public_dir
53
+ )
54
+ puts "Created application in #{public_dir}"
55
+ exit
56
+ else
57
+ puts optparse
58
+ exit
59
+ end
41
60
 
42
61
  FileUtils.rm_rf build_dir
43
62
  build_dir.parent.mkpath
@@ -74,4 +93,6 @@ FileUtils.cd build_dir.join("Contents") do
74
93
  plist = build_dir.join("Info.plist").read
75
94
  plist.gsub!("MacGap", options[:name])
76
95
  build_dir.join("Info.plist").open("w+") {|io| io.write plist }
77
- end
96
+ end
97
+
98
+ puts "Built application in #{build_dir.parent}"
@@ -3,7 +3,7 @@ $:.push File.expand_path("../lib", __FILE__)
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "macgap"
6
- s.version = "0.0.5"
6
+ s.version = "0.0.6"
7
7
  s.authors = ["Alex MacCaw"]
8
8
  s.email = ["info@eribium.org"]
9
9
  s.homepage = "http://github.com/maccman/macgap-rb"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: macgap
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -40,6 +40,7 @@ files:
40
40
  - assets/MacGap.app/Contents/Resources/en.lproj/MainMenu.nib
41
41
  - assets/MacGap.app/Contents/Resources/en.lproj/Window.nib
42
42
  - assets/MacGap.app/Contents/Resources/public/index.html
43
+ - assets/index.html
43
44
  - bin/macgap
44
45
  - macgap.gemspec
45
46
  - test/public/index.html