plunk_it 0.0.2 → 0.0.3
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/Gemfile +1 -0
- data/Gemfile.lock +2 -0
- data/VERSION +1 -1
- data/bin/plunk_it +28 -13
- data/plunk_it.gemspec +5 -2
- metadata +19 -3
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.3
|
data/bin/plunk_it
CHANGED
@@ -4,9 +4,13 @@ require 'multi_json'
|
|
4
4
|
require 'nokogiri'
|
5
5
|
require 'mechanize'
|
6
6
|
require 'logger'
|
7
|
+
require 'trollop'
|
8
|
+
|
7
9
|
#TODO - allow you to configure what gets excluded from uploading
|
8
10
|
#TODO - add support for pulling down a plunk to keep the local file in sync
|
9
|
-
|
11
|
+
opts = Trollop::options do
|
12
|
+
opt :plunk_txt, "Output a plunk.txt with url"
|
13
|
+
end
|
10
14
|
|
11
15
|
VALID_EXTENSTIONS = [".js", ".html"]
|
12
16
|
if !File.exists?(File.expand_path("~/.plunk_it"))
|
@@ -116,7 +120,6 @@ if manifest["plnkr_id"]
|
|
116
120
|
payload["files"] = new_files
|
117
121
|
end
|
118
122
|
|
119
|
-
#pp payload
|
120
123
|
# pp MultiJson.dump(payload)
|
121
124
|
# abort("oops")
|
122
125
|
else
|
@@ -125,16 +128,28 @@ else
|
|
125
128
|
current_data_page = @agent.get(post_url)
|
126
129
|
end
|
127
130
|
|
128
|
-
|
129
|
-
|
130
|
-
"
|
131
|
-
|
132
|
-
|
131
|
+
if !payload.empty?
|
132
|
+
plunk_post = @agent.post(post_url, MultiJson.dump(payload),
|
133
|
+
{"Content-type" => "application/json;charset=UTF-8",
|
134
|
+
"Host" => "api.plnkr.co",
|
135
|
+
"Origin" => "http://plnkr.co",
|
136
|
+
"Referer" => referer })
|
133
137
|
|
134
|
-
|
135
|
-
plunk_data = MultiJson.load(plunk_post.body)
|
136
|
-
manifest["plnkr_id"] = plunk_data["id"]
|
137
|
-
File.open(manifest_filename, "wb") do |f|
|
138
|
-
|
138
|
+
|
139
|
+
plunk_data = MultiJson.load(plunk_post.body)
|
140
|
+
manifest["plnkr_id"] = plunk_data["id"]
|
141
|
+
File.open(manifest_filename, "wb") do |f|
|
142
|
+
f.write(YAML.dump(manifest))
|
143
|
+
end
|
144
|
+
plunk_url = "http://plnkr.co/edit/#{plunk_data["id"]}"
|
145
|
+
if opts[:plunk_txt]
|
146
|
+
plunk_txt_filename = File.expand_path([target_directory, "plunk.txt"].join(File::SEPARATOR))
|
147
|
+
File.open(plunk_txt_filename, "wb") do |f|
|
148
|
+
f.write(plunk_url)
|
149
|
+
end
|
150
|
+
puts "Wrote #{plunk_txt_filename}"
|
151
|
+
end
|
152
|
+
puts "It has been plunked to #{plunk_url}"
|
153
|
+
else
|
154
|
+
puts "No change to plunk"
|
139
155
|
end
|
140
|
-
puts "It has been plunked to http://plnkr.co/edit/#{plunk_data["id"]}"
|
data/plunk_it.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "plunk_it"
|
8
|
-
s.version = "0.0.
|
8
|
+
s.version = "0.0.3"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Dirk Elmendorf"]
|
12
|
-
s.date = "2013-02-
|
12
|
+
s.date = "2013-02-13"
|
13
13
|
s.description = "This gem gives you a command line tool to keep your code in sync with plunks you publish at http://plnkr.co"
|
14
14
|
s.email = "code@r26d.com"
|
15
15
|
s.executables = ["plunk_it"]
|
@@ -48,12 +48,14 @@ Gem::Specification.new do |s|
|
|
48
48
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
49
49
|
s.add_runtime_dependency(%q<multi_json>, [">= 0"])
|
50
50
|
s.add_runtime_dependency(%q<mechanize>, [">= 0"])
|
51
|
+
s.add_runtime_dependency(%q<trollop>, [">= 0"])
|
51
52
|
s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
|
52
53
|
s.add_development_dependency(%q<bundler>, [">= 0"])
|
53
54
|
s.add_development_dependency(%q<jeweler>, ["~> 1.8.4"])
|
54
55
|
else
|
55
56
|
s.add_dependency(%q<multi_json>, [">= 0"])
|
56
57
|
s.add_dependency(%q<mechanize>, [">= 0"])
|
58
|
+
s.add_dependency(%q<trollop>, [">= 0"])
|
57
59
|
s.add_dependency(%q<rdoc>, ["~> 3.12"])
|
58
60
|
s.add_dependency(%q<bundler>, [">= 0"])
|
59
61
|
s.add_dependency(%q<jeweler>, ["~> 1.8.4"])
|
@@ -61,6 +63,7 @@ Gem::Specification.new do |s|
|
|
61
63
|
else
|
62
64
|
s.add_dependency(%q<multi_json>, [">= 0"])
|
63
65
|
s.add_dependency(%q<mechanize>, [">= 0"])
|
66
|
+
s.add_dependency(%q<trollop>, [">= 0"])
|
64
67
|
s.add_dependency(%q<rdoc>, ["~> 3.12"])
|
65
68
|
s.add_dependency(%q<bundler>, [">= 0"])
|
66
69
|
s.add_dependency(%q<jeweler>, ["~> 1.8.4"])
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: plunk_it
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
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: 2013-02-
|
12
|
+
date: 2013-02-13 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: multi_json
|
@@ -43,6 +43,22 @@ dependencies:
|
|
43
43
|
- - ! '>='
|
44
44
|
- !ruby/object:Gem::Version
|
45
45
|
version: '0'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: trollop
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :runtime
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
46
62
|
- !ruby/object:Gem::Dependency
|
47
63
|
name: rdoc
|
48
64
|
requirement: !ruby/object:Gem::Requirement
|
@@ -133,7 +149,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
133
149
|
version: '0'
|
134
150
|
segments:
|
135
151
|
- 0
|
136
|
-
hash: -
|
152
|
+
hash: -3788668038108426638
|
137
153
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
138
154
|
none: false
|
139
155
|
requirements:
|