vj-sdk 0.4.3 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -2,4 +2,5 @@ log/*
2
2
  core-fixtures.yml
3
3
  pkg/*
4
4
  .DS_Store
5
- *.tmproj
5
+ *.tmproj
6
+ .bundle
data/Gemfile ADDED
@@ -0,0 +1,18 @@
1
+ source :gemcutter
2
+
3
+ # http://github.com/carlhuda/bundler/issues/#issue/107
4
+ # - do not change unless lib/bundler_runtime_patch tested / defunct
5
+ gem "bundler", "0.9.10"
6
+
7
+ def gems(names, version)
8
+ names.each { |n| gem(n, version) }
9
+ end
10
+
11
+ # DataObjects, DataMapper and Merb
12
+ gem "merb-core", "1.1.0.pre"
13
+ gem "jeweler", ">= 1.4.0"
14
+ gem "rake", ">= 0.8.7"
15
+ gem "rspec", ">= 1.3.0"
16
+ gem "mash"
17
+ gem "randexp"
18
+ gem "ruby-hmac"
data/Rakefile CHANGED
@@ -1,6 +1,10 @@
1
1
  require 'rubygems'
2
- require 'merb-core'
3
- require 'rake'
2
+ require 'bundler'
3
+ require 'net/http'
4
+
5
+ # BUNDLER TRANSFORM!
6
+ require 'lib/bundler_runtime_patch' # Andre's OMG MEGA HAX to allow DataMapper to require successfully
7
+ Bundler.require :default, :vj_core_dependencies
4
8
 
5
9
  begin
6
10
  require 'jeweler'
@@ -28,10 +32,7 @@ end
28
32
 
29
33
  namespace :spec do
30
34
  task :sdk do
31
- require 'tasks/vj-core'
32
- Rake::Task["videojuicer:core:setup"].invoke
33
35
  Rake::Task["spec"].execute
34
- Rake::Task["videojuicer:core:cleanup"].invoke
35
36
  end
36
37
  end
37
38
  task :default => :"spec:sdk"
data/VERSION.yml CHANGED
@@ -1,4 +1,5 @@
1
1
  ---
2
- :minor: 4
3
- :patch: 3
2
+ :build:
4
3
  :major: 0
4
+ :minor: 5
5
+ :patch: 0
@@ -0,0 +1,50 @@
1
+ module Bundler
2
+ class Runtime
3
+ private
4
+ def autorequires_for_groups(*groups)
5
+ groups.map! { |g| g.to_sym }
6
+ autorequires = Hash.new { |h,k| h[k] = [] }
7
+
8
+ # ----- PATCH -----
9
+
10
+ # ORIGINAL METHOD - unfortunately inside out
11
+ # ordered_deps = []
12
+ # specs_for(*groups).each do |g|
13
+ # dep = @definition.dependencies.find{|d| d.name == g.name }
14
+ # ordered_deps << dep if dep && !ordered_deps.include?(dep)
15
+ # end
16
+
17
+ # NEW METHOD
18
+ ordered_deps = []
19
+ spec_names = specs_for(*groups).map { |s| s.name }
20
+ @definition.dependencies.each do |dep|
21
+ ordered_deps << dep if spec_names.include?(dep.name) && !ordered_deps.include?(dep)
22
+ end
23
+
24
+ # DEBUG: verify that ordered_deps are in gem file specification order
25
+ # p ordered_deps.map { |d| d.name }
26
+
27
+ # ----- /PATCH -----
28
+
29
+ ordered_deps.each do |dep|
30
+ dep.groups.each do |group|
31
+ # If there is no autorequire, then rescue from
32
+ # autorequiring the gems name
33
+ if dep.autorequire
34
+ dep.autorequire.each do |file|
35
+ autorequires[group] << [file, true]
36
+ end
37
+ else
38
+ autorequires[group] << [dep.name, false]
39
+ end
40
+ end
41
+ end
42
+
43
+ if groups.empty?
44
+ autorequires
45
+ else
46
+ groups.inject({}) { |h,g| h[g] = autorequires[g]; h }
47
+ end
48
+ end
49
+ end
50
+ end
@@ -22,6 +22,7 @@ module Videojuicer
22
22
  base.property :file, File
23
23
  base.property :file_name, String
24
24
  base.property :file_size, Integer, :writer => :private # bytes
25
+ base.property :source_uri, String
25
26
 
26
27
  # - common metadata
27
28
  base.property :licensed_at, Date
@@ -32,9 +33,13 @@ module Videojuicer
32
33
  # - access control / workflow
33
34
  base.property :url, String, :writer => :private
34
35
  base.property :http_url, String, :writer => :private
36
+
37
+ base.property :ingest_key, String, :writer => :private
35
38
  base.property :state, String, :writer => :private
36
39
  base.property :state_changed_at, DateTime, :writer => :private
37
40
  base.property :state_changed_url, String
41
+ base.property :state_location, String, :writer => :private
42
+ base.property :state_message, String, :writer => :private
38
43
  base.property :created_at, DateTime
39
44
  base.property :updated_at, DateTime
40
45
  end
@@ -41,11 +41,15 @@ module SpecHelper
41
41
  end
42
42
 
43
43
  def fixtures
44
- fixture_path = File.join(File.dirname(__FILE__), "..", "..", "core-fixtures.yml")
44
+ fixture_path = File.join(core_path, "sdk_fixtures.yml")
45
45
  fixture_src = File.open(fixture_path).read
46
46
  @core_fixtures ||= Mash.new(YAML.load(fixture_src))
47
47
  end
48
48
 
49
+ def core_path
50
+ File.join(File.dirname(__FILE__), "..", "..", "..", "vj-core")
51
+ end
52
+
49
53
  end
50
54
 
51
55
  Spec::Runner.configure do |config|
data/vj-sdk.gemspec CHANGED
@@ -1,15 +1,15 @@
1
1
  # Generated by jeweler
2
- # DO NOT EDIT THIS FILE
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run `rake gemspec`
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
4
  # -*- encoding: utf-8 -*-
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{vj-sdk}
8
- s.version = "0.4.3"
8
+ s.version = "0.5.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["danski", "thejohnny", "knowtheory", "sixones", "btab"]
12
- s.date = %q{2010-03-10}
12
+ s.date = %q{2010-04-22}
13
13
  s.email = %q{dan@videojuicer.com}
14
14
  s.extra_rdoc_files = [
15
15
  "LICENSE",
@@ -17,15 +17,16 @@ Gem::Specification.new do |s|
17
17
  ]
18
18
  s.files = [
19
19
  ".gitignore",
20
+ "Gemfile",
20
21
  "LICENSE",
21
22
  "README.markdown",
22
23
  "Rakefile",
23
24
  "VERSION.yml",
25
+ "lib/bundler_runtime_patch.rb",
24
26
  "lib/core_ext/cgi.rb",
25
27
  "lib/core_ext/hash.rb",
26
28
  "lib/core_ext/object.rb",
27
29
  "lib/core_ext/string.rb",
28
- "lib/sdk_connection_harness.rb",
29
30
  "lib/videojuicer.rb",
30
31
  "lib/videojuicer/asset/audio.rb",
31
32
  "lib/videojuicer/asset/base.rb",
@@ -105,7 +106,6 @@ Gem::Specification.new do |s|
105
106
  "spec/spec.opts",
106
107
  "spec/user_spec.rb",
107
108
  "spec/videojuicer_spec.rb",
108
- "tasks/vj-core.rb",
109
109
  "vj-sdk.gemspec"
110
110
  ]
111
111
  s.homepage = %q{http://github.com/videojuicer/vj-sdk}
@@ -171,3 +171,4 @@ Gem::Specification.new do |s|
171
171
  s.add_dependency(%q<mash>, [">= 0.0.3"])
172
172
  end
173
173
  end
174
+
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
- - 4
8
- - 3
9
- version: 0.4.3
7
+ - 5
8
+ - 0
9
+ version: 0.5.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - danski
@@ -18,7 +18,7 @@ autorequire:
18
18
  bindir: bin
19
19
  cert_chain: []
20
20
 
21
- date: 2010-03-10 00:00:00 +00:00
21
+ date: 2010-04-22 00:00:00 +01:00
22
22
  default_executable:
23
23
  dependencies:
24
24
  - !ruby/object:Gem::Dependency
@@ -73,15 +73,16 @@ extra_rdoc_files:
73
73
  - README.markdown
74
74
  files:
75
75
  - .gitignore
76
+ - Gemfile
76
77
  - LICENSE
77
78
  - README.markdown
78
79
  - Rakefile
79
80
  - VERSION.yml
81
+ - lib/bundler_runtime_patch.rb
80
82
  - lib/core_ext/cgi.rb
81
83
  - lib/core_ext/hash.rb
82
84
  - lib/core_ext/object.rb
83
85
  - lib/core_ext/string.rb
84
- - lib/sdk_connection_harness.rb
85
86
  - lib/videojuicer.rb
86
87
  - lib/videojuicer/asset/audio.rb
87
88
  - lib/videojuicer/asset/base.rb
@@ -161,7 +162,6 @@ files:
161
162
  - spec/spec.opts
162
163
  - spec/user_spec.rb
163
164
  - spec/videojuicer_spec.rb
164
- - tasks/vj-core.rb
165
165
  - vj-sdk.gemspec
166
166
  has_rdoc: true
167
167
  homepage: http://github.com/videojuicer/vj-sdk
@@ -1,101 +0,0 @@
1
- begin
2
- require 'extlib'
3
- rescue LoadError
4
- require 'mash'
5
- end
6
- require 'yaml'
7
- class SDKConnectionHarness
8
- class << self
9
-
10
- attr_accessor :server_pid
11
- attr_accessor :fixtures
12
-
13
- def core_directory
14
- File.expand_path(File.join(File.dirname(__FILE__), "..", "..", "vj-core"))
15
- end
16
-
17
- def start!
18
- stop! if running?
19
- puts "Starting vj-core from #{core_directory}\n"
20
- Thread.new do
21
- cur_dir = Dir.pwd
22
- Dir.chdir(core_directory) do
23
- `./bin/merb -d #{app_server} -p #{port} -e test --log ./log/sdk-development.log`
24
- end
25
- Dir.chdir(cur_dir)
26
- end
27
- end
28
-
29
- def stop!
30
- Thread.new do
31
- `killall -9 "merb : worker (port #{port})"`
32
- end
33
- end
34
-
35
- def running?
36
- uri = URI.parse("http://localhost:#{port}/")
37
- req = Net::HTTP::Get.new(uri.path)
38
-
39
- begin
40
- resp = Net::HTTP.start(uri.host, uri.port) do |http|
41
- http.request(req)
42
- end
43
- return true
44
- rescue Exception => e
45
- # Connection refused means the daemon isn't running
46
- return false
47
- end
48
- end
49
-
50
- def load_fixtures
51
- Dir.chdir(core_directory) do
52
- out = `./bin/rake videojuicer:sdk:setup MERB_ENV=test`
53
- out = out.match(/!!!([^!]+)!!!/m)
54
- self.fixtures = out[1]
55
- end
56
- end
57
-
58
- def write_fixtures
59
- f = File.open(File.join(File.dirname(__FILE__), "..", "core-fixtures.yml"), "w+")
60
- f.rewind
61
- f.write(self.fixtures)
62
- f.close
63
- end
64
-
65
- def app_server
66
- begin
67
- require 'thin'
68
- adapter = 'thin'
69
- rescue LoadError
70
- adapter = 'mongrel'
71
- end
72
- return "--adapter #{adapter}"
73
- end
74
-
75
- def port
76
- 6666
77
- end
78
-
79
- def connect(overrides={})
80
- fixtures = Mash.new(YAML.load(load_fixtures)).merge(overrides)
81
- configure_test_settings(fixtures)
82
- Videojuicer.enter_scope :seed_name => fixtures[:seed][:name],
83
- :consumer_key=>fixtures["write-master"][:consumer][:consumer_key],
84
- :consumer_secret=>fixtures["write-master"][:consumer][:consumer_secret],
85
- :token=>fixtures["write-master"][:authorized_token][:oauth_token],
86
- :token_secret=>fixtures["write-master"][:authorized_token][:oauth_token_secret]
87
- end
88
-
89
- def configure_test_settings(overrides={})
90
- Videojuicer.configure!({
91
- :consumer_key => nil,
92
- :consumer_secret => nil,
93
- :api_version => 1,
94
- :protocol => "http",
95
- :host => "localhost",
96
- :port => port
97
- }.merge(overrides))
98
- end
99
-
100
- end
101
- end
data/tasks/vj-core.rb DELETED
@@ -1,72 +0,0 @@
1
- =begin
2
-
3
- Prepares the vj-core development environment. Runs automatically before spec.
4
-
5
- =end
6
-
7
- require 'net/http'
8
- require File.join(File.dirname(__FILE__), "..", "lib", "sdk_connection_harness")
9
-
10
- namespace :videojuicer do
11
- namespace :core do
12
-
13
- task :setup do
14
- Rake::Task['videojuicer:core:stop'].invoke
15
- Rake::Task['videojuicer:core:load_fixtures'].invoke
16
- Rake::Task['videojuicer:core:start'].invoke
17
- end
18
-
19
- task :cleanup do
20
- Rake::Task['videojuicer:core:stop'].invoke
21
- end
22
-
23
- task :load_fixtures do
24
- puts "Loading fixtures from vj-core..."
25
- SDKConnectionHarness.load_fixtures
26
- puts "Writing to tempfile..."
27
- SDKConnectionHarness.write_fixtures
28
- end
29
-
30
- task :start do
31
- if SDKConnectionHarness.running?
32
- puts "The SDK Test harness is already running on port #{SDKConnectionHarness.port}. Attempting to stop."
33
- SDKConnectionHarness.stop!
34
- until !SDKConnectionHarness.running? do
35
- print "+"
36
- sleep 1
37
- end
38
- else
39
- SDKConnectionHarness.start!
40
- puts "Waiting for test harness to launch and open the port."
41
- until SDKConnectionHarness.running? do
42
- print "+"
43
- sleep 1
44
- end
45
- end
46
- end
47
-
48
- task :status do
49
- puts( if SDKConnectionHarness.running?
50
- "The test harness is RUNNING on port #{SDKConnectionHarness.port}"
51
- else
52
- "The test harness is NOT running on port #{SDKConnectionHarness.port}"
53
- end
54
- )
55
- end
56
-
57
- task :stop do
58
- if SDKConnectionHarness.running?
59
- SDKConnectionHarness.stop!
60
- puts "Waiting for exit"
61
- while SDKConnectionHarness.running? do
62
- print "."
63
- sleep 1
64
- end
65
- else
66
- puts "The test harness is not running."
67
- end
68
- end
69
-
70
- end
71
- end
72
-