jister 0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. data/LICENSE +19 -0
  2. data/README.md +45 -0
  3. data/bin/jister +21 -0
  4. data/lib/jister.rake +46 -0
  5. metadata +84 -0
data/LICENSE ADDED
@@ -0,0 +1,19 @@
1
+ Copyright (c) 2013 Darío Cravero (dario@uxtemple.com | @dariocravero)
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
4
+ this software and associated documentation files (the "Software"), to deal in
5
+ the Software without restriction, including without limitation the rights to
6
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
7
+ of the Software, and to permit persons to whom the Software is furnished to do
8
+ so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in all
11
+ copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
+ SOFTWARE.
@@ -0,0 +1,45 @@
1
+ # jister
2
+
3
+ Easily gist a whole project.
4
+
5
+ ## Installing
6
+
7
+ gem install jister
8
+
9
+ ### Pulling a jister without installation
10
+
11
+ curl -L http://jister.uxtemple.com | `which bash` -s GIST-ID
12
+
13
+ ## Commands
14
+
15
+ jister push
16
+
17
+ Will push a
18
+
19
+ jister pull GIST-ID
20
+
21
+ ## Configuration
22
+
23
+ ### JISTER_ROOT
24
+
25
+ The project's root. Default's to the working directory. To set it, do:
26
+
27
+ export JISTER_ROOT='/path/to/jisted/project'
28
+
29
+ ### JISTER_FILES
30
+
31
+ The files that will be saved to the gist. Defaults to ```['**/*.rb', '**/*.haml', '**/*.rake', '**/*.js', '**/*.css']```. To set it, do:
32
+
33
+ export JISTER_FILES='Gemfile,**/*.rb,thisfile.js'
34
+
35
+ ## Using it as a rake task
36
+
37
+ Copy lib/jister.rake into your app. Make sure you have "jist" installed first.
38
+
39
+ ## Creating a new Padrino project from a gist
40
+
41
+ padrino g project some_project; cd some_project; jister pull GIST-ID
42
+
43
+ or
44
+
45
+ padrino g project some_project; cd some_project; curl -L http://jister.uxtemple.com | `which bash` -s GIST-ID
@@ -0,0 +1,21 @@
1
+ #!/usr/bin/env ruby
2
+ require 'rubygems' # ruby1.9 doesn't 'require' it though
3
+ require 'thor'
4
+ require 'rake'
5
+ load File.expand_path('../../lib/jister.rake', __FILE__)
6
+
7
+ class Jister < Thor
8
+ include Thor::RakeCompat
9
+
10
+ desc 'push', "Push the current project to a Gist"
11
+ def push
12
+ Rake::Task['jister:push'].execute
13
+ end
14
+
15
+ desc 'pull', "Pull a Gist with a project"
16
+ def pull(id)
17
+ Rake::Task['jister:pull'].invoke(id)
18
+ end
19
+ end
20
+
21
+ Jister.start
@@ -0,0 +1,46 @@
1
+ desc 'Gist an entire project'
2
+ namespace :jister do
3
+ task :push do
4
+ require 'jist'
5
+ ROOT = ENV['JISTER_ROOT'] || Dir.pwd
6
+ FILES = ENV['JISTER_FILES'] ? ENV['JISTER_FILES'].split(',') : ['**/*.rb', '**/*.haml', '**/*.rake', '**/*.js', '**/*.css']
7
+
8
+ puts "Be patient... We're preparing your gist."
9
+
10
+ # Get the files
11
+ files = Dir[*FILES.map { |f| File.join(ROOT, f) }]
12
+ gist = Hash[files.map do |f|
13
+ [f.tap { |s| s.slice!("#{ROOT}#{File::SEPARATOR}") }.gsub('/','_-_'), File.read(f)]
14
+ end]
15
+
16
+ # Login if we weren't logged in before
17
+ Jist.login! unless File.exists?(File.join(ENV['HOME'],'.jist'))
18
+
19
+ jisted = File.join(ROOT, '.jisted')
20
+ new_jist = !File.exists?(jisted)
21
+
22
+ # Set the gist to public and update it if it already existed
23
+ options = {:public => true}
24
+ options[:update] = File.read(jisted) unless new_jist
25
+
26
+ # Gist it!
27
+ jist = Jist.multi_gist(gist, options)
28
+
29
+ # Save the id if it didn't exist
30
+ File.open(jisted, 'w') { |f| f.write jist['id'] } if new_jist
31
+
32
+ puts "Here it is. Share it with the world:"
33
+ puts " #{share(jist['id'])}"
34
+ puts "\n URL: #{jist['html_url']}"
35
+ puts " Files:"
36
+ puts " #{files.join("\n ")}"
37
+ end
38
+
39
+ task :pull, :gist_id do |t, args|
40
+ `#{share(args[:gist_id])}`
41
+ end
42
+
43
+ def share(id)
44
+ "curl -L http://jister.uxtemple.com | `which bash` -s #{id}"
45
+ end
46
+ end
metadata ADDED
@@ -0,0 +1,84 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: jister
3
+ version: !ruby/object:Gem::Version
4
+ version: '0.1'
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Darío Javier Cravero
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-01-06 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rake
16
+ requirement: &70335343932840 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: *70335343932840
25
+ - !ruby/object:Gem::Dependency
26
+ name: thor
27
+ requirement: &70335343932000 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: *70335343932000
36
+ - !ruby/object:Gem::Dependency
37
+ name: jist
38
+ requirement: &70335343931340 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
44
+ type: :runtime
45
+ prerelease: false
46
+ version_requirements: *70335343931340
47
+ description: Use jister to push and pull an entire project from Github's gists! It's
48
+ great for sharing a project while debugging an issue...
49
+ email: dario@uxtemple.com
50
+ executables:
51
+ - jister
52
+ extensions: []
53
+ extra_rdoc_files: []
54
+ files:
55
+ - bin/jister
56
+ - lib/jister.rake
57
+ - README.md
58
+ - LICENSE
59
+ homepage: http://github.com/dariocravero/jister
60
+ licenses: []
61
+ post_install_message:
62
+ rdoc_options: []
63
+ require_paths:
64
+ - lib
65
+ required_ruby_version: !ruby/object:Gem::Requirement
66
+ none: false
67
+ requirements:
68
+ - - ! '>='
69
+ - !ruby/object:Gem::Version
70
+ version: '0'
71
+ required_rubygems_version: !ruby/object:Gem::Requirement
72
+ none: false
73
+ requirements:
74
+ - - ! '>='
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ requirements: []
78
+ rubyforge_project:
79
+ rubygems_version: 1.8.11
80
+ signing_key:
81
+ specification_version: 3
82
+ summary: Gist an entire project back and forth
83
+ test_files: []
84
+ has_rdoc: