fresnel 0.5.7 → 0.5.8

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/fresnel.gemspec CHANGED
@@ -3,8 +3,8 @@ Gem::Specification.new do |s|
3
3
  s.name = 'fresnel'
4
4
  s.summary = "Fresnel is a console manager to LighthouseApp.com using the official lighthouse api."
5
5
  s.description = s.summary
6
- s.version = '0.5.7'
7
- s.date = '2009-12-09'
6
+ s.version = '0.5.8'
7
+ s.date = '2009-12-11'
8
8
  s.platform = Gem::Platform::RUBY
9
9
  s.authors = ["Gerard de Brieder", "Wes Oldenbeuving"]
10
10
  s.email = "smeevil@gmail.com"
data/lib/fresnel/cli.rb CHANGED
@@ -16,6 +16,8 @@ class Cli
16
16
  @fresnel.get_tickets_in_bin(ARGV[1])
17
17
  when "create"
18
18
  @fresnel.create
19
+ when "new"
20
+ @fresnel.create_project
19
21
  when "help"
20
22
  help
21
23
  when /\d+/
@@ -49,6 +51,7 @@ class Cli
49
51
 
50
52
  def help
51
53
  help = {
54
+ 'new' => 'Create a new project',
52
55
  'projects' => 'Show all projects',
53
56
  'tickets' => 'Show all tickets',
54
57
  'bins' => 'Show all ticket bins',
@@ -35,15 +35,19 @@ class SetupWizard
35
35
  puts "generated your config in #{fresnel.global_config_file}, going on with main program..."
36
36
  File.open(fresnel.global_config_file,'w+'){ |f| f.write(YAML::dump(config)) }
37
37
  end
38
-
38
+
39
39
  def self.project(fresnel)
40
40
  config=Hash.new
41
41
  data=fresnel.projects(:object=>true)
42
42
  current_dir=File.expand_path(".").split("/").last
43
43
  fresnel.projects(:selectable=>true, :clear=>false, :setup=>true)
44
- project_id=InputDetector.new("please select which project # resides here : ", 0...data.size).answer
45
- config['project_id']=data[project_id].id
46
- puts "generated your config in #{fresnel.project_config_file}, going on with main program..."
47
- File.open(fresnel.project_config_file,'w+'){ |f| f.write(YAML::dump(config)) }
44
+ project_id=InputDetector.new("please select which project # resides here or [c]reate a new one : ", 0...data.size).answer
45
+ if project_id=="c"
46
+ fresnel.create_project
47
+ else
48
+ config['project_id']=data[project_id.to_i].id
49
+ puts "generated your config in #{fresnel.project_config_file}, going on with main program..."
50
+ File.open(fresnel.project_config_file,'w+'){ |f| f.write(YAML::dump(config)) }
51
+ end
48
52
  end
49
53
  end
data/lib/fresnel.rb CHANGED
@@ -12,6 +12,18 @@ require "fresnel/input_detector"
12
12
 
13
13
  HighLine.track_eof = false
14
14
 
15
+ LICENSES={
16
+ 'mit' => "MIT License",
17
+ 'apache-2-0' => "Apache License 2.0",
18
+ 'artistic-gpl-2' => "Artistic License/GPLv2",
19
+ 'gpl-2' => "GNU General Public License v2",
20
+ 'gpl-3' => "GNU General Public License v3",
21
+ 'lgpl' => "GNU Lesser General Public License",
22
+ 'mozilla-1-1' => "Mozilla Public License 1.1",
23
+ 'new-bsd' => "New BSD License",
24
+ 'afl-3' => "Academic Free License v. 3.0"
25
+ }.sort
26
+
15
27
  class Fresnel
16
28
  attr_reader :global_config_file, :project_config_file, :app_description
17
29
  attr_accessor :lighthouse, :current_project_id, :cache, :cache_timeout, :current_user_id
@@ -74,7 +86,34 @@ class Fresnel
74
86
  end
75
87
 
76
88
  def create_project
77
- puts "create project is not implemented yet"
89
+ name=ask("Name of this project : ")
90
+ type=InputDetector.new("[p]rivate or [o]ss : ").answer
91
+ if type=="o"
92
+ row=Array.new
93
+ license_table = table do |t|
94
+ t.headings=['#' , 'license']
95
+ LICENSES.each_with_index do |lic,i|
96
+ t<<[i, lic.last]
97
+ end
98
+ end
99
+ puts license_table
100
+ license=InputDetector.new("License # : ",(0...LICENSES.size).to_a).answer
101
+ license=LICENSES[license.to_i].first
102
+ end
103
+
104
+ puts "collected :"
105
+ puts "#{name} : #{license}"
106
+ project = Lighthouse::Project.new(:name => name)
107
+ if license.present?
108
+ project.access = 'oss'
109
+ project.license = license
110
+ end
111
+ puts "creating project on lighthouse..."
112
+ project.save
113
+ config=Hash.new
114
+ config['project_id']=project.id
115
+ File.open(self.project_config_file,'w+'){ |f| f.write(YAML::dump(config)) }
116
+ load_project_config
78
117
  end
79
118
 
80
119
  def projects(options=Hash.new)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fresnel
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.7
4
+ version: 0.5.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gerard de Brieder
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2009-12-09 00:00:00 +01:00
13
+ date: 2009-12-11 00:00:00 +01:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency