geppetto 0.9.4 → 0.9.5
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/README.md +88 -0
 - data/lib/geppetto.rb +11 -0
 - data/lib/geppetto/480_640.png +0 -0
 - data/lib/geppetto/640_480.png +0 -0
 - data/lib/geppetto/cli.rb +8 -6
 - data/lib/geppetto/version.rb +1 -1
 - metadata +9 -9
 - data/README.textile +0 -17
 
    
        data/README.md
    ADDED
    
    | 
         @@ -0,0 +1,88 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            Geppetto is a simple command line tool to help manage Facebook test users and the generation of content.
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            ## Installation
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            <pre class="terminal">
         
     | 
| 
      
 6 
     | 
    
         
            +
            $ gem install geppetto
         
     | 
| 
      
 7 
     | 
    
         
            +
            </pre>
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
            ## Usage
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
            ### Help
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
            <pre class="terminal">
         
     | 
| 
      
 14 
     | 
    
         
            +
            $ geppetto help
         
     | 
| 
      
 15 
     | 
    
         
            +
            </pre>
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
            ### Common Scenarios
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
            First let's start by creating a network of 5 friends.
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
            <pre class="terminal">
         
     | 
| 
      
 22 
     | 
    
         
            +
            $ geppetto create 5 --networked
         
     | 
| 
      
 23 
     | 
    
         
            +
            </pre>
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
            For each user, you will get a <code>login_url</code>, <code>id</code> and <code>access_token</code>. The <code>login_url</code> is useful to view this user on the facebook.com site. Otherwise, you can simply use the <code>access_token</code> to authenticate them within your own application.
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
      
 27 
     | 
    
         
            +
            <img src="http://cdn.ternarylabs.com/media/2011/03/fb_new_user.png">
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
      
 29 
     | 
    
         
            +
            <p class="caption">
         
     | 
| 
      
 30 
     | 
    
         
            +
            A new test user. Test users seem to always be female.
         
     | 
| 
      
 31 
     | 
    
         
            +
            </p>
         
     | 
| 
      
 32 
     | 
    
         
            +
             
     | 
| 
      
 33 
     | 
    
         
            +
            To list all your test users, simply type:
         
     | 
| 
      
 34 
     | 
    
         
            +
             
     | 
| 
      
 35 
     | 
    
         
            +
            <pre class="terminal">
         
     | 
| 
      
 36 
     | 
    
         
            +
            $ geppetto list
         
     | 
| 
      
 37 
     | 
    
         
            +
            </pre>
         
     | 
| 
      
 38 
     | 
    
         
            +
             
     | 
| 
      
 39 
     | 
    
         
            +
            Now it's time to create some content by having all the users in the network update their status.
         
     | 
| 
      
 40 
     | 
    
         
            +
             
     | 
| 
      
 41 
     | 
    
         
            +
            <pre class="terminal">
         
     | 
| 
      
 42 
     | 
    
         
            +
            $ geppetto generate_status
         
     | 
| 
      
 43 
     | 
    
         
            +
            </pre>
         
     | 
| 
      
 44 
     | 
    
         
            +
             
     | 
| 
      
 45 
     | 
    
         
            +
            <img src="http://cdn.ternarylabs.com/media/2011/03/fb_status_update.png">
         
     | 
| 
      
 46 
     | 
    
         
            +
             
     | 
| 
      
 47 
     | 
    
         
            +
            <p class="caption">
         
     | 
| 
      
 48 
     | 
    
         
            +
            A new status update.
         
     | 
| 
      
 49 
     | 
    
         
            +
            </p>
         
     | 
| 
      
 50 
     | 
    
         
            +
             
     | 
| 
      
 51 
     | 
    
         
            +
            Let's engage in some social interactions. Each user will comment and like each other's posts.
         
     | 
| 
      
 52 
     | 
    
         
            +
             
     | 
| 
      
 53 
     | 
    
         
            +
            <pre class="terminal">
         
     | 
| 
      
 54 
     | 
    
         
            +
            $ geppetto generate_comments
         
     | 
| 
      
 55 
     | 
    
         
            +
            $ geppetto generate_likes
         
     | 
| 
      
 56 
     | 
    
         
            +
            </pre>
         
     | 
| 
      
 57 
     | 
    
         
            +
             
     | 
| 
      
 58 
     | 
    
         
            +
            <img src="http://cdn.ternarylabs.com/media/2011/03/fb_like.png">
         
     | 
| 
      
 59 
     | 
    
         
            +
             
     | 
| 
      
 60 
     | 
    
         
            +
            <p class="caption">
         
     | 
| 
      
 61 
     | 
    
         
            +
            Liking and commenting.
         
     | 
| 
      
 62 
     | 
    
         
            +
            </p>
         
     | 
| 
      
 63 
     | 
    
         
            +
             
     | 
| 
      
 64 
     | 
    
         
            +
            You can also create and upload "photos".
         
     | 
| 
      
 65 
     | 
    
         
            +
             
     | 
| 
      
 66 
     | 
    
         
            +
            <pre class="terminal">
         
     | 
| 
      
 67 
     | 
    
         
            +
            $ geppetto generate_images
         
     | 
| 
      
 68 
     | 
    
         
            +
            </pre>
         
     | 
| 
      
 69 
     | 
    
         
            +
             
     | 
| 
      
 70 
     | 
    
         
            +
            <img src="http://cdn.ternarylabs.com/media/2011/03/fb_photo.png">
         
     | 
| 
      
 71 
     | 
    
         
            +
             
     | 
| 
      
 72 
     | 
    
         
            +
            <p class="caption">
         
     | 
| 
      
 73 
     | 
    
         
            +
            A photo is posted.
         
     | 
| 
      
 74 
     | 
    
         
            +
            </p>
         
     | 
| 
      
 75 
     | 
    
         
            +
             
     | 
| 
      
 76 
     | 
    
         
            +
            Geppetto provides a couple of shortcuts to populate content.
         
     | 
| 
      
 77 
     | 
    
         
            +
             
     | 
| 
      
 78 
     | 
    
         
            +
            <pre class="terminal">
         
     | 
| 
      
 79 
     | 
    
         
            +
            $ geppetto build
         
     | 
| 
      
 80 
     | 
    
         
            +
            </pre>
         
     | 
| 
      
 81 
     | 
    
         
            +
             
     | 
| 
      
 82 
     | 
    
         
            +
            Will build a network of test users and generate posts, likes, comments and images.
         
     | 
| 
      
 83 
     | 
    
         
            +
             
     | 
| 
      
 84 
     | 
    
         
            +
            <pre class="terminal">
         
     | 
| 
      
 85 
     | 
    
         
            +
            $ geppetto frenzy
         
     | 
| 
      
 86 
     | 
    
         
            +
            </pre>
         
     | 
| 
      
 87 
     | 
    
         
            +
             
     | 
| 
      
 88 
     | 
    
         
            +
            Frenzy mode will continuously generate random content until you terminate the application.
         
     | 
    
        data/lib/geppetto.rb
    CHANGED
    
    | 
         @@ -1 +1,12 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            require 'geppetto/version'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require 'net/http'
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
            # Mokey patch to suppress 'warning: peer certificate won't be verified in this SSL session'
         
     | 
| 
      
 5 
     | 
    
         
            +
            class Net::HTTP
         
     | 
| 
      
 6 
     | 
    
         
            +
              alias_method :old_initialize, :initialize
         
     | 
| 
      
 7 
     | 
    
         
            +
              def initialize(*args)
         
     | 
| 
      
 8 
     | 
    
         
            +
                old_initialize(*args)
         
     | 
| 
      
 9 
     | 
    
         
            +
                @ssl_context = OpenSSL::SSL::SSLContext.new
         
     | 
| 
      
 10 
     | 
    
         
            +
                @ssl_context.verify_mode = OpenSSL::SSL::VERIFY_NONE
         
     | 
| 
      
 11 
     | 
    
         
            +
              end
         
     | 
| 
      
 12 
     | 
    
         
            +
            end
         
     | 
| 
         Binary file 
     | 
| 
         Binary file 
     | 
    
        data/lib/geppetto/cli.rb
    CHANGED
    
    | 
         @@ -147,7 +147,7 @@ module Geppetto 
     | 
|
| 
       147 
147 
     | 
    
         
             
                  }
         
     | 
| 
       148 
148 
     | 
    
         
             
                end
         
     | 
| 
       149 
149 
     | 
    
         | 
| 
       150 
     | 
    
         
            -
                desc "generate_images", "Every user will post  
     | 
| 
      
 150 
     | 
    
         
            +
                desc "generate_images", "Every user will post two pictures (landscape and portrait) to their feed"
         
     | 
| 
       151 
151 
     | 
    
         
             
                def generate_images
         
     | 
| 
       152 
152 
     | 
    
         
             
                  users_hash = get_test_users
         
     | 
| 
       153 
153 
     | 
    
         
             
                  say "Posting images for #{users_hash.size} users", :white
         
     | 
| 
         @@ -155,9 +155,11 @@ module Geppetto 
     | 
|
| 
       155 
155 
     | 
    
         
             
                  users_hash.each{|user_hash|
         
     | 
| 
       156 
156 
     | 
    
         
             
                    # Get this user's feed
         
     | 
| 
       157 
157 
     | 
    
         
             
                    @graph = Facebook::GraphAPI.new(get_token_for_user_id(user_hash['id']))
         
     | 
| 
       158 
     | 
    
         
            -
                     
     | 
| 
       159 
     | 
    
         
            -
             
     | 
| 
       160 
     | 
    
         
            -
             
     | 
| 
      
 158 
     | 
    
         
            +
                    %w(640_480.png 480_640.png).each {|file_name|
         
     | 
| 
      
 159 
     | 
    
         
            +
                      file_path = File.join(File.dirname(__FILE__), file_name)
         
     | 
| 
      
 160 
     | 
    
         
            +
                      @graph.put_picture(file_path, 'image/png', {:message => "Image created at #{Time.now}"})
         
     | 
| 
      
 161 
     | 
    
         
            +
                      progress.inc
         
     | 
| 
      
 162 
     | 
    
         
            +
                    }
         
     | 
| 
       161 
163 
     | 
    
         
             
                  }
         
     | 
| 
       162 
164 
     | 
    
         
             
                  progress.finish
         
     | 
| 
       163 
165 
     | 
    
         
             
                end
         
     | 
| 
         @@ -192,7 +194,7 @@ module Geppetto 
     | 
|
| 
       192 
194 
     | 
    
         
             
                  format_string = "%#{max_key_width}s: %s"
         
     | 
| 
       193 
195 
     | 
    
         
             
                  hash.each{|key,value| say format(format_string, key, value)}
         
     | 
| 
       194 
196 
     | 
    
         
             
                  if hash.has_key?('access_token') 
         
     | 
| 
       195 
     | 
    
         
            -
                    say format(format_string, 'app_login',  "#{Settings[options.env]['app_url']} 
     | 
| 
      
 197 
     | 
    
         
            +
                    say format(format_string, 'app_login',  "#{Settings[options.env]['app_url']}#access_token=#{hash['access_token']}&expires_in=0")
         
     | 
| 
       196 
198 
     | 
    
         
             
                  end
         
     | 
| 
       197 
199 
     | 
    
         
             
                  say "-" * 80
         
     | 
| 
       198 
200 
     | 
    
         
             
                end
         
     | 
| 
         @@ -232,7 +234,7 @@ module Geppetto 
     | 
|
| 
       232 
234 
     | 
    
         
             
                end  
         
     | 
| 
       233 
235 
     | 
    
         | 
| 
       234 
236 
     | 
    
         
             
                def create_network(network_size, installed = true, permissions = '')
         
     | 
| 
       235 
     | 
    
         
            -
                  network_size =  
     | 
| 
      
 237 
     | 
    
         
            +
                  network_size = 1000 if network_size > 1000
         
     | 
| 
       236 
238 
     | 
    
         
             
                  progress = ProgressBar.new("Creating", network_size)
         
     | 
| 
       237 
239 
     | 
    
         
             
                  users = (0...network_size).collect { 
         
     | 
| 
       238 
240 
     | 
    
         
             
                    progress.inc
         
     | 
    
        data/lib/geppetto/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | 
         @@ -1,13 +1,13 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification 
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: geppetto
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version 
         
     | 
| 
       4 
     | 
    
         
            -
              hash:  
     | 
| 
      
 4 
     | 
    
         
            +
              hash: 49
         
     | 
| 
       5 
5 
     | 
    
         
             
              prerelease: 
         
     | 
| 
       6 
6 
     | 
    
         
             
              segments: 
         
     | 
| 
       7 
7 
     | 
    
         
             
              - 0
         
     | 
| 
       8 
8 
     | 
    
         
             
              - 9
         
     | 
| 
       9 
     | 
    
         
            -
              -  
     | 
| 
       10 
     | 
    
         
            -
              version: 0.9. 
     | 
| 
      
 9 
     | 
    
         
            +
              - 5
         
     | 
| 
      
 10 
     | 
    
         
            +
              version: 0.9.5
         
     | 
| 
       11 
11 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       12 
12 
     | 
    
         
             
            authors: 
         
     | 
| 
       13 
13 
     | 
    
         
             
            - Georges Auberger
         
     | 
| 
         @@ -15,7 +15,7 @@ autorequire: 
     | 
|
| 
       15 
15 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       16 
16 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       17 
17 
     | 
    
         | 
| 
       18 
     | 
    
         
            -
            date: 2011- 
     | 
| 
      
 18 
     | 
    
         
            +
            date: 2011-05-23 00:00:00 -07:00
         
     | 
| 
       19 
19 
     | 
    
         
             
            default_executable: geppetto
         
     | 
| 
       20 
20 
     | 
    
         
             
            dependencies: 
         
     | 
| 
       21 
21 
     | 
    
         
             
            - !ruby/object:Gem::Dependency 
         
     | 
| 
         @@ -26,14 +26,12 @@ dependencies: 
     | 
|
| 
       26 
26 
     | 
    
         
             
                requirements: 
         
     | 
| 
       27 
27 
     | 
    
         
             
                - - ~>
         
     | 
| 
       28 
28 
     | 
    
         
             
                  - !ruby/object:Gem::Version 
         
     | 
| 
       29 
     | 
    
         
            -
                    hash:  
     | 
| 
      
 29 
     | 
    
         
            +
                    hash: 23
         
     | 
| 
       30 
30 
     | 
    
         
             
                    segments: 
         
     | 
| 
       31 
31 
     | 
    
         
             
                    - 1
         
     | 
| 
       32 
32 
     | 
    
         
             
                    - 0
         
     | 
| 
       33 
33 
     | 
    
         
             
                    - 0
         
     | 
| 
       34 
     | 
    
         
            -
                     
     | 
| 
       35 
     | 
    
         
            -
                    - 2
         
     | 
| 
       36 
     | 
    
         
            -
                    version: 1.0.0.beta2
         
     | 
| 
      
 34 
     | 
    
         
            +
                    version: 1.0.0
         
     | 
| 
       37 
35 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       38 
36 
     | 
    
         
             
              version_requirements: *id001
         
     | 
| 
       39 
37 
     | 
    
         
             
            - !ruby/object:Gem::Dependency 
         
     | 
| 
         @@ -75,11 +73,13 @@ extra_rdoc_files: [] 
     | 
|
| 
       75 
73 
     | 
    
         
             
            files: 
         
     | 
| 
       76 
74 
     | 
    
         
             
            - bin/geppetto
         
     | 
| 
       77 
75 
     | 
    
         
             
            - lib/geppetto/320_240.png
         
     | 
| 
      
 76 
     | 
    
         
            +
            - lib/geppetto/480_640.png
         
     | 
| 
      
 77 
     | 
    
         
            +
            - lib/geppetto/640_480.png
         
     | 
| 
       78 
78 
     | 
    
         
             
            - lib/geppetto/cli.rb
         
     | 
| 
       79 
79 
     | 
    
         
             
            - lib/geppetto/version.rb
         
     | 
| 
       80 
80 
     | 
    
         
             
            - lib/geppetto.rb
         
     | 
| 
       81 
81 
     | 
    
         
             
            - LICENSE
         
     | 
| 
       82 
     | 
    
         
            -
            - README. 
     | 
| 
      
 82 
     | 
    
         
            +
            - README.md
         
     | 
| 
       83 
83 
     | 
    
         
             
            has_rdoc: true
         
     | 
| 
       84 
84 
     | 
    
         
             
            homepage: https://github.com/ternarylabs/geppetto
         
     | 
| 
       85 
85 
     | 
    
         
             
            licenses: []
         
     | 
    
        data/README.textile
    DELETED
    
    | 
         @@ -1,17 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            Geppetto is a simple command line tool to help manage Facebook test users and the generation of content.
         
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
       3 
     | 
    
         
            -
            h2. Installation
         
     | 
| 
       4 
     | 
    
         
            -
             
     | 
| 
       5 
     | 
    
         
            -
            @gem install geppetto@
         
     | 
| 
       6 
     | 
    
         
            -
             
     | 
| 
       7 
     | 
    
         
            -
            h2. Usage
         
     | 
| 
       8 
     | 
    
         
            -
             
     | 
| 
       9 
     | 
    
         
            -
            @geppetto help@
         
     | 
| 
       10 
     | 
    
         
            -
             
     | 
| 
       11 
     | 
    
         
            -
            h2. Dependencies
         
     | 
| 
       12 
     | 
    
         
            -
             
     | 
| 
       13 
     | 
    
         
            -
            A working version of ImageMagick library is required.
         
     | 
| 
       14 
     | 
    
         
            -
             
     | 
| 
       15 
     | 
    
         
            -
            To install on OS X via port
         
     | 
| 
       16 
     | 
    
         
            -
             
     | 
| 
       17 
     | 
    
         
            -
            @port install tiff -macosx imagemagick +q8 +gs +wmf@
         
     |