pinpress 1.0.0

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: ea39fb758bf97cf8f47309bcc35add0175aa8561
4
+ data.tar.gz: b63090bb8ac27bcff1f1c2ddeeee196ea5175f87
5
+ SHA512:
6
+ metadata.gz: f11eb31a9996f117027e4ec5724a3060b5871dbfc71772cfca938eb7cf043d1ead657a48703fa28c3082c52c400e921014e9dbbc4332436a4a8b5eba3b310a2d
7
+ data.tar.gz: 0555405cf2812e393cda962a3f67cf6ec37e3e6ded2cec4038b93d10f74d58685ebd22ac4efa2fbe9bd2321f4fc59318dd844f35daa7e1816bd67dc43d7b76e1
data/.gitignore ADDED
@@ -0,0 +1,7 @@
1
+ .DS_Store
2
+ doc
3
+ pkg
4
+ .yardoc
5
+ bin
6
+ .tmp
7
+ Gemfile.lock
data/.travis.yml ADDED
@@ -0,0 +1,6 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.1.0
4
+ - 2.0.0
5
+ - 1.9.3
6
+ - jruby-19mode
data/Gemfile ADDED
@@ -0,0 +1,5 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem "cliutils", :path => "/Users/abach/Git/cliutils"
4
+
5
+ gemspec
data/HISTORY.md ADDED
File without changes
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2014 Aaron Bach
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/PinPress.gemspec ADDED
@@ -0,0 +1,33 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'pinpress/constants'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'pinpress'
8
+ spec.version = PinPress::VERSION
9
+ spec.authors = ['Aaron Bach']
10
+ spec.email = ['bachya1208@googlemail.com']
11
+ spec.summary = PinPress::SUMMARY
12
+ spec.description = PinPress::DESCRIPTION
13
+ spec.homepage = 'https://github.com/bachya/PinPress'
14
+ spec.license = 'MIT'
15
+ spec.platform = Gem::Platform::RUBY
16
+
17
+ spec.require_paths = ["lib"]
18
+ spec.files = `git ls-files`.split("\n")
19
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
20
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
21
+
22
+ spec.license = 'MIT'
23
+ spec.rdoc_options = ['--charset=UTF-8']
24
+ spec.extra_rdoc_files = %w[README.md HISTORY.md LICENSE]
25
+
26
+ spec.add_development_dependency('rake', '10.1.1')
27
+ spec.add_development_dependency('rdoc', '4.1.1')
28
+ spec.add_development_dependency('aruba', '0.5.4')
29
+ spec.add_runtime_dependency('chronic', '0.10.2')
30
+ spec.add_runtime_dependency('cliutils', '~> 2.0')
31
+ spec.add_runtime_dependency('gli','2.9.0')
32
+ spec.add_runtime_dependency('pinboard', '0.1.1')
33
+ end
data/README.md ADDED
@@ -0,0 +1,4 @@
1
+ PinPress
2
+ ========
3
+
4
+ A simple CLI to create HTML templates of Pinboard data.
data/Rakefile ADDED
@@ -0,0 +1,51 @@
1
+ require 'rake/clean'
2
+ require 'rubygems'
3
+
4
+ def version
5
+ contents = File.read File.expand_path('../lib/pinpress/constants.rb', __FILE__)
6
+ contents[/\sVERSION = '([^']+)'/, 1]
7
+ end
8
+
9
+ spec = eval(File.read('pinpress.gemspec'))
10
+
11
+ require 'rake/testtask'
12
+ desc 'Run unit tests'
13
+ Rake::TestTask.new do |t|
14
+ t.libs << "test"
15
+ t.test_files = FileList['test/*_test.rb']
16
+ end
17
+
18
+ require 'cucumber'
19
+ require 'cucumber/rake/task'
20
+ CUKE_RESULTS = 'results.html'
21
+ CLEAN << CUKE_RESULTS
22
+ desc 'Run Cucumber features'
23
+ Cucumber::Rake::Task.new(:features) do |t|
24
+ opts = "features --format html -o #{CUKE_RESULTS} --format progress -x"
25
+ opts += " --tags #{ENV['TAGS']}" if ENV['TAGS']
26
+ t.cucumber_opts = opts
27
+ t.fork = false
28
+ end
29
+
30
+ desc "Release PinPress version #{ version }"
31
+ task :release => :build do
32
+ unless `git branch` =~ /^\* master$/
33
+ puts "You must be on the master branch to release!"
34
+ exit!
35
+ end
36
+
37
+ sh "git commit --allow-empty -a -m 'Release #{ version }'"
38
+ sh "git tag v#{ version }"
39
+ sh "git push origin master"
40
+ sh "git push origin v#{ version }"
41
+ sh "gem push pkg/pinpress-#{ version }.gem"
42
+ end
43
+
44
+ desc "Build the gem"
45
+ task :build do
46
+ FileUtils.mkdir_p "pkg"
47
+ sh "gem build pinpress.gemspec"
48
+ FileUtils.mv("./pinpress-#{ version }.gem", "pkg")
49
+ end
50
+
51
+ task :default => [:test, :features]
@@ -0,0 +1,7 @@
1
+ Feature: UI
2
+ As a user, when I ask for help, I should be presented
3
+ with instructions on how to run the app.
4
+
5
+ Scenario: Display help instructions
6
+ When I get help for "pinpress"
7
+ Then the exit status should be 0
@@ -0,0 +1,125 @@
1
+ Feature: Initialization
2
+ As a user, when I initialize PinPress,
3
+ I should be guided through the process as
4
+ necessary.
5
+
6
+ Scenario: Basic Initialization
7
+ Given no file located at "/tmp/pp/.pinpress"
8
+ When I run `pinpress init` interactively
9
+ And I type ""
10
+ And I type "12345"
11
+ Then the exit status should be 0
12
+ And the file "/tmp/pp/.pinpress" should contain:
13
+ """
14
+ ---
15
+ pinpress:
16
+ config_location: "/tmp/pp/.pinpress"
17
+ default_template: pinpress_default
18
+ log_level: WARN
19
+ version: 1.0.0
20
+ api_token: '12345'
21
+ templates:
22
+ - name: pinpress_default
23
+ opener: "<ul>"
24
+ item: "<li><b><a title=\"<%= description %>\" href=\"<%= href %>\" target=\"_blank\"><%=
25
+ description %></a>.</b> <%= extended %></li>"
26
+ closer: "</ul>"
27
+ """
28
+
29
+ Scenario: Reinitialization (refuse)
30
+ Given a file located at "/tmp/pp/.pinpress" with the contents:
31
+ """
32
+ ---
33
+ pinpress:
34
+ config_location: "/tmp/pp/.pinpress"
35
+ default_template: pinpress_default
36
+ log_level: WARN
37
+ version: 1.0.0
38
+ api_token: '12345'
39
+ templates:
40
+ - name: pinpress_default
41
+ opener: "<ul>"
42
+ item: "<li><b><a title=\"<%= description %>\" href=\"<%= href %>\" target=\"_blank\"><%=
43
+ description %></a>.</b> <%= extended %></li>"
44
+ closer: "</ul>"
45
+ """
46
+ When I run `pinpress init` interactively
47
+ And I type ""
48
+ Then the exit status should be 0
49
+
50
+ Scenario: Reinitialization (accept)
51
+ Given a file located at "/tmp/pp/.pinpress" with the contents:
52
+ """
53
+ ---
54
+ pinpress:
55
+ config_location: "/tmp/pp/.pinpress"
56
+ default_template: pinpress_default
57
+ log_level: WARN
58
+ version: 1.0.0
59
+ api_token: '12345'
60
+ templates:
61
+ - name: pinpress_default
62
+ opener: "<ul>"
63
+ item: "<li><b><a title=\"<%= description %>\" href=\"<%= href %>\" target=\"_blank\"><%=
64
+ description %></a>.</b> <%= extended %></li>"
65
+ closer: "</ul>"
66
+ """
67
+ When I run `pinpress init` interactively
68
+ And I type "y"
69
+ And I type ""
70
+ And I type "12345"
71
+ Then the exit status should be 0
72
+ And the file "/tmp/pp/.pinpress" should contain:
73
+ """
74
+ ---
75
+ pinpress:
76
+ config_location: "/tmp/pp/.pinpress"
77
+ default_template: pinpress_default
78
+ log_level: WARN
79
+ version: 1.0.0
80
+ api_token: '12345'
81
+ templates:
82
+ - name: pinpress_default
83
+ opener: "<ul>"
84
+ item: "<li><b><a title=\"<%= description %>\" href=\"<%= href %>\" target=\"_blank\"><%=
85
+ description %></a>.</b> <%= extended %></li>"
86
+ closer: "</ul>"
87
+ """
88
+
89
+ Scenario: Reinitialization (from scratch)
90
+ Given a file located at "/tmp/pp/.pinpress" with the contents:
91
+ """
92
+ ---
93
+ pinpress:
94
+ config_location: "/tmp/pp/.pinpress"
95
+ default_template: pinpress_default
96
+ log_level: WARN
97
+ version: 1.0.0
98
+ api_token: '12345'
99
+ templates:
100
+ - name: pinpress_default
101
+ opener: "<ul>"
102
+ item: "<li><b><a title=\"<%= description %>\" href=\"<%= href %>\" target=\"_blank\"><%=
103
+ description %></a>.</b> <%= extended %></li>"
104
+ closer: "</ul>"
105
+ """
106
+ When I run `pinpress init -s` interactively
107
+ And I type ""
108
+ And I type "12345"
109
+ Then the exit status should be 0
110
+ And the file "/tmp/pp/.pinpress" should contain:
111
+ """
112
+ ---
113
+ pinpress:
114
+ config_location: "/tmp/pp/.pinpress"
115
+ default_template: pinpress_default
116
+ log_level: WARN
117
+ version: 1.0.0
118
+ api_token: '12345'
119
+ templates:
120
+ - name: pinpress_default
121
+ opener: "<ul>"
122
+ item: "<li><b><a title=\"<%= description %>\" href=\"<%= href %>\" target=\"_blank\"><%=
123
+ description %></a>.</b> <%= extended %></li>"
124
+ closer: "</ul>"
125
+ """
@@ -0,0 +1,113 @@
1
+ Feature: Templates
2
+ As a user, I should be able to list available
3
+ templates and choose one.
4
+
5
+ Scenario: List Templates (implicit)
6
+ Given a file located at "/tmp/pp/.pinpress" with the contents:
7
+ """
8
+ ---
9
+ pinpress:
10
+ config_location: "/tmp/pp/.pinpress"
11
+ default_template: pinpress_default
12
+ log_level: WARN
13
+ version: 1.0.0
14
+ api_token: '12345'
15
+ templates:
16
+ - name: pinpress_default
17
+ opener: "<ul>"
18
+ item: "<li><b><a title=\"<%= description %>\" href=\"<%= href %>\" target=\"_blank\"><%=
19
+ description %></a>.</b> <%= extended %></li>"
20
+ closer: "</ul>"
21
+ - name: secondary
22
+ item: "* <%= href %>"
23
+ """
24
+ When I run `pinpress template` interactively
25
+ Then the exit status should be 0
26
+ And the output should contain:
27
+ """
28
+ ---> AVAILABLE TEMPLATES
29
+ # 1. pinpress_default
30
+ # 2. secondary
31
+ """
32
+
33
+ Scenario: List Templates (explicit)
34
+ Given a file located at "/tmp/pp/.pinpress" with the contents:
35
+ """
36
+ ---
37
+ pinpress:
38
+ config_location: "/tmp/pp/.pinpress"
39
+ default_template: pinpress_default
40
+ log_level: WARN
41
+ version: 1.0.0
42
+ api_token: '12345'
43
+ templates:
44
+ - name: pinpress_default
45
+ opener: "<ul>"
46
+ item: "<li><b><a title=\"<%= description %>\" href=\"<%= href %>\" target=\"_blank\"><%=
47
+ description %></a>.</b> <%= extended %></li>"
48
+ closer: "</ul>"
49
+ - name: secondary
50
+ item: "* <%= href %>"
51
+ """
52
+ When I run `pinpress template list` interactively
53
+ Then the exit status should be 0
54
+ And the output should contain:
55
+ """
56
+ ---> AVAILABLE TEMPLATES
57
+ # 1. pinpress_default
58
+ # 2. secondary
59
+ """
60
+
61
+ Scenario: Choose Default Template
62
+ Given a file located at "/tmp/pp/.pinpress" with the contents:
63
+ """
64
+ ---
65
+ pinpress:
66
+ config_location: "/tmp/pp/.pinpress"
67
+ default_template: pinpress_default
68
+ log_level: WARN
69
+ version: 1.0.0
70
+ api_token: '12345'
71
+ templates:
72
+ - name: pinpress_default
73
+ opener: "<ul>"
74
+ item: "<li><b><a title=\"<%= description %>\" href=\"<%= href %>\" target=\"_blank\"><%=
75
+ description %></a>.</b> <%= extended %></li>"
76
+ closer: "</ul>"
77
+ - name: secondary
78
+ item: "* <%= href %>"
79
+ """
80
+ When I run `pinpress template default` interactively
81
+ And I type "4"
82
+ And I type "0"
83
+ And I type "asd"
84
+ And I type "2"
85
+ Then the exit status should be 0
86
+ And the output should contain:
87
+ """
88
+ ---> CHOOSE A DEFAULT TEMPLATE
89
+ # Current Default Template: pinpress_default
90
+ # Choose a New Template:
91
+ # 1. pinpress_default
92
+ # 2. secondary
93
+ # Invalid choice: 4
94
+ # Invalid choice: 0
95
+ # Invalid choice: asd
96
+ # New default template chosen: secondary
97
+ """
98
+ And the file "/tmp/pp/.pinpress" should contain:
99
+ """
100
+ ---
101
+ pinpress:
102
+ config_location: "/tmp/pp/.pinpress"
103
+ default_template: secondary
104
+ log_level: WARN
105
+ version: 1.0.0
106
+ api_token: '12345'
107
+ templates:
108
+ - name: pinpress_default
109
+ opener: "<ul>"
110
+ item: "<li><b><a title=\"<%= description %>\" href=\"<%= href %>\" target=\"_blank\"><%=
111
+ description %></a>.</b> <%= extended %></li>"
112
+ closer: "</ul>"
113
+ """
@@ -0,0 +1,25 @@
1
+ Feature: Templates
2
+ As a user, I should be able get pins from Pinboard
3
+ and have them inherit certain templates.
4
+
5
+ Scenario: Invalid API Key
6
+ Given a file located at "/tmp/pp/.pinpress" with the contents:
7
+ """
8
+ ---
9
+ pinpress:
10
+ config_location: "/tmp/pp/.pinpress"
11
+ default_template: pinpress_default
12
+ log_level: WARN
13
+ version: 1.0.0
14
+ api_token: '12345'
15
+ templates:
16
+ - name: pinpress_default
17
+ opener: "<ul>"
18
+ item: "<li><b><a title=\"<%= description %>\" href=\"<%= href %>\" target=\"_blank\"><%=
19
+ description %></a>.</b> <%= extended %></li>"
20
+ closer: "</ul>"
21
+ - name: secondary
22
+ item: "* <%= href %>"
23
+ """
24
+ When I run `pinpress pins` interactively
25
+ Then the exit status should be 1
@@ -0,0 +1,12 @@
1
+ When /^I get help for "([^"]*)"$/ do |app_name|
2
+ @app_name = app_name
3
+ step %(I run `#{app_name} help`)
4
+ end
5
+
6
+ Given(/^no file located at "(.*?)"$/) do |filepath|
7
+ step %(the file "#{ filepath }" should not exist)
8
+ end
9
+
10
+ Given(/^a file located at "(.*?)" with the contents:$/) do |filepath, contents|
11
+ File.open(filepath, 'w') { |f| f.write(contents) }
12
+ end
@@ -0,0 +1,20 @@
1
+ require 'aruba/cucumber'
2
+
3
+ ENV['PATH'] = "#{File.expand_path(File.dirname(__FILE__) + '/../../bin')}#{File::PATH_SEPARATOR}#{ENV['PATH']}"
4
+ LIB_DIR = File.join(File.expand_path(File.dirname(__FILE__)),'..','..','lib')
5
+
6
+ Before do
7
+ # Using "announce" causes massive warnings on 1.9.2
8
+ @puts = true
9
+ @original_rubylib = ENV['RUBYLIB']
10
+ ENV['RUBYLIB'] = LIB_DIR + File::PATH_SEPARATOR + ENV['RUBYLIB'].to_s
11
+ @original_home = ENV['HOME']
12
+ ENV['HOME'] = "/tmp/pp"
13
+ FileUtils.rm_rf "/tmp/pp"
14
+ FileUtils.mkdir "/tmp/pp"
15
+ end
16
+
17
+ After do
18
+ ENV['RUBYLIB'] = @original_rubylib
19
+ ENV['HOME'] = @original_home
20
+ end