flex-sdk 0.3.1 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,45 +1,76 @@
1
1
  # flex-sdk
2
2
 
3
- Provides the FlexSDK for building the Flex applications
3
+ Provides a Gemified wrapper for the FlexSDK, for building Flex applications in other projects.
4
+
5
+ Note: This Gem does not provide or redistribute the actual Flex SDK, only a way to download it and build against it in other projects.
4
6
 
5
7
  ## Installation
6
8
 
7
- This gem is (or at least should be) included in a Gemfile for the project.
9
+ This gem is (or at least should be) included in a Gemfile for the project that requires the Flex SDK.
8
10
 
9
- The Gemfile should have a line something like this:
11
+ The Flex Project's Gemfile should have a line something like this:
10
12
 
11
- gem "flex-sdk", :git => "git://github.com/visfleet/flex-sdk.git"
13
+ gem "flex-sdk"
12
14
 
13
15
  It could also probably be put in a "build" group. This would mean that Rails won't attempt to load it during normal operation, only during Rake tasks. Like this:
14
16
 
15
17
  group :build do
16
- gem "flex-sdk", :git => "git://github.com/visfleet/flex-sdk.git"
18
+ gem "flex-sdk"
17
19
  end
18
20
 
19
- ## Usage
21
+ ## Usage in Ruby
22
+
23
+ require 'flex-sdk'
24
+ ...
25
+ flexsdk = FlexSDK.new
26
+ ...
27
+ config = flexsdk.config
28
+ ...
29
+ config["sdk_dir"]
30
+ => "/Volumes/Data/git/flex-sdk/vendor/flex_sdk_3.5.0.12683"
31
+
32
+ flexsdk.download(config)
33
+ => "Downloading SDK"
34
+ => "From: http://fpdownload.adobe.com/pub/flex/sdk/builds/flex3/flex_sdk_3.5.0.12683.zip"
35
+ => "To: /Volumes/Data/git/flex-sdk/vendor/flex_sdk_3.5.0.12683.zip"
36
+
37
+ flexsdk.unzip(config)
38
+ => "Unzipping SDK"
39
+ => "From: /Volumes/Data/git/flex-sdk/vendor/flex_sdk_3.5.0.12683.zip"
40
+ => "To: /Volumes/Data/git/flex-sdk/vendor/flex_sdk_3.5.0.12683/"
41
+
42
+ ## Usage in Bash
43
+
44
+ To download and unzip the Flex SDK from Adobe site, into vendor/ in this Gem
45
+
46
+ bundle exec flex-sdk-prime
47
+
48
+ Report the installation path of the Flex SDK
49
+
50
+ bundle exec flex-sdk-path
20
51
 
21
- TODO
22
52
 
23
53
  ## Upgrading the SDK version used in this Gem
24
54
 
25
- Update the SDK version in the Rakefile of this project, e.g
55
+ Edit config.yml and update the version number. Make sure that this is a valid version on the Adobe website. e.g:
26
56
 
27
- sdk_ver = "3.5.0.12683"
57
+ sdk_ver: "3.5.0.12683"
58
+
28
59
  Bump the version of this gem
29
60
 
30
61
  rake version:bump:minor
62
+
31
63
  Release
32
64
 
33
65
  rake release
34
66
 
35
67
  ## Copylocale
36
68
 
37
- Once the SDK in downloaded, unzipped and copied in, this project (flex-sdk) has a Rake task to do the copylocale thing:
69
+ Once the SDK is downloaded, unzipped and copied in, this project (flex-sdk) has a method to do the copylocale thing:
38
70
 
39
- rake flex:copy_locale
71
+ flexsdk.copylocale(config)
40
72
 
41
73
  In the old money, this is the same as doing:
42
74
 
43
75
  (Old way) bin/copylocale en_US en_NZ
44
-
45
- Once this is done, make sure you commit / push back to GitHub.
76
+
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.1
1
+ 0.3.2
@@ -8,4 +8,4 @@ config = flexsdk.config
8
8
 
9
9
  flexsdk.download(config)
10
10
  flexsdk.unzip(config)
11
-
11
+ puts "Done. Flex SDK should now be ready for building\n\n"
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{flex-sdk}
8
- s.version = "0.3.1"
8
+ s.version = "0.3.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Jonathan Hoskin"]
@@ -1,14 +1,17 @@
1
1
  class FlexSDK
2
2
 
3
+ # Create a hash of configuration objects, some from config.yml, the rest figured out
3
4
  def config
4
5
  require 'yaml'
5
6
  config = YAML.load_file(File.expand_path(File.join((File.dirname(__FILE__)), "..", "config.yml")))
6
7
  config_hash = config["flex-sdk"]
7
8
 
9
+ # These variables are provided by config.yml
8
10
  sdk_ver = config_hash["sdk_ver"]
9
11
  vendor_path = config_hash["vendor_path"]
10
12
  cdn_path = config_hash["cdn_path"]
11
-
13
+
14
+ # These variables are determined at runtime and combined into one hash
12
15
  sdk_name = "flex_sdk_" + sdk_ver
13
16
  config_hash["sdk_name"] = sdk_name
14
17
  sdk_file = sdk_name + ".zip"
@@ -18,17 +21,27 @@ class FlexSDK
18
21
  config_hash["dest_dir"] = dest_dir
19
22
  config_hash["dest_file"] = File.join(dest_dir, sdk_file)
20
23
  config_hash["sdk_dir"] = File.join(dest_dir, sdk_name)
24
+
21
25
  config_hash
22
26
  end
23
27
 
28
+ # Return the full path to the SDK dir, so other things/people can use it
24
29
  def sdk_dir
25
30
  config = self.config
26
31
  sdk_dir = config["sdk_dir"]
27
32
  end
28
33
 
34
+ # Download the SDK zip file to the gem
29
35
  def download(config)
36
+ require 'fileutils'
37
+
38
+ dest_dir = config["dest_dir"]
30
39
  dest_file = config["dest_file"]
31
40
  cdn_file = config["cdn_file"]
41
+
42
+ # Make sure the destination dir (likely GEM_NAME/vendor/) exists
43
+ FileUtils.mkdir_p dest_dir
44
+
32
45
  puts "\n"
33
46
  unless File.file?(dest_file)
34
47
  puts "Downloading SDK\n\tFrom:\t#{cdn_file}\n\tTo:\t#{dest_file}\n\n"
@@ -41,15 +54,13 @@ class FlexSDK
41
54
  end
42
55
  end
43
56
 
57
+ # Unzip the downloaded zip file into the target dir
44
58
  def unzip(config)
45
- require 'fileutils'
46
-
47
59
  sdk_dir = config["sdk_dir"]
48
60
  dest_file = config["dest_file"]
49
61
  dest_dir = config["dest_dir"]
50
62
 
51
63
  puts "\n"
52
- FileUtils.mkdir_p dest_dir
53
64
  unless File.directory?(sdk_dir)
54
65
  puts "Unzipping SDK\n\tFrom:\t#{dest_file}\n\tTo:\t#{sdk_dir}/\n\n"
55
66
  `unzip #{dest_file} -d #{dest_dir}`
@@ -59,9 +70,9 @@ class FlexSDK
59
70
  else
60
71
  puts "Won't unzip SDK, directory #{sdk_dir}/ already exists\n\n"
61
72
  end
62
- puts "Done. Flex SDK should now be ready for building\n\n"
63
73
  end
64
74
 
75
+ # Perform the copylocale step
65
76
  def copylocale(config)
66
77
  sdk_name = config["sdk_dir"]
67
78
  puts = `#{sdk_dir}/bin/copylocale en_US en_NZ`
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flex-sdk
3
3
  version: !ruby/object:Gem::Version
4
- hash: 17
4
+ hash: 23
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 3
9
- - 1
10
- version: 0.3.1
9
+ - 2
10
+ version: 0.3.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Jonathan Hoskin