ofxbundler 0.1 → 0.2

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock ADDED
@@ -0,0 +1,29 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ ofxbundler (0.1)
5
+ faraday
6
+ nokogiri
7
+ rubyzip
8
+
9
+ GEM
10
+ remote: https://rubygems.org/
11
+ specs:
12
+ addressable (2.2.7)
13
+ faraday (0.7.6)
14
+ addressable (~> 2.2)
15
+ multipart-post (~> 1.1)
16
+ rack (~> 1.1)
17
+ multipart-post (1.1.5)
18
+ nokogiri (1.5.2)
19
+ rack (1.4.1)
20
+ rubyzip (0.9.7)
21
+
22
+ PLATFORMS
23
+ ruby
24
+
25
+ DEPENDENCIES
26
+ faraday
27
+ nokogiri
28
+ ofxbundler!
29
+ rubyzip
data/OfxFile CHANGED
@@ -1,4 +1,5 @@
1
1
 
2
- #ofx "007" # this line will donwload the ofx 007 version
2
+ ofx :version=>"007" # this line will donwload the ofx 007 version
3
+ # ofx :version=>"007_64" # this line will donwload the ofx 007_64 version (linux only)
3
4
 
4
- # addon "armadillu/ofxAnimatable" # this line will download the this addons from github
5
+ addon "armadillu/ofxAnimatable" # this line will download the this addons from github
data/README.md CHANGED
@@ -6,15 +6,23 @@ inspired by vundle and bundler
6
6
 
7
7
  ## pre-install
8
8
 
9
- git,
9
+ git
10
10
 
11
11
  ## Usage
12
12
 
13
- edit the OfxFile
13
+ ofxbundler help : list available commands
14
14
 
15
- bundle "armadillu/ofxAnimatable" will download this repo to ofx
15
+ ofxbundler list: show the latest openframeworks version
16
+
17
+ ofxbundler install: install the openframeworks by OfxFile
18
+
19
+ ofxbundler search keywork: searching addons by keyword
20
+
21
+ ## Edit the OfxFile
22
+
23
+ ofx "007" # download version 007 and unzip it. not support older version yet.
24
+
25
+ addon "armadillu/ofxAnimatable" # download/update this repo to ofx
16
26
 
17
27
 
18
- or
19
28
 
20
- ofxbundle -s searhTerm # this will return possible addons
data/bin/ofxbundle CHANGED
@@ -8,45 +8,56 @@ options={}
8
8
  def colorize(text, color_code)
9
9
  "\e[#{color_code}m#{text}\e[0m"
10
10
  end
11
- OptionParser.new do |opts|
12
- opts.banner = "Usage: example.rb [options]"
13
- opts.on("-l","list current openframeworks version") do |v|
14
- response = Faraday.get do |req|
15
- req.url "http://www.openframeworks.cc/download/"
16
- end
17
- doc = Nokogiri::HTML(response.body)
18
- version = doc.css("#download-latest-header h2")
19
- puts "Openframeworks current version is "+ version.text
20
- end
21
11
 
22
- opts.on("install","install by bundler file") do |v|
23
- #find bundler.file
24
- OfxBundler::Dsl.evalute("OfxFile")
12
+ usage_helper=" ofxbundler help \n ofxbundler list : list latest openframeworks version \n ofxbundler install : install Openframeworks addons \n ofxbundler search keyword : searching addons by keyword"
13
+
14
+ available_commands =%w(install search list)
15
+ if ARGV.size ==0
16
+ puts usage_helper
17
+ exit
18
+ end
19
+ command = ARGV.shift
20
+ if !available_commands.include?(command)
21
+ puts usage_helper
22
+ end
23
+
24
+ case command
25
+ when "help" then
26
+ puts usage_helper
27
+ when "list" then
28
+ response = Faraday.get do |req|
29
+ req.url "http://www.openframeworks.cc/download/"
25
30
  end
26
- opts.on("-s w","--search w","search the addons") do |w|
27
- response = Faraday.get do |req|
28
- req.url "http://ofxaddons.com/"
29
- end
30
- doc = Nokogiri::HTML(response.body)
31
- doc.css("div.repo").each do |repo|
32
- is_found=false;
33
- repo_name=''
34
- repo.css("p.name a").each do |item|
35
- text = item.text()
36
- if text.downcase.include?(w.downcase)
37
- is_found=true
38
- repo_name=text
39
- end
40
- end
41
- if is_found
42
- repo_author = repo.css("p.author").first.text()
43
- puts " "+colorize(repo_name,31)+" - #{repo_author}"
44
- repo_desc = repo.css("p.description em").first.text()
45
- repo_desc.gsub!(/\[view on Github\]/,'')
46
- github_link = (repo.css("p.description em a.github_link").first)["href"]
47
- puts " "+colorize(repo_desc,32)
48
- puts " github:"+github_link
31
+ doc = Nokogiri::HTML(response.body)
32
+ version = doc.css("#download-latest-header h2")
33
+ puts "Openframeworks current version is "+ version.text
34
+ when "install" then
35
+ OfxBundler::Dsl.evalute("OfxFile")
36
+ when "search" then
37
+ w = ARGV.shift
38
+ response = Faraday.get do |req|
39
+ req.url "http://ofxaddons.com/"
40
+ end
41
+ doc = Nokogiri::HTML(response.body)
42
+ doc.css("div.repo").each do |repo|
43
+ is_found=false;
44
+ repo_name=''
45
+ repo.css("p.name a").each do |item|
46
+ text = item.text()
47
+ if text.downcase.include?(w.downcase)
48
+ is_found=true
49
+ repo_name=text
49
50
  end
50
51
  end
52
+ if is_found
53
+ repo_author = repo.css("p.author").first.text()
54
+ puts " "+colorize(repo_name,31)+" - #{repo_author}"
55
+ repo_desc = repo.css("p.description em").first.text()
56
+ repo_desc.gsub!(/\[view on Github\]/,'')
57
+ github_link = (repo.css("p.description em a.github_link").first)["href"]
58
+ puts " "+colorize(repo_desc,32)
59
+ puts " github:"+github_link
60
+ end
51
61
  end
52
- end.parse!
62
+ end
63
+
@@ -4,14 +4,32 @@ require 'net/http'
4
4
  require 'zip/zip'
5
5
  module OfxBundler
6
6
  class Dsl
7
- @@download_href={
7
+ @@configs={
8
8
  :osx=>{
9
- "007"=>"http://www.openframeworks.cc/versions/preRelease_v0.07/of_preRelease_v007_osx.zip",
10
- "filename"=>'of_preRelease_v007_osx.zip"',
11
- "dirname"=>'of_preRelease_v007_osx'
12
- }
9
+ "007"=>
10
+ {
11
+ "file"=>"http://www.openframeworks.cc/versions/preRelease_v0.07/of_preRelease_v007_osx.zip",
12
+ "filename"=>'of_preRelease_v007_osx.zip"',
13
+ "dirname"=>'of_preRelease_v007_osx'
14
+
15
+ }
16
+ },
17
+ "linux"=>{
18
+ "007" =>{
19
+ "file"=> "http://www.openframeworks.cc/versions/preRelease_v0.07/of_preRelease_v007_linux.tar.gz",
20
+ "filename"=>"of_preRelease_v007_linux.tar.gz",
21
+ "dirname" => "of_preRelease_v007_linux"
22
+ },
23
+ "007_64" => {
24
+ "file"=> "http://www.openframeworks.cc/versions/preRelease_v0.07/of_preRelease_v007_linux64.tar.gz",
25
+ "filename" => "of_preRelease_v007_linux64",
26
+ "dirname"=> "of_preRelease_v007_linux64"
27
+ }
28
+
29
+ }
13
30
 
14
31
  }
32
+
15
33
  def initialize
16
34
  end
17
35
 
@@ -28,31 +46,38 @@ module OfxBundler
28
46
  instance_eval(File.read(filename))
29
47
  end
30
48
 
31
- def get_config
49
+ def get_config version
32
50
  config=nil
33
51
  if RUBY_PLATFORM.downcase.include?("darwin")
34
- config= @@download_href[:osx]
52
+ config= @@configs[:osx][version]
35
53
  elsif RUBY_PLATFORM.downcase.include?("mswin")
36
54
  elsif RUBY_PLATFORM.downcase.include?("linux")
55
+ config= @@configs[:linux][version]
37
56
  end
38
57
  config
39
58
  end
40
59
 
41
60
  #install latest version
42
- def ofx(version="latest")
61
+ def ofx(opts)
62
+ version = opts[:version] || "007"
63
+ extra = opts[:extra]
43
64
  response = Faraday.get do |req|
44
65
  req.url "http://www.openframeworks.cc/download/"
45
66
  end
46
67
  doc = Nokogiri::HTML(response.body)
47
- version = doc.css("#download-latest-header h2")
48
- puts "Openframeworks current version is "+ version.text+"\n"
68
+ latest_version = doc.css("#download-latest-header h2")
69
+ puts "Openframeworks current version is "+ latest_version.text+"\n"
49
70
  puts "your os is "+RUBY_PLATFORM.downcase
71
+ config = get_config(version)
72
+ p config
50
73
  href=""
51
74
  if RUBY_PLATFORM.downcase.include?("darwin")
52
- href = @@download_href[:osx]["007"]
75
+ href = config["file"]
53
76
  elsif RUBY_PLATFORM.downcase.include?("mswin")
54
77
  elsif RUBY_PLATFORM.downcase.include?("linux")
78
+ href = @@configs[:linux][version]["file"]
55
79
  end
80
+
56
81
 
57
82
  if href!=""
58
83
  p "downing "+href
@@ -78,6 +103,10 @@ module OfxBundler
78
103
  file.extract(f,f_path)
79
104
  end
80
105
  }
106
+ #cleanup
107
+ p "cleanup..."
108
+ `rm -rf __MACOSX`
109
+ `rm -rf ofx.zip`
81
110
 
82
111
  end
83
112
 
@@ -1,3 +1,3 @@
1
1
  module Ofxbundler
2
- VERSION = "0.1"
2
+ VERSION = "0.2"
3
3
  end
data/ofxbundler.gemspec CHANGED
@@ -4,8 +4,8 @@ require File.expand_path('../lib/ofxbundler/version', __FILE__)
4
4
  Gem::Specification.new do |gem|
5
5
  gem.authors = ["crazylion"]
6
6
  gem.email = ["crazylion2@gmail.com"]
7
- gem.description = %q{help user to manager their openframes addons }
8
- gem.summary = %q{help user to manager their openframes addons }
7
+ gem.description = %q{help user to manager their openframeworks addons }
8
+ gem.summary = %q{help user to manager their openframeworks addons }
9
9
  gem.homepage = "https://github.com/crazylion/ofxbundler"
10
10
 
11
11
  gem.files = `git ls-files`.split($\)
@@ -15,6 +15,10 @@ Gem::Specification.new do |gem|
15
15
  gem.require_paths = ["lib"]
16
16
  gem.version = Ofxbundler::VERSION
17
17
 
18
- gem.add_development_dependency 'fadary'
18
+ gem.add_development_dependency 'faraday'
19
19
  gem.add_development_dependency 'nokogiri'
20
+ gem.add_development_dependency 'rubyzip'
21
+ gem.add_runtime_dependency 'faraday'
22
+ gem.add_runtime_dependency 'nokogiri'
23
+ gem.add_runtime_dependency 'rubyzip'
20
24
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ofxbundler
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.1'
4
+ version: '0.2'
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-04-06 00:00:00.000000000Z
12
+ date: 2012-04-09 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
- name: fadary
16
- requirement: &70186037407480 !ruby/object:Gem::Requirement
15
+ name: faraday
16
+ requirement: &2154462440 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *70186037407480
24
+ version_requirements: *2154462440
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: nokogiri
27
- requirement: &70186037407060 !ruby/object:Gem::Requirement
27
+ requirement: &2154462020 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,8 +32,52 @@ dependencies:
32
32
  version: '0'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *70186037407060
36
- description: ! 'help user to manager their openframes addons '
35
+ version_requirements: *2154462020
36
+ - !ruby/object:Gem::Dependency
37
+ name: rubyzip
38
+ requirement: &2154461600 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
44
+ type: :development
45
+ prerelease: false
46
+ version_requirements: *2154461600
47
+ - !ruby/object:Gem::Dependency
48
+ name: faraday
49
+ requirement: &2154461180 !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ type: :runtime
56
+ prerelease: false
57
+ version_requirements: *2154461180
58
+ - !ruby/object:Gem::Dependency
59
+ name: nokogiri
60
+ requirement: &2154460760 !ruby/object:Gem::Requirement
61
+ none: false
62
+ requirements:
63
+ - - ! '>='
64
+ - !ruby/object:Gem::Version
65
+ version: '0'
66
+ type: :runtime
67
+ prerelease: false
68
+ version_requirements: *2154460760
69
+ - !ruby/object:Gem::Dependency
70
+ name: rubyzip
71
+ requirement: &2160119460 !ruby/object:Gem::Requirement
72
+ none: false
73
+ requirements:
74
+ - - ! '>='
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ type: :runtime
78
+ prerelease: false
79
+ version_requirements: *2160119460
80
+ description: ! 'help user to manager their openframeworks addons '
37
81
  email:
38
82
  - crazylion2@gmail.com
39
83
  executables:
@@ -42,6 +86,7 @@ extensions: []
42
86
  extra_rdoc_files: []
43
87
  files:
44
88
  - Gemfile
89
+ - Gemfile.lock
45
90
  - LICENSE
46
91
  - OfxFile
47
92
  - README.md
@@ -74,5 +119,5 @@ rubyforge_project:
74
119
  rubygems_version: 1.8.15
75
120
  signing_key:
76
121
  specification_version: 3
77
- summary: help user to manager their openframes addons
122
+ summary: help user to manager their openframeworks addons
78
123
  test_files: []