kango 0.0.1.0.9.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: bdc2be53d8f420608f41bd768f53ca202890b1f6
4
+ data.tar.gz: 0c63041dac9f92a83761318ff52d11201bd04928
5
+ SHA512:
6
+ metadata.gz: aee98c4ecb784862f53704fd6aa78a4af817edb863c42d558d8cfe7831c4cbfac02956ae78804af2c85350005b705c89e3649770c113b61dd06338ae7b9f8d0f
7
+ data.tar.gz: 7b4604ff30a7509809066732f94446beb5cbf79184b6ddee34341ea8e15a029f0b8bc258021391b15bbb9ca2af5836216bfe483eb0830f8ba2b29320c3e22dc9
data/.gitignore ADDED
@@ -0,0 +1,18 @@
1
+ .DS_Store
2
+ *.gem
3
+ *.rbc
4
+ .bundle
5
+ .config
6
+ .yardoc
7
+ Gemfile.lock
8
+ InstalledFiles
9
+ _yardoc
10
+ coverage
11
+ doc/
12
+ lib/bundler/man
13
+ pkg
14
+ rdoc
15
+ spec/reports
16
+ test/tmp
17
+ test/version_tmp
18
+ tmp
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --format progress
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in kango.gemspec
4
+ gemspec
data/Guardfile ADDED
@@ -0,0 +1,8 @@
1
+ # A sample Guardfile
2
+ # More info at https://github.com/guard/guard#readme
3
+
4
+ guard :rspec do
5
+ watch(%r{^spec/.+_spec\.rb$})
6
+ watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
7
+ watch('spec/spec_helper.rb') { "spec" }
8
+ end
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Keyvan Fatehi
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,49 @@
1
+ # Kango
2
+
3
+ Wrapper and task runner for the [Kango Framework](http://kangoextensions.com)
4
+
5
+ Thanks to the folks @ Kango Framework!
6
+
7
+ ## Installation
8
+
9
+ Make sure you have python. Kango Framework is written in python.
10
+ This gem calls python directly, so make sure it's in your PATH.
11
+
12
+ Add this line to your application's Gemfile:
13
+
14
+ gem 'kango'
15
+
16
+ And then execute:
17
+
18
+ $ bundle
19
+
20
+ Or install it yourself as:
21
+
22
+ $ gem install kango
23
+
24
+ ## Usage
25
+
26
+ `kango docs` will take you to http://kangoextensions.com/docs/index.html
27
+ `kango install` will download and install kango framework into your home directory
28
+ `kango create` wraps kango's create command, ready for coffeescript via this gem
29
+ `kango build` will compile your coffeescript and use KangoFramework to build
30
+
31
+ ## Example
32
+
33
+ ```bash
34
+ gem install kango # install the gem
35
+ kango install # install the kango framework into ~/kango-framework
36
+ kango create adblock # generate a new browser extension called adblock
37
+ cd adblock
38
+ bundle # bundle this gem so you can build
39
+ vim coffee/main.coffee # write coffeescript here!
40
+ kango build # compile the coffeescript and build with the Kango Framework
41
+ ```
42
+
43
+ ## Contributing
44
+
45
+ 1. Fork it
46
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
47
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
48
+ 4. Push to the branch (`git push origin my-new-feature`)
49
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
data/bin/kango ADDED
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ require 'kango'
3
+
4
+ Kango::Tasks.start
data/kango.gemspec ADDED
@@ -0,0 +1,31 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'kango/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "kango"
8
+ spec.version = Kango::VERSION
9
+ spec.authors = ["Keyvan Fatehi"]
10
+ spec.email = ["keyvanfatehi@gmail.com"]
11
+ spec.description = %q{Wraps the brilliant Kango Framework with ruby niceties}
12
+ spec.summary = %q{Write browser extensions with Kango & Coffeescript}
13
+ spec.homepage = "https://github.com/keyvanfatehi/kango"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.3"
22
+ spec.add_development_dependency "rake"
23
+ spec.add_development_dependency 'pry'
24
+ spec.add_development_dependency 'rspec'
25
+ spec.add_development_dependency 'guard'
26
+ spec.add_development_dependency 'guard-rspec'
27
+
28
+ spec.add_runtime_dependency 'thor', '~>0.18.1'
29
+ spec.add_runtime_dependency 'coffee-script', '~> 2.2.0'
30
+ spec.add_runtime_dependency 'launchy'
31
+ end
@@ -0,0 +1,20 @@
1
+ module Kango
2
+ def self.install!
3
+ zipfile = File.expand_path(File.join("~", 'kango-framework.zip'))
4
+ puts "Downloading Kango Framework to #{zipfile}..."
5
+ require 'open-uri'
6
+ File.open(zipfile, 'wb') do |file|
7
+ open(KANGO_FRAMEWORK_URL, 'rb') do |download|
8
+ file.write download.read
9
+ end
10
+ end
11
+ puts "Download complete! Extracting..."
12
+ `unzip #{zipfile} -d #{KANGO_FRAMEWORK}`
13
+ if Kango.framework_exists?
14
+ FileUtils.rm zipfile
15
+ puts "Kango Framework is ready. You can now rake build"
16
+ else
17
+ puts "Something went wrong... probably could not download Kango Framework"
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,24 @@
1
+ module Kango
2
+ module Templates
3
+ def self.gemfile
4
+ <<-EOF
5
+ source 'https://rubygems.org'
6
+
7
+ gem 'kango', '~> #{Kango::VERSION}'
8
+ EOF
9
+ end
10
+
11
+ def self.main_coffee
12
+ <<-EOF
13
+ MyExtension = ->
14
+ kango.ui.browserButton.addEventListener kango.ui.browserButton.event.COMMAND, =>
15
+ @._onCommand()
16
+
17
+ MyExtension:: = _onCommand: ->
18
+ kango.browser.tabs.create url: "http://kangoextensions.com/"
19
+
20
+ extension = new MyExtension()
21
+ EOF
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,3 @@
1
+ module Kango
2
+ VERSION = "0.0.1.0.9.2"
3
+ end
data/lib/kango.rb ADDED
@@ -0,0 +1,94 @@
1
+ require "kango/version"
2
+ require 'thor'
3
+
4
+ module Kango
5
+ KANGO_FRAMEWORK_URL = "http://kangoextensions.com/kango/kango-framework-latest.zip"
6
+ KANGO_FRAMEWORK = File.expand_path(File.join('~', 'kango-framework'))
7
+
8
+ def self.framework_exists?
9
+ File.directory? KANGO_FRAMEWORK
10
+ end
11
+
12
+ class Tasks < Thor
13
+ desc "install", "Install the kango framework"
14
+ def install
15
+ require 'kango/install'
16
+ if Kango.framework_exists?
17
+ puts "Framework exists! Will not re-install."
18
+ else
19
+ Kango.install!
20
+ end
21
+ end
22
+
23
+ desc 'compile', 'Compile coffeescript userscripts into common as javascript'
24
+ def compile
25
+ require 'coffee-script'
26
+ Dir.glob('coffee/**/*.coffee') do |file|
27
+ script = file.gsub(/(^coffee|coffee$)/, 'js').split('/').last
28
+ path = Pathname.new('src/common').join(script)
29
+ puts "[ INFO] Compiling #{file} to #{path.to_s}"
30
+ FileUtils.mkdir_p path.dirname
31
+ File.open(path.to_s, 'w') do |f|
32
+ f.puts userscript_commentblock(file)
33
+ f.puts CoffeeScript.compile File.read(file), :bare => true
34
+ end
35
+ end
36
+ end
37
+
38
+ desc 'build', 'Build the extensions with Kango'
39
+ def build
40
+ self.compile
41
+ ensure_framework do
42
+ `python #{KANGO_FRAMEWORK}/kango.py build .`
43
+ end
44
+ end
45
+
46
+ desc 'create', 'Create a new kango project'
47
+ def create name
48
+ require 'kango/templates'
49
+ ensure_framework do
50
+ path = File.expand_path(File.join(Dir.pwd, name))
51
+ puts "Creating Kango project at #{path}"
52
+ `echo #{name} | python #{KANGO_FRAMEWORK}/kango.py create #{path}`
53
+ File.open(File.join(path, 'Gemfile'), 'w') do |gemfile|
54
+ gemfile.puts Kango::Templates.gemfile
55
+ end
56
+ FileUtils.mkdir File.join(path, 'coffee')
57
+ File.open(File.join(path, 'coffee', 'main.coffee'), 'w') do |main|
58
+ main.puts Kango::Templates.main_coffee
59
+ end
60
+ end
61
+ end
62
+
63
+ desc 'docs', 'Open Kango Framework documentation'
64
+ def docs
65
+ require 'launchy'
66
+ Launchy.open("http://kangoextensions.com/docs/index.html")
67
+ end
68
+
69
+ private
70
+
71
+ ##
72
+ # Extract userscript comment block from CoffeeScript file.
73
+ def userscript_commentblock(coffee_file)
74
+ comment = ""
75
+ File.open(coffee_file) do |f|
76
+ while line = f.gets
77
+ break unless line =~ /^#/
78
+ comment += line.gsub(/^#/, '//')
79
+ end
80
+ end
81
+ comment
82
+ end
83
+
84
+ ##
85
+ # Calls the block only if the framework exists
86
+ def ensure_framework &block
87
+ if Kango.framework_exists?
88
+ block.call
89
+ else
90
+ puts "Kango Framework is missing. Install it with 'kango install'"
91
+ end
92
+ end
93
+ end
94
+ end
@@ -0,0 +1,27 @@
1
+ require 'kango'
2
+
3
+ PROJECT_DIR = File.join(Dir.pwd, 'my_extension')
4
+ def erase_fixture_project
5
+ FileUtils.rm_r(PROJECT_DIR) if File.exists?(PROJECT_DIR)
6
+ end
7
+
8
+
9
+ RSpec.configure do |config|
10
+ config.treat_symbols_as_metadata_keys_with_true_values = true
11
+ config.run_all_when_everything_filtered = true
12
+ config.filter_run :focus
13
+
14
+ # Run specs in random order to surface order dependencies. If you find an
15
+ # order dependency and want to debug it, you can fix the order by providing
16
+ # the seed, which is printed after each run.
17
+ # --seed 1234
18
+ config.order = 'random'
19
+
20
+ config.before(:suite) do
21
+ erase_fixture_project
22
+ end
23
+
24
+ config.after(:suite) do
25
+ erase_fixture_project
26
+ end
27
+ end
metadata ADDED
@@ -0,0 +1,186 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: kango
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1.0.9.2
5
+ platform: ruby
6
+ authors:
7
+ - Keyvan Fatehi
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-05-20 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.3'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.3'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: pry
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: guard
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: guard-rspec
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - '>='
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - '>='
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: thor
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ~>
102
+ - !ruby/object:Gem::Version
103
+ version: 0.18.1
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ~>
109
+ - !ruby/object:Gem::Version
110
+ version: 0.18.1
111
+ - !ruby/object:Gem::Dependency
112
+ name: coffee-script
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ~>
116
+ - !ruby/object:Gem::Version
117
+ version: 2.2.0
118
+ type: :runtime
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ~>
123
+ - !ruby/object:Gem::Version
124
+ version: 2.2.0
125
+ - !ruby/object:Gem::Dependency
126
+ name: launchy
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - '>='
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :runtime
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - '>='
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ description: Wraps the brilliant Kango Framework with ruby niceties
140
+ email:
141
+ - keyvanfatehi@gmail.com
142
+ executables:
143
+ - kango
144
+ extensions: []
145
+ extra_rdoc_files: []
146
+ files:
147
+ - .gitignore
148
+ - .rspec
149
+ - Gemfile
150
+ - Guardfile
151
+ - LICENSE.txt
152
+ - README.md
153
+ - Rakefile
154
+ - bin/kango
155
+ - kango.gemspec
156
+ - lib/kango.rb
157
+ - lib/kango/install.rb
158
+ - lib/kango/templates.rb
159
+ - lib/kango/version.rb
160
+ - spec/spec_helper.rb
161
+ homepage: https://github.com/keyvanfatehi/kango
162
+ licenses:
163
+ - MIT
164
+ metadata: {}
165
+ post_install_message:
166
+ rdoc_options: []
167
+ require_paths:
168
+ - lib
169
+ required_ruby_version: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - '>='
172
+ - !ruby/object:Gem::Version
173
+ version: '0'
174
+ required_rubygems_version: !ruby/object:Gem::Requirement
175
+ requirements:
176
+ - - '>='
177
+ - !ruby/object:Gem::Version
178
+ version: '0'
179
+ requirements: []
180
+ rubyforge_project:
181
+ rubygems_version: 2.0.3
182
+ signing_key:
183
+ specification_version: 4
184
+ summary: Write browser extensions with Kango & Coffeescript
185
+ test_files:
186
+ - spec/spec_helper.rb