high_five 0.1.5 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ ODliMzU0MzVmNjgzZGY4NWRlODYwM2RlYzM5MGY5NmIwOGRlM2NmYQ==
5
+ data.tar.gz: !binary |-
6
+ YjEzMjcwM2UwNTE5YTJkY2FmNWYzNzVkYzdmN2UwMTRmNDdkMmQzNg==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ ZjdmMWVhYjhhOTJhODhhMWZhMTkyODNjNWEyNDRmZTE1NmMzODdiMTFjYjBm
10
+ MGMwYWVjYzlmYmZiY2VhZjdkMTE0NGUzNTdiZDMxYzE4ZmFhMmEzNjQ3YTRk
11
+ ZWEyN2QyNGFiNTQzMzFkMDRkMzk0ZTVjYzhlM2Y3MzUyZTljNjQ=
12
+ data.tar.gz: !binary |-
13
+ OGRmY2RhMWRmZTgwOTU4YjQwOGFlODU2YmE4ZjdlYWRmMWI2ZTIxYWRjODU2
14
+ NGI3M2Q5ZWEyOGU3MDFhMmY1NDE1ZGIxNDYwNDE2YTdlMzcwN2I5NmM2ZDNj
15
+ Yjc3YTEyNzU4MDQwYjZjNjM2YTY3ZWM4YjFhMjljNjZlZTkwZjQ=
data/Gemfile.lock CHANGED
@@ -1,9 +1,12 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- high_five (0.1.4)
4
+ high_five (0.2.0)
5
+ coffee-script (~> 2.2.0)
5
6
  compass (~> 0.12.2)
6
7
  multi_json (~> 1.0)
8
+ nokogiri (>= 1.5.0)
9
+ plist (>= 3.0)
7
10
  sprockets (>= 2.0)
8
11
  thor (~> 0.17.0)
9
12
  uglifier (~> 2.1.1)
@@ -16,18 +19,25 @@ GEM
16
19
  Platform (>= 0.4.0)
17
20
  open4
18
21
  Platform (0.4.0)
19
- chunky_png (1.2.8)
22
+ chunky_png (1.2.9)
23
+ coffee-script (2.2.0)
24
+ coffee-script-source
25
+ execjs
26
+ coffee-script-source (1.6.3)
20
27
  compass (0.12.2)
21
28
  chunky_png (~> 1.2)
22
29
  fssm (>= 0.2.7)
23
30
  sass (~> 3.1)
24
- diff-lcs (1.2.4)
25
- execjs (1.4.0)
26
- multi_json (~> 1.0)
31
+ diff-lcs (1.2.5)
32
+ execjs (2.0.2)
27
33
  fssm (0.2.10)
28
34
  hike (1.2.3)
29
- multi_json (1.7.6)
35
+ mini_portile (0.5.2)
36
+ multi_json (1.8.4)
37
+ nokogiri (1.6.1)
38
+ mini_portile (~> 0.5.0)
30
39
  open4 (1.3.0)
40
+ plist (3.1.0)
31
41
  rack (1.5.2)
32
42
  rspec (2.13.0)
33
43
  rspec-core (~> 2.13.0)
@@ -37,15 +47,15 @@ GEM
37
47
  rspec-expectations (2.13.0)
38
48
  diff-lcs (>= 1.1.3, < 2.0)
39
49
  rspec-mocks (2.13.1)
40
- sass (3.2.9)
41
- sprockets (2.10.0)
50
+ sass (3.2.13)
51
+ sprockets (2.10.1)
42
52
  hike (~> 1.2)
43
53
  multi_json (~> 1.0)
44
54
  rack (~> 1.0)
45
55
  tilt (~> 1.1, != 1.3.0)
46
56
  thor (0.17.0)
47
57
  tilt (1.4.1)
48
- uglifier (2.1.1)
58
+ uglifier (2.1.2)
49
59
  execjs (>= 0.3.0)
50
60
  multi_json (~> 1.0, >= 1.0.2)
51
61
  yui-compressor (0.9.6)
data/Thorfile ADDED
@@ -0,0 +1,2 @@
1
+ $: << '.'
2
+ require 'cleanthor/thor/tasks'
data/bin/hi5 CHANGED
@@ -1,17 +1,20 @@
1
1
  #!/usr/bin/env ruby
2
2
  # resolve bin path, ignoring symlinks
3
- require "pathname"
3
+ require 'high_five'
4
+ require 'high_five/thor/runner'
4
5
  bin_file = Pathname.new(__FILE__).realpath
5
6
 
6
7
  # add self to libpath
7
8
  $:.unshift File.expand_path("../../lib", bin_file)
8
9
 
9
- begin
10
- require 'high_five'
11
- rescue LoadError
12
- require 'rubygems'
13
- require 'high_five'
14
- end
15
- require 'high_five/cli'
10
+ # begin
11
+ # require 'high_five'
12
+ # rescue LoadError
13
+ # require 'rubygems'
14
+ # require 'high_five'
15
+ # end
16
+ # require 'high_five/cli'
16
17
 
17
- HighFive::Cli.start
18
+ $thor_runner = true
19
+ $high_five_runner = true
20
+ ::HighFive::Thor::Runner.start
data/ext/mkrf_conf.rb ADDED
@@ -0,0 +1,25 @@
1
+ require 'rubygems'
2
+ require 'rubygems/command.rb'
3
+ require 'rubygems/dependency_installer.rb'
4
+ require 'rbconfig'
5
+ begin
6
+ Gem::Command.build_args = ARGV
7
+ rescue NoMethodError
8
+ end
9
+ inst = Gem::DependencyInstaller.new
10
+ begin
11
+ if RbConfig::CONFIG['host_os'] =~ /mswin|windows|cygwin/i
12
+ inst.install "win32-open3", "0.0.2"
13
+ end
14
+ if RUBY_VERSION < "1.9"
15
+ inst.install "ruby-debug-base", "~> 0.10.3"
16
+ else
17
+ inst.install "ruby-debug-base19", "~> 0.11.24"
18
+ end
19
+ rescue
20
+ exit(1)
21
+ end
22
+
23
+ f = File.open(File.join(File.dirname(__FILE__), "Rakefile"), "w") # create dummy rakefile to indicate success
24
+ f.write("task :default\n")
25
+ f.close
data/high_five.gemspec CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |s|
10
10
  s.email = ["brian@tenforwardconsulting.com"]
11
11
  s.homepage = "http://github.com/tenforwardconsulting/high_five"
12
12
  s.summary = %q{HighFive is a set of build scripts and tools for packing HTML5 apps both for the web and for phonegap}
13
- s.description = %q{Build, minify, and deal with different platforms and environments for your HTML5 app.
13
+ s.description = %q{Build, minify, and deal with different platforms and environments for your HTML5 app.
14
14
  This is often used with PhoneGap but designed not to require it, and high_five can be used to deploy any kind of HTML/JS/CSS-based
15
15
  application that requires different deployment configurations.
16
16
  }
@@ -21,6 +21,9 @@ Gem::Specification.new do |s|
21
21
  s.add_runtime_dependency "yui-compressor", "~>0.9.6"
22
22
  s.add_runtime_dependency "uglifier", "~>2.1.1"
23
23
  s.add_runtime_dependency "sprockets", ">=2.0"
24
+ s.add_runtime_dependency "coffee-script", "~>2.2.0"
25
+ s.add_runtime_dependency "plist", ">=3.0"
26
+ s.add_runtime_dependency "nokogiri", ">=1.5.0"
24
27
  s.add_development_dependency "rspec", "~>2.13.0"
25
28
 
26
29
 
@@ -0,0 +1,24 @@
1
+ module HighFive
2
+ module AndroidHelper
3
+ def self.project_name_from_build_xml(path)
4
+ File.open(path, 'r', :encoding => 'iso-8859-1').each do |line|
5
+ if line =~ /<project name="(.*)" /
6
+ return $1
7
+ end
8
+ end
9
+ nil
10
+ end
11
+
12
+ def android_manifest_path
13
+ platform_config = base_config.build_platform_config(:android)
14
+ destination_dir = platform_config.destination
15
+ root_dir = destination_dir
16
+ while true
17
+ glob = Dir[File.join(root_dir, "AndroidManifest.xml")]
18
+ return glob.first if (glob.length > 0)
19
+ root_dir = File.expand_path("..", root_dir)
20
+ raise "Couldn't find android manifest near #{destination_dir}" if root_dir == '/'
21
+ end
22
+ end
23
+ end
24
+ end
data/lib/high_five/cli.rb CHANGED
@@ -1,7 +1,4 @@
1
1
  require 'thor'
2
- require 'high_five/deploy_task'
3
- require 'high_five/init_task'
4
- require 'high_five/android_tasks'
5
2
  require 'high_five/config'
6
3
 
7
4
  module HighFive
@@ -10,6 +7,7 @@ module HighFive
10
7
  include HighFive::InitTask
11
8
  include HighFive::DeployTask
12
9
  include HighFive::AndroidTasks
10
+ include HighFive::DistTask
13
11
  # source root path for Thor::Actions commands
14
12
 
15
13
  class_option :version, type: :boolean, desc: "Print version and ext", aliases: "-v"
@@ -35,8 +35,9 @@ module HighFive
35
35
  :compass_dir, # directory that contaings compass' config.rb
36
36
  :dev_index, # copy generated index.html to here on build for use in development
37
37
  :minify, # defaults to true in production mode and false otherwise, overridable
38
- :manifest # generate html5 manifest
39
-
38
+ :manifest, # generate html5 manifest
39
+ :app_name, # App Name
40
+ :app_id # App id (com.tenforwardconsulting.myapp)
40
41
 
41
42
  def self.configure(&block)
42
43
  @@instance = HighFive::Config.new
@@ -0,0 +1,34 @@
1
+ module HighFive
2
+ module IosHelper
3
+ def IosHelper.uuid_from_mobileprovision(path)
4
+ uuid_found = false
5
+ File.open(path, 'r', :encoding => 'iso-8859-1').each do |line|
6
+ if uuid_found
7
+ line =~ /<string>(.*)<\/string>/
8
+ return $1
9
+ end
10
+ uuid_found = true if line =~ /UUID/
11
+ end
12
+ nil
13
+ end
14
+
15
+ def info_plist_path
16
+ root_dir = File.dirname(xcodeproj_path)
17
+ info = Dir["#{root_dir}/**/*-Info.plist"].first
18
+ raise "Couldn't find infoplist" if info.nil?
19
+ return info
20
+ end
21
+
22
+ def xcodeproj_path
23
+ platform_config = base_config.build_platform_config(:ios)
24
+ destination_dir = platform_config.destination
25
+ root_dir = destination_dir
26
+ while true
27
+ glob = Dir[File.join(root_dir, "*.xcodeproj")]
28
+ return glob.first if (glob.length > 0)
29
+ root_dir = File.expand_path("..", root_dir)
30
+ raise "Couldn't find xcodeproj near #{destination_dir}" if root_dir == '/'
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,44 @@
1
+ require "thor/runner"
2
+ require 'high_five/thor/task'
3
+ require 'high_five/thor/tasks'
4
+
5
+ module HighFive
6
+ module Thor
7
+ class Runner < ::Thor::Runner
8
+
9
+ #this works but I hate it
10
+ register(HighFive::Thor::Tasks::Distribution, "dist", "dist [PLATFORM]", "Shortcut to distribution:dist")
11
+ register(HighFive::Thor::Tasks::Deploy, "deploy", "deploy [PLATFORM]", "Shortcut to deploy:deploy")
12
+ register(HighFive::Thor::Tasks::Initialization, "init", "init", "Shortcut to Initialization:init")
13
+
14
+ # Note: because of the way task.run works, there has to be a local
15
+ # definition. Also, we want tasks to work WITH our base namespace
16
+ # if it is included, so that we can use our binary with the same
17
+ # signature we would use thor
18
+ def method_missing(meth, *args)
19
+ meth = meth.to_s
20
+ #meth.sub!(/^high_five:/, '')
21
+ if (!meth.match(/:/))
22
+ meth = "high_five:#{meth}"
23
+ end
24
+ super meth, *args
25
+ end
26
+
27
+ class_option :version, type: :boolean, desc: "Print version and ext", aliases: "-v"
28
+ def initialize(*args)
29
+ super
30
+ #override version task
31
+ if args[2][:current_task][:name] == "version"
32
+ puts "HighFive #{HighFive::VERSION}"
33
+ Process.exit(0)
34
+ end
35
+ end
36
+
37
+ private
38
+ def thorfiles(*args)
39
+ Dir[File.join(File.dirname(__FILE__), 'tasks/*.rb')]
40
+ end
41
+
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,58 @@
1
+ require 'high_five/config'
2
+
3
+ module HighFive
4
+ module Thor
5
+ class Task < ::Thor
6
+ def self.banner(task, namespace = false, subcommand = true)
7
+ if self.namespace == "high_five"
8
+ ns = ""
9
+ else
10
+ ns = "#{self.namespace}:"
11
+ end
12
+ "hi5 #{ns}" + task.formatted_usage(self, namespace, subcommand)
13
+ end
14
+
15
+ no_tasks {
16
+ def invoke(name=nil, *args)
17
+ name.sub!(/^high_five:/, '') if name && $high_five_runner
18
+ super
19
+ end
20
+
21
+ class << self
22
+ def inherited(base) #:nodoc:
23
+ base.send :extend, ClassMethods
24
+ end
25
+ end
26
+
27
+ def base_config
28
+ begin
29
+ @base_config ||= HighFive::Config.load
30
+ rescue StandardError => e
31
+ say e.message, :red
32
+ exit
33
+ end
34
+ end
35
+ }
36
+
37
+ def initialize(*args)
38
+ super
39
+
40
+ end
41
+
42
+ module ClassMethods
43
+ def namespace(name=nil)
44
+ case name
45
+ when nil
46
+ constant = self.to_s.gsub(/^Thor::Sandbox::/, "")
47
+ strip = $high_five_runner ? /^HighFive::Thor::Tasks::/ : /(?<=HighFive::)Thor::Tasks::/
48
+ constant = constant.gsub(strip, "")
49
+ constant = ::Thor::Util.snake_case(constant).squeeze(":")
50
+ @namespace ||= constant
51
+ else
52
+ super
53
+ end
54
+ end
55
+ end
56
+ end
57
+ end
58
+ end
@@ -0,0 +1,54 @@
1
+ require 'high_five/android_helper'
2
+ require 'nokogiri'
3
+
4
+ module HighFive
5
+ module Thor
6
+ module Tasks
7
+ class AndroidTasks < ::HighFive::Thor::Task
8
+ include ::Thor::Actions
9
+ include HighFive::AndroidHelper
10
+ namespace :android
11
+
12
+ desc "debug", "build the debug apk via ant debug"
13
+ def debug(target)
14
+ @destination_root = base_config.root
15
+ puts "Debugy #{target}"
16
+ end
17
+
18
+ desc "build", "build the apk"
19
+ def build
20
+ run('ant -file build.xml "-Dkey.store=/Users/Shared/Jenkins/Home/jobs/modern resident/workspace/modern_resident-mobile/android/Keystore.ks" -Dkey.store.password=modernresident -Dkey.alias=android -Dkey.alias.password=modernresident clean release
21
+ Buildfile: /Users/Shared/Jenkins/Home/jobs/modern resident/workspace/modern_resident-mobile/android/build.xml')
22
+ end
23
+
24
+ desc "set_version", "build the debug apk via ant debug"
25
+ method_option :version, :aliases => "-v", :desc => "Set main version"
26
+ method_option :build_number, :aliases => '-b', :desc => "set build number"
27
+ def set_version
28
+ # read and parse the old file
29
+ file = File.read(android_manifest_path)
30
+ xml = Nokogiri::XML(file)
31
+
32
+ # replace \n and any additional whitespace with a space
33
+ xml.xpath("//manifest").each do |node|
34
+ if (options[:version])
35
+ old = node["android:versionName"]
36
+ node["android:versionName"] = options[:version]
37
+ puts "Setting version #{old} => #{options[:version]}"
38
+ end
39
+ if (options[:build_number])
40
+ old = node["android:versionCode"]
41
+ node["android:versionCode"] = options[:build_number]
42
+ puts "Setting versionCode #{old} => #{options[:build_number]}"
43
+ end
44
+ end
45
+
46
+ # save the output into a new file
47
+ File.open(android_manifest_path, "w") do |f|
48
+ f.write xml.to_xml
49
+ end
50
+ end
51
+ end
52
+ end
53
+ end
54
+ end
@@ -4,10 +4,11 @@ require 'uglifier'
4
4
  require "yui/compressor"
5
5
 
6
6
  module HighFive
7
- module DeployTask
8
-
9
- def self.included(mod)
10
- mod.class_eval do
7
+ module Thor
8
+ module Tasks
9
+ class Deploy < ::HighFive::Thor::Task
10
+ include ::Thor::Actions
11
+ default_task :deploy
11
12
 
12
13
  desc "deploy", "Deploy the app for a specific platform in a specific environment"
13
14
  method_option :environment, :aliases => "-e", :desc => "Environemnt [production|development]", :default => "development"
@@ -25,7 +26,7 @@ module HighFive
25
26
 
26
27
  self.source_paths << File.join(base_config.root, @config_root)
27
28
  self.source_paths << File.join(base_config.root)
28
- self.source_paths << File.join(File.dirname(__FILE__), 'generators')
29
+ self.source_paths << File.join(File.dirname(__FILE__), '..', '..', 'generators')
29
30
  @config.asset_paths.each do |asset_path|
30
31
  self.source_paths << asset_path
31
32
  end
@@ -0,0 +1,74 @@
1
+ require 'high_five/ios_helper'
2
+ require 'high_five/android_helper'
3
+ module HighFive
4
+ module Thor
5
+ module Tasks
6
+ class Distribution < ::HighFive::Thor::Task
7
+ include ::Thor::Actions
8
+ include IosHelper
9
+
10
+ default_task :dist
11
+
12
+ desc "dist [PLATFORM]", "Create a distribution package for a specific platform"
13
+ method_option :output_file_name, :aliases => "-o", :desc => "Name of the final output file. Defaults to project_name.apk/ipa"
14
+ method_option :sign_identity, :aliases => "-s", :desc => "Full name of the code sign identity for use by xcode"
15
+ method_option :provisioning_profile, :aliases => "-p", :desc => "Path to the provisioning profile"
16
+ def dist(platform)
17
+ @output_file_name = options[:output_file_name]
18
+ @sign_identity = options[:sign_identity]
19
+ @provisioning_profile = options[:provisioning_profile]
20
+ @platform = platform
21
+ @config = base_config.build_platform_config(@platform).build_platform_config(@environment)
22
+ @config_root = File.join("config", "high_five")
23
+
24
+ raise "Please set config.destination" if @config.destination.nil?
25
+ self.destination_root = @config.destination
26
+
27
+ if @platform == "android" || @platform == "amazon"
28
+ path = self.destination_root
29
+ while path != base_config.root
30
+ if File.exists? File.join(path, 'AndroidManifest.xml')
31
+ android_path = path
32
+ break
33
+ else
34
+ path = File.expand_path('..', path)
35
+ end
36
+ end
37
+
38
+ if !android_path
39
+ raise "Couldn't find the path of the android manifest."
40
+ end
41
+
42
+ system("ant -file '#{android_path}/build.xml' release")
43
+
44
+ android_name = HighFive::AndroidHelper.project_name_from_build_xml("#{android_path}/build.xml")
45
+ if @output_file_name
46
+ FileUtils.cp("#{android_path}/bin/#{android_name}-release.apk", "#{android_path}/bin/#{@output_file_name}.apk")
47
+ end
48
+ elsif @platform == "ios"
49
+ raise "Please pass in the code sign identity to build an ios app. -s [sign_identity]" if @sign_identity.nil?
50
+ raise "Please pass in the path to the provisioning profile to build an ios app. -p [provisioning_profile]" if @provisioning_profile.nil?
51
+
52
+ ios_path = File.dirname(xcodeproj_path())
53
+
54
+ if !ios_path
55
+ raise "Couldn't find the path of the xcodeproj."
56
+ end
57
+
58
+ ios_project_name = File.basename(Dir[ios_path + "/*.xcodeproj"].first, '.xcodeproj')
59
+ keychain = ios_project_name.gsub(/\s/, '').gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').gsub(/([a-z\d])([A-Z])/,'\1_\2').tr("-", "_").downcase + '-ios.keychain'
60
+
61
+ @output_file_name ||= ios_project_name
62
+
63
+ uuid = HighFive::IosHelper.uuid_from_mobileprovision(@provisioning_profile)
64
+ ENV['uuid'] = uuid
65
+ FileUtils.cp(@provisioning_profile, "#{ENV['HOME']}/Library/MobileDevice/Provisioning Profiles/#{uuid}.mobileprovision")
66
+ system(%Q(cd "#{ios_path}";
67
+ /usr/bin/xcodebuild -target "#{ios_project_name}" -configuration Release build "CONFIGURATION_BUILD_DIR=#{ios_path}/build" "CODE_SIGN_IDENTITY=#{@sign_identity}" PROVISIONING_PROFILE=$uuid))
68
+ system(%Q(/usr/bin/xcrun -sdk iphoneos PackageApplication -v "#{ios_path}/build/#{ios_project_name}.app" -o "#{ios_path}/build/#{@output_file_name}.ipa" --embed "#{@provisioning_profile}" --sign "#{@sign_identity}"))
69
+ end
70
+ end
71
+ end
72
+ end
73
+ end
74
+ end
@@ -1,8 +1,10 @@
1
1
  require 'fileutils'
2
2
  module HighFive
3
- module InitTask
4
- def self.included(mod)
5
- mod.class_eval do
3
+ module Thor
4
+ module Tasks
5
+ class Initialization < ::HighFive::Thor::Task
6
+ include ::Thor::Actions
7
+ default_task :init
6
8
 
7
9
  desc "init", "Initialize the high_five configuration in the current working directory"
8
10
  def init
@@ -23,9 +25,7 @@ module HighFive
23
25
  end
24
26
  end
25
27
  end
26
-
27
-
28
- end #end class_eval
28
+ end
29
29
  end
30
30
  end
31
31
  end
@@ -0,0 +1,42 @@
1
+ require 'high_five/ios_helper'
2
+ require 'plist'
3
+
4
+ module HighFive
5
+ module Thor
6
+ module Tasks
7
+ class IosTasks < ::HighFive::Thor::Task
8
+ include ::Thor::Actions
9
+ include ::HighFive::IosHelper
10
+ namespace :ios
11
+
12
+ desc "set_version", "build the debug apk via ant debug"
13
+ method_option :version, :aliases => "-v", :desc => "Set main version"
14
+ method_option :build_number, :aliases => '-b', :desc => "set build number"
15
+ def set_version
16
+ info = info_plist_path
17
+ puts "Using #{info}"
18
+ plist = Plist::parse_xml(info)
19
+
20
+ if (options[:version])
21
+ puts "Changing version from #{plist["CFBundleShortVersionString"]} => #{options[:version]}"
22
+ plist["CFBundleShortVersionString"] = options[:version]
23
+ end
24
+
25
+ if (options[:build_number])
26
+ puts "Changind build number from #{plist["CFBundleVersion"]} => #{options[:build_number]}"
27
+ plist["CFBundleVersion"] = options[:build_number]
28
+ end
29
+ File.open(info, 'w') do |f|
30
+ f.write(Plist::Emit.dump(plist))
31
+ end
32
+ puts "Wrote Info.plist succesfully"
33
+ end
34
+
35
+ desc "build", "build the apk"
36
+ def build
37
+
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,10 @@
1
+ require 'high_five/thor/tasks/deploy'
2
+ require 'high_five/thor/tasks/distribution'
3
+ require 'high_five/thor/tasks/initialization'
4
+ require 'high_five/thor/tasks/android_tasks'
5
+ module HighFive
6
+ module Thor
7
+ module Tasks
8
+ end
9
+ end
10
+ end
@@ -1,3 +1,3 @@
1
1
  module HighFive
2
- VERSION = "0.1.5"
3
- end
2
+ VERSION = "0.2.0"
3
+ end
@@ -0,0 +1,9 @@
1
+ require 'spec_helper'
2
+
3
+ describe HighFive::AndroidHelper do
4
+ it 'should be able to extract the project name from a build.xml' do
5
+ name = HighFive::AndroidHelper.project_name_from_build_xml(File.join(File.dirname(__FILE__), "dummy", "build.xml"))
6
+
7
+ name.should eq 'Fake Name'
8
+ end
9
+ end
data/spec/config_spec.rb CHANGED
@@ -27,6 +27,13 @@ describe HighFive::Config do
27
27
  config.environment :production do |production|
28
28
  production.setting base_url: "http://production.example.com/api"
29
29
  end
30
+
31
+ config.platform :android do |android|
32
+ android.setting base_url: "http://android.example.com"
33
+ android.environment :production do |android_production|
34
+ android_production.setting base_url: "http://android-production.example.com"
35
+ end
36
+ end
30
37
  end
31
38
  @config = HighFive::Config.instance
32
39
  end
@@ -40,6 +47,11 @@ describe HighFive::Config do
40
47
  prod.js_settings[:base_url].should eq "http://production.example.com/api"
41
48
  end
42
49
 
50
+ it "should handle nested settings properly" do
51
+ android_production = @config.build_platform_config(:platform).build_platform_config(:android)
52
+ android_production.js_settings[:base_url].should eq "http://android-production.example.com"
53
+ end
54
+
43
55
  end
44
56
 
45
57
  context "environment configuration" do
@@ -108,4 +120,39 @@ describe HighFive::Config do
108
120
  end
109
121
  end
110
122
 
123
+ context "nested settings" do
124
+ before do
125
+ HighFive::Config.configure do |config|
126
+ config.root = "/"
127
+ config.setting base_url: "http://example.com/api"
128
+ config.platform :ios do |ios|
129
+
130
+ end
131
+ config.platform :android do |android|
132
+ android.assets "android_asset"
133
+ android.setting android_flag: true
134
+ config.environment :production do |android_production|
135
+ android_production.setting base_url: "http://android-production.example.com/api"
136
+ end
137
+ end
138
+ config.environment :production do |production|
139
+ production.assets "production_asset"
140
+ production.setting base_url: "http://production.example.com/api"
141
+ end
142
+ end
143
+ @config = HighFive::Config.instance
144
+ end
145
+
146
+ it "should use the environment setting if none is specified" do
147
+ platform_config = @config.build_platform_config('ios').build_platform_config('production')
148
+ platform_config.js_settings[:base_url].should eq "http://production.example.com/api"
149
+ end
150
+
151
+ it "should allow platforms to specifically override environment settings" do
152
+ platform_config = @config.build_platform_config('android').build_platform_config('production')
153
+ platform_config.js_settings[:base_url].should eq "http://android-production.example.com/api"
154
+ end
155
+
156
+ end
157
+
111
158
  end
data/spec/deploy_spec.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe HighFive::DeployTask do
3
+ describe HighFive::Thor::Tasks::Deploy do
4
4
  def create_dummy_app!
5
5
  @original_dir = Dir.pwd
6
6
  @project_root = Dir.mktmpdir("hi5")
@@ -9,7 +9,7 @@ describe HighFive::DeployTask do
9
9
  end
10
10
 
11
11
  def cli(options={environment: 'development'})
12
- cli = HighFive::Cli.new([], options)
12
+ cli = HighFive::Thor::Tasks::Deploy.new([], options)
13
13
  cli.instance_variable_set("@base_config", HighFive::Config.instance)
14
14
  cli
15
15
  end
@@ -0,0 +1,92 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project name="Fake Name" default="help">
3
+
4
+ <!-- The local.properties file is created and updated by the 'android' tool.
5
+ It contains the path to the SDK. It should *NOT* be checked into
6
+ Version Control Systems. -->
7
+ <property file="local.properties" />
8
+
9
+ <!-- The ant.properties file can be created by you. It is only edited by the
10
+ 'android' tool to add properties to it.
11
+ This is the place to change some Ant specific build properties.
12
+ Here are some properties you may want to change/update:
13
+
14
+ source.dir
15
+ The name of the source directory. Default is 'src'.
16
+ out.dir
17
+ The name of the output directory. Default is 'bin'.
18
+
19
+ For other overridable properties, look at the beginning of the rules
20
+ files in the SDK, at tools/ant/build.xml
21
+
22
+ Properties related to the SDK location or the project target should
23
+ be updated using the 'android' tool with the 'update' action.
24
+
25
+ This file is an integral part of the build system for your
26
+ application and should be checked into Version Control Systems.
27
+
28
+ -->
29
+ <property file="ant.properties" />
30
+
31
+ <!-- if sdk.dir was not set from one of the property file, then
32
+ get it from the ANDROID_HOME env var.
33
+ This must be done before we load project.properties since
34
+ the proguard config can use sdk.dir -->
35
+ <property environment="env" />
36
+ <condition property="sdk.dir" value="${env.ANDROID_HOME}">
37
+ <isset property="env.ANDROID_HOME" />
38
+ </condition>
39
+
40
+ <!-- The project.properties file is created and updated by the 'android'
41
+ tool, as well as ADT.
42
+
43
+ This contains project specific properties such as project target, and library
44
+ dependencies. Lower level build properties are stored in ant.properties
45
+ (or in .classpath for Eclipse projects).
46
+
47
+ This file is an integral part of the build system for your
48
+ application and should be checked into Version Control Systems. -->
49
+ <loadproperties srcFile="project.properties" />
50
+
51
+ <!-- quick check on sdk.dir -->
52
+ <fail
53
+ message="sdk.dir is missing. Make sure to generate local.properties using 'android update project' or to inject it through the ANDROID_HOME environment variable."
54
+ unless="sdk.dir"
55
+ />
56
+
57
+ <!--
58
+ Import per project custom build rules if present at the root of the project.
59
+ This is the place to put custom intermediary targets such as:
60
+ -pre-build
61
+ -pre-compile
62
+ -post-compile (This is typically used for code obfuscation.
63
+ Compiled code location: ${out.classes.absolute.dir}
64
+ If this is not done in place, override ${out.dex.input.absolute.dir})
65
+ -post-package
66
+ -post-build
67
+ -pre-clean
68
+ -->
69
+ <import file="custom_rules.xml" optional="true" />
70
+
71
+ <!-- Import the actual build file.
72
+
73
+ To customize existing targets, there are two options:
74
+ - Customize only one target:
75
+ - copy/paste the target into this file, *before* the
76
+ <import> task.
77
+ - customize it to your needs.
78
+ - Customize the whole content of build.xml
79
+ - copy/paste the content of the rules files (minus the top node)
80
+ into this file, replacing the <import> task.
81
+ - customize to your needs.
82
+
83
+ ***********************
84
+ ****** IMPORTANT ******
85
+ ***********************
86
+ In all cases you must update the value of version-tag below to read 'custom' instead of an integer,
87
+ in order to avoid having your file be overridden by tools such as "android update project"
88
+ -->
89
+ <!-- version-tag: 1 -->
90
+ <import file="${sdk.dir}/tools/ant/build.xml" />
91
+
92
+ </project>
Binary file
data/spec/init_spec.rb CHANGED
@@ -2,7 +2,7 @@ require 'spec_helper'
2
2
  require 'tmpdir'
3
3
  require 'fileutils'
4
4
 
5
- describe "InitTask" do
5
+ describe HighFive::Thor::Tasks::Initialization do
6
6
  before :each do
7
7
  @original_dir = Dir.pwd
8
8
  @project_root = Dir.mktmpdir("hi5")
@@ -15,7 +15,7 @@ describe "InitTask" do
15
15
  end
16
16
 
17
17
  it "should create high_five.rb in the config directory" do
18
- HighFive::Cli.start(["init"])
18
+ ::HighFive::Thor::Tasks::Initialization.start(["init"])
19
19
  Dir.exists?(File.join(@project_root, "config")).should be_true
20
20
  File.exists?(File.join(@project_root, "config", "high_five.rb")).should be_true
21
21
  Dir.exists?(File.join(@project_root, "config", "high_five")).should be_true
@@ -0,0 +1,9 @@
1
+ require 'spec_helper'
2
+
3
+ describe HighFive::IosHelper do
4
+ it 'should be able to extract a UUID from a mobileprovision file' do
5
+ uuid = HighFive::IosHelper.uuid_from_mobileprovision(File.join(File.dirname(__FILE__), "dummy", "fake.mobileprovision"))
6
+
7
+ uuid.should eq 'THIS-IS-A-FAKE-UUID'
8
+ end
9
+ end
data/spec/spec_helper.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  require "high_five"
2
- require 'high_five/cli'
2
+ require 'high_five/thor/runner'
3
+ require 'high_five/thor/tasks'
3
4
  # This file was generated by the `rspec --init` command. Conventionally, all
4
5
  # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
5
6
  # Require this file using `require "spec_helper"` to ensure that it is only
@@ -1,4 +1,7 @@
1
1
  HighFive::Config.configure do |config|
2
+ config.app_name = "ExampleApp"
3
+ config.app_id = "com.example.app"
4
+
2
5
  config.root = File.join(File.dirname(__FILE__), '..')
3
6
  config.destination = "www"
4
7
 
@@ -35,13 +38,18 @@ HighFive::Config.configure do |config|
35
38
  # android.assets "resources/android"
36
39
  end
37
40
 
41
+ config.platform :Web do |web|
42
+ web.manifest = true #generate app cache manifest (production env only)
43
+ web.dev_index = "index-debug.html" #copy generated index.html to index-debug (development env only)
44
+ end
45
+
38
46
  # if you need platform-specific javascripts,
39
47
  # simply create app-<platform>.js
40
48
  # these files are managed by sprockets, and are used to determine the javascript include order
41
49
 
42
50
  # Environment support: production/development/etc
43
51
  # Environments work just like platforms
44
- config.envrionment :development do |development|
52
+ config.environment :development do |development|
45
53
  # development.javascripts "lib/some-library-debug-all.js"
46
54
  # development.setting base_url: "http://dev.example.com:1234/api/"
47
55
  end
@@ -49,6 +57,7 @@ HighFive::Config.configure do |config|
49
57
  config.environment :production do |production|
50
58
  # production.javascripts "lib/some-library-minified.js"
51
59
  # production.setting base_url: "http://production.example.com/api/" #these take precedence over the platform overrides
60
+ # production.minify :uglifier # or :yui
52
61
  end
53
62
 
54
63
  end
metadata CHANGED
@@ -1,20 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: high_five
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
5
- prerelease:
4
+ version: 0.2.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Brian Samson
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-06-18 00:00:00.000000000 Z
11
+ date: 2014-01-10 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: multi_json
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
17
  - - ~>
20
18
  - !ruby/object:Gem::Version
@@ -22,7 +20,6 @@ dependencies:
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
24
  - - ~>
28
25
  - !ruby/object:Gem::Version
@@ -30,7 +27,6 @@ dependencies:
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: thor
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
31
  - - ~>
36
32
  - !ruby/object:Gem::Version
@@ -38,7 +34,6 @@ dependencies:
38
34
  type: :runtime
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
38
  - - ~>
44
39
  - !ruby/object:Gem::Version
@@ -46,7 +41,6 @@ dependencies:
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: compass
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
45
  - - ~>
52
46
  - !ruby/object:Gem::Version
@@ -54,7 +48,6 @@ dependencies:
54
48
  type: :runtime
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
52
  - - ~>
60
53
  - !ruby/object:Gem::Version
@@ -62,7 +55,6 @@ dependencies:
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: yui-compressor
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
59
  - - ~>
68
60
  - !ruby/object:Gem::Version
@@ -70,7 +62,6 @@ dependencies:
70
62
  type: :runtime
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
66
  - - ~>
76
67
  - !ruby/object:Gem::Version
@@ -78,7 +69,6 @@ dependencies:
78
69
  - !ruby/object:Gem::Dependency
79
70
  name: uglifier
80
71
  requirement: !ruby/object:Gem::Requirement
81
- none: false
82
72
  requirements:
83
73
  - - ~>
84
74
  - !ruby/object:Gem::Version
@@ -86,7 +76,6 @@ dependencies:
86
76
  type: :runtime
87
77
  prerelease: false
88
78
  version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
79
  requirements:
91
80
  - - ~>
92
81
  - !ruby/object:Gem::Version
@@ -94,7 +83,6 @@ dependencies:
94
83
  - !ruby/object:Gem::Dependency
95
84
  name: sprockets
96
85
  requirement: !ruby/object:Gem::Requirement
97
- none: false
98
86
  requirements:
99
87
  - - ! '>='
100
88
  - !ruby/object:Gem::Version
@@ -102,15 +90,55 @@ dependencies:
102
90
  type: :runtime
103
91
  prerelease: false
104
92
  version_requirements: !ruby/object:Gem::Requirement
105
- none: false
106
93
  requirements:
107
94
  - - ! '>='
108
95
  - !ruby/object:Gem::Version
109
96
  version: '2.0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: coffee-script
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ~>
102
+ - !ruby/object:Gem::Version
103
+ version: 2.2.0
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ~>
109
+ - !ruby/object:Gem::Version
110
+ version: 2.2.0
111
+ - !ruby/object:Gem::Dependency
112
+ name: plist
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ! '>='
116
+ - !ruby/object:Gem::Version
117
+ version: '3.0'
118
+ type: :runtime
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ! '>='
123
+ - !ruby/object:Gem::Version
124
+ version: '3.0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: nokogiri
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ! '>='
130
+ - !ruby/object:Gem::Version
131
+ version: 1.5.0
132
+ type: :runtime
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ! '>='
137
+ - !ruby/object:Gem::Version
138
+ version: 1.5.0
110
139
  - !ruby/object:Gem::Dependency
111
140
  name: rspec
112
141
  requirement: !ruby/object:Gem::Requirement
113
- none: false
114
142
  requirements:
115
143
  - - ~>
116
144
  - !ruby/object:Gem::Version
@@ -118,15 +146,14 @@ dependencies:
118
146
  type: :development
119
147
  prerelease: false
120
148
  version_requirements: !ruby/object:Gem::Requirement
121
- none: false
122
149
  requirements:
123
150
  - - ~>
124
151
  - !ruby/object:Gem::Version
125
152
  version: 2.13.0
126
153
  description: ! "Build, minify, and deal with different platforms and environments
127
- for your HTML5 app. \n This is often used with PhoneGap but designed not to
128
- require it, and high_five can be used to deploy any kind of HTML/JS/CSS-based\n
129
- \ application that requires different deployment configurations.\n "
154
+ for your HTML5 app.\n This is often used with PhoneGap but designed not to require
155
+ it, and high_five can be used to deploy any kind of HTML/JS/CSS-based\n application
156
+ that requires different deployment configurations.\n "
130
157
  email:
131
158
  - brian@tenforwardconsulting.com
132
159
  executables:
@@ -142,18 +169,29 @@ files:
142
169
  - Gemfile.lock
143
170
  - README.md
144
171
  - Rakefile
172
+ - Thorfile
145
173
  - bin/hi5
174
+ - ext/mkrf_conf.rb
146
175
  - high_five.gemspec
147
176
  - lib/high_five.rb
148
- - lib/high_five/android_tasks.rb
177
+ - lib/high_five/android_helper.rb
149
178
  - lib/high_five/cli.rb
150
179
  - lib/high_five/config.rb
151
- - lib/high_five/deploy_task.rb
152
180
  - lib/high_five/generators/manifest.erb
153
- - lib/high_five/init_task.rb
181
+ - lib/high_five/ios_helper.rb
182
+ - lib/high_five/thor/runner.rb
183
+ - lib/high_five/thor/task.rb
184
+ - lib/high_five/thor/tasks.rb
185
+ - lib/high_five/thor/tasks/android_tasks.rb
186
+ - lib/high_five/thor/tasks/deploy.rb
187
+ - lib/high_five/thor/tasks/distribution.rb
188
+ - lib/high_five/thor/tasks/initialization.rb
189
+ - lib/high_five/thor/tasks/ios_tasks.rb
154
190
  - lib/high_five/version.rb
191
+ - spec/android_helper_spec.rb
155
192
  - spec/config_spec.rb
156
193
  - spec/deploy_spec.rb
194
+ - spec/dummy/build.xml
157
195
  - spec/dummy/config.rb
158
196
  - spec/dummy/config/high_five.rb
159
197
  - spec/dummy/config/high_five/app-android.js
@@ -162,6 +200,7 @@ files:
162
200
  - spec/dummy/config/high_five/app-ios.js
163
201
  - spec/dummy/config/high_five/app-web.js
164
202
  - spec/dummy/config/high_five/index.html.erb
203
+ - spec/dummy/fake.mobileprovision
165
204
  - spec/dummy/javascripts/app.js
166
205
  - spec/dummy/javascripts/app/component.js
167
206
  - spec/dummy/public/custom_path/custom_app.js
@@ -169,6 +208,7 @@ files:
169
208
  - spec/dummy/sass/sass.scss
170
209
  - spec/dummy/stylesheets/screen.css
171
210
  - spec/init_spec.rb
211
+ - spec/ios_helper_spec.rb
172
212
  - spec/spec_helper.rb
173
213
  - template/config/high_five.rb
174
214
  - template/config/high_five/app-common.js
@@ -176,32 +216,33 @@ files:
176
216
  - template/config/high_five/index.html.erb
177
217
  homepage: http://github.com/tenforwardconsulting/high_five
178
218
  licenses: []
219
+ metadata: {}
179
220
  post_install_message:
180
221
  rdoc_options: []
181
222
  require_paths:
182
223
  - lib
183
224
  required_ruby_version: !ruby/object:Gem::Requirement
184
- none: false
185
225
  requirements:
186
226
  - - ! '>='
187
227
  - !ruby/object:Gem::Version
188
228
  version: '0'
189
229
  required_rubygems_version: !ruby/object:Gem::Requirement
190
- none: false
191
230
  requirements:
192
231
  - - ! '>='
193
232
  - !ruby/object:Gem::Version
194
233
  version: '0'
195
234
  requirements: []
196
235
  rubyforge_project:
197
- rubygems_version: 1.8.25
236
+ rubygems_version: 2.1.11
198
237
  signing_key:
199
- specification_version: 3
238
+ specification_version: 4
200
239
  summary: HighFive is a set of build scripts and tools for packing HTML5 apps both
201
240
  for the web and for phonegap
202
241
  test_files:
242
+ - spec/android_helper_spec.rb
203
243
  - spec/config_spec.rb
204
244
  - spec/deploy_spec.rb
245
+ - spec/dummy/build.xml
205
246
  - spec/dummy/config.rb
206
247
  - spec/dummy/config/high_five.rb
207
248
  - spec/dummy/config/high_five/app-android.js
@@ -210,6 +251,7 @@ test_files:
210
251
  - spec/dummy/config/high_five/app-ios.js
211
252
  - spec/dummy/config/high_five/app-web.js
212
253
  - spec/dummy/config/high_five/index.html.erb
254
+ - spec/dummy/fake.mobileprovision
213
255
  - spec/dummy/javascripts/app.js
214
256
  - spec/dummy/javascripts/app/component.js
215
257
  - spec/dummy/public/custom_path/custom_app.js
@@ -217,4 +259,5 @@ test_files:
217
259
  - spec/dummy/sass/sass.scss
218
260
  - spec/dummy/stylesheets/screen.css
219
261
  - spec/init_spec.rb
262
+ - spec/ios_helper_spec.rb
220
263
  - spec/spec_helper.rb
@@ -1,17 +0,0 @@
1
- module HighFive
2
- module AndroidTasks
3
- def self.included(mod)
4
- mod.class_eval do
5
-
6
- namespace "android"
7
- desc "android_debug", "build the debug apk via ant debug"
8
- def android_debug
9
- self.destination_root = base_config.root
10
- puts "Debugy"
11
- end
12
-
13
-
14
- end #end class_eval
15
- end
16
- end
17
- end