gasoline 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/.travis.yml ADDED
@@ -0,0 +1,6 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.9.3
4
+ - rbx-18mode
5
+ - rbx-19mode
6
+ - 1.8.7
data/CHANGELOG.md ADDED
@@ -0,0 +1,17 @@
1
+ ## 0.0.2 (Dec 27, 2012)
2
+
3
+ Features:
4
+
5
+ - Propane will be refreshed after igniting (using applescript)
6
+ - Added Speakerdeck gist, by dlackty
7
+
8
+ Bugfixes:
9
+
10
+ - Missing gists will no longer break ignite feature
11
+ - Pry for dev console
12
+
13
+ ## 0.0.1 (Aug 5, 2012)
14
+
15
+ Features:
16
+
17
+ - It's alive.
data/Gemfile CHANGED
@@ -3,7 +3,16 @@ source 'https://rubygems.org'
3
3
  # Specify your gem's dependencies in gasoline.gemspec
4
4
  gemspec
5
5
 
6
+ group :development do
7
+ # An IRB alternative and runtime developer console
8
+ # [pry](http://pry.github.com)
9
+ gem 'pry', '~> 0.9.10'
10
+ end
11
+
6
12
  group :test do
13
+ # Adding rake for Travis.
14
+ gem 'rake'
15
+
7
16
  # minitest provides a complete suite of testing facilities...
8
17
  # [minitest](https://github.com/seattlerb/minitest)
9
18
  gem 'minitest', '~> 3.3.0'
data/README.md CHANGED
@@ -4,7 +4,7 @@ I'm an avid [Campfire](http://campfirenow.com) user and [Propane](http://propane
4
4
 
5
5
  Since Propane 1.1.2 they've added a way to add some javascript, to augment the experience even more. Like adding avatars:
6
6
 
7
- [Fancy screenshot](http://cl.ly/image/1r0T3h1q460I)
7
+ ![Fancy screenshot](http://f.cl.ly/items/1q3a3v163W2I0A1B3j1H/Screen%20Shot%202012-08-07%20at%2000.10.59.png)
8
8
 
9
9
  The only downside to that approach was managing the file. So that's where Gasoline comes in. It's a gem that installs the command line utility `gasoline` which can download gists and append them to the patch file.
10
10
 
@@ -14,8 +14,39 @@ The only downside to that approach was managing the file. So that's where Gasoli
14
14
 
15
15
  ## Usage
16
16
 
17
- `gasoline ignite` will download the default drops and install them to the patch file.
17
+ Some default drops are included and can be installed using:
18
+
19
+ `gasoline ignite`
20
+
21
+ Adding new functionality is done by running (for example):
22
+
23
+ `gasoline add "Githubber" "https://gist.github.com/3288393" "Add github repo descriptions to your Campfire rooms"`
24
+
25
+ After adding a gist (or multiple) make sure to ignite them: `gasoline ignite`
26
+
27
+ ## More drops
28
+
29
+ - [Sounds](https://gist.github.com/686d56fcc7d7081232c6) Adds some extra sounds to Campfire
30
+
31
+ - [Avatars](https://gist.github.com/065d1dc1906c153e4edc) Adds avatars to friendly faces
32
+
33
+ - [Cloud App](https://gist.github.com/431f7c803ddb0d751a40) Adds support for Cloud.ly links
34
+
35
+ - [Flickr](https://gist.github.com/6dcf1366df5203157fda) Adds support for Flickr links
36
+
37
+ - [Build Colorizer](https://gist.github.com/4cf99c91eefc6d325d2c) Colors build output messages
38
+
39
+ - [Instagram](https://gist.github.com/3258692) Instagram support
40
+
41
+ - [HTML5Audio](https://gist.github.com/1288515) Adds html5 audio support
42
+
43
+ - [Githubber](https://gist.github.com/3288393) Add github repo descriptions to your Campfire rooms
44
+
45
+ - [Gists](https://gist.github.com/3288317) Inlines gists
46
+
47
+ - [speakerdeck](https://gist.github.com/4377786) Embeds SpeakerDeck slide inline.
18
48
 
19
49
  ## Contributing
20
50
 
21
51
  Fork it! Improve it! Test it! Rewrite it! (technology)
52
+ [![Build Status](https://secure.travis-ci.org/pjaspers/gasoline.png?branch=master)](http://travis-ci.org/pjaspers/gasoline)
data/bin/gasoline CHANGED
File without changes
data/example_drops.yml CHANGED
@@ -11,4 +11,7 @@
11
11
  :description: Adds support for Flickr links
12
12
  - :name: Instagram
13
13
  :url: https://gist.github.com/3258692
14
- :description: Instagram support
14
+ :description: Instagram support
15
+ - :name: SpeakerDeck
16
+ :url: https://gist.github.com/4377786
17
+ :description: Adds support for SpeakerDeck links
@@ -0,0 +1,44 @@
1
+ module Gasoline
2
+ class Applescript
3
+ # Runs a piece of Applescript,
4
+ #
5
+ # Gasoline::Applescript.run do
6
+ # "set ten_and_ten to 10 + 10"
7
+ # end
8
+ # => "20"
9
+ #
10
+ # Since Applescript has a nasy bit of littering its
11
+ # return values with `\n`, already escaping those.
12
+ def self.run
13
+ value = `/usr/bin/osascript -e "#{yield.gsub('"', '\"')}"`
14
+ value.gsub("\n", '')
15
+ end
16
+
17
+ # Checks if Propane is currently running
18
+ #
19
+ # Returns a bool
20
+ def self.propane_running?
21
+ running = run {'tell application "System Events" to (name of processes) contains "Propane"'}
22
+ running == "true"
23
+ end
24
+
25
+ # If Propane is running, this will send it a refresh command
26
+ #
27
+ # Returns a string
28
+ def self.refresh_propane_if_running
29
+ return unless propane_running?
30
+
31
+ script = <<SCRIPT
32
+ tell application "Propane"
33
+ activate
34
+ tell application "System Events"
35
+ # Refresh current room
36
+ keystroke "r" using command down
37
+ end tell
38
+ end tell
39
+ SCRIPT
40
+
41
+ run { script }
42
+ end
43
+ end
44
+ end
data/lib/gasoline/drop.rb CHANGED
@@ -71,8 +71,11 @@ end
71
71
  #{header}
72
72
  #{@js}
73
73
 
74
-
74
+ // console.log("Loaded #{@name}");
75
75
  PATCH
76
+ rescue => error
77
+ puts " -> #{error.message}"
78
+ nil
76
79
  end
77
80
 
78
81
  end
@@ -71,13 +71,14 @@ module Gasoline
71
71
  def patch_it_chewie
72
72
  to_keep = @lines[0...cut_line_index]
73
73
  snippet = [Gasoline::Texts::cut_here_snippet]
74
- to_add = drops.collect {|d| d.patch}
74
+ to_add = drops.collect(&:patch).compact
75
75
  @lines = (to_keep + snippet + to_add)
76
76
  end
77
77
 
78
78
  # First fills up the @lines instance, then saves the file
79
79
  def patch_it_chewie!
80
80
  patch_it_chewie
81
+ Gasoline::Applescript.refresh_propane_if_running
81
82
  save
82
83
  end
83
84
 
@@ -1,3 +1,3 @@
1
1
  module Gasoline
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
data/lib/gasoline.rb CHANGED
@@ -8,6 +8,7 @@ require "gasoline/drop"
8
8
  require "gasoline/patchor"
9
9
  require "gasoline/texts"
10
10
  require "gasoline/cli"
11
+ require "gasoline/applescript"
11
12
 
12
13
  module Gasoline
13
14
 
data/test/drop_test.rb CHANGED
@@ -55,6 +55,11 @@ describe Gasoline::Drop do
55
55
  assert_match "zyx", @drop.description
56
56
  end
57
57
 
58
+ it "should return nil if there was any error fetching it" do
59
+ @drop.stubs(:download_content).raises(StandardError, 'some error probably 404')
60
+ assert_nil @drop.patch
61
+ end
62
+
58
63
  it "should try to download when asked for patch" do
59
64
  @drop.expects(:download_content).returns("ZE JS CONTENT")
60
65
  assert_match "ZE JS", @drop.patch
data/test/patchor.js ADDED
@@ -0,0 +1,16 @@
1
+ /*
2
+ As of version 1.1.2, Propane will load and execute the contents of
3
+ ~Library/Application Support/Propane/unsupported/caveatPatchor.js
4
+ immediately following the execution of its own enhancer.js file.
5
+
6
+ You can use this mechanism to add your own customizations to Campfire
7
+ in Propane.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
10
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
11
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
12
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
13
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
14
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
15
+ THE SOFTWARE.
16
+ */
data/test/patchor_test.rb CHANGED
@@ -24,12 +24,11 @@ describe Gasoline::Patchor do
24
24
  describe "patching the patch" do
25
25
  before do
26
26
  @patchor = Gasoline::Patchor.new
27
- drop = mock()
28
- drop.expects(:patch).returns("ZE PATCH")
29
- @patchor.expects(:drops).returns([drop])
30
27
  end
31
28
 
32
29
  it "should download the patches and add them to lines" do
30
+ drop = OpenStruct.new(:patch => "ZE PATCH")
31
+ @patchor.expects(:drops).returns([drop])
33
32
  @patchor.patch_it_chewie
34
33
  assert @patchor.lines.include?("ZE PATCH")
35
34
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gasoline
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-08-06 00:00:00.000000000 Z
12
+ date: 2012-12-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: thor
@@ -36,6 +36,8 @@ extensions: []
36
36
  extra_rdoc_files: []
37
37
  files:
38
38
  - .gitignore
39
+ - .travis.yml
40
+ - CHANGELOG.md
39
41
  - Gemfile
40
42
  - LICENSE
41
43
  - README.md
@@ -44,6 +46,7 @@ files:
44
46
  - example_drops.yml
45
47
  - gasoline.gemspec
46
48
  - lib/gasoline.rb
49
+ - lib/gasoline/applescript.rb
47
50
  - lib/gasoline/cli.rb
48
51
  - lib/gasoline/drop.rb
49
52
  - lib/gasoline/jerrycan.rb
@@ -54,6 +57,7 @@ files:
54
57
  - test/example_drops.yml
55
58
  - test/helper.rb
56
59
  - test/jerrycan_test.rb
60
+ - test/patchor.js
57
61
  - test/patchor_test.rb
58
62
  homepage: ''
59
63
  licenses: []
@@ -67,12 +71,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
67
71
  - - ! '>='
68
72
  - !ruby/object:Gem::Version
69
73
  version: '0'
74
+ segments:
75
+ - 0
76
+ hash: -4349780859751840339
70
77
  required_rubygems_version: !ruby/object:Gem::Requirement
71
78
  none: false
72
79
  requirements:
73
80
  - - ! '>='
74
81
  - !ruby/object:Gem::Version
75
82
  version: '0'
83
+ segments:
84
+ - 0
85
+ hash: -4349780859751840339
76
86
  requirements: []
77
87
  rubyforge_project:
78
88
  rubygems_version: 1.8.24
@@ -84,4 +94,5 @@ test_files:
84
94
  - test/example_drops.yml
85
95
  - test/helper.rb
86
96
  - test/jerrycan_test.rb
97
+ - test/patchor.js
87
98
  - test/patchor_test.rb